@pixelmatters/markup 1.6.1 → 1.7.0
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/README.md +6 -6
- package/dist/widget.js +216 -114
- package/dist/widget.js.map +1 -0
- package/package.json +2 -1
package/dist/widget.js
CHANGED
|
@@ -2943,19 +2943,31 @@ function Wr() {
|
|
|
2943
2943
|
name: e?.name,
|
|
2944
2944
|
email: e?.email
|
|
2945
2945
|
};
|
|
2946
|
-
|
|
2947
|
-
state: {
|
|
2948
|
-
kind: "verified",
|
|
2949
|
-
identity: {
|
|
2950
|
-
clientId: e.clientId,
|
|
2951
|
-
token: e.token,
|
|
2952
|
-
tokenExpiresAt: e.tokenExpiresAt,
|
|
2953
|
-
name: e.name,
|
|
2954
|
-
email: e.email
|
|
2955
|
-
}
|
|
2956
|
-
},
|
|
2946
|
+
if (!e) return {
|
|
2947
|
+
state: { kind: "unresolved" },
|
|
2957
2948
|
preserved: t
|
|
2958
|
-
}
|
|
2949
|
+
};
|
|
2950
|
+
if (e.isVerified && typeof e.clientId == "string" && typeof e.token == "string" && typeof e.tokenExpiresAt == "number" && typeof e.name == "string") {
|
|
2951
|
+
let n = e.tokenExpiresAt > Date.now(), r = typeof e.refreshToken == "string" && typeof e.refreshTokenExpiresAt == "number" && e.refreshTokenExpiresAt > Date.now();
|
|
2952
|
+
if (n || r) return {
|
|
2953
|
+
state: {
|
|
2954
|
+
kind: "verified",
|
|
2955
|
+
identity: {
|
|
2956
|
+
clientId: e.clientId,
|
|
2957
|
+
token: e.token,
|
|
2958
|
+
tokenExpiresAt: e.tokenExpiresAt,
|
|
2959
|
+
...r ? {
|
|
2960
|
+
refreshToken: e.refreshToken,
|
|
2961
|
+
refreshTokenExpiresAt: e.refreshTokenExpiresAt
|
|
2962
|
+
} : {},
|
|
2963
|
+
name: e.name,
|
|
2964
|
+
email: e.email
|
|
2965
|
+
}
|
|
2966
|
+
},
|
|
2967
|
+
preserved: t
|
|
2968
|
+
};
|
|
2969
|
+
}
|
|
2970
|
+
return typeof e.clientId == "string" && typeof e.anonToken == "string" ? {
|
|
2959
2971
|
state: {
|
|
2960
2972
|
kind: "anon",
|
|
2961
2973
|
identity: {
|
|
@@ -2969,9 +2981,6 @@ function Wr() {
|
|
|
2969
2981
|
} : {
|
|
2970
2982
|
state: { kind: "unresolved" },
|
|
2971
2983
|
preserved: t
|
|
2972
|
-
} : {
|
|
2973
|
-
state: { kind: "unresolved" },
|
|
2974
|
-
preserved: t
|
|
2975
2984
|
};
|
|
2976
2985
|
}
|
|
2977
2986
|
function Gr(e) {
|
|
@@ -2981,6 +2990,8 @@ function Gr(e) {
|
|
|
2981
2990
|
clientId: e.identity.clientId,
|
|
2982
2991
|
token: e.identity.token,
|
|
2983
2992
|
tokenExpiresAt: e.identity.tokenExpiresAt,
|
|
2993
|
+
refreshToken: e.identity.refreshToken,
|
|
2994
|
+
refreshTokenExpiresAt: e.identity.refreshTokenExpiresAt,
|
|
2984
2995
|
isVerified: !0,
|
|
2985
2996
|
name: e.identity.name,
|
|
2986
2997
|
email: e.identity.email
|
|
@@ -3039,7 +3050,7 @@ async function Yr(e, t) {
|
|
|
3039
3050
|
});
|
|
3040
3051
|
if (!n.ok) throw Error(`popup-exchange responded with ${n.status}`);
|
|
3041
3052
|
let { code: i } = await n.json(), a = new URL("/widget/auth", e);
|
|
3042
|
-
a.searchParams.set("code", i), r = a.toString();
|
|
3053
|
+
a.searchParams.set("code", i), a.searchParams.set("capabilities", "refresh"), r = a.toString();
|
|
3043
3054
|
} catch (e) {
|
|
3044
3055
|
return Promise.reject(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to start popup exchange"));
|
|
3045
3056
|
}
|
|
@@ -3054,7 +3065,9 @@ async function Yr(e, t) {
|
|
|
3054
3065
|
a?.type === "MARKUP_AUTH_RESULT" && (r(), a.identity?.id && a.identity?.name ? e({
|
|
3055
3066
|
identity: a.identity,
|
|
3056
3067
|
token: typeof a.token == "string" ? a.token : null,
|
|
3057
|
-
tokenExpiresAt: typeof a.tokenExpiresAt == "number" ? a.tokenExpiresAt : null
|
|
3068
|
+
tokenExpiresAt: typeof a.tokenExpiresAt == "number" ? a.tokenExpiresAt : null,
|
|
3069
|
+
refreshToken: typeof a.refreshToken == "string" ? a.refreshToken : null,
|
|
3070
|
+
refreshTokenExpiresAt: typeof a.refreshTokenExpiresAt == "number" ? a.refreshTokenExpiresAt : null
|
|
3058
3071
|
}) : t(/* @__PURE__ */ Error("Sign-in cancelled")));
|
|
3059
3072
|
}
|
|
3060
3073
|
let a = window.setInterval(() => {
|
|
@@ -3652,13 +3665,83 @@ function Oa(e) {
|
|
|
3652
3665
|
}, [e, n]), t.kind === "active" ? t.token : null;
|
|
3653
3666
|
}
|
|
3654
3667
|
//#endregion
|
|
3668
|
+
//#region src/runtime/refresh-token.ts
|
|
3669
|
+
async function ka(e) {
|
|
3670
|
+
try {
|
|
3671
|
+
let t = await fetch(`${e.apiUrl.replace(/\/+$/, "")}/widget/refresh`, {
|
|
3672
|
+
method: "POST",
|
|
3673
|
+
headers: {
|
|
3674
|
+
"content-type": "application/json",
|
|
3675
|
+
"x-markup-api-key": e.apiKey
|
|
3676
|
+
},
|
|
3677
|
+
body: JSON.stringify({ refreshToken: e.refreshToken }),
|
|
3678
|
+
signal: e.signal
|
|
3679
|
+
});
|
|
3680
|
+
if (!t.ok) return null;
|
|
3681
|
+
let n = await t.json();
|
|
3682
|
+
return typeof n.accessToken != "string" || typeof n.accessTokenExpiresAt != "number" || typeof n.refreshToken != "string" || typeof n.refreshTokenExpiresAt != "number" ? null : {
|
|
3683
|
+
accessToken: n.accessToken,
|
|
3684
|
+
accessTokenExpiresAt: n.accessTokenExpiresAt,
|
|
3685
|
+
refreshToken: n.refreshToken,
|
|
3686
|
+
refreshTokenExpiresAt: n.refreshTokenExpiresAt
|
|
3687
|
+
};
|
|
3688
|
+
} catch {
|
|
3689
|
+
return null;
|
|
3690
|
+
}
|
|
3691
|
+
}
|
|
3692
|
+
//#endregion
|
|
3693
|
+
//#region src/runtime/use-token-refresh.ts
|
|
3694
|
+
var Aa = 6e4, ja = 500;
|
|
3695
|
+
function Ma(e, t, n, r, i) {
|
|
3696
|
+
let a = e.kind === "verified", o = a ? e.identity.refreshToken : void 0, s = a ? e.identity.refreshTokenExpiresAt : void 0, c = a ? e.identity.tokenExpiresAt : void 0;
|
|
3697
|
+
z(() => {
|
|
3698
|
+
if (!a || o == null || s == null || c == null) return;
|
|
3699
|
+
let l = Date.now();
|
|
3700
|
+
if (s <= l) {
|
|
3701
|
+
i();
|
|
3702
|
+
return;
|
|
3703
|
+
}
|
|
3704
|
+
let u = Math.max(ja, c - Aa - l), d = new AbortController(), f = window.setTimeout(async () => {
|
|
3705
|
+
let a = await ka({
|
|
3706
|
+
apiUrl: t,
|
|
3707
|
+
apiKey: n,
|
|
3708
|
+
refreshToken: o,
|
|
3709
|
+
signal: d.signal
|
|
3710
|
+
});
|
|
3711
|
+
if (!d.signal.aborted) {
|
|
3712
|
+
if (!a) {
|
|
3713
|
+
i();
|
|
3714
|
+
return;
|
|
3715
|
+
}
|
|
3716
|
+
e.kind === "verified" && r({
|
|
3717
|
+
...e.identity,
|
|
3718
|
+
token: a.accessToken,
|
|
3719
|
+
tokenExpiresAt: a.accessTokenExpiresAt,
|
|
3720
|
+
refreshToken: a.refreshToken,
|
|
3721
|
+
refreshTokenExpiresAt: a.refreshTokenExpiresAt
|
|
3722
|
+
});
|
|
3723
|
+
}
|
|
3724
|
+
}, u);
|
|
3725
|
+
return () => {
|
|
3726
|
+
window.clearTimeout(f), d.abort();
|
|
3727
|
+
};
|
|
3728
|
+
}, [
|
|
3729
|
+
a,
|
|
3730
|
+
o,
|
|
3731
|
+
s,
|
|
3732
|
+
c,
|
|
3733
|
+
t,
|
|
3734
|
+
n
|
|
3735
|
+
]);
|
|
3736
|
+
}
|
|
3737
|
+
//#endregion
|
|
3655
3738
|
//#region src/runtime/utils.ts
|
|
3656
3739
|
function Z(...e) {
|
|
3657
3740
|
return e.filter(Boolean).join(" ");
|
|
3658
3741
|
}
|
|
3659
3742
|
//#endregion
|
|
3660
3743
|
//#region src/runtime/use-drag.ts
|
|
3661
|
-
function
|
|
3744
|
+
function Na(e) {
|
|
3662
3745
|
let t = B(e);
|
|
3663
3746
|
t.current = e;
|
|
3664
3747
|
let [n, r] = R(!1), i = B(!1);
|
|
@@ -3687,8 +3770,8 @@ function ka(e) {
|
|
|
3687
3770
|
g = !0, i.current = !0, r(!0), t.current.onStart?.();
|
|
3688
3771
|
}
|
|
3689
3772
|
let o = Math.max(m, window.innerWidth - d - m), v = Math.max(m, window.innerHeight - f - m), y = {
|
|
3690
|
-
left:
|
|
3691
|
-
top:
|
|
3773
|
+
left: Pa(l + n, m, o),
|
|
3774
|
+
top: Pa(u + a, m, v)
|
|
3692
3775
|
};
|
|
3693
3776
|
_ = y, t.current.onMove(y);
|
|
3694
3777
|
}
|
|
@@ -3704,12 +3787,12 @@ function ka(e) {
|
|
|
3704
3787
|
consumeClickIfDragged: V(() => i.current ? (i.current = !1, !0) : !1, [])
|
|
3705
3788
|
};
|
|
3706
3789
|
}
|
|
3707
|
-
function
|
|
3790
|
+
function Pa(e, t, n) {
|
|
3708
3791
|
return Math.max(t, Math.min(n, e));
|
|
3709
3792
|
}
|
|
3710
3793
|
//#endregion
|
|
3711
3794
|
//#region ../../node_modules/.pnpm/preact@10.29.1/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
|
|
3712
|
-
var
|
|
3795
|
+
var Fa = 0;
|
|
3713
3796
|
Array.isArray;
|
|
3714
3797
|
function Q(e, n, r, i, a, o) {
|
|
3715
3798
|
n ||= {};
|
|
@@ -3726,7 +3809,7 @@ function Q(e, n, r, i, a, o) {
|
|
|
3726
3809
|
__e: null,
|
|
3727
3810
|
__c: null,
|
|
3728
3811
|
constructor: void 0,
|
|
3729
|
-
__v: --
|
|
3812
|
+
__v: --Fa,
|
|
3730
3813
|
__i: -1,
|
|
3731
3814
|
__u: 0,
|
|
3732
3815
|
__source: a,
|
|
@@ -3737,7 +3820,7 @@ function Q(e, n, r, i, a, o) {
|
|
|
3737
3820
|
}
|
|
3738
3821
|
//#endregion
|
|
3739
3822
|
//#region src/runtime/ui/icons.tsx
|
|
3740
|
-
function
|
|
3823
|
+
function Ia({ size: e = 16 }) {
|
|
3741
3824
|
return /* @__PURE__ */ Q("svg", {
|
|
3742
3825
|
width: e,
|
|
3743
3826
|
height: e,
|
|
@@ -3747,7 +3830,7 @@ function Ma({ size: e = 16 }) {
|
|
|
3747
3830
|
children: /* @__PURE__ */ Q("path", { d: "M63.4561 0.00557731C70.6277 -0.0175584 76.9025 1.04088 83.5898 3.71066C97.7952 9.43043 109.186 20.5001 115.311 34.5359C119.708 44.8002 120.746 54.7869 119.156 65.8171C116.857 82.7956 105.129 98.8382 90.0566 106.846C83.4394 110.362 74.7336 113.029 67.2051 113.271C62.4204 113.425 61.1274 113.32 56.6807 115.204C50.2035 117.858 43.6874 120.417 37.1348 122.879C34.8442 123.763 32.3203 124.902 29.9404 125.51C29.4023 125.648 28.1978 125.009 27.7598 124.646C26.9046 123.951 27.0582 122.505 27.0264 121.484C26.8123 114.646 27.3302 107.458 26.8604 100.656C25.1578 98.6714 22.4026 96.603 20.3086 94.1989C12.1853 84.8731 7.05334 73.9949 6.18164 61.6101C4.95583 46.292 9.97176 31.1285 20.0908 19.5632C29.989 8.13202 44.0369 1.11921 59.1221 0.0788195C60.2694 -0.0356049 62.2637 0.00944821 63.4561 0.00557731ZM92.2676 55.7497C91.5754 39.5314 77.8207 26.9725 61.6064 27.7536C45.5175 28.5287 33.0758 42.1537 33.7627 58.2468C34.4496 74.3398 48.007 86.8553 64.1035 86.2566C80.3254 85.6533 92.9599 71.968 92.2676 55.7497Z" })
|
|
3748
3831
|
});
|
|
3749
3832
|
}
|
|
3750
|
-
function
|
|
3833
|
+
function La({ size: e = 16 }) {
|
|
3751
3834
|
return /* @__PURE__ */ Q("svg", {
|
|
3752
3835
|
width: e,
|
|
3753
3836
|
height: e,
|
|
@@ -3756,7 +3839,7 @@ function Na({ size: e = 16 }) {
|
|
|
3756
3839
|
children: /* @__PURE__ */ Q("path", { d: "M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z" })
|
|
3757
3840
|
});
|
|
3758
3841
|
}
|
|
3759
|
-
function
|
|
3842
|
+
function Ra({ size: e = 16 }) {
|
|
3760
3843
|
return /* @__PURE__ */ Q("svg", {
|
|
3761
3844
|
width: e,
|
|
3762
3845
|
height: e,
|
|
@@ -3765,7 +3848,7 @@ function Pa({ size: e = 16 }) {
|
|
|
3765
3848
|
children: /* @__PURE__ */ Q("path", { d: "M3 10a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM8.5 10a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM15.5 8.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z" })
|
|
3766
3849
|
});
|
|
3767
3850
|
}
|
|
3768
|
-
function
|
|
3851
|
+
function za({ size: e = 16 }) {
|
|
3769
3852
|
return /* @__PURE__ */ Q("svg", {
|
|
3770
3853
|
width: e,
|
|
3771
3854
|
height: e,
|
|
@@ -3778,7 +3861,7 @@ function Fa({ size: e = 16 }) {
|
|
|
3778
3861
|
})
|
|
3779
3862
|
});
|
|
3780
3863
|
}
|
|
3781
|
-
function
|
|
3864
|
+
function Ba({ size: e = 16 }) {
|
|
3782
3865
|
return /* @__PURE__ */ Q("svg", {
|
|
3783
3866
|
width: e,
|
|
3784
3867
|
height: e,
|
|
@@ -3792,7 +3875,7 @@ function Ia({ size: e = 16 }) {
|
|
|
3792
3875
|
})
|
|
3793
3876
|
});
|
|
3794
3877
|
}
|
|
3795
|
-
function
|
|
3878
|
+
function Va({ size: e = 16 }) {
|
|
3796
3879
|
return /* @__PURE__ */ Q("svg", {
|
|
3797
3880
|
width: e,
|
|
3798
3881
|
height: e,
|
|
@@ -3801,7 +3884,7 @@ function La({ size: e = 16 }) {
|
|
|
3801
3884
|
children: /* @__PURE__ */ Q("path", { d: "M2.87 2.298a.75.75 0 0 0-.812 1.021L3.39 6.624a1 1 0 0 0 .928.626H8.25a.75.75 0 0 1 0 1.5H4.318a1 1 0 0 0-.927.626l-1.333 3.305a.75.75 0 0 0 .811 1.022 24.89 24.89 0 0 0 11.668-5.115.75.75 0 0 0 0-1.175A24.89 24.89 0 0 0 2.869 2.298Z" })
|
|
3802
3885
|
});
|
|
3803
3886
|
}
|
|
3804
|
-
function
|
|
3887
|
+
function Ha({ size: e = 16 }) {
|
|
3805
3888
|
return /* @__PURE__ */ Q("svg", {
|
|
3806
3889
|
width: e,
|
|
3807
3890
|
height: e,
|
|
@@ -3813,8 +3896,8 @@ function Ra({ size: e = 16 }) {
|
|
|
3813
3896
|
}
|
|
3814
3897
|
//#endregion
|
|
3815
3898
|
//#region src/runtime/ui/fab.tsx
|
|
3816
|
-
function
|
|
3817
|
-
let o = a === "icon-only", s = r === "bottom-left" ? "markup-fab-left" : r === "bottom-center" ? "markup-fab-center" : "markup-fab-right", [c, l] = R(null), { onPointerDown: u, isDragging: d, consumeClickIfDragged: f } =
|
|
3899
|
+
function Ua({ isActive: e, onToggle: t, onHide: n, position: r = "bottom-right", onPositionChange: i, variant: a = "default" }) {
|
|
3900
|
+
let o = a === "icon-only", s = r === "bottom-left" ? "markup-fab-left" : r === "bottom-center" ? "markup-fab-center" : "markup-fab-right", [c, l] = R(null), { onPointerDown: u, isDragging: d, consumeClickIfDragged: f } = Na({
|
|
3818
3901
|
preventDefault: !0,
|
|
3819
3902
|
stopPropagation: !0,
|
|
3820
3903
|
onMove: l,
|
|
@@ -3846,7 +3929,7 @@ function za({ isActive: e, onToggle: t, onHide: n, position: r = "bottom-right",
|
|
|
3846
3929
|
"aria-pressed": e,
|
|
3847
3930
|
children: [/* @__PURE__ */ Q("span", {
|
|
3848
3931
|
class: "markup-fab-icon",
|
|
3849
|
-
children: Q(e ?
|
|
3932
|
+
children: Q(e ? La : Ia, { size: 16 })
|
|
3850
3933
|
}), o ? null : /* @__PURE__ */ Q("span", {
|
|
3851
3934
|
class: "markup-fab-label",
|
|
3852
3935
|
children: e ? "Cancel" : "Markup"
|
|
@@ -3855,7 +3938,7 @@ function za({ isActive: e, onToggle: t, onHide: n, position: r = "bottom-right",
|
|
|
3855
3938
|
}
|
|
3856
3939
|
//#endregion
|
|
3857
3940
|
//#region src/runtime/use-focus-trap.ts
|
|
3858
|
-
var
|
|
3941
|
+
var Wa = [
|
|
3859
3942
|
"a[href]",
|
|
3860
3943
|
"button:not([disabled])",
|
|
3861
3944
|
"input:not([disabled])",
|
|
@@ -3863,14 +3946,14 @@ var Ba = [
|
|
|
3863
3946
|
"textarea:not([disabled])",
|
|
3864
3947
|
"[tabindex]:not([tabindex=\"-1\"])"
|
|
3865
3948
|
].join(",");
|
|
3866
|
-
function
|
|
3949
|
+
function Ga(e, t) {
|
|
3867
3950
|
z(() => {
|
|
3868
3951
|
if (!t) return;
|
|
3869
3952
|
let n = e.current;
|
|
3870
3953
|
if (!n) return;
|
|
3871
3954
|
function r(e) {
|
|
3872
3955
|
if (e.key !== "Tab") return;
|
|
3873
|
-
let t = Array.from(n.querySelectorAll(
|
|
3956
|
+
let t = Array.from(n.querySelectorAll(Wa)), r = t[0], i = t[t.length - 1];
|
|
3874
3957
|
if (!r || !i) return;
|
|
3875
3958
|
let a = n.getRootNode(), o = a instanceof ShadowRoot ? a.activeElement : document.activeElement;
|
|
3876
3959
|
(e.shiftKey ? o === r : o === i) && (e.preventDefault(), (e.shiftKey ? i : r).focus());
|
|
@@ -3880,7 +3963,7 @@ function Va(e, t) {
|
|
|
3880
3963
|
}
|
|
3881
3964
|
//#endregion
|
|
3882
3965
|
//#region src/runtime/use-object-url.ts
|
|
3883
|
-
function
|
|
3966
|
+
function Ka(e) {
|
|
3884
3967
|
let [t, n] = R(null);
|
|
3885
3968
|
return z(() => {
|
|
3886
3969
|
if (!e) {
|
|
@@ -3893,7 +3976,7 @@ function Ha(e) {
|
|
|
3893
3976
|
}
|
|
3894
3977
|
//#endregion
|
|
3895
3978
|
//#region src/runtime/ui/author-prompt.tsx
|
|
3896
|
-
function
|
|
3979
|
+
function qa({ isPending: e, isConnecting: t = !1, isSigningIn: n = !1, onSubmit: r, onCancel: i, onSignIn: a }) {
|
|
3897
3980
|
let [o, s] = R(""), [c, l] = R(""), u = B(null);
|
|
3898
3981
|
z(() => {
|
|
3899
3982
|
u.current?.focus();
|
|
@@ -3972,8 +4055,8 @@ function Ua({ isPending: e, isConnecting: t = !1, isSigningIn: n = !1, onSubmit:
|
|
|
3972
4055
|
}
|
|
3973
4056
|
//#endregion
|
|
3974
4057
|
//#region src/runtime/ui/composer.tsx
|
|
3975
|
-
var
|
|
3976
|
-
function
|
|
4058
|
+
var Ja = 4e3;
|
|
4059
|
+
function Ya({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "Post", initialFocus: r = !0, isPending: i, error: a, onSubmit: o }) {
|
|
3977
4060
|
let [s, c] = R(""), l = B(null), u = B(!1);
|
|
3978
4061
|
z(() => {
|
|
3979
4062
|
r && l.current?.focus();
|
|
@@ -3983,7 +4066,7 @@ function Ga({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
|
|
|
3983
4066
|
}, [s]), z(() => {
|
|
3984
4067
|
u.current && !i && !a && (c(""), l.current?.focus()), u.current = i;
|
|
3985
4068
|
}, [i, a]);
|
|
3986
|
-
let d =
|
|
4069
|
+
let d = Ja - s.length, f = d < 0;
|
|
3987
4070
|
function p(e) {
|
|
3988
4071
|
e?.preventDefault();
|
|
3989
4072
|
let t = s.trim();
|
|
@@ -4001,7 +4084,7 @@ function Ga({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
|
|
|
4001
4084
|
"aria-label": i ? "Sending…" : n,
|
|
4002
4085
|
title: i ? "Sending…" : n,
|
|
4003
4086
|
tabIndex: e,
|
|
4004
|
-
children: /* @__PURE__ */ Q(
|
|
4087
|
+
children: /* @__PURE__ */ Q(Va, { size: 14 })
|
|
4005
4088
|
});
|
|
4006
4089
|
}
|
|
4007
4090
|
return /* @__PURE__ */ Q("form", {
|
|
@@ -4014,7 +4097,7 @@ function Ga({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
|
|
|
4014
4097
|
class: "markup-composer-input",
|
|
4015
4098
|
placeholder: t,
|
|
4016
4099
|
rows: h ? 2 : 1,
|
|
4017
|
-
maxLength:
|
|
4100
|
+
maxLength: Ja + 100,
|
|
4018
4101
|
value: s,
|
|
4019
4102
|
onInput: (e) => c(e.currentTarget.value),
|
|
4020
4103
|
onKeyDown: m,
|
|
@@ -4050,10 +4133,10 @@ function Ga({ label: e, placeholder: t = "Leave feedback…", submitLabel: n = "
|
|
|
4050
4133
|
}
|
|
4051
4134
|
//#endregion
|
|
4052
4135
|
//#region src/runtime/ui/new-thread-popover.tsx
|
|
4053
|
-
function
|
|
4136
|
+
function Xa({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolving: i, isSigningIn: a, isPending: o, error: s, screenshot: c, isScreenshotCapturing: l, screenshotRedactedCount: u, screenshotRedactedSelectors: d, onAuthor: f, onSignIn: p, onSubmit: m, onClose: h }) {
|
|
4054
4137
|
let g = B(null);
|
|
4055
|
-
|
|
4056
|
-
let [_, v] = R(!1), [y, b] = R(!1), x =
|
|
4138
|
+
Ga(g, !0);
|
|
4139
|
+
let [_, v] = R(!1), [y, b] = R(!1), x = Ka(c), [C, w] = R(null), { onPointerDown: T, isDragging: E } = Na({
|
|
4057
4140
|
targetRef: g,
|
|
4058
4141
|
shouldStart: (e) => !e.target?.closest("button, a, input, textarea, select"),
|
|
4059
4142
|
onMove: w
|
|
@@ -4069,7 +4152,7 @@ function Ka({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolv
|
|
|
4069
4152
|
}
|
|
4070
4153
|
return e.addEventListener("toggle", t), () => e.removeEventListener("toggle", t);
|
|
4071
4154
|
}, [h]);
|
|
4072
|
-
let D =
|
|
4155
|
+
let D = Za(e - window.scrollX + 16, 12, window.innerWidth - 320 - 12), O = Za(t - window.scrollY - 16, 12, window.innerHeight - 220), k = c != null, A = l || k;
|
|
4073
4156
|
return /* @__PURE__ */ Q("div", {
|
|
4074
4157
|
ref: g,
|
|
4075
4158
|
class: Z("markup-popover", C && "is-floating", E && "is-dragging"),
|
|
@@ -4091,9 +4174,9 @@ function Ka({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolv
|
|
|
4091
4174
|
class: "markup-icon-btn",
|
|
4092
4175
|
"aria-label": "Discard pin",
|
|
4093
4176
|
onClick: h,
|
|
4094
|
-
children: /* @__PURE__ */ Q(
|
|
4177
|
+
children: /* @__PURE__ */ Q(La, { size: 16 })
|
|
4095
4178
|
})]
|
|
4096
|
-
}), n == null ? /* @__PURE__ */ Q(
|
|
4179
|
+
}), n == null ? /* @__PURE__ */ Q(qa, {
|
|
4097
4180
|
isPending: o,
|
|
4098
4181
|
isConnecting: i,
|
|
4099
4182
|
isSigningIn: a,
|
|
@@ -4117,7 +4200,7 @@ function Ka({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolv
|
|
|
4117
4200
|
}) : null
|
|
4118
4201
|
]
|
|
4119
4202
|
}),
|
|
4120
|
-
/* @__PURE__ */ Q(
|
|
4203
|
+
/* @__PURE__ */ Q(Ya, {
|
|
4121
4204
|
label: "Feedback",
|
|
4122
4205
|
placeholder: "What's wrong, missing, or worth noting?",
|
|
4123
4206
|
submitLabel: "Post markup",
|
|
@@ -4135,7 +4218,7 @@ function Ka({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolv
|
|
|
4135
4218
|
class: "markup-screenshot-checkbox",
|
|
4136
4219
|
disabled: !0
|
|
4137
4220
|
}),
|
|
4138
|
-
/* @__PURE__ */ Q(
|
|
4221
|
+
/* @__PURE__ */ Q(Ba, { size: 12 }),
|
|
4139
4222
|
/* @__PURE__ */ Q("span", { children: "Capturing…" })
|
|
4140
4223
|
]
|
|
4141
4224
|
}) : /* @__PURE__ */ Q("label", {
|
|
@@ -4147,7 +4230,7 @@ function Ka({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolv
|
|
|
4147
4230
|
checked: _,
|
|
4148
4231
|
onChange: (e) => v(e.currentTarget.checked)
|
|
4149
4232
|
}),
|
|
4150
|
-
/* @__PURE__ */ Q(
|
|
4233
|
+
/* @__PURE__ */ Q(Ba, { size: 12 }),
|
|
4151
4234
|
/* @__PURE__ */ Q("span", { children: "Attach screenshot" }),
|
|
4152
4235
|
x && _ ? /* @__PURE__ */ Q("img", {
|
|
4153
4236
|
class: "markup-screenshot-thumb",
|
|
@@ -4195,12 +4278,12 @@ function Ka({ pageX: e, pageY: t, authorName: n, isVerified: r, isIdentityResolv
|
|
|
4195
4278
|
})]
|
|
4196
4279
|
});
|
|
4197
4280
|
}
|
|
4198
|
-
function
|
|
4281
|
+
function Za(e, t, n) {
|
|
4199
4282
|
return Math.max(t, Math.min(n, e));
|
|
4200
4283
|
}
|
|
4201
4284
|
//#endregion
|
|
4202
4285
|
//#region src/runtime/ui/pin.tsx
|
|
4203
|
-
function
|
|
4286
|
+
function Qa({ pageX: e, pageY: t, count: n, isActive: r, isUnresolved: i, onClick: a }) {
|
|
4204
4287
|
let o = t - window.scrollY, s = e - window.scrollX;
|
|
4205
4288
|
return /* @__PURE__ */ Q("button", {
|
|
4206
4289
|
type: "button",
|
|
@@ -4223,7 +4306,7 @@ function Ja({ pageX: e, pageY: t, count: n, isActive: r, isUnresolved: i, onClic
|
|
|
4223
4306
|
}) : null]
|
|
4224
4307
|
});
|
|
4225
4308
|
}
|
|
4226
|
-
function
|
|
4309
|
+
function $a({ pageX: e, pageY: t }) {
|
|
4227
4310
|
let n = t - window.scrollY, r = e - window.scrollX;
|
|
4228
4311
|
return /* @__PURE__ */ Q("div", {
|
|
4229
4312
|
class: "markup-pin markup-pin-ghost is-anchor",
|
|
@@ -4239,7 +4322,7 @@ function Ya({ pageX: e, pageY: t }) {
|
|
|
4239
4322
|
}
|
|
4240
4323
|
//#endregion
|
|
4241
4324
|
//#region src/runtime/ui/placement-overlay.tsx
|
|
4242
|
-
function
|
|
4325
|
+
function eo({ onPlace: e, onCancel: t }) {
|
|
4243
4326
|
z(() => {
|
|
4244
4327
|
function e(e) {
|
|
4245
4328
|
e.key === "Escape" && t();
|
|
@@ -4265,14 +4348,14 @@ function Xa({ onPlace: e, onCancel: t }) {
|
|
|
4265
4348
|
}
|
|
4266
4349
|
//#endregion
|
|
4267
4350
|
//#region src/runtime/ui/thread-popover.tsx
|
|
4268
|
-
var
|
|
4351
|
+
var to = [
|
|
4269
4352
|
"👍",
|
|
4270
4353
|
"❤️",
|
|
4271
4354
|
"🎉",
|
|
4272
4355
|
"😮",
|
|
4273
4356
|
"😄",
|
|
4274
4357
|
"❓"
|
|
4275
|
-
],
|
|
4358
|
+
], no = ar({
|
|
4276
4359
|
none: {
|
|
4277
4360
|
"toggle-thread-menu": () => ({
|
|
4278
4361
|
kind: "thread-menu",
|
|
@@ -4328,13 +4411,13 @@ var Za = [
|
|
|
4328
4411
|
dismiss: () => ({ kind: "none" })
|
|
4329
4412
|
}
|
|
4330
4413
|
});
|
|
4331
|
-
function
|
|
4332
|
-
let y = B(null), b = B(null), x = B(null), S = B(null), [C, w] = or(
|
|
4414
|
+
function ro({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIdentityResolving: i, isSigningIn: a, canDelete: o, isPending: s, error: c, isHidden: l = !1, onAuthor: u, onSignIn: d, onClose: f, onReply: p, onEditComment: m, onDeleteComment: h, onToggleReaction: g, onResolve: _, onDelete: v }) {
|
|
4415
|
+
let y = B(null), b = B(null), x = B(null), S = B(null), [C, w] = or(no, { kind: "none" }), [T, E] = R(null), { onPointerDown: D, isDragging: O } = Na({
|
|
4333
4416
|
targetRef: y,
|
|
4334
4417
|
shouldStart: (e) => !e.target?.closest("button, a, input, textarea, select"),
|
|
4335
4418
|
onMove: E
|
|
4336
4419
|
});
|
|
4337
|
-
|
|
4420
|
+
Ga(y, !0);
|
|
4338
4421
|
let k = e.resolvedAt != null, A = Ce(() => e.comments.filter((e) => !e.deleted), [e.comments]);
|
|
4339
4422
|
z(() => {
|
|
4340
4423
|
if (C.kind === "none" || C.kind === "editing") return;
|
|
@@ -4380,8 +4463,8 @@ function $a({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
|
|
|
4380
4463
|
anchorSelector: e.anchorSelector
|
|
4381
4464
|
});
|
|
4382
4465
|
return {
|
|
4383
|
-
left:
|
|
4384
|
-
top:
|
|
4466
|
+
left: so(t.pageX - window.scrollX + 16, 12, window.innerWidth - 320 - 12),
|
|
4467
|
+
top: so(t.pageY - window.scrollY - 16, 12, window.innerHeight - 200)
|
|
4385
4468
|
};
|
|
4386
4469
|
}, [
|
|
4387
4470
|
e.anchorX,
|
|
@@ -4425,7 +4508,7 @@ function $a({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
|
|
|
4425
4508
|
class: Z("markup-icon-btn", C.kind === "thread-menu" && "is-open"),
|
|
4426
4509
|
title: "More options",
|
|
4427
4510
|
onClick: () => w({ type: "toggle-thread-menu" }),
|
|
4428
|
-
children: /* @__PURE__ */ Q(
|
|
4511
|
+
children: /* @__PURE__ */ Q(Ra, { size: 16 })
|
|
4429
4512
|
}), C.kind === "thread-menu" ? /* @__PURE__ */ Q("div", {
|
|
4430
4513
|
class: "markup-thread-menu-list",
|
|
4431
4514
|
children: [/* @__PURE__ */ Q("button", {
|
|
@@ -4453,14 +4536,14 @@ function $a({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
|
|
|
4453
4536
|
title: "Mark as resolved",
|
|
4454
4537
|
disabled: s,
|
|
4455
4538
|
onClick: _,
|
|
4456
|
-
children: /* @__PURE__ */ Q(
|
|
4539
|
+
children: /* @__PURE__ */ Q(za, { size: 16 })
|
|
4457
4540
|
}) : null,
|
|
4458
4541
|
/* @__PURE__ */ Q("button", {
|
|
4459
4542
|
type: "button",
|
|
4460
4543
|
class: "markup-icon-btn",
|
|
4461
4544
|
title: "Close thread",
|
|
4462
4545
|
onClick: f,
|
|
4463
|
-
children: /* @__PURE__ */ Q(
|
|
4546
|
+
children: /* @__PURE__ */ Q(La, { size: 16 })
|
|
4464
4547
|
})
|
|
4465
4548
|
]
|
|
4466
4549
|
})]
|
|
@@ -4487,12 +4570,12 @@ function $a({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
|
|
|
4487
4570
|
/* @__PURE__ */ Q("time", {
|
|
4488
4571
|
class: "markup-comment-time",
|
|
4489
4572
|
datetime: new Date(t.createdAt).toISOString(),
|
|
4490
|
-
title:
|
|
4491
|
-
children:
|
|
4573
|
+
title: lo(t.createdAt),
|
|
4574
|
+
children: co(t.createdAt)
|
|
4492
4575
|
}),
|
|
4493
4576
|
/* @__PURE__ */ Q("div", {
|
|
4494
4577
|
class: "markup-thread-actions",
|
|
4495
|
-
children: [!k && !l ? /* @__PURE__ */ Q(
|
|
4578
|
+
children: [!k && !l ? /* @__PURE__ */ Q(io, {
|
|
4496
4579
|
comment: t,
|
|
4497
4580
|
pickerOpen: p,
|
|
4498
4581
|
pickerDirection: _,
|
|
@@ -4560,7 +4643,7 @@ function $a({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
|
|
|
4560
4643
|
direction: a < i ? "up" : "down"
|
|
4561
4644
|
});
|
|
4562
4645
|
},
|
|
4563
|
-
children: /* @__PURE__ */ Q(
|
|
4646
|
+
children: /* @__PURE__ */ Q(Ra, { size: 16 })
|
|
4564
4647
|
}), d ? /* @__PURE__ */ Q("div", {
|
|
4565
4648
|
class: "markup-thread-menu-list",
|
|
4566
4649
|
children: [o ? /* @__PURE__ */ Q("button", {
|
|
@@ -4632,7 +4715,7 @@ function $a({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
|
|
|
4632
4715
|
children: [t.body, t.editedAt == null ? null : /* @__PURE__ */ Q("time", {
|
|
4633
4716
|
class: "markup-comment-edited",
|
|
4634
4717
|
datetime: new Date(t.editedAt).toISOString(),
|
|
4635
|
-
title:
|
|
4718
|
+
title: lo(t.editedAt),
|
|
4636
4719
|
children: [" ", "(edited)"]
|
|
4637
4720
|
})]
|
|
4638
4721
|
}),
|
|
@@ -4645,7 +4728,7 @@ function $a({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
|
|
|
4645
4728
|
alt: "Screenshot"
|
|
4646
4729
|
})
|
|
4647
4730
|
}) : null,
|
|
4648
|
-
!l && t.reactions.length > 0 ? /* @__PURE__ */ Q(
|
|
4731
|
+
!l && t.reactions.length > 0 ? /* @__PURE__ */ Q(ao, {
|
|
4649
4732
|
comment: t,
|
|
4650
4733
|
isResolved: k,
|
|
4651
4734
|
onToggle: (e) => g(t._id, e)
|
|
@@ -4665,7 +4748,7 @@ function $a({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
|
|
|
4665
4748
|
onClick: (e) => {
|
|
4666
4749
|
e.stopPropagation(), x.current?.close();
|
|
4667
4750
|
},
|
|
4668
|
-
children: /* @__PURE__ */ Q(
|
|
4751
|
+
children: /* @__PURE__ */ Q(La, { size: 16 })
|
|
4669
4752
|
}), /* @__PURE__ */ Q("img", {
|
|
4670
4753
|
class: "markup-lightbox-img",
|
|
4671
4754
|
src: e.screenshotUrl,
|
|
@@ -4673,7 +4756,7 @@ function $a({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
|
|
|
4673
4756
|
onClick: (e) => e.stopPropagation()
|
|
4674
4757
|
})]
|
|
4675
4758
|
}) : null,
|
|
4676
|
-
t == null ? /* @__PURE__ */ Q(
|
|
4759
|
+
t == null ? /* @__PURE__ */ Q(qa, {
|
|
4677
4760
|
isPending: s,
|
|
4678
4761
|
isConnecting: i,
|
|
4679
4762
|
isSigningIn: a,
|
|
@@ -4695,7 +4778,7 @@ function $a({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
|
|
|
4695
4778
|
children: "team"
|
|
4696
4779
|
}) : null
|
|
4697
4780
|
]
|
|
4698
|
-
}), /* @__PURE__ */ Q(
|
|
4781
|
+
}), /* @__PURE__ */ Q(Ya, {
|
|
4699
4782
|
label: "Reply",
|
|
4700
4783
|
placeholder: "Write a reply…",
|
|
4701
4784
|
submitLabel: "Reply",
|
|
@@ -4708,7 +4791,7 @@ function $a({ thread: e, authorName: t, currentClientId: n, isVerified: r, isIde
|
|
|
4708
4791
|
]
|
|
4709
4792
|
});
|
|
4710
4793
|
}
|
|
4711
|
-
function
|
|
4794
|
+
function io({ comment: e, pickerOpen: t, pickerDirection: n, pickerSide: r, pickerRef: i, onPickerClick: a, onPickerSelect: o }) {
|
|
4712
4795
|
return /* @__PURE__ */ Q("div", {
|
|
4713
4796
|
class: Z("markup-reaction-picker-wrap", t && "is-open", t && n === "up" && "is-up", r && "is-side"),
|
|
4714
4797
|
ref: i,
|
|
@@ -4718,11 +4801,11 @@ function eo({ comment: e, pickerOpen: t, pickerDirection: n, pickerSide: r, pick
|
|
|
4718
4801
|
title: "Add reaction",
|
|
4719
4802
|
"aria-label": "Add reaction",
|
|
4720
4803
|
onClick: a,
|
|
4721
|
-
children: /* @__PURE__ */ Q(
|
|
4804
|
+
children: /* @__PURE__ */ Q(Ha, { size: 16 })
|
|
4722
4805
|
}), t ? /* @__PURE__ */ Q("div", {
|
|
4723
4806
|
class: "markup-reaction-picker",
|
|
4724
4807
|
role: "menu",
|
|
4725
|
-
children:
|
|
4808
|
+
children: to.map((t) => /* @__PURE__ */ Q("button", {
|
|
4726
4809
|
type: "button",
|
|
4727
4810
|
role: "menuitem",
|
|
4728
4811
|
class: Z("markup-reaction-picker-item", (e.reactions.find((e) => e.emoji === t)?.mine ?? !1) && "is-mine"),
|
|
@@ -4732,11 +4815,11 @@ function eo({ comment: e, pickerOpen: t, pickerDirection: n, pickerSide: r, pick
|
|
|
4732
4815
|
}) : null]
|
|
4733
4816
|
});
|
|
4734
4817
|
}
|
|
4735
|
-
function
|
|
4818
|
+
function ao({ comment: e, isResolved: t, onToggle: n }) {
|
|
4736
4819
|
return /* @__PURE__ */ Q("div", {
|
|
4737
4820
|
class: "markup-reactions",
|
|
4738
4821
|
children: e.reactions.map((e) => {
|
|
4739
|
-
let r =
|
|
4822
|
+
let r = oo(e.reactors, e.mine, e.count, e.emoji);
|
|
4740
4823
|
return /* @__PURE__ */ Q("button", {
|
|
4741
4824
|
type: "button",
|
|
4742
4825
|
class: Z("markup-reaction-chip", e.mine && "is-mine"),
|
|
@@ -4757,14 +4840,14 @@ function to({ comment: e, isResolved: t, onToggle: n }) {
|
|
|
4757
4840
|
})
|
|
4758
4841
|
});
|
|
4759
4842
|
}
|
|
4760
|
-
function
|
|
4843
|
+
function oo(e, t, n, r) {
|
|
4761
4844
|
let i = e.slice(), a = i.length + +!!t, o = Math.max(0, n - a);
|
|
4762
4845
|
return o > 0 && i.push(`${o} other${o === 1 ? "" : "s"}`), t && i.push("you"), i.length === 0 ? `${n} reacted with ${r}` : `${i.length === 1 ? i[0] : `${i.slice(0, -1).join(", ")} and ${i[i.length - 1]}`} reacted with ${r}`;
|
|
4763
4846
|
}
|
|
4764
|
-
function
|
|
4847
|
+
function so(e, t, n) {
|
|
4765
4848
|
return Math.max(t, Math.min(n, e));
|
|
4766
4849
|
}
|
|
4767
|
-
function
|
|
4850
|
+
function co(e) {
|
|
4768
4851
|
let t = Date.now() - e, n = Math.floor(t / 1e3);
|
|
4769
4852
|
if (n < 60) return "just now";
|
|
4770
4853
|
let r = Math.floor(n / 60);
|
|
@@ -4781,7 +4864,7 @@ function io(e) {
|
|
|
4781
4864
|
year: "numeric"
|
|
4782
4865
|
});
|
|
4783
4866
|
}
|
|
4784
|
-
function
|
|
4867
|
+
function lo(e) {
|
|
4785
4868
|
return new Date(e).toLocaleDateString([], {
|
|
4786
4869
|
month: "long",
|
|
4787
4870
|
day: "numeric",
|
|
@@ -4792,19 +4875,25 @@ function ao(e) {
|
|
|
4792
4875
|
}
|
|
4793
4876
|
//#endregion
|
|
4794
4877
|
//#region src/runtime/ui/app.tsx
|
|
4795
|
-
function
|
|
4796
|
-
|
|
4878
|
+
function uo(e) {
|
|
4879
|
+
if (!e.token || e.tokenExpiresAt == null) return null;
|
|
4880
|
+
let t = typeof e.refreshToken == "string" && typeof e.refreshTokenExpiresAt == "number";
|
|
4881
|
+
return {
|
|
4797
4882
|
clientId: `markup_user_${e.identity.id}`,
|
|
4798
4883
|
token: e.token,
|
|
4799
4884
|
tokenExpiresAt: e.tokenExpiresAt,
|
|
4885
|
+
...t ? {
|
|
4886
|
+
refreshToken: e.refreshToken,
|
|
4887
|
+
refreshTokenExpiresAt: e.refreshTokenExpiresAt
|
|
4888
|
+
} : {},
|
|
4800
4889
|
name: e.identity.name,
|
|
4801
4890
|
email: e.identity.email
|
|
4802
4891
|
};
|
|
4803
4892
|
}
|
|
4804
|
-
function
|
|
4893
|
+
function fo() {
|
|
4805
4894
|
return window.location.host + window.location.pathname;
|
|
4806
4895
|
}
|
|
4807
|
-
var
|
|
4896
|
+
var po = ar({
|
|
4808
4897
|
visible: {
|
|
4809
4898
|
"hide-with-toast": () => ({ kind: "hidden-with-toast" }),
|
|
4810
4899
|
toggle: () => ({ kind: "hidden" })
|
|
@@ -4818,7 +4907,7 @@ var co = ar({
|
|
|
4818
4907
|
function $(e) {
|
|
4819
4908
|
return Gr(e), e;
|
|
4820
4909
|
}
|
|
4821
|
-
var
|
|
4910
|
+
var mo = ar({
|
|
4822
4911
|
unresolved: {
|
|
4823
4912
|
"mint-success": (e, t) => $({
|
|
4824
4913
|
kind: "anon",
|
|
@@ -4867,9 +4956,12 @@ var lo = ar({
|
|
|
4867
4956
|
})
|
|
4868
4957
|
}
|
|
4869
4958
|
});
|
|
4870
|
-
function
|
|
4871
|
-
let [a, o] = R(
|
|
4872
|
-
g.current = f
|
|
4959
|
+
function ho({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "default", screenshots: i }) {
|
|
4960
|
+
let [a, o] = R(fo), [s, c] = R([]), [l, u] = R(!1), d = Ce(() => Wr(), []), [f, p] = or(mo, d.state), [m, h] = R(n), g = B(f);
|
|
4961
|
+
g.current = f, Ma(f, e, t, (e) => p({
|
|
4962
|
+
type: "signed-in",
|
|
4963
|
+
identity: e
|
|
4964
|
+
}), () => p({ type: "unauthorized" }));
|
|
4873
4965
|
let _ = Ce(() => Nr({
|
|
4874
4966
|
apiUrl: e,
|
|
4875
4967
|
apiKey: t,
|
|
@@ -4891,7 +4983,7 @@ function uo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
|
|
|
4891
4983
|
e,
|
|
4892
4984
|
t,
|
|
4893
4985
|
p
|
|
4894
|
-
]), [v, y] = R({ kind: "idle" }), b = cr(), x = cr(), S = cr(), { run: C, reset: w } = b, { run: T } = x, { run: E, reset: D } = S, O = b.isPending, k = b.error ?? x.error ?? S.error, [A, j] = or(
|
|
4986
|
+
]), [v, y] = R({ kind: "idle" }), b = cr(), x = cr(), S = cr(), { run: C, reset: w } = b, { run: T } = x, { run: E, reset: D } = S, O = b.isPending, k = b.error ?? x.error ?? S.error, [A, j] = or(po, { kind: "visible" }), M = A.kind !== "visible", [N, ee] = R(0), te = B(null), ne = qr(f), re = f.kind === "verified", ie = f.kind === "unresolved" || f.kind === "recovering", P = Kr(f);
|
|
4895
4987
|
z(() => {
|
|
4896
4988
|
if (f.kind !== "unresolved" && f.kind !== "recovering") return;
|
|
4897
4989
|
let e = f.kind === "recovering" ? f.preserved : d.preserved, t = !1, n = null, r = 1e3;
|
|
@@ -4953,7 +5045,7 @@ function uo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
|
|
|
4953
5045
|
}), history.replaceState(null, "", window.location.pathname + window.location.search);
|
|
4954
5046
|
}
|
|
4955
5047
|
ce.current = !0;
|
|
4956
|
-
}, [s, l]), z(() => Br(() => o(
|
|
5048
|
+
}, [s, l]), z(() => Br(() => o(fo())), []), z(() => {
|
|
4957
5049
|
function e(e) {
|
|
4958
5050
|
e.key === "." && (e.metaKey || e.ctrlKey) && (e.altKey || e.shiftKey || (e.preventDefault(), j({ type: "toggle" })));
|
|
4959
5051
|
}
|
|
@@ -5030,7 +5122,7 @@ function uo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
|
|
|
5030
5122
|
});
|
|
5031
5123
|
}, [p]), pe = x.isPending, me = V(async () => {
|
|
5032
5124
|
await T(async () => {
|
|
5033
|
-
let n =
|
|
5125
|
+
let n = uo(await Yr(e, t));
|
|
5034
5126
|
if (!n) throw Error("Sign-in did not return a verified token");
|
|
5035
5127
|
p({
|
|
5036
5128
|
type: "signed-in",
|
|
@@ -5203,7 +5295,7 @@ function uo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
|
|
|
5203
5295
|
class: "markup-pins-layer",
|
|
5204
5296
|
children: [M ? null : Se.map(({ thread: e, point: t }) => {
|
|
5205
5297
|
let n = v.kind === "thread" && v.threadId === e._id, r = e.comments.reduce((e, t) => e + +!t.deleted, 0);
|
|
5206
|
-
return /* @__PURE__ */ Q(
|
|
5298
|
+
return /* @__PURE__ */ Q(Qa, {
|
|
5207
5299
|
pageX: t.pageX,
|
|
5208
5300
|
pageY: t.pageY,
|
|
5209
5301
|
count: r,
|
|
@@ -5214,16 +5306,16 @@ function uo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
|
|
|
5214
5306
|
threadId: e._id
|
|
5215
5307
|
})
|
|
5216
5308
|
}, e._id);
|
|
5217
|
-
}), v.kind === "composing-new" ? /* @__PURE__ */ Q(
|
|
5309
|
+
}), v.kind === "composing-new" ? /* @__PURE__ */ Q($a, {
|
|
5218
5310
|
pageX: v.pageX,
|
|
5219
5311
|
pageY: v.pageY
|
|
5220
5312
|
}) : null]
|
|
5221
5313
|
}),
|
|
5222
|
-
v.kind === "placing" ? /* @__PURE__ */ Q(
|
|
5314
|
+
v.kind === "placing" ? /* @__PURE__ */ Q(eo, {
|
|
5223
5315
|
onPlace: F,
|
|
5224
5316
|
onCancel: ue
|
|
5225
5317
|
}) : null,
|
|
5226
|
-
v.kind === "thread" && L ? /* @__PURE__ */ Q(
|
|
5318
|
+
v.kind === "thread" && L ? /* @__PURE__ */ Q(ro, {
|
|
5227
5319
|
thread: L,
|
|
5228
5320
|
authorName: ne,
|
|
5229
5321
|
currentClientId: P ?? null,
|
|
@@ -5244,7 +5336,7 @@ function uo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
|
|
|
5244
5336
|
onDelete: I,
|
|
5245
5337
|
onResolve: ge
|
|
5246
5338
|
}, L._id) : null,
|
|
5247
|
-
v.kind === "composing-new" ? /* @__PURE__ */ Q(
|
|
5339
|
+
v.kind === "composing-new" ? /* @__PURE__ */ Q(Xa, {
|
|
5248
5340
|
pageX: v.pageX,
|
|
5249
5341
|
pageY: v.pageY,
|
|
5250
5342
|
authorName: ne,
|
|
@@ -5262,7 +5354,7 @@ function uo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
|
|
|
5262
5354
|
onSubmit: he,
|
|
5263
5355
|
onClose: ue
|
|
5264
5356
|
}) : null,
|
|
5265
|
-
!M || v.kind === "placing" || v.kind === "composing-new" ? /* @__PURE__ */ Q(
|
|
5357
|
+
!M || v.kind === "placing" || v.kind === "composing-new" ? /* @__PURE__ */ Q(Ua, {
|
|
5266
5358
|
isActive: v.kind === "placing",
|
|
5267
5359
|
onToggle: () => v.kind === "placing" ? ue() : le(),
|
|
5268
5360
|
onHide: () => j({ type: "hide-with-toast" }),
|
|
@@ -5270,11 +5362,11 @@ function uo({ apiUrl: e, apiKey: t, position: n = "bottom-right", fab: r = "defa
|
|
|
5270
5362
|
onPositionChange: h,
|
|
5271
5363
|
variant: r
|
|
5272
5364
|
}) : null,
|
|
5273
|
-
A.kind === "hidden-with-toast" ? /* @__PURE__ */ Q(
|
|
5365
|
+
A.kind === "hidden-with-toast" ? /* @__PURE__ */ Q(go, { position: m }) : null
|
|
5274
5366
|
]
|
|
5275
5367
|
});
|
|
5276
5368
|
}
|
|
5277
|
-
function
|
|
5369
|
+
function go({ position: e }) {
|
|
5278
5370
|
let t = /Mac|iPhone|iPad/.test(navigator.platform || navigator.userAgent) ? "⌘" : "Ctrl";
|
|
5279
5371
|
return /* @__PURE__ */ Q("div", {
|
|
5280
5372
|
class: Z("markup-hud-hidden-toast", e === "bottom-left" ? "markup-hud-hidden-toast-left" : e === "bottom-center" ? "markup-hud-hidden-toast-center" : "markup-hud-hidden-toast-right"),
|
|
@@ -5296,7 +5388,7 @@ function fo({ position: e }) {
|
|
|
5296
5388
|
}
|
|
5297
5389
|
//#endregion
|
|
5298
5390
|
//#region src/runtime/mount.tsx
|
|
5299
|
-
function
|
|
5391
|
+
function _o(e, t) {
|
|
5300
5392
|
e.style.position = "fixed", e.style.inset = "0", e.style.zIndex = "2147483647", e.style.pointerEvents = "none";
|
|
5301
5393
|
let n = t.theme ?? "auto";
|
|
5302
5394
|
n !== "auto" && (e.dataset.theme = n);
|
|
@@ -5305,24 +5397,32 @@ function po(e, t) {
|
|
|
5305
5397
|
let a = document.createElement("div");
|
|
5306
5398
|
a.className = "markup-shadow-root", r.appendChild(a);
|
|
5307
5399
|
let { theme: o, ...s } = t;
|
|
5308
|
-
return le(/* @__PURE__ */ Q(
|
|
5400
|
+
return le(/* @__PURE__ */ Q(ho, { ...s }), a), () => le(null, a);
|
|
5309
5401
|
}
|
|
5310
5402
|
//#endregion
|
|
5311
5403
|
//#region src/widget.ts
|
|
5312
|
-
var
|
|
5313
|
-
function
|
|
5404
|
+
var vo = null, yo = null, bo = null;
|
|
5405
|
+
function xo(e) {
|
|
5314
5406
|
if (!e.apiUrl || !e.apiKey) return console.warn("[markup] init() requires both apiUrl and apiKey — widget not mounted"), () => {};
|
|
5315
|
-
|
|
5316
|
-
let t =
|
|
5317
|
-
|
|
5407
|
+
So();
|
|
5408
|
+
let t = () => {
|
|
5409
|
+
if (bo = null, !document.body) return;
|
|
5410
|
+
let t = document.createElement("div");
|
|
5411
|
+
t.id = "markup-widget", document.body.appendChild(t), yo = t, vo = _o(t, e);
|
|
5412
|
+
};
|
|
5413
|
+
if (document.readyState === "loading" || !document.body) {
|
|
5414
|
+
let e = () => t();
|
|
5415
|
+
bo = () => document.removeEventListener("DOMContentLoaded", e), document.addEventListener("DOMContentLoaded", e, { once: !0 });
|
|
5416
|
+
} else t();
|
|
5417
|
+
return So;
|
|
5318
5418
|
}
|
|
5319
|
-
function
|
|
5320
|
-
|
|
5419
|
+
function So() {
|
|
5420
|
+
bo &&= (bo(), null), vo &&= (vo(), null), yo?.parentNode && yo.parentNode.removeChild(yo), yo = null;
|
|
5321
5421
|
}
|
|
5322
5422
|
if (typeof document < "u") {
|
|
5323
5423
|
let e = document.currentScript ?? document.querySelector("script[data-markup-widget=\"true\"]"), t = e?.dataset.apiUrl, n = e?.dataset.apiKey;
|
|
5324
5424
|
if (t && n) {
|
|
5325
|
-
let r = e?.dataset.position, i = e?.dataset.theme, a = e?.dataset.fab, o = () =>
|
|
5425
|
+
let r = e?.dataset.position, i = e?.dataset.theme, a = e?.dataset.fab, o = () => xo({
|
|
5326
5426
|
apiUrl: t,
|
|
5327
5427
|
apiKey: n,
|
|
5328
5428
|
position: r,
|
|
@@ -5333,4 +5433,6 @@ if (typeof document < "u") {
|
|
|
5333
5433
|
}
|
|
5334
5434
|
}
|
|
5335
5435
|
//#endregion
|
|
5336
|
-
export {
|
|
5436
|
+
export { So as destroy, xo as init };
|
|
5437
|
+
|
|
5438
|
+
//# sourceMappingURL=widget.js.map
|