playlight-sdk 0.1.6 → 0.1.7
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.
package/dist/playlight-sdk.es.js
CHANGED
|
@@ -581,18 +581,18 @@ function resume_children(e2, t2) {
|
|
|
581
581
|
if (null !== e2.transitions) for (const n3 of e2.transitions) (n3.is_global || t2) && n3.in();
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
|
-
let
|
|
584
|
+
let E = [], j = [];
|
|
585
585
|
function run_micro_tasks() {
|
|
586
|
-
var e2 =
|
|
587
|
-
|
|
586
|
+
var e2 = E;
|
|
587
|
+
E = [], run_all(e2);
|
|
588
588
|
}
|
|
589
589
|
function queue_micro_task(e2) {
|
|
590
|
-
0 ===
|
|
590
|
+
0 === E.length && queueMicrotask(run_micro_tasks), E.push(e2);
|
|
591
591
|
}
|
|
592
592
|
function flush_tasks() {
|
|
593
|
-
|
|
594
|
-
var e2 =
|
|
595
|
-
|
|
593
|
+
E.length > 0 && run_micro_tasks(), j.length > 0 && function run_idle_tasks() {
|
|
594
|
+
var e2 = j;
|
|
595
|
+
j = [], run_all(e2);
|
|
596
596
|
}();
|
|
597
597
|
}
|
|
598
598
|
let N = false, B = false, A = null, W = false, z = false;
|
|
@@ -2607,12 +2607,12 @@ const Oe = function createToastState() {
|
|
|
2607
2607
|
heights: t2
|
|
2608
2608
|
};
|
|
2609
2609
|
}();
|
|
2610
|
-
const
|
|
2610
|
+
const Ee = function toastFunction(e2, t2) {
|
|
2611
2611
|
return Oe.create({
|
|
2612
2612
|
message: e2,
|
|
2613
2613
|
...t2
|
|
2614
2614
|
});
|
|
2615
|
-
},
|
|
2615
|
+
}, je = Object.assign(Ee, {
|
|
2616
2616
|
success: Oe.success,
|
|
2617
2617
|
info: Oe.info,
|
|
2618
2618
|
warning: Oe.warning,
|
|
@@ -2643,14 +2643,14 @@ function Toast(e2, t2) {
|
|
|
2643
2643
|
info: "",
|
|
2644
2644
|
loading: ""
|
|
2645
2645
|
}, { toasts: b2, heights: y2, removeHeight: $2, setHeight: w2, remove: x2 } = Oe;
|
|
2646
|
-
let k2 = prop(t2, "toast", 9), C2 = prop(t2, "index", 9), S2 = prop(t2, "expanded", 9), M2 = prop(t2, "invert", 13), I2 = prop(t2, "position", 9), T2 = prop(t2, "visibleToasts", 9), q2 = prop(t2, "expandByDefault", 9), P2 = prop(t2, "closeButton", 9), D2 = prop(t2, "interacting", 9), O2 = prop(t2, "cancelButtonStyle", 9, ""),
|
|
2646
|
+
let k2 = prop(t2, "toast", 9), C2 = prop(t2, "index", 9), S2 = prop(t2, "expanded", 9), M2 = prop(t2, "invert", 13), I2 = prop(t2, "position", 9), T2 = prop(t2, "visibleToasts", 9), q2 = prop(t2, "expandByDefault", 9), P2 = prop(t2, "closeButton", 9), D2 = prop(t2, "interacting", 9), O2 = prop(t2, "cancelButtonStyle", 9, ""), E2 = prop(t2, "actionButtonStyle", 9, ""), j2 = prop(t2, "duration", 9, 4e3), N2 = prop(t2, "descriptionClass", 9, ""), B2 = prop(t2, "classes", 29, () => ({})), A2 = prop(t2, "unstyled", 9, false), W2 = mutable_state(false, true), z2 = mutable_state(false, true), L2 = mutable_state(false, true), G2 = mutable_state(false, true), F2 = mutable_state(0, true), H2 = mutable_state(0, true), R2 = mutable_state(void 0, true), V2 = mutable_state(0, true), K2 = 0, U2 = 0, Y2 = null;
|
|
2647
2647
|
function deleteToast() {
|
|
2648
2648
|
set(z2, true), // Save the offset for the exit swipe animation
|
|
2649
2649
|
set(F2, get$1(V2)), $2(k2().id), setTimeout(() => {
|
|
2650
2650
|
x2(k2().id);
|
|
2651
2651
|
}, 200);
|
|
2652
2652
|
}
|
|
2653
|
-
let Z2 = mutable_state(void 0, true), J2 = mutable_state(k2().duration ||
|
|
2653
|
+
let Z2 = mutable_state(void 0, true), J2 = mutable_state(k2().duration || j2() || 4e3, true);
|
|
2654
2654
|
function startTimer() {
|
|
2655
2655
|
K2 = (/* @__PURE__ */ new Date()).getTime(), // Let the toast know it has started
|
|
2656
2656
|
set(Z2, setTimeout(() => {
|
|
@@ -2714,11 +2714,11 @@ function Toast(e2, t2) {
|
|
|
2714
2714
|
height: i3
|
|
2715
2715
|
});
|
|
2716
2716
|
}();
|
|
2717
|
-
}), legacy_pre_effect(() => (deep_read_state(k2()), get$1(Z2), deep_read_state(
|
|
2717
|
+
}), legacy_pre_effect(() => (deep_read_state(k2()), get$1(Z2), deep_read_state(j2())), () => {
|
|
2718
2718
|
k2().updated && // if the toast has been updated after the initial render,
|
|
2719
2719
|
// we want to reset the timer and set the remaining time to the
|
|
2720
2720
|
// new duration
|
|
2721
|
-
(clearTimeout(get$1(Z2)), set(J2, k2().duration ||
|
|
2721
|
+
(clearTimeout(get$1(Z2)), set(J2, k2().duration || j2() || 4e3), startTimer());
|
|
2722
2722
|
}), legacy_pre_effect(() => (deep_read_state(k2()), get$1(u2)), () => {
|
|
2723
2723
|
set(h2, k2().promise && "loading" === get$1(u2) || k2().duration === Number.POSITIVE_INFINITY);
|
|
2724
2724
|
}), legacy_pre_effect(() => (get$1(h2), deep_read_state(S2()), deep_read_state(D2()), get$1(Z2)), () => {
|
|
@@ -2889,7 +2889,7 @@ function Toast(e2, t2) {
|
|
|
2889
2889
|
var c3 = sibling(l3, 2), consequent_14 = (e4) => {
|
|
2890
2890
|
var t3 = Le(), n4 = child(t3);
|
|
2891
2891
|
template_effect((e5) => {
|
|
2892
|
-
set_style(t3,
|
|
2892
|
+
set_style(t3, E2()), set_class(t3, 1, e5), set_text(n4, k2().action.label);
|
|
2893
2893
|
}, [() => {
|
|
2894
2894
|
var _a2, _b2, _c2;
|
|
2895
2895
|
return clsx(cn((_a2 = B2()) == null ? void 0 : _a2.actionButton, (_c2 = (_b2 = k2()) == null ? void 0 : _b2.classes) == null ? void 0 : _c2.actionButton));
|
|
@@ -3015,7 +3015,7 @@ function Toaster(e2, t2) {
|
|
|
3015
3015
|
);
|
|
3016
3016
|
}
|
|
3017
3017
|
}), legacy_pre_effect_reset(), init();
|
|
3018
|
-
var
|
|
3018
|
+
var E2 = comment(), j2 = first_child(E2), consequent = (e3) => {
|
|
3019
3019
|
var s3 = Re();
|
|
3020
3020
|
set_attribute(s3, "tabindex", -1), each(s3, 5, () => get$1(a2), index, (e4, s4, a3, l3) => {
|
|
3021
3021
|
var c3 = He();
|
|
@@ -3157,9 +3157,9 @@ function Toaster(e2, t2) {
|
|
|
3157
3157
|
}), event("pointerdown", c3, () => set(T2, true)), event("pointerup", c3, () => set(T2, false)), append(e4, c3);
|
|
3158
3158
|
}), template_effect(() => set_attribute(s3, "aria-label", `${g2()} ${get$1(l2)}`)), append(e3, s3);
|
|
3159
3159
|
};
|
|
3160
|
-
if_block(
|
|
3160
|
+
if_block(j2, (e3) => {
|
|
3161
3161
|
$toasts().length > 0 && e3(consequent);
|
|
3162
|
-
}), append(e2,
|
|
3162
|
+
}), append(e2, E2), pop(), s2();
|
|
3163
3163
|
}
|
|
3164
3164
|
const Ve = writable(false), Ke = writable("https://sdk.playlight.dev");
|
|
3165
3165
|
function handleClick(e2, t2, n2) {
|
|
@@ -3285,7 +3285,7 @@ const Qe = new (_b = class {
|
|
|
3285
3285
|
}
|
|
3286
3286
|
return await o2.json();
|
|
3287
3287
|
} catch (e3) {
|
|
3288
|
-
|
|
3288
|
+
je.error("Error: " + e3), console.error("Playlight API error:", e3);
|
|
3289
3289
|
}
|
|
3290
3290
|
}
|
|
3291
3291
|
// Get all categories
|
|
@@ -3664,12 +3664,13 @@ function CurrentGameDisplay(e2, t2) {
|
|
|
3664
3664
|
t2.currentGame && get$1(i2) && e3(consequent_1);
|
|
3665
3665
|
}), append(e2, f2), pop();
|
|
3666
3666
|
}
|
|
3667
|
+
function closeDiscoveryOnEmptyClick(e2, t2) {
|
|
3668
|
+
e2.target === e2.currentTarget && store_set(Ve, false);
|
|
3669
|
+
}
|
|
3667
3670
|
delegate(["mousedown", "mousemove", "mouseup", "touchstart", "touchmove", "touchend", "click"]);
|
|
3668
3671
|
var on_click = (e2, t2) => {
|
|
3669
|
-
e2.target === e2.currentTarget && store_set(Ve, false);
|
|
3670
|
-
}, on_click_1 = (e2, t2) => {
|
|
3671
3672
|
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));
|
|
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>'),
|
|
3673
|
+
}, 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" id="playlight-discovery"><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 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>');
|
|
3673
3674
|
function DiscoveryOverlay(e2, t2) {
|
|
3674
3675
|
push(t2, true);
|
|
3675
3676
|
const [n2, o2] = setup_stores(), $discoveryOpen = () => store_get(Ve, "$discoveryOpen", n2);
|
|
@@ -3683,7 +3684,7 @@ function DiscoveryOverlay(e2, t2) {
|
|
|
3683
3684
|
(set(h2, true), set(_2, 1), setTimeout(() => fetchGames(), 100))
|
|
3684
3685
|
) : set(g2, false) : set(_2, get$1(_2) + 1);
|
|
3685
3686
|
} catch (e3) {
|
|
3686
|
-
console.error(e3),
|
|
3687
|
+
console.error(e3), je.error("Failed to load games: " + e3);
|
|
3687
3688
|
} finally {
|
|
3688
3689
|
set(c2, false), set(u2, false), // For Chrome: manually check if element is still in view and should trigger another load
|
|
3689
3690
|
get$1(g2) && get$1(v2) && setTimeout(() => {
|
|
@@ -3715,10 +3716,10 @@ function DiscoveryOverlay(e2, t2) {
|
|
|
3715
3716
|
var m2 = gt();
|
|
3716
3717
|
event("keydown", q, (e3) => {
|
|
3717
3718
|
"Escape" == e3.key && store_set(Ve, false);
|
|
3718
|
-
}), m2.__click = [
|
|
3719
|
+
}), m2.__click = [closeDiscoveryOnEmptyClick, $discoveryOpen];
|
|
3719
3720
|
var b2 = child(m2), y2 = child(b2), $2 = child(y2), w2 = child(sibling(y2, 2)), consequent = (e3) => {
|
|
3720
3721
|
var t3 = ut();
|
|
3721
|
-
t3.__click = [
|
|
3722
|
+
t3.__click = [on_click, a2];
|
|
3722
3723
|
var n3 = child(t3), o3 = child(n3);
|
|
3723
3724
|
template_effect(() => set_text(o3, get$1(a2) ? "Don't show on exit" : "Do show on exit")), append(e3, t3);
|
|
3724
3725
|
};
|
|
@@ -3726,7 +3727,7 @@ function DiscoveryOverlay(e2, t2) {
|
|
|
3726
3727
|
s2() && e3(consequent);
|
|
3727
3728
|
});
|
|
3728
3729
|
var x2 = sibling(w2, 2);
|
|
3729
|
-
x2.__click = [
|
|
3730
|
+
x2.__click = [on_click_1, $discoveryOpen], function X(e3, t3) {
|
|
3730
3731
|
const n3 = legacy_rest_props(t3, ["children", "$$slots", "$$events", "$$legacy"]);
|
|
3731
3732
|
Icon$1(e3, spread_props({
|
|
3732
3733
|
name: "x"
|
|
@@ -3766,7 +3767,9 @@ function DiscoveryOverlay(e2, t2) {
|
|
|
3766
3767
|
return get$1(d2);
|
|
3767
3768
|
}
|
|
3768
3769
|
});
|
|
3769
|
-
var S2 = sibling(C2, 2)
|
|
3770
|
+
var S2 = sibling(C2, 2);
|
|
3771
|
+
S2.__click = [closeDiscoveryOnEmptyClick, $discoveryOpen];
|
|
3772
|
+
var M2 = child(S2), consequent_1 = (e3) => {
|
|
3770
3773
|
var t3 = dt();
|
|
3771
3774
|
Loader_circle(child(t3), {
|
|
3772
3775
|
class: "animate-spin opacity-75",
|