playlight-sdk 0.1.4 → 0.1.6

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.
@@ -3666,11 +3666,13 @@ function CurrentGameDisplay(e2, t2) {
3666
3666
  }
3667
3667
  delegate(["mousedown", "mousemove", "mouseup", "touchstart", "touchmove", "touchend", "click"]);
3668
3668
  var on_click = (e2, t2) => {
3669
+ e2.target === e2.currentTarget && store_set(Ve, false);
3670
+ }, on_click_1 = (e2, t2) => {
3669
3671
  localStorage.getItem("playlight_exit_intent_disabled_by_user") ? localStorage.removeItem("playlight_exit_intent_disabled_by_user") : localStorage.setItem("playlight_exit_intent_disabled_by_user", true), set(t2, !get$1(t2));
3670
- }, ut = /* @__PURE__ */ template('<button class="cursor-pointer truncate text-sm text-nowrap opacity-50 transition hover:opacity-25 max-md:hidden"><p class="bg-background/50 text-primary p-1 px-2 text-sm"> </p></button>'), on_click_1 = (e2, t2) => store_set(Ve, false), dt = /* @__PURE__ */ template('<div class="flex h-4/5 items-center justify-center gap-4"><!></div>'), ft = /* @__PURE__ */ template('<div class="text-muted-foreground flex h-4/5 items-center justify-center gap-4"><p>No games found that match the filter.</p></div>'), pt = /* @__PURE__ */ template("<!> <!>", 1), _t = /* @__PURE__ */ template('<div class="mx-auto flex h-full flex-wrap content-start justify-center gap-10 lg:max-w-4/5"><!> <div class="flex h-10 w-full justify-center"><!></div></div>'), gt = /* @__PURE__ */ template('<div class="bg-background/75 fixed inset-0 top-0 right-0 bottom-0 left-0 z-99999 flex flex-col justify-center text-white backdrop-blur-md"><div class="ml-2 flex items-center justify-between p-4"><a href="https://playlight.dev" target="_blank"><img alt="logo" class="w-50"></a> <div class="mt-4 mr-2 flex items-center justify-evenly gap-8 overflow-hidden md:mr-4"><!> <button class="cursor-pointer text-white transition hover:opacity-50" aria-label="Close"><!></button></div></div> <div class="mx-auto p-2 px-5"><!></div> <!> <div class="mask-fade no-scrollbar relative h-full w-full overflow-y-auto p-4 svelte-12skmk8"><!></div> <div class="fixed right-4 bottom-4 flex items-center justify-between"><a href="https://playlight.dev" target="_blank" class="text-muted-foreground flex items-center gap-1 text-sm transition hover:text-white">Join Playlight <!></a></div></div>');
3672
+ }, ut = /* @__PURE__ */ template('<button class="cursor-pointer truncate text-sm text-nowrap opacity-50 transition hover:opacity-25 max-md:hidden"><p class="bg-background/50 text-primary p-1 px-2 text-sm"> </p></button>'), on_click_2 = (e2, t2) => store_set(Ve, false), dt = /* @__PURE__ */ template('<div class="flex h-4/5 items-center justify-center gap-4"><!></div>'), ft = /* @__PURE__ */ template('<div class="text-muted-foreground flex h-4/5 items-center justify-center gap-4"><p>No games found that match the filter.</p></div>'), pt = /* @__PURE__ */ template("<!> <!>", 1), _t = /* @__PURE__ */ template('<div class="mx-auto flex h-full flex-wrap content-start justify-center gap-10 lg:max-w-4/5"><!> <div class="flex h-10 w-full justify-center"><!></div></div>'), gt = /* @__PURE__ */ template('<div class="bg-background/75 fixed inset-0 top-0 right-0 bottom-0 left-0 z-99999 flex flex-col justify-center text-white backdrop-blur-md" id="playlight-discovery" role="menu" tabindex="0"><div class="pointer-events-none ml-2 flex items-center justify-between p-4"><a href="https://playlight.dev" target="_blank"><img alt="logo" class="w-50"></a> <div class="mt-4 mr-2 flex items-center justify-evenly gap-8 overflow-hidden md:mr-4"><!> <button class="cursor-pointer text-white transition hover:opacity-50" aria-label="Close"><!></button></div></div> <div class="mx-auto p-2 px-5"><!></div> <!> <div class="mask-fade no-scrollbar pointer-events-none relative h-full w-full overflow-y-auto p-4 svelte-12skmk8"><!></div> <div class="fixed right-4 bottom-4 flex items-center justify-between"><a href="https://playlight.dev" target="_blank" class="text-muted-foreground flex items-center gap-1 text-sm transition hover:text-white">Join Playlight <!></a></div></div>');
3671
3673
  function DiscoveryOverlay(e2, t2) {
3672
3674
  push(t2, true);
3673
- const [n2, o2] = setup_stores();
3675
+ const [n2, o2] = setup_stores(), $discoveryOpen = () => store_get(Ve, "$discoveryOpen", n2);
3674
3676
  let i2, s2 = prop(t2, "showIntentToggle", 3, true), a2 = state(true), l2 = state(void 0), c2 = state(true), u2 = state(false), d2 = state(void 0), f2 = state(proxy([])), p2 = state(proxy([])), _2 = state(1), g2 = state(true), v2 = state(void 0), h2 = state(false);
3675
3677
  async function fetchGames() {
3676
3678
  if (!(get$1(c2) && get$1(_2) > 1 || get$1(u2))) try {
@@ -3713,18 +3715,18 @@ function DiscoveryOverlay(e2, t2) {
3713
3715
  var m2 = gt();
3714
3716
  event("keydown", q, (e3) => {
3715
3717
  "Escape" == e3.key && store_set(Ve, false);
3716
- });
3718
+ }), m2.__click = [on_click, $discoveryOpen];
3717
3719
  var b2 = child(m2), y2 = child(b2), $2 = child(y2), w2 = child(sibling(y2, 2)), consequent = (e3) => {
3718
3720
  var t3 = ut();
3719
- t3.__click = [on_click, a2];
3721
+ t3.__click = [on_click_1, a2];
3720
3722
  var n3 = child(t3), o3 = child(n3);
3721
- template_effect(() => set_text(o3, get$1(a2) ? "Ignore exit intent" : "Trigger on exit intent")), append(e3, t3);
3723
+ template_effect(() => set_text(o3, get$1(a2) ? "Don't show on exit" : "Do show on exit")), append(e3, t3);
3722
3724
  };
3723
3725
  if_block(w2, (e3) => {
3724
3726
  s2() && e3(consequent);
3725
3727
  });
3726
3728
  var x2 = sibling(w2, 2);
3727
- x2.__click = [on_click_1, () => store_get(Ve, "$discoveryOpen", n2)], function X(e3, t3) {
3729
+ x2.__click = [on_click_2, $discoveryOpen], function X(e3, t3) {
3728
3730
  const n3 = legacy_rest_props(t3, ["children", "$$slots", "$$events", "$$legacy"]);
3729
3731
  Icon$1(e3, spread_props({
3730
3732
  name: "x"
@@ -3846,21 +3848,28 @@ function App(e2, t2) {
3846
3848
  var _a2, _b2, _c2, _d;
3847
3849
  push(t2, true);
3848
3850
  const [n2, o2] = setup_stores(), $discoveryOpen = () => store_get(Ve, "$discoveryOpen", n2);
3849
- let i2 = proxy((_b2 = (_a2 = t2.config) == null ? void 0 : _a2.button) == null ? void 0 : _b2.position), s2 = proxy((_d = (_c2 = t2.config) == null ? void 0 : _c2.button) == null ? void 0 : _d.visible);
3851
+ let i2, s2 = proxy((_b2 = (_a2 = t2.config) == null ? void 0 : _a2.button) == null ? void 0 : _b2.position), a2 = proxy((_d = (_c2 = t2.config) == null ? void 0 : _c2.button) == null ? void 0 : _d.visible);
3850
3852
  function openDiscovery() {
3851
3853
  store_set(Ve, true), Qe.trackOpen();
3852
3854
  }
3853
- var a2 = ht(), l2 = first_child(a2);
3854
- FloatingButton(l2, {
3855
+ Ve.subscribe((e3) => {
3856
+ try {
3857
+ e3 ? (i2 = document.body.style.overflow, document.body.style.overflow = "hidden") : document.body.style.overflow = i2;
3858
+ } catch (e4) {
3859
+ console.error("Failed to toggle body overflow style:", e4);
3860
+ }
3861
+ });
3862
+ var l2 = ht(), c2 = first_child(l2);
3863
+ FloatingButton(c2, {
3855
3864
  get position() {
3856
- return i2;
3865
+ return s2;
3857
3866
  },
3858
3867
  get visible() {
3859
- return s2;
3868
+ return a2;
3860
3869
  },
3861
3870
  onClick: openDiscovery
3862
3871
  });
3863
- var c2 = sibling(l2, 2), consequent = (e3) => {
3872
+ var u2 = sibling(c2, 2), consequent = (e3) => {
3864
3873
  const n3 = /* @__PURE__ */ derived(() => {
3865
3874
  var _a3, _b3;
3866
3875
  return (_b3 = (_a3 = t2.config) == null ? void 0 : _a3.exitIntent) == null ? void 0 : _b3.enabled;
@@ -3871,11 +3880,11 @@ function App(e2, t2) {
3871
3880
  }
3872
3881
  });
3873
3882
  };
3874
- if_block(c2, (e3) => {
3883
+ if_block(u2, (e3) => {
3875
3884
  $discoveryOpen() && e3(consequent);
3876
3885
  });
3877
- var u2 = sibling(c2, 2);
3878
- const d2 = /* @__PURE__ */ derived(() => {
3886
+ var d2 = sibling(u2, 2);
3887
+ const f2 = /* @__PURE__ */ derived(() => {
3879
3888
  var _a3, _b3;
3880
3889
  return (_b3 = (_a3 = t2.config) == null ? void 0 : _a3.exitIntent) == null ? void 0 : _b3.enabled;
3881
3890
  });
@@ -3891,14 +3900,14 @@ function App(e2, t2) {
3891
3900
  }, sibling(a3, 2).__mouseover = function handleBottomBarTrigger() {
3892
3901
  o3 = "bottom", i3 = Date.now();
3893
3902
  }, append(e3, s3), pop();
3894
- }(u2, {
3903
+ }(d2, {
3895
3904
  get enabled() {
3896
- return get$1(d2);
3905
+ return get$1(f2);
3897
3906
  },
3898
3907
  onIntent: () => {
3899
3908
  $discoveryOpen() || openDiscovery();
3900
3909
  }
3901
- }), Toaster(sibling(u2, 2), {}), append(e2, a2), pop(), o2();
3910
+ }), Toaster(sibling(d2, 2), {}), append(e2, l2), pop(), o2();
3902
3911
  }
3903
3912
  const mt = {
3904
3913
  button: {
@@ -3949,10 +3958,10 @@ const yt = new (_c = class {
3949
3958
  }
3950
3959
  /**
3951
3960
  * Show or hide the discovery
3952
- * @param {boolean} value - Whether to show the discovery
3961
+ * @param {boolean} [value=true] - Whether to show the discovery
3953
3962
  */
3954
- setDiscovery(e2) {
3955
- this.isInitialized && (Ve.set(e2), get(Ve) && Qe.trackOpen());
3963
+ setDiscovery(e2 = true) {
3964
+ this.isInitialized && (Ve.set(e2), e2 && Qe.trackOpen());
3956
3965
  }
3957
3966
  }, _PlaylightSDK_instances = new WeakSet(), /**
3958
3967
  * Mount the Svelte app to the playlight container