mesurer-solid 0.2.1-beta.4 → 0.2.1-beta.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.
- package/README.md +4 -1
- package/dist/index.js +994 -671
- package/dist/inject-script.js +8 -8
- package/dist/inject.js +989 -666
- package/dist/plugins.js +1363 -1041
- package/package.json +13 -3
- package/plugins/recording/bridge.d.ts +39 -0
- package/plugins/recording/bridge.mjs +60 -0
- package/plugins/recording/preload.cjs +25 -0
- package/plugins/recording/preload.d.ts +16 -0
- package/plugins/recording/preload.mjs +18 -0
package/dist/index.js
CHANGED
|
@@ -5508,7 +5508,7 @@ function ll(e) {
|
|
|
5508
5508
|
get children() {
|
|
5509
5509
|
var n = X("div", {
|
|
5510
5510
|
"data-mesurer-measurement-chrome": "true",
|
|
5511
|
-
class: "msr:absolute"
|
|
5511
|
+
class: "msr:pointer-events-none msr:absolute"
|
|
5512
5512
|
});
|
|
5513
5513
|
return aa(() => (e) => {
|
|
5514
5514
|
t = e;
|
|
@@ -5870,6 +5870,7 @@ function dl(e) {
|
|
|
5870
5870
|
};
|
|
5871
5871
|
});
|
|
5872
5872
|
var B = X("div", {
|
|
5873
|
+
"data-mesurer-interaction-overlay": "true",
|
|
5873
5874
|
onPointerDown: (t) => e.onPointerDown(t),
|
|
5874
5875
|
onPointerUp: (t) => e.onPointerUp(t),
|
|
5875
5876
|
onPointerLeave: (t) => e.onPointerLeave(t)
|
|
@@ -17744,6 +17745,19 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
17744
17745
|
}, 1500);
|
|
17745
17746
|
e.addEventListener("message", i), e.postMessage(jy(xy, n), Ay(e));
|
|
17746
17747
|
}), Iy = async (e, t) => {
|
|
17748
|
+
let n = e.__MESURER_HOST__?.captureRecordingStream;
|
|
17749
|
+
if (!n) throw Error("Native recording capture is unavailable.");
|
|
17750
|
+
let r = (await n())?.streamId?.trim();
|
|
17751
|
+
if (!r) throw Error("Native recording capture returned no stream id.");
|
|
17752
|
+
let i = { mandatory: {
|
|
17753
|
+
chromeMediaSource: "tab",
|
|
17754
|
+
chromeMediaSourceId: r
|
|
17755
|
+
} };
|
|
17756
|
+
return t.getUserMedia({
|
|
17757
|
+
audio: !1,
|
|
17758
|
+
video: i
|
|
17759
|
+
});
|
|
17760
|
+
}, Ly = async (e, t) => {
|
|
17747
17761
|
if (!e.isSecureContext || !await Py(e)) return null;
|
|
17748
17762
|
let n = await Fy(e);
|
|
17749
17763
|
if (!n) return null;
|
|
@@ -17755,11 +17769,12 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
17755
17769
|
audio: !1,
|
|
17756
17770
|
video: r
|
|
17757
17771
|
});
|
|
17758
|
-
},
|
|
17772
|
+
}, Ry = async (e) => {
|
|
17759
17773
|
let t = e.navigator.mediaDevices;
|
|
17760
17774
|
if (!t) throw Error("Screen recording is unavailable in this browser.");
|
|
17775
|
+
if (e.__MESURER_HOST__?.captureRecordingStream) return Iy(e, t);
|
|
17761
17776
|
try {
|
|
17762
|
-
let n = await
|
|
17777
|
+
let n = await Ly(e, t);
|
|
17763
17778
|
if (n) return n;
|
|
17764
17779
|
} catch {}
|
|
17765
17780
|
if (!t.getDisplayMedia) throw Error("Screen recording is unavailable in this browser.");
|
|
@@ -17778,8 +17793,8 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
17778
17793
|
video: !0
|
|
17779
17794
|
});
|
|
17780
17795
|
}
|
|
17781
|
-
},
|
|
17782
|
-
let r = await
|
|
17796
|
+
}, zy = async (e, t, n) => {
|
|
17797
|
+
let r = await Ry(t), i = r.getVideoTracks()[0];
|
|
17783
17798
|
if (!i) throw r.getTracks().forEach((e) => e.stop()), Error("No video track was selected.");
|
|
17784
17799
|
if (i.getSettings().displaySurface && i.getSettings().displaySurface !== "browser") throw r.getTracks().forEach((e) => e.stop()), Error("Select the current browser tab to record this region.");
|
|
17785
17800
|
let a = e.createElement("video");
|
|
@@ -17808,11 +17823,11 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
17808
17823
|
cropTarget: s ? o : null,
|
|
17809
17824
|
regionLocked: s
|
|
17810
17825
|
};
|
|
17811
|
-
return
|
|
17826
|
+
return By(f, n, Ty(t)), f;
|
|
17812
17827
|
} catch (e) {
|
|
17813
17828
|
throw a.pause(), a.srcObject = null, a.remove(), r.getTracks().forEach((e) => e.stop()), e;
|
|
17814
17829
|
}
|
|
17815
|
-
},
|
|
17830
|
+
}, By = (e, t, n) => {
|
|
17816
17831
|
let { source: r, canvas: i, context: a, regionLocked: o } = e;
|
|
17817
17832
|
if (r.videoWidth <= 0 || r.videoHeight <= 0) return;
|
|
17818
17833
|
if (o) {
|
|
@@ -17821,19 +17836,19 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
17821
17836
|
}
|
|
17822
17837
|
let s = Ey(t, r.videoWidth, r.videoHeight, n), c = s.dx <= .001 && s.dy <= .001 && s.dw >= .999 && s.dh >= .999, l = c ? 0 : s.dx * i.width, u = c ? 0 : s.dy * i.height, d = c ? i.width : s.dw * i.width, f = c ? i.height : s.dh * i.height;
|
|
17823
17838
|
c || (a.fillStyle = "#000", a.fillRect(0, 0, i.width, i.height)), !(d < 1 || f < 1 || s.dw <= 0 || s.dh <= 0) && a.drawImage(r, s.sx, s.sy, s.sw, s.sh, l, u, d, f);
|
|
17824
|
-
},
|
|
17839
|
+
}, Vy = (e) => {
|
|
17825
17840
|
e.source.pause(), e.source.srcObject = null, e.stream.getTracks().forEach((e) => e.stop()), e.cropTarget?.remove(), e.canvas.remove(), e.source.remove();
|
|
17826
|
-
},
|
|
17841
|
+
}, Hy = {
|
|
17827
17842
|
webm: "video/webm",
|
|
17828
17843
|
mp4: "video/mp4"
|
|
17829
|
-
},
|
|
17830
|
-
let r = Math.max(2, Math.round(
|
|
17844
|
+
}, Uy = ["vp9", "vp8"], Wy = ["avc"], Gy = (e) => new c(e), Ky = (e, t) => Number.isFinite(e) && e > 0 ? e : t, qy = (e, t, n) => {
|
|
17845
|
+
let r = Math.max(2, Math.round(Ky(e, 2))), i = Math.max(2, Math.round(Ky(t, 2)));
|
|
17831
17846
|
return n === "mp4" && (r % 2 != 0 && (r += 1), i % 2 != 0 && (i += 1)), {
|
|
17832
17847
|
width: r,
|
|
17833
17848
|
height: i
|
|
17834
17849
|
};
|
|
17835
|
-
},
|
|
17836
|
-
let n = Math.max(.001,
|
|
17850
|
+
}, Jy = (e, t = {}) => {
|
|
17851
|
+
let n = Math.max(.001, Ky(e.duration, .001)), r = Math.min(n, Math.max(0, Number.isFinite(t.startTime) ? t.startTime ?? 0 : 0)), i = Number.isFinite(t.endTime) ? t.endTime ?? n : n, a = Math.min(n, Math.max(r + .001, i));
|
|
17837
17852
|
return {
|
|
17838
17853
|
format: t.format ?? "webm",
|
|
17839
17854
|
startTime: r,
|
|
@@ -17841,33 +17856,33 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
17841
17856
|
scale: t.scale ?? 1,
|
|
17842
17857
|
quality: t.quality ?? "medium"
|
|
17843
17858
|
};
|
|
17844
|
-
},
|
|
17845
|
-
let a =
|
|
17846
|
-
for (let t of
|
|
17859
|
+
}, Yy = (e) => e === "webm" ? Uy : Wy, Xy = async (e, t, n, r, i = "medium") => {
|
|
17860
|
+
let a = qy(t, n, e), o = Gy(i);
|
|
17861
|
+
for (let t of Yy(e)) if (await u(t, {
|
|
17847
17862
|
width: a.width,
|
|
17848
17863
|
height: a.height,
|
|
17849
17864
|
frameRate: r,
|
|
17850
17865
|
quality: o
|
|
17851
17866
|
})) return t;
|
|
17852
17867
|
return null;
|
|
17853
|
-
},
|
|
17868
|
+
}, Zy = async (e, t, n = 30) => {
|
|
17854
17869
|
let r = [];
|
|
17855
|
-
return await
|
|
17856
|
-
},
|
|
17857
|
-
let i = t.format ?? "webm", a = Math.max(1, Math.min(120, Math.round(t.frameRate ?? 30))), o = t.quality ?? "medium", c = e.width, l = e.height, u = await
|
|
17870
|
+
return await Xy("webm", e, t, n) && r.push("webm"), await Xy("mp4", e, t, n) && r.push("mp4"), r;
|
|
17871
|
+
}, Qy = (e) => e === "webm" ? new l() : new o(), $y = async (e, t = {}) => {
|
|
17872
|
+
let i = t.format ?? "webm", a = Math.max(1, Math.min(120, Math.round(t.frameRate ?? 30))), o = t.quality ?? "medium", c = e.width, l = e.height, u = await Xy(i, c, l, a, o);
|
|
17858
17873
|
if (!u) throw Error(`MediaBunny cannot encode ${i.toUpperCase()} at ${c}×${l} in this runtime.`);
|
|
17859
17874
|
let d = new n(), f = new s({
|
|
17860
|
-
format:
|
|
17875
|
+
format: Qy(i),
|
|
17861
17876
|
target: d
|
|
17862
17877
|
}), p = new r(e, {
|
|
17863
17878
|
codec: u,
|
|
17864
|
-
quality:
|
|
17879
|
+
quality: Gy(o)
|
|
17865
17880
|
});
|
|
17866
17881
|
f.addVideoTrack(p, { frameRate: a }), await f.start();
|
|
17867
17882
|
let m = !1, h = -1;
|
|
17868
17883
|
return {
|
|
17869
17884
|
format: i,
|
|
17870
|
-
mimeType:
|
|
17885
|
+
mimeType: Hy[i],
|
|
17871
17886
|
codec: u,
|
|
17872
17887
|
async addFrame(e, t = 1 / a) {
|
|
17873
17888
|
if (m) throw Error("Recording session is already closed.");
|
|
@@ -17879,7 +17894,7 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
17879
17894
|
finalize: async () => {
|
|
17880
17895
|
if (m) throw Error("Recording session is already closed.");
|
|
17881
17896
|
if (m = !0, p.close(), await f.finalize(), !d.buffer || d.buffer.byteLength === 0) throw Error("MediaBunny produced an empty recording.");
|
|
17882
|
-
return new Blob([d.buffer], { type:
|
|
17897
|
+
return new Blob([d.buffer], { type: Hy[i] });
|
|
17883
17898
|
},
|
|
17884
17899
|
async cancel() {
|
|
17885
17900
|
if (!m) {
|
|
@@ -17890,7 +17905,7 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
17890
17905
|
}
|
|
17891
17906
|
}
|
|
17892
17907
|
};
|
|
17893
|
-
},
|
|
17908
|
+
}, eb = async (n) => {
|
|
17894
17909
|
let r = new a({
|
|
17895
17910
|
source: new t(n),
|
|
17896
17911
|
formats: e
|
|
@@ -17912,14 +17927,14 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
17912
17927
|
} finally {
|
|
17913
17928
|
r.dispose();
|
|
17914
17929
|
}
|
|
17915
|
-
},
|
|
17916
|
-
let c = await
|
|
17930
|
+
}, tb = async (r, o = {}) => {
|
|
17931
|
+
let c = await eb(r), l = Jy(c, o), u = qy(c.width * l.scale, c.height * l.scale, l.format), d = await Xy(l.format, u.width, u.height, 30, l.quality);
|
|
17917
17932
|
if (!d) throw Error(`MediaBunny cannot export ${l.format.toUpperCase()} in this runtime.`);
|
|
17918
17933
|
let f = new a({
|
|
17919
17934
|
source: new t(r),
|
|
17920
17935
|
formats: e
|
|
17921
17936
|
}), p = new n(), m = new s({
|
|
17922
|
-
format:
|
|
17937
|
+
format: Qy(l.format),
|
|
17923
17938
|
target: p
|
|
17924
17939
|
});
|
|
17925
17940
|
try {
|
|
@@ -17935,14 +17950,14 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
17935
17950
|
width: u.width,
|
|
17936
17951
|
height: u.height,
|
|
17937
17952
|
fit: "fill",
|
|
17938
|
-
quality:
|
|
17953
|
+
quality: Gy(l.quality),
|
|
17939
17954
|
forceTranscode: !0
|
|
17940
17955
|
},
|
|
17941
17956
|
audio: { discard: !0 }
|
|
17942
17957
|
});
|
|
17943
17958
|
if (!e.isValid) throw Error(`MediaBunny cannot convert this recording to ${l.format.toUpperCase()}.`);
|
|
17944
17959
|
if (await e.execute(), !p.buffer || p.buffer.byteLength === 0) throw Error("MediaBunny produced an empty export.");
|
|
17945
|
-
let t = new Blob([p.buffer], { type:
|
|
17960
|
+
let t = new Blob([p.buffer], { type: Hy[l.format] }), n = await eb(t);
|
|
17946
17961
|
return {
|
|
17947
17962
|
blob: t,
|
|
17948
17963
|
format: l.format,
|
|
@@ -17953,14 +17968,14 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
17953
17968
|
} finally {
|
|
17954
17969
|
f.dispose();
|
|
17955
17970
|
}
|
|
17956
|
-
},
|
|
17971
|
+
}, nb = (e, t = /* @__PURE__ */ new Date()) => `mesurer-recording-${t.toISOString().replace(/[:.]/g, "-")}.${e}`, rb = 352, ib = 576, ab = 8, ob = 8, sb = .05, cb = (e, t) => {
|
|
17957
17972
|
for (let [n, r] of Object.entries(t)) e.style.setProperty(n, r);
|
|
17958
|
-
},
|
|
17973
|
+
}, lb = (e) => {
|
|
17959
17974
|
let t = Number.isFinite(e) ? Math.max(0, e) : 0, n = Math.floor(t / 60);
|
|
17960
17975
|
return `${n}:${(t - n * 60).toFixed(2).padStart(5, "0")}`;
|
|
17961
|
-
},
|
|
17976
|
+
}, ub = (e, t) => {
|
|
17962
17977
|
let n = e.createElement("button");
|
|
17963
|
-
return n.type = "button", n.textContent = t,
|
|
17978
|
+
return n.type = "button", n.textContent = t, cb(n, {
|
|
17964
17979
|
height: "28px",
|
|
17965
17980
|
padding: "0 9px",
|
|
17966
17981
|
border: "1px solid var(--msr-color-ink-200, #e2e8f0)",
|
|
@@ -17972,9 +17987,9 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
17972
17987
|
"font-weight": "500",
|
|
17973
17988
|
cursor: "pointer"
|
|
17974
17989
|
}), n;
|
|
17975
|
-
},
|
|
17990
|
+
}, db = (e, t) => {
|
|
17976
17991
|
let n = e.createElement("select");
|
|
17977
|
-
return n.setAttribute("aria-label", t),
|
|
17992
|
+
return n.setAttribute("aria-label", t), cb(n, {
|
|
17978
17993
|
height: "28px",
|
|
17979
17994
|
padding: "0 24px 0 8px",
|
|
17980
17995
|
border: "1px solid var(--msr-color-ink-200, #e2e8f0)",
|
|
@@ -17985,18 +18000,18 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
17985
18000
|
"font-size": "11px",
|
|
17986
18001
|
cursor: "pointer"
|
|
17987
18002
|
}), n;
|
|
17988
|
-
},
|
|
18003
|
+
}, fb = (e, t, n, r) => {
|
|
17989
18004
|
let i = e.createElement("option");
|
|
17990
18005
|
i.value = n, i.textContent = r, t.append(i);
|
|
17991
|
-
},
|
|
18006
|
+
}, pb = (e, t, n, r) => {
|
|
17992
18007
|
let i = globalThis.URL.createObjectURL(e), a = n.createElement("a");
|
|
17993
18008
|
a.href = i, a.download = t, a.rel = "noopener", n.documentElement.append(a), a.click(), a.remove(), r.setTimeout(() => globalThis.URL.revokeObjectURL(i), 1e3);
|
|
17994
|
-
},
|
|
18009
|
+
}, mb = ({ ownerDocument: e, ownerWindow: t, root: n, formats: r, onDiscard: i, onExport: a }) => {
|
|
17995
18010
|
let o = e.createElement("section");
|
|
17996
|
-
o.dataset.mesurerRecordingPreview = "true", o.dataset.mesurerInspectorUi = "true", o.setAttribute("role", "dialog"), o.setAttribute("aria-label", "Screen recording editor"),
|
|
18011
|
+
o.dataset.mesurerRecordingPreview = "true", o.dataset.mesurerInspectorUi = "true", o.setAttribute("role", "dialog"), o.setAttribute("aria-label", "Screen recording editor"), cb(o, {
|
|
17997
18012
|
position: "fixed",
|
|
17998
18013
|
display: "none",
|
|
17999
|
-
width: `${
|
|
18014
|
+
width: `${rb}px`,
|
|
18000
18015
|
"max-width": "calc(100vw - 16px)",
|
|
18001
18016
|
padding: "8px",
|
|
18002
18017
|
"z-index": "98",
|
|
@@ -18011,7 +18026,7 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18011
18026
|
"pointer-events": "auto"
|
|
18012
18027
|
}), n.append(o);
|
|
18013
18028
|
let s = e.createElement("div");
|
|
18014
|
-
|
|
18029
|
+
cb(s, {
|
|
18015
18030
|
position: "relative",
|
|
18016
18031
|
width: "100%",
|
|
18017
18032
|
"min-height": "72px",
|
|
@@ -18022,7 +18037,7 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18022
18037
|
transition: "max-height 150ms ease"
|
|
18023
18038
|
}), o.append(s);
|
|
18024
18039
|
let c = e.createElement("video");
|
|
18025
|
-
c.muted = !0, c.playsInline = !0, c.preload = "auto",
|
|
18040
|
+
c.muted = !0, c.playsInline = !0, c.preload = "auto", cb(c, {
|
|
18026
18041
|
display: "block",
|
|
18027
18042
|
width: "100%",
|
|
18028
18043
|
height: "100%",
|
|
@@ -18030,8 +18045,8 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18030
18045
|
"object-fit": "contain",
|
|
18031
18046
|
transition: "max-height 150ms ease"
|
|
18032
18047
|
}), s.append(c);
|
|
18033
|
-
let l =
|
|
18034
|
-
l.dataset.mesurerRecordingDiscard = "true", l.setAttribute("aria-label", "Discard recording"),
|
|
18048
|
+
let l = ub(e, "×");
|
|
18049
|
+
l.dataset.mesurerRecordingDiscard = "true", l.setAttribute("aria-label", "Discard recording"), cb(l, {
|
|
18035
18050
|
position: "absolute",
|
|
18036
18051
|
top: "6px",
|
|
18037
18052
|
right: "6px",
|
|
@@ -18043,37 +18058,37 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18043
18058
|
border: "0"
|
|
18044
18059
|
}), s.append(l);
|
|
18045
18060
|
let u = e.createElement("div");
|
|
18046
|
-
|
|
18061
|
+
cb(u, {
|
|
18047
18062
|
display: "flex",
|
|
18048
18063
|
"align-items": "center",
|
|
18049
18064
|
gap: "6px",
|
|
18050
18065
|
"margin-top": "8px"
|
|
18051
18066
|
}), o.append(u);
|
|
18052
|
-
let d =
|
|
18067
|
+
let d = ub(e, "Play");
|
|
18053
18068
|
d.dataset.mesurerRecordingPlay = "true", u.append(d);
|
|
18054
18069
|
let f = e.createElement("span");
|
|
18055
|
-
f.textContent = "0:00.00",
|
|
18070
|
+
f.textContent = "0:00.00", cb(f, {
|
|
18056
18071
|
width: "48px",
|
|
18057
18072
|
color: "var(--msr-color-ink-500, #64748b)",
|
|
18058
18073
|
"font-family": "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
18059
18074
|
"font-variant-numeric": "tabular-nums"
|
|
18060
18075
|
}), u.append(f);
|
|
18061
18076
|
let p = e.createElement("span");
|
|
18062
|
-
|
|
18077
|
+
cb(p, {
|
|
18063
18078
|
"margin-left": "auto",
|
|
18064
18079
|
color: "var(--msr-color-ink-500, #64748b)",
|
|
18065
18080
|
"font-family": "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
18066
18081
|
"font-variant-numeric": "tabular-nums"
|
|
18067
18082
|
}), u.append(p);
|
|
18068
18083
|
let m = e.createElement("div");
|
|
18069
|
-
m.dataset.mesurerRecordingTrimLabel = "true",
|
|
18084
|
+
m.dataset.mesurerRecordingTrimLabel = "true", cb(m, {
|
|
18070
18085
|
"margin-top": "8px",
|
|
18071
18086
|
color: "var(--msr-color-ink-500, #64748b)",
|
|
18072
18087
|
"font-family": "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
18073
18088
|
"font-variant-numeric": "tabular-nums"
|
|
18074
18089
|
}), o.append(m);
|
|
18075
18090
|
let h = e.createElement("div");
|
|
18076
|
-
|
|
18091
|
+
cb(h, {
|
|
18077
18092
|
display: "grid",
|
|
18078
18093
|
"grid-template-columns": "32px minmax(0, 1fr)",
|
|
18079
18094
|
gap: "5px 8px",
|
|
@@ -18088,7 +18103,7 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18088
18103
|
v.textContent = "Out", v.style.color = "var(--msr-color-ink-500, #64748b)", h.append(v);
|
|
18089
18104
|
let y = e.createElement("input");
|
|
18090
18105
|
y.type = "range", y.min = "0", y.step = "0.01", y.dataset.mesurerRecordingTrimEnd = "true", h.append(y);
|
|
18091
|
-
for (let e of [_, y])
|
|
18106
|
+
for (let e of [_, y]) cb(e, {
|
|
18092
18107
|
width: "100%",
|
|
18093
18108
|
height: "20px",
|
|
18094
18109
|
margin: "0",
|
|
@@ -18096,27 +18111,27 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18096
18111
|
cursor: "ew-resize"
|
|
18097
18112
|
});
|
|
18098
18113
|
let b = e.createElement("div");
|
|
18099
|
-
|
|
18114
|
+
cb(b, {
|
|
18100
18115
|
display: "flex",
|
|
18101
18116
|
"align-items": "center",
|
|
18102
18117
|
gap: "6px",
|
|
18103
18118
|
"margin-top": "8px"
|
|
18104
18119
|
}), o.append(b);
|
|
18105
|
-
let x =
|
|
18120
|
+
let x = db(e, "Export format");
|
|
18106
18121
|
x.dataset.mesurerRecordingFormat = "true", b.append(x);
|
|
18107
|
-
let S =
|
|
18108
|
-
S.dataset.mesurerRecordingScale = "true",
|
|
18109
|
-
let C =
|
|
18110
|
-
C.dataset.mesurerRecordingExport = "true",
|
|
18122
|
+
let S = db(e, "Export scale");
|
|
18123
|
+
S.dataset.mesurerRecordingScale = "true", fb(e, S, "1", "1×"), fb(e, S, "2", "2×"), fb(e, S, "3", "3×"), b.append(S);
|
|
18124
|
+
let C = ub(e, "Export");
|
|
18125
|
+
C.dataset.mesurerRecordingExport = "true", cb(C, {
|
|
18111
18126
|
"margin-left": "auto",
|
|
18112
18127
|
background: "var(--msr-content, #18181b)",
|
|
18113
18128
|
color: "var(--msr-surface, #fff)",
|
|
18114
18129
|
border: "0"
|
|
18115
18130
|
}), b.append(C);
|
|
18116
|
-
let w =
|
|
18131
|
+
let w = ub(e, "Expand");
|
|
18117
18132
|
w.dataset.mesurerRecordingExpand = "true", b.append(w);
|
|
18118
18133
|
let T = e.createElement("p");
|
|
18119
|
-
T.dataset.mesurerRecordingPreviewStatus = "true", T.setAttribute("role", "status"),
|
|
18134
|
+
T.dataset.mesurerRecordingPreviewStatus = "true", T.setAttribute("role", "status"), cb(T, {
|
|
18120
18135
|
display: "none",
|
|
18121
18136
|
margin: "7px 0 0",
|
|
18122
18137
|
color: "var(--msr-color-ink-500, #64748b)",
|
|
@@ -18129,11 +18144,11 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18129
18144
|
let e = E?.duration ?? 0, t = Math.min(e, Math.max(0, Number(_.value) || 0));
|
|
18130
18145
|
return {
|
|
18131
18146
|
start: t,
|
|
18132
|
-
end: Math.min(e, Math.max(t +
|
|
18147
|
+
end: Math.min(e, Math.max(t + sb, Number(y.value) || e))
|
|
18133
18148
|
};
|
|
18134
18149
|
}, N = () => {
|
|
18135
18150
|
let { start: e, end: t } = M();
|
|
18136
|
-
m.textContent = `Trim ${
|
|
18151
|
+
m.textContent = `Trim ${lb(e)}–${lb(t)}`;
|
|
18137
18152
|
}, P = (e) => {
|
|
18138
18153
|
k = e;
|
|
18139
18154
|
for (let t of [
|
|
@@ -18149,8 +18164,8 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18149
18164
|
C.textContent = e ? "Exporting…" : "Export";
|
|
18150
18165
|
}, F = () => {
|
|
18151
18166
|
if (o.style.display === "none") return;
|
|
18152
|
-
let r = Math.min(O ?
|
|
18153
|
-
s = Math.min(Math.max(
|
|
18167
|
+
let r = Math.min(O ? ib : rb, Math.max(1, t.innerWidth - 16)), i = Math.max(180, o.offsetHeight), a = (n.closest("[data-mesurer-root='true']")?.querySelector("[data-mesurer-tool-id='recording']") ?? e.querySelector("[data-mesurer-tool-id='recording']"))?.getBoundingClientRect(), s = a ? a.left + a.width / 2 - r / 2 : t.innerWidth - r - ab, c = a ? a.bottom + ob : ab;
|
|
18168
|
+
s = Math.min(Math.max(ab, s), Math.max(ab, t.innerWidth - r - ab)), c + i > t.innerHeight - ab && (c = a ? a.top - i - ob : t.innerHeight - i - ab), o.style.left = `${s}px`, o.style.top = `${Math.max(ab, c)}px`;
|
|
18154
18169
|
}, I = () => {
|
|
18155
18170
|
c.pause(), c.removeAttribute("src"), c.load(), D &&= (globalThis.URL.revokeObjectURL(D), null);
|
|
18156
18171
|
}, L = () => {
|
|
@@ -18174,17 +18189,17 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18174
18189
|
}), c.addEventListener("timeupdate", () => {
|
|
18175
18190
|
if (!E) return;
|
|
18176
18191
|
let { start: e, end: t } = M();
|
|
18177
|
-
c.currentTime >= t - .01 ? (c.pause(), c.currentTime = e) : c.currentTime < e && (c.currentTime = e), f.textContent =
|
|
18192
|
+
c.currentTime >= t - .01 ? (c.pause(), c.currentTime = e) : c.currentTime < e && (c.currentTime = e), f.textContent = lb(c.currentTime);
|
|
18178
18193
|
}), _.addEventListener("input", () => {
|
|
18179
18194
|
if (!E) return;
|
|
18180
|
-
let e = Math.min(E.duration -
|
|
18181
|
-
_.value = String(e), (Number(y.value) || E.duration) < e +
|
|
18195
|
+
let e = Math.min(E.duration - sb, Math.max(0, Number(_.value) || 0));
|
|
18196
|
+
_.value = String(e), (Number(y.value) || E.duration) < e + sb && (y.value = String(Math.min(E.duration, e + sb))), c.currentTime = e, N();
|
|
18182
18197
|
}), y.addEventListener("input", () => {
|
|
18183
18198
|
if (!E) return;
|
|
18184
|
-
let e = Number(_.value) || 0, t = Math.max(e +
|
|
18199
|
+
let e = Number(_.value) || 0, t = Math.max(e + sb, Math.min(E.duration, Number(y.value) || E.duration));
|
|
18185
18200
|
y.value = String(t), c.currentTime = t, N();
|
|
18186
18201
|
}), w.addEventListener("click", () => {
|
|
18187
|
-
O = !O, o.style.width = `${O ?
|
|
18202
|
+
O = !O, o.style.width = `${O ? ib : rb}px`, s.style.maxHeight = O ? "440px" : "160px", c.style.maxHeight = O ? "440px" : "160px", w.textContent = O ? "Shrink" : "Expand", t.requestAnimationFrame(F);
|
|
18188
18203
|
}), C.addEventListener("click", () => {
|
|
18189
18204
|
if (!E || k) return;
|
|
18190
18205
|
let n = ++A, { start: r, end: i } = M(), o = x.value === "mp4" ? "mp4" : "webm";
|
|
@@ -18194,7 +18209,7 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18194
18209
|
endTime: i,
|
|
18195
18210
|
scale: j()
|
|
18196
18211
|
}).then((r) => {
|
|
18197
|
-
n === A && (
|
|
18212
|
+
n === A && (pb(r.blob, r.filename, e, t), T.textContent = `Exported ${r.width}×${r.height} ${r.format.toUpperCase()}`);
|
|
18198
18213
|
}).catch((e) => {
|
|
18199
18214
|
n === A && (T.textContent = e instanceof Error ? e.message : "Could not export the recording.");
|
|
18200
18215
|
}).finally(() => {
|
|
@@ -18206,13 +18221,13 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18206
18221
|
show(n) {
|
|
18207
18222
|
A += 1, I(), E = n;
|
|
18208
18223
|
let i = globalThis.URL.createObjectURL(n.blob);
|
|
18209
|
-
D = i, c.src = i, c.currentTime = 0, f.textContent = "0:00.00", p.textContent =
|
|
18224
|
+
D = i, c.src = i, c.currentTime = 0, f.textContent = "0:00.00", p.textContent = lb(n.duration), _.max = String(n.duration), _.value = "0", y.max = String(n.duration), y.value = String(n.duration), N(), x.replaceChildren(), fb(e, x, "webm", "WebM"), o.style.display = "block", T.style.display = "none", P(!1), F();
|
|
18210
18225
|
let a = A;
|
|
18211
18226
|
r(n).then((t) => {
|
|
18212
18227
|
if (!(a !== A || !E)) {
|
|
18213
18228
|
x.replaceChildren();
|
|
18214
|
-
for (let n of t)
|
|
18215
|
-
t.length === 0 ? (
|
|
18229
|
+
for (let n of t) fb(e, x, n, n === "mp4" ? "MP4" : "WebM");
|
|
18230
|
+
t.length === 0 ? (fb(e, x, "webm", "No export codec"), x.disabled = !0, C.disabled = !0, T.style.display = "block", T.textContent = "No MediaBunny video encoder is available in this runtime.") : (x.disabled = !1, C.disabled = !1);
|
|
18216
18231
|
}
|
|
18217
18232
|
}).catch((e) => {
|
|
18218
18233
|
a === A && (T.style.display = "block", T.textContent = e instanceof Error ? e.message : "Could not inspect export support.");
|
|
@@ -18223,19 +18238,19 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18223
18238
|
L(), t.removeEventListener("resize", R), o.remove();
|
|
18224
18239
|
}
|
|
18225
18240
|
};
|
|
18226
|
-
},
|
|
18241
|
+
}, hb = "mesurer.recording", gb = "recording:v1", _b = "mesurer.recording.settings", vb = "runtime:solid", yb = "recording.toggle", bb = "recording.stop", xb = "recording.discard", Sb = "recording.export", Cb = 30, wb = 60, Tb = 3e3, Eb = {
|
|
18227
18242
|
viewBox: "0 0 24 24",
|
|
18228
18243
|
paths: ["M7 5.75A3.25 3.25 0 0 0 3.75 9v6A3.25 3.25 0 0 0 7 18.25h7A3.25 3.25 0 0 0 17.25 15v-1.03l2.13 1.42a.75.75 0 0 0 1.17-.624V9.234a.75.75 0 0 0-1.17-.624l-2.13 1.42V9A3.25 3.25 0 0 0 14 5.75H7Zm10.25 6.082 1.8-1.2v2.736l-1.8-1.2v-.336Z", "M10.5 9.25a2.75 2.75 0 1 0 0 5.5 2.75 2.75 0 0 0 0-5.5Z"]
|
|
18229
|
-
},
|
|
18244
|
+
}, Db = (e) => e ? { ...e } : null, Ob = (e) => ({
|
|
18230
18245
|
...e,
|
|
18231
|
-
rect:
|
|
18232
|
-
}),
|
|
18246
|
+
rect: Db(e.rect)
|
|
18247
|
+
}), kb = (e, t) => {
|
|
18233
18248
|
for (let [n, r] of Object.entries(t)) e.style.setProperty(n, r);
|
|
18234
|
-
},
|
|
18235
|
-
if (!
|
|
18249
|
+
}, Ab = (e) => e != null && !Array.isArray(e) && typeof e == "object", jb = (e) => typeof e == "number" && Number.isFinite(e), Mb = (e) => {
|
|
18250
|
+
if (!Ab(e)) return {};
|
|
18236
18251
|
let t = {};
|
|
18237
|
-
return (e.format === "webm" || e.format === "mp4") && (t.format = e.format),
|
|
18238
|
-
},
|
|
18252
|
+
return (e.format === "webm" || e.format === "mp4") && (t.format = e.format), jb(e.startTime) && (t.startTime = e.startTime), jb(e.endTime) && (t.endTime = e.endTime), (e.scale === 1 || e.scale === 2 || e.scale === 3) && (t.scale = e.scale), t;
|
|
18253
|
+
}, Nb = (e) => ({
|
|
18239
18254
|
status: e.status,
|
|
18240
18255
|
elapsed: e.elapsed,
|
|
18241
18256
|
rect: e.rect ? { ...e.rect } : null,
|
|
@@ -18243,52 +18258,56 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18243
18258
|
width: e.width,
|
|
18244
18259
|
height: e.height,
|
|
18245
18260
|
error: e.error
|
|
18246
|
-
}),
|
|
18261
|
+
}), Pb = (e) => ({
|
|
18247
18262
|
filename: e.filename,
|
|
18248
18263
|
format: e.format,
|
|
18249
18264
|
duration: e.duration,
|
|
18250
18265
|
width: e.width,
|
|
18251
18266
|
height: e.height,
|
|
18252
18267
|
bytes: e.blob.size
|
|
18253
|
-
}),
|
|
18268
|
+
}), Fb = (e) => ({
|
|
18254
18269
|
format: e.format,
|
|
18255
18270
|
duration: e.duration,
|
|
18256
18271
|
width: e.width,
|
|
18257
18272
|
height: e.height,
|
|
18258
18273
|
bytes: e.blob.size,
|
|
18259
18274
|
createdAt: e.createdAt
|
|
18260
|
-
}),
|
|
18275
|
+
}), Ib = (e, t, n) => {
|
|
18261
18276
|
let r = globalThis.URL.createObjectURL(e.blob), i = t.createElement("a");
|
|
18262
18277
|
i.href = r, i.download = e.filename, i.rel = "noopener", t.documentElement.append(i), i.click(), i.remove(), n.setTimeout(() => globalThis.URL.revokeObjectURL(r), 1e3);
|
|
18263
|
-
},
|
|
18264
|
-
id:
|
|
18278
|
+
}, Lb = (e = {}) => Ta({
|
|
18279
|
+
id: hb,
|
|
18265
18280
|
version: "0.1.0",
|
|
18266
|
-
requires: [
|
|
18267
|
-
provides: ["tool:recording",
|
|
18281
|
+
requires: [vb],
|
|
18282
|
+
provides: ["tool:recording", gb],
|
|
18268
18283
|
setup(t) {
|
|
18269
|
-
let n = t.service.get(
|
|
18284
|
+
let n = t.service.get(vb);
|
|
18270
18285
|
if (!n) throw Error("Recording plugin requires the Solid renderer runtime.");
|
|
18271
|
-
let { ownerDocument: r, ownerWindow: i } = n, a = n.createInspectorMount(), o = a.element
|
|
18272
|
-
|
|
18286
|
+
let { ownerDocument: r, ownerWindow: i } = n, a = n.createInspectorMount(), o = a.element, s = n.rendererRoot ?? n.portalTarget.querySelector("[data-mesurer-root='true']"), c = (e) => {
|
|
18287
|
+
s?.toggleAttribute("data-mesurer-recording-active", e);
|
|
18288
|
+
let t = s?.querySelector("[data-mesurer-interaction-overlay='true']");
|
|
18289
|
+
t && (e ? (t.style.setProperty("pointer-events", "none", "important"), t.style.setProperty("cursor", "default", "important")) : (t.style.removeProperty("pointer-events"), t.style.removeProperty("cursor")));
|
|
18290
|
+
};
|
|
18291
|
+
o.dataset.mesurerRecording = "true", kb(o, {
|
|
18273
18292
|
position: "fixed",
|
|
18274
18293
|
inset: "0",
|
|
18275
18294
|
"z-index": "86",
|
|
18276
18295
|
"pointer-events": "none",
|
|
18277
18296
|
"font-family": "ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif"
|
|
18278
18297
|
});
|
|
18279
|
-
let
|
|
18298
|
+
let l = Math.max(1, Math.min(60, Math.round(e.frameRate ?? Cb))), u = Math.max(1, Math.min(600, e.maxDurationSeconds ?? wb)), d = e.quality ?? "medium";
|
|
18280
18299
|
t.state.register({
|
|
18281
|
-
id:
|
|
18300
|
+
id: _b,
|
|
18282
18301
|
initial: { toolEnabled: e.toolEnabled ?? !0 },
|
|
18283
18302
|
persist: !0
|
|
18284
18303
|
});
|
|
18285
|
-
let
|
|
18286
|
-
t.state.update(
|
|
18304
|
+
let f = () => ({ toolEnabled: t.state.get("mesurer.recording.settings")?.toolEnabled ?? !0 }), p = (e) => {
|
|
18305
|
+
t.state.update(_b, (t) => {
|
|
18287
18306
|
let n = { ...t };
|
|
18288
18307
|
return e.toolEnabled !== void 0 && (n.toolEnabled = e.toolEnabled), n;
|
|
18289
18308
|
});
|
|
18290
|
-
},
|
|
18291
|
-
|
|
18309
|
+
}, m = r.createElement("div");
|
|
18310
|
+
m.dataset.mesurerRecordingSelect = "true", m.dataset.mesurerInspectorUi = "true", m.setAttribute("role", "application"), m.setAttribute("aria-label", "Recording selection"), kb(m, {
|
|
18292
18311
|
position: "fixed",
|
|
18293
18312
|
inset: "0",
|
|
18294
18313
|
display: "none",
|
|
@@ -18297,24 +18316,24 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18297
18316
|
"pointer-events": "auto",
|
|
18298
18317
|
"user-select": "none",
|
|
18299
18318
|
"touch-action": "none"
|
|
18300
|
-
}), o.append(
|
|
18301
|
-
let
|
|
18319
|
+
}), o.append(m);
|
|
18320
|
+
let h = Array.from({ length: 4 }, () => {
|
|
18302
18321
|
let e = r.createElement("div");
|
|
18303
|
-
return
|
|
18322
|
+
return kb(e, {
|
|
18304
18323
|
position: "fixed",
|
|
18305
18324
|
background: "rgb(0 0 0 / 40%)",
|
|
18306
18325
|
"pointer-events": "none"
|
|
18307
|
-
}),
|
|
18308
|
-
}),
|
|
18309
|
-
|
|
18326
|
+
}), m.append(e), e;
|
|
18327
|
+
}), g = r.createElement("div");
|
|
18328
|
+
g.dataset.mesurerRecordingSelection = "true", kb(g, {
|
|
18310
18329
|
position: "fixed",
|
|
18311
18330
|
display: "none",
|
|
18312
18331
|
border: "1px solid var(--msr-accent, #0d99ff)",
|
|
18313
18332
|
"box-sizing": "border-box",
|
|
18314
18333
|
"pointer-events": "none"
|
|
18315
|
-
}),
|
|
18316
|
-
let
|
|
18317
|
-
|
|
18334
|
+
}), m.append(g);
|
|
18335
|
+
let _ = r.createElement("div");
|
|
18336
|
+
kb(_, {
|
|
18318
18337
|
position: "fixed",
|
|
18319
18338
|
display: "none",
|
|
18320
18339
|
transform: "translateX(-50%)",
|
|
@@ -18325,9 +18344,9 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18325
18344
|
"font-size": "10px",
|
|
18326
18345
|
"font-variant-numeric": "tabular-nums",
|
|
18327
18346
|
"pointer-events": "none"
|
|
18328
|
-
}),
|
|
18329
|
-
let
|
|
18330
|
-
|
|
18347
|
+
}), m.append(_);
|
|
18348
|
+
let v = r.createElement("div");
|
|
18349
|
+
v.textContent = "Drag a region to record · Esc to cancel", kb(v, {
|
|
18331
18350
|
position: "fixed",
|
|
18332
18351
|
left: "50%",
|
|
18333
18352
|
bottom: "16px",
|
|
@@ -18338,26 +18357,217 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18338
18357
|
color: "var(--msr-surface, #fff)",
|
|
18339
18358
|
"font-size": "11px",
|
|
18340
18359
|
"pointer-events": "none"
|
|
18341
|
-
}),
|
|
18342
|
-
let
|
|
18343
|
-
|
|
18360
|
+
}), m.append(v);
|
|
18361
|
+
let y = r.createElement("div");
|
|
18362
|
+
y.dataset.mesurerRecordingRegion = "true", y.dataset.mesurerInspectorUi = "true", y.setAttribute("role", "dialog"), y.setAttribute("aria-label", "Recording region"), kb(y, {
|
|
18344
18363
|
position: "fixed",
|
|
18345
18364
|
display: "none",
|
|
18346
|
-
|
|
18347
|
-
padding: "
|
|
18365
|
+
width: "220px",
|
|
18366
|
+
padding: "8px",
|
|
18367
|
+
"z-index": "90",
|
|
18368
|
+
"box-sizing": "border-box",
|
|
18369
|
+
overflow: "hidden",
|
|
18370
|
+
"border-radius": "10px",
|
|
18371
|
+
background: "var(--msr-surface-raised, #fff)",
|
|
18372
|
+
color: "var(--msr-content, #18181b)",
|
|
18373
|
+
"box-shadow": "var(--msr-shadow-floating, 0 10px 30px rgba(0,0,0,.12))",
|
|
18374
|
+
"font-size": "11px",
|
|
18375
|
+
"pointer-events": "auto",
|
|
18376
|
+
transform: "translateX(-50%)"
|
|
18377
|
+
}), m.append(y);
|
|
18378
|
+
let b = (e) => {
|
|
18379
|
+
let t = r.createElement("label");
|
|
18380
|
+
kb(t, {
|
|
18381
|
+
display: "grid",
|
|
18382
|
+
"grid-template-columns": "44px minmax(0,1fr)",
|
|
18383
|
+
"align-items": "center",
|
|
18384
|
+
gap: "8px"
|
|
18385
|
+
});
|
|
18386
|
+
let n = r.createElement("span");
|
|
18387
|
+
n.textContent = e, n.style.color = "var(--msr-color-ink-500, #64748b)", t.append(n);
|
|
18388
|
+
let i = r.createElement("div");
|
|
18389
|
+
return kb(i, {
|
|
18390
|
+
display: "flex",
|
|
18391
|
+
"align-items": "center",
|
|
18392
|
+
gap: "4px",
|
|
18393
|
+
"min-width": "0"
|
|
18394
|
+
}), t.append(i), y.append(t), i;
|
|
18395
|
+
}, x = (e) => {
|
|
18396
|
+
let t = r.createElement("input");
|
|
18397
|
+
return t.type = "number", t.setAttribute("aria-label", e), t.step = "1", kb(t, {
|
|
18398
|
+
width: "0",
|
|
18399
|
+
"min-width": "0",
|
|
18400
|
+
flex: "1 1 0",
|
|
18401
|
+
height: "26px",
|
|
18402
|
+
padding: "0 6px",
|
|
18403
|
+
border: "1px solid var(--msr-color-ink-200, #e2e8f0)",
|
|
18404
|
+
"border-radius": "6px",
|
|
18405
|
+
background: "var(--msr-surface, #fff)",
|
|
18406
|
+
color: "var(--msr-content, #18181b)",
|
|
18407
|
+
"font-family": "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
18408
|
+
"font-size": "10px",
|
|
18409
|
+
"font-variant-numeric": "tabular-nums"
|
|
18410
|
+
}), t;
|
|
18411
|
+
}, S = b("Size"), C = x("Width"), w = x("Height");
|
|
18412
|
+
S.append(C);
|
|
18413
|
+
let T = r.createElement("span");
|
|
18414
|
+
T.textContent = "×", T.style.color = "var(--msr-color-ink-500, #64748b)", S.append(T, w);
|
|
18415
|
+
let E = r.createElement("span");
|
|
18416
|
+
E.textContent = "px", E.style.color = "var(--msr-color-ink-500, #64748b)", S.append(E);
|
|
18417
|
+
let D = b("Position");
|
|
18418
|
+
D.style.marginTop = "8px";
|
|
18419
|
+
let O = x("Left"), k = x("Top");
|
|
18420
|
+
D.append(O, k);
|
|
18421
|
+
let A = r.createElement("span");
|
|
18422
|
+
A.textContent = "px", A.style.color = "var(--msr-color-ink-500, #64748b)", D.append(A);
|
|
18423
|
+
let j = r.createElement("button");
|
|
18424
|
+
j.type = "button", j.dataset.mesurerRecordingStart = "true", j.textContent = "● Start recording", kb(j, {
|
|
18425
|
+
width: "100%",
|
|
18426
|
+
height: "28px",
|
|
18427
|
+
"margin-top": "8px",
|
|
18428
|
+
border: "1px solid var(--msr-color-ink-200, #e2e8f0)",
|
|
18429
|
+
"border-radius": "7px",
|
|
18430
|
+
background: "var(--msr-surface-raised, #fff)",
|
|
18431
|
+
color: "var(--msr-content, #18181b)",
|
|
18432
|
+
"font-family": "inherit",
|
|
18433
|
+
"font-size": "11px",
|
|
18434
|
+
"font-weight": "500",
|
|
18435
|
+
cursor: "pointer"
|
|
18436
|
+
}), y.append(j);
|
|
18437
|
+
let M = r.createElement("div");
|
|
18438
|
+
M.dataset.mesurerRecordingGrid = "true", kb(M, {
|
|
18439
|
+
position: "absolute",
|
|
18440
|
+
inset: "0",
|
|
18441
|
+
display: "none",
|
|
18442
|
+
"pointer-events": "none"
|
|
18443
|
+
}), g.append(M);
|
|
18444
|
+
let N = (e) => {
|
|
18445
|
+
let t = r.createElement("div");
|
|
18446
|
+
kb(t, {
|
|
18447
|
+
position: "absolute",
|
|
18448
|
+
opacity: "0.3",
|
|
18449
|
+
...e
|
|
18450
|
+
}), M.append(t);
|
|
18451
|
+
};
|
|
18452
|
+
N({
|
|
18453
|
+
left: "33.333%",
|
|
18454
|
+
top: "0",
|
|
18455
|
+
bottom: "0",
|
|
18456
|
+
borderLeft: "1px dashed var(--msr-color-ink-500, #64748b)"
|
|
18457
|
+
}), N({
|
|
18458
|
+
left: "66.666%",
|
|
18459
|
+
top: "0",
|
|
18460
|
+
bottom: "0",
|
|
18461
|
+
borderLeft: "1px dashed var(--msr-color-ink-500, #64748b)"
|
|
18462
|
+
}), N({
|
|
18463
|
+
top: "33.333%",
|
|
18464
|
+
left: "0",
|
|
18465
|
+
right: "0",
|
|
18466
|
+
borderTop: "1px dashed var(--msr-color-ink-500, #64748b)"
|
|
18467
|
+
}), N({
|
|
18468
|
+
top: "66.666%",
|
|
18469
|
+
left: "0",
|
|
18470
|
+
right: "0",
|
|
18471
|
+
borderTop: "1px dashed var(--msr-color-ink-500, #64748b)"
|
|
18472
|
+
});
|
|
18473
|
+
let P = Object.entries({
|
|
18474
|
+
nw: {
|
|
18475
|
+
left: "0",
|
|
18476
|
+
top: "0"
|
|
18477
|
+
},
|
|
18478
|
+
n: {
|
|
18479
|
+
left: "50%",
|
|
18480
|
+
top: "0"
|
|
18481
|
+
},
|
|
18482
|
+
ne: {
|
|
18483
|
+
left: "100%",
|
|
18484
|
+
top: "0"
|
|
18485
|
+
},
|
|
18486
|
+
e: {
|
|
18487
|
+
left: "100%",
|
|
18488
|
+
top: "50%"
|
|
18489
|
+
},
|
|
18490
|
+
se: {
|
|
18491
|
+
left: "100%",
|
|
18492
|
+
top: "100%"
|
|
18493
|
+
},
|
|
18494
|
+
s: {
|
|
18495
|
+
left: "50%",
|
|
18496
|
+
top: "100%"
|
|
18497
|
+
},
|
|
18498
|
+
sw: {
|
|
18499
|
+
left: "0",
|
|
18500
|
+
top: "100%"
|
|
18501
|
+
},
|
|
18502
|
+
w: {
|
|
18503
|
+
left: "0",
|
|
18504
|
+
top: "50%"
|
|
18505
|
+
}
|
|
18506
|
+
}).map(([e, t]) => {
|
|
18507
|
+
let n = r.createElement("button");
|
|
18508
|
+
return n.type = "button", n.dataset.mesurerRecordingResize = e, n.setAttribute("aria-label", `Resize ${e}`), kb(n, {
|
|
18509
|
+
position: "absolute",
|
|
18510
|
+
display: "none",
|
|
18511
|
+
left: t.left,
|
|
18512
|
+
top: t.top,
|
|
18513
|
+
width: "8px",
|
|
18514
|
+
height: "8px",
|
|
18515
|
+
padding: "0",
|
|
18516
|
+
border: "1px solid var(--msr-color-white, #fff)",
|
|
18517
|
+
"border-radius": "999px",
|
|
18518
|
+
background: "var(--msr-color-ink-900, #18181b)",
|
|
18519
|
+
"box-shadow": "0 0 0 1px rgb(0 0 0 / 25%)",
|
|
18520
|
+
transform: "translate(-50%, -50%)",
|
|
18521
|
+
cursor: e === "n" || e === "s" ? "ns-resize" : e === "e" || e === "w" ? "ew-resize" : e === "nw" || e === "se" ? "nwse-resize" : "nesw-resize",
|
|
18522
|
+
"pointer-events": "auto"
|
|
18523
|
+
}), g.append(n), n;
|
|
18524
|
+
}), F = r.createElement("section");
|
|
18525
|
+
F.dataset.mesurerRecordingStatus = "true", F.dataset.mesurerInspectorUi = "true", F.setAttribute("aria-label", "Screen recording"), kb(F, {
|
|
18526
|
+
position: "fixed",
|
|
18527
|
+
display: "none",
|
|
18528
|
+
height: "34px",
|
|
18529
|
+
padding: "0 8px",
|
|
18530
|
+
"align-items": "center",
|
|
18531
|
+
gap: "8px",
|
|
18348
18532
|
border: "0",
|
|
18349
|
-
"border-radius": "
|
|
18533
|
+
"border-radius": "9px",
|
|
18350
18534
|
background: "var(--msr-surface-raised, #fff)",
|
|
18351
18535
|
color: "var(--msr-content, #18181b)",
|
|
18352
18536
|
"box-shadow": "var(--msr-shadow-floating, 0 8px 24px rgba(0,0,0,.14))",
|
|
18353
18537
|
"font-family": "inherit",
|
|
18354
18538
|
"font-size": "11px",
|
|
18355
|
-
"font-variant-numeric": "tabular-nums",
|
|
18356
|
-
cursor: "pointer",
|
|
18357
18539
|
"pointer-events": "auto"
|
|
18358
|
-
})
|
|
18359
|
-
let
|
|
18360
|
-
|
|
18540
|
+
});
|
|
18541
|
+
let I = r.createElement("span");
|
|
18542
|
+
I.setAttribute("aria-hidden", "true"), kb(I, {
|
|
18543
|
+
width: "6px",
|
|
18544
|
+
height: "6px",
|
|
18545
|
+
"border-radius": "999px",
|
|
18546
|
+
background: "var(--msr-danger-solid-bg, #dc2626)",
|
|
18547
|
+
"flex-shrink": "0"
|
|
18548
|
+
}), F.append(I);
|
|
18549
|
+
let L = r.createElement("span");
|
|
18550
|
+
L.dataset.mesurerRecordingTime = "true", L.textContent = "00:00", kb(L, {
|
|
18551
|
+
color: "var(--msr-content, #18181b)",
|
|
18552
|
+
"font-family": "ui-monospace, SFMono-Regular, Menlo, monospace",
|
|
18553
|
+
"font-size": "11px",
|
|
18554
|
+
"font-variant-numeric": "tabular-nums"
|
|
18555
|
+
}), F.append(L);
|
|
18556
|
+
let R = r.createElement("button");
|
|
18557
|
+
R.type = "button", R.dataset.mesurerRecordingStop = "true", R.textContent = "Stop", R.setAttribute("aria-label", "Stop recording"), kb(R, {
|
|
18558
|
+
height: "24px",
|
|
18559
|
+
padding: "0 8px",
|
|
18560
|
+
border: "0",
|
|
18561
|
+
"border-radius": "6px",
|
|
18562
|
+
background: "var(--msr-danger-solid-bg, #dc2626)",
|
|
18563
|
+
color: "var(--msr-danger-solid-text, #fff)",
|
|
18564
|
+
"font-family": "inherit",
|
|
18565
|
+
"font-size": "11px",
|
|
18566
|
+
"font-weight": "500",
|
|
18567
|
+
cursor: "pointer"
|
|
18568
|
+
}), F.append(R), o.append(F);
|
|
18569
|
+
let z = r.createElement("div");
|
|
18570
|
+
z.dataset.mesurerRecordingError = "true", z.dataset.mesurerInspectorUi = "true", z.setAttribute("role", "status"), kb(z, {
|
|
18361
18571
|
position: "fixed",
|
|
18362
18572
|
display: "none",
|
|
18363
18573
|
left: "8px",
|
|
@@ -18369,8 +18579,8 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18369
18579
|
color: "#fff",
|
|
18370
18580
|
"font-size": "11px",
|
|
18371
18581
|
"pointer-events": "none"
|
|
18372
|
-
}), o.append(
|
|
18373
|
-
let
|
|
18582
|
+
}), o.append(z);
|
|
18583
|
+
let B = {
|
|
18374
18584
|
status: "idle",
|
|
18375
18585
|
elapsed: 0,
|
|
18376
18586
|
rect: null,
|
|
@@ -18378,28 +18588,28 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18378
18588
|
width: null,
|
|
18379
18589
|
height: null,
|
|
18380
18590
|
error: null
|
|
18381
|
-
},
|
|
18382
|
-
let e =
|
|
18383
|
-
for (let t of
|
|
18384
|
-
},
|
|
18385
|
-
|
|
18386
|
-
...
|
|
18591
|
+
}, V = /* @__PURE__ */ new Set(), H = null, U = null, ee = null, te = null, ne = null, W = null, re = !1, ie = null, ae = null, oe = 0, se = 0, ce = 0, le = 0, G = 0, ue = -1, de = !1, fe = null, pe = () => {
|
|
18592
|
+
let e = Ob(B);
|
|
18593
|
+
for (let t of V) t(e);
|
|
18594
|
+
}, me = (e) => {
|
|
18595
|
+
B = {
|
|
18596
|
+
...B,
|
|
18387
18597
|
...e,
|
|
18388
|
-
rect: e.rect === void 0 ?
|
|
18389
|
-
},
|
|
18390
|
-
},
|
|
18391
|
-
if (
|
|
18598
|
+
rect: e.rect === void 0 ? B.rect : Db(e.rect)
|
|
18599
|
+
}, pe();
|
|
18600
|
+
}, he = () => B.status === "selecting" || B.status === "recording" || B.status === "exporting", ge = () => {
|
|
18601
|
+
if (ae) return;
|
|
18392
18602
|
let e = n.portalTarget.querySelector("[data-mesurer-toolbar='true']");
|
|
18393
|
-
e && (
|
|
18603
|
+
e && (ae = {
|
|
18394
18604
|
element: e,
|
|
18395
18605
|
value: e.style.getPropertyValue("visibility"),
|
|
18396
18606
|
priority: e.style.getPropertyPriority("visibility")
|
|
18397
18607
|
}, e.style.setProperty("visibility", "hidden", "important"));
|
|
18398
|
-
},
|
|
18399
|
-
if (!
|
|
18400
|
-
let e =
|
|
18401
|
-
|
|
18402
|
-
},
|
|
18608
|
+
}, _e = () => {
|
|
18609
|
+
if (!ae) return;
|
|
18610
|
+
let e = ae;
|
|
18611
|
+
ae = null, e.value || e.priority ? e.element.style.setProperty("visibility", e.value, e.priority) : e.element.style.removeProperty("visibility");
|
|
18612
|
+
}, ve = (e, t) => {
|
|
18403
18613
|
for (let n of [
|
|
18404
18614
|
"left",
|
|
18405
18615
|
"top",
|
|
@@ -18409,78 +18619,128 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18409
18619
|
let r = t[n];
|
|
18410
18620
|
r === void 0 ? e.style.removeProperty(n) : e.style.setProperty(n, `${r}px`);
|
|
18411
18621
|
}
|
|
18412
|
-
},
|
|
18622
|
+
}, ye = (e) => {
|
|
18623
|
+
let t = i.innerWidth, n = i.innerHeight, r = Math.min(t, Math.max(4, Math.round(e.width))), a = Math.min(n, Math.max(4, Math.round(e.height)));
|
|
18624
|
+
return {
|
|
18625
|
+
left: Math.min(Math.max(0, Math.round(e.left)), Math.max(0, t - r)),
|
|
18626
|
+
top: Math.min(Math.max(0, Math.round(e.top)), Math.max(0, n - a)),
|
|
18627
|
+
width: r,
|
|
18628
|
+
height: a
|
|
18629
|
+
};
|
|
18630
|
+
}, be = (e, t) => t.x >= e.left && t.x <= e.left + e.width && t.y >= e.top && t.y <= e.top + e.height, xe = (e) => {
|
|
18413
18631
|
let t = i.innerWidth, n = i.innerHeight;
|
|
18414
18632
|
if (!e || e.width <= 0 || e.height <= 0) {
|
|
18415
|
-
|
|
18633
|
+
ve(h[0], {
|
|
18416
18634
|
left: 0,
|
|
18417
18635
|
top: 0,
|
|
18418
18636
|
width: t,
|
|
18419
18637
|
height: n
|
|
18420
18638
|
});
|
|
18421
|
-
for (let e of
|
|
18639
|
+
for (let e of h.slice(1)) ve(e, {
|
|
18422
18640
|
left: 0,
|
|
18423
18641
|
top: 0,
|
|
18424
18642
|
width: 0,
|
|
18425
18643
|
height: 0
|
|
18426
18644
|
});
|
|
18427
|
-
|
|
18645
|
+
g.style.display = "none", g.style.pointerEvents = "none", M.style.display = "none";
|
|
18646
|
+
for (let e of P) e.style.display = "none";
|
|
18647
|
+
_.style.display = "none", y.style.display = "none", v.textContent = "Drag to select a region · Esc to cancel";
|
|
18428
18648
|
return;
|
|
18429
18649
|
}
|
|
18430
|
-
|
|
18650
|
+
if (ve(h[0], {
|
|
18431
18651
|
left: 0,
|
|
18432
18652
|
top: 0,
|
|
18433
18653
|
width: t,
|
|
18434
18654
|
height: e.top
|
|
18435
|
-
}),
|
|
18655
|
+
}), ve(h[1], {
|
|
18436
18656
|
left: 0,
|
|
18437
18657
|
top: e.top,
|
|
18438
18658
|
width: e.left,
|
|
18439
18659
|
height: e.height
|
|
18440
|
-
}),
|
|
18660
|
+
}), ve(h[2], {
|
|
18441
18661
|
left: e.left + e.width,
|
|
18442
18662
|
top: e.top,
|
|
18443
18663
|
width: Math.max(0, t - e.left - e.width),
|
|
18444
18664
|
height: e.height
|
|
18445
|
-
}),
|
|
18665
|
+
}), ve(h[3], {
|
|
18446
18666
|
left: 0,
|
|
18447
18667
|
top: e.top + e.height,
|
|
18448
18668
|
width: t,
|
|
18449
18669
|
height: Math.max(0, n - e.top - e.height)
|
|
18450
|
-
}),
|
|
18451
|
-
|
|
18452
|
-
|
|
18453
|
-
|
|
18454
|
-
|
|
18455
|
-
|
|
18456
|
-
|
|
18457
|
-
|
|
18670
|
+
}), g.style.display = "block", ve(g, e), re) {
|
|
18671
|
+
g.style.pointerEvents = "auto", g.style.cursor = "move", M.style.display = "block";
|
|
18672
|
+
for (let e of P) e.style.display = "block";
|
|
18673
|
+
_.style.display = "none", C.value = String(Math.round(e.width)), w.value = String(Math.round(e.height)), O.value = String(Math.round(e.left)), k.value = String(Math.round(e.top)), C.max = String(t), w.max = String(n), O.max = String(Math.max(0, t - e.width)), k.max = String(Math.max(0, n - e.height));
|
|
18674
|
+
let r = Math.min(Math.max(118, e.left + e.width / 2), Math.max(118, t - 110 - 8)), i = e.top + e.height + 12, a = i + 112 <= n ? i : Math.max(8, e.top - 112);
|
|
18675
|
+
y.style.left = `${r}px`, y.style.top = `${a}px`, y.style.display = "block", v.textContent = "Adjust region · Enter to start · Esc to cancel";
|
|
18676
|
+
} else {
|
|
18677
|
+
g.style.pointerEvents = "none", g.style.cursor = "", M.style.display = "none";
|
|
18678
|
+
for (let e of P) e.style.display = "none";
|
|
18679
|
+
y.style.display = "none", _.style.display = "block", _.textContent = `${Math.round(e.width)} × ${Math.round(e.height)}`, ve(_, {
|
|
18680
|
+
left: e.left + e.width / 2,
|
|
18681
|
+
top: Math.min(n - 22, e.top + e.height + 6)
|
|
18682
|
+
}), v.textContent = "Drag to select a region · Esc to cancel";
|
|
18683
|
+
}
|
|
18684
|
+
}, Se = (e) => {
|
|
18685
|
+
let t = ye(e);
|
|
18686
|
+
W = t, me({ rect: t }), xe(t);
|
|
18687
|
+
}, Ce = (e) => {
|
|
18688
|
+
let t = i.innerWidth, n = i.innerHeight;
|
|
18689
|
+
ve(h[0], {
|
|
18690
|
+
left: 0,
|
|
18691
|
+
top: 0,
|
|
18692
|
+
width: t,
|
|
18693
|
+
height: e.top
|
|
18694
|
+
}), ve(h[1], {
|
|
18695
|
+
left: 0,
|
|
18696
|
+
top: e.top,
|
|
18697
|
+
width: e.left,
|
|
18698
|
+
height: e.height
|
|
18699
|
+
}), ve(h[2], {
|
|
18700
|
+
left: e.left + e.width,
|
|
18701
|
+
top: e.top,
|
|
18702
|
+
width: Math.max(0, t - e.left - e.width),
|
|
18703
|
+
height: e.height
|
|
18704
|
+
}), ve(h[3], {
|
|
18705
|
+
left: 0,
|
|
18706
|
+
top: e.top + e.height,
|
|
18707
|
+
width: t,
|
|
18708
|
+
height: Math.max(0, n - e.top - e.height)
|
|
18709
|
+
}), g.style.display = "none", _.style.display = "none", y.style.display = "none", M.style.display = "none", v.style.display = "none";
|
|
18710
|
+
for (let e of P) e.style.display = "none";
|
|
18711
|
+
m.style.display = "block", m.style.pointerEvents = "none", m.style.cursor = "default";
|
|
18712
|
+
}, we = () => {
|
|
18713
|
+
c(!1), m.style.display = "none", m.style.pointerEvents = "auto", m.style.cursor = "crosshair", v.style.removeProperty("display");
|
|
18714
|
+
}, Te = () => {
|
|
18715
|
+
ne = null, W = null, re = !1, ie = null, xe(null), m.style.display = "none", m.style.cursor = "crosshair", o.style.pointerEvents = "none";
|
|
18716
|
+
}, Ee = (e) => {
|
|
18717
|
+
let t = i.innerHeight, n = i.innerWidth, r = Math.max(112, F.offsetWidth || 112), a = null;
|
|
18458
18718
|
if (e.top >= 46 ? a = e.top - 30 - 8 : t - (e.top + e.height) >= 46 && (a = e.top + e.height + 8), a === null) {
|
|
18459
|
-
|
|
18719
|
+
F.style.display = "none";
|
|
18460
18720
|
return;
|
|
18461
18721
|
}
|
|
18462
18722
|
let o = Math.min(n - r - 8, Math.max(8, e.left + e.width / 2 - r / 2));
|
|
18463
|
-
|
|
18464
|
-
},
|
|
18465
|
-
|
|
18466
|
-
},
|
|
18467
|
-
|
|
18723
|
+
F.style.left = `${o}px`, F.style.top = `${a}px`, F.style.display = "flex";
|
|
18724
|
+
}, De = () => {
|
|
18725
|
+
F.style.display = "none";
|
|
18726
|
+
}, Oe = (e) => {
|
|
18727
|
+
ce && i.clearTimeout(ce);
|
|
18468
18728
|
let t = e instanceof Error ? e.message : "Could not record this region.";
|
|
18469
|
-
|
|
18470
|
-
|
|
18471
|
-
},
|
|
18472
|
-
},
|
|
18473
|
-
|
|
18474
|
-
let t =
|
|
18475
|
-
if (
|
|
18729
|
+
z.textContent = t, z.style.display = "block", ce = i.setTimeout(() => {
|
|
18730
|
+
ce = 0, z.style.display = "none";
|
|
18731
|
+
}, Tb);
|
|
18732
|
+
}, ke = async (e) => {
|
|
18733
|
+
oe && i.cancelAnimationFrame(oe), oe = 0, se && i.clearTimeout(se), se = 0;
|
|
18734
|
+
let t = te;
|
|
18735
|
+
if (te = null, t) try {
|
|
18476
18736
|
await t;
|
|
18477
18737
|
} catch {}
|
|
18478
|
-
let n =
|
|
18479
|
-
|
|
18480
|
-
let r =
|
|
18481
|
-
|
|
18482
|
-
},
|
|
18483
|
-
|
|
18738
|
+
let n = ee;
|
|
18739
|
+
ee = null, e && await n?.cancel();
|
|
18740
|
+
let r = U;
|
|
18741
|
+
U = null, r && Vy(r), we(), De();
|
|
18742
|
+
}, Ae = () => {
|
|
18743
|
+
H = null, Ne.dismiss(), me({
|
|
18484
18744
|
status: "idle",
|
|
18485
18745
|
elapsed: 0,
|
|
18486
18746
|
rect: null,
|
|
@@ -18489,23 +18749,23 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18489
18749
|
height: null,
|
|
18490
18750
|
error: null
|
|
18491
18751
|
}), t.hook.emit("recording:discard", {});
|
|
18492
|
-
},
|
|
18493
|
-
let e =
|
|
18494
|
-
return
|
|
18495
|
-
},
|
|
18496
|
-
let n =
|
|
18752
|
+
}, je = async () => {
|
|
18753
|
+
let e = H;
|
|
18754
|
+
return Zy(e?.width ?? Math.max(2, Math.round(i.innerWidth)), e?.height ?? Math.max(2, Math.round(i.innerHeight)), l);
|
|
18755
|
+
}, Me = async (e = {}) => {
|
|
18756
|
+
let n = H;
|
|
18497
18757
|
if (!n) throw Error("No recording is ready to export.");
|
|
18498
|
-
let r =
|
|
18499
|
-
|
|
18758
|
+
let r = B.status;
|
|
18759
|
+
me({
|
|
18500
18760
|
status: "exporting",
|
|
18501
18761
|
error: null
|
|
18502
18762
|
});
|
|
18503
18763
|
try {
|
|
18504
|
-
let r = await
|
|
18764
|
+
let r = await tb(n.blob, e), i = {
|
|
18505
18765
|
...r,
|
|
18506
|
-
filename:
|
|
18766
|
+
filename: nb(r.format)
|
|
18507
18767
|
};
|
|
18508
|
-
return
|
|
18768
|
+
return me({
|
|
18509
18769
|
status: "ready",
|
|
18510
18770
|
duration: n.duration,
|
|
18511
18771
|
width: n.width,
|
|
@@ -18520,30 +18780,30 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18520
18780
|
bytes: i.blob.size
|
|
18521
18781
|
}), i;
|
|
18522
18782
|
} catch (e) {
|
|
18523
|
-
throw
|
|
18783
|
+
throw me({
|
|
18524
18784
|
status: r === "ready" ? "ready" : "error",
|
|
18525
18785
|
error: e instanceof Error ? e.message : "Could not export the recording."
|
|
18526
18786
|
}), e;
|
|
18527
18787
|
}
|
|
18528
|
-
},
|
|
18788
|
+
}, Ne = mb({
|
|
18529
18789
|
ownerDocument: r,
|
|
18530
18790
|
ownerWindow: i,
|
|
18531
18791
|
root: o,
|
|
18532
|
-
formats: async () =>
|
|
18533
|
-
onDiscard:
|
|
18534
|
-
onExport:
|
|
18535
|
-
}),
|
|
18536
|
-
if (
|
|
18537
|
-
if (
|
|
18538
|
-
let e =
|
|
18792
|
+
formats: async () => je(),
|
|
18793
|
+
onDiscard: Ae,
|
|
18794
|
+
onExport: Me
|
|
18795
|
+
}), Pe = async () => {
|
|
18796
|
+
if (fe) return fe;
|
|
18797
|
+
if (B.status !== "recording" || !ee || !U) throw Error("No recording is active.");
|
|
18798
|
+
let e = le, n = ee, r = U, a = Db(B.rect);
|
|
18539
18799
|
if (!a) throw Error("Recording region is unavailable.");
|
|
18540
|
-
return
|
|
18541
|
-
|
|
18542
|
-
let s =
|
|
18543
|
-
|
|
18800
|
+
return fe = (async () => {
|
|
18801
|
+
oe && i.cancelAnimationFrame(oe), oe = 0, se && i.clearTimeout(se), se = 0;
|
|
18802
|
+
let s = te;
|
|
18803
|
+
te = null, s && await s;
|
|
18544
18804
|
let c = await n.finalize();
|
|
18545
|
-
if (
|
|
18546
|
-
let l = await
|
|
18805
|
+
if (ee = null, U = null, Vy(r), le !== e || de) throw Error("Recording was cancelled.");
|
|
18806
|
+
let l = await eb(c), u = {
|
|
18547
18807
|
blob: c,
|
|
18548
18808
|
format: "webm",
|
|
18549
18809
|
duration: l.duration,
|
|
@@ -18551,14 +18811,14 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18551
18811
|
height: l.height,
|
|
18552
18812
|
createdAt: Date.now()
|
|
18553
18813
|
};
|
|
18554
|
-
return
|
|
18814
|
+
return H = u, we(), De(), _e(), o.style.pointerEvents = "none", me({
|
|
18555
18815
|
status: "ready",
|
|
18556
18816
|
elapsed: l.duration,
|
|
18557
18817
|
duration: l.duration,
|
|
18558
18818
|
width: l.width,
|
|
18559
18819
|
height: l.height,
|
|
18560
18820
|
error: null
|
|
18561
|
-
}),
|
|
18821
|
+
}), Ne.show(u), await t.hook.emit("recording:ready", {
|
|
18562
18822
|
rect: a,
|
|
18563
18823
|
duration: l.duration,
|
|
18564
18824
|
width: l.width,
|
|
@@ -18566,45 +18826,45 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18566
18826
|
bytes: c.size
|
|
18567
18827
|
}), u;
|
|
18568
18828
|
})().catch(async (t) => {
|
|
18569
|
-
if (await
|
|
18829
|
+
if (await ke(!0), _e(), le === e && !de) {
|
|
18570
18830
|
let e = t instanceof Error ? t.message : "Could not finish the recording.";
|
|
18571
|
-
|
|
18831
|
+
me({
|
|
18572
18832
|
status: "error",
|
|
18573
18833
|
error: e
|
|
18574
|
-
}),
|
|
18834
|
+
}), Oe(t);
|
|
18575
18835
|
}
|
|
18576
18836
|
throw t;
|
|
18577
18837
|
}).finally(() => {
|
|
18578
|
-
|
|
18579
|
-
}),
|
|
18580
|
-
},
|
|
18581
|
-
let r = 1 /
|
|
18582
|
-
if (
|
|
18583
|
-
let s = Math.max(0, (o -
|
|
18584
|
-
|
|
18838
|
+
fe = null;
|
|
18839
|
+
}), fe;
|
|
18840
|
+
}, Fe = (e, t, n) => {
|
|
18841
|
+
let r = 1 / l, a = (o) => {
|
|
18842
|
+
if (de || le !== n || B.status !== "recording" || ee !== t || U !== e) return;
|
|
18843
|
+
let s = Math.max(0, (o - G) / 1e3);
|
|
18844
|
+
me({ elapsed: s }), L.textContent = `${String(Math.floor(s / 60)).padStart(2, "0")}:${String(Math.floor(s % 60)).padStart(2, "0")}`;
|
|
18585
18845
|
let c = s;
|
|
18586
|
-
!
|
|
18846
|
+
!te && c - ue >= r * .8 && (By(e, B.rect ?? {
|
|
18587
18847
|
left: 0,
|
|
18588
18848
|
top: 0,
|
|
18589
18849
|
width: i.innerWidth,
|
|
18590
18850
|
height: i.innerHeight
|
|
18591
|
-
}, Ty(i)),
|
|
18592
|
-
throw
|
|
18593
|
-
|
|
18851
|
+
}, Ty(i)), ue = c, te = t.addFrame(c, r).catch((e) => {
|
|
18852
|
+
throw le === n && !de && ke(!0).then(() => {
|
|
18853
|
+
_e();
|
|
18594
18854
|
let t = e instanceof Error ? e.message : "MediaBunny could not encode the recording.";
|
|
18595
|
-
|
|
18855
|
+
me({
|
|
18596
18856
|
status: "error",
|
|
18597
18857
|
error: t
|
|
18598
|
-
}),
|
|
18858
|
+
}), Oe(e);
|
|
18599
18859
|
}), e;
|
|
18600
18860
|
}).finally(() => {
|
|
18601
|
-
|
|
18602
|
-
})),
|
|
18861
|
+
te = null;
|
|
18862
|
+
})), oe = i.requestAnimationFrame(a);
|
|
18603
18863
|
};
|
|
18604
|
-
|
|
18605
|
-
},
|
|
18606
|
-
let n = ++
|
|
18607
|
-
|
|
18864
|
+
oe = i.requestAnimationFrame(a);
|
|
18865
|
+
}, Ie = async (e) => {
|
|
18866
|
+
let n = ++le;
|
|
18867
|
+
Ne.dismiss(), H = null, Te(), _e(), me({
|
|
18608
18868
|
status: "selecting",
|
|
18609
18869
|
elapsed: 0,
|
|
18610
18870
|
rect: e,
|
|
@@ -18614,47 +18874,47 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18614
18874
|
error: null
|
|
18615
18875
|
});
|
|
18616
18876
|
try {
|
|
18617
|
-
let a = await
|
|
18618
|
-
if (
|
|
18619
|
-
|
|
18877
|
+
let a = await zy(r, i, e);
|
|
18878
|
+
if (de || le !== n) {
|
|
18879
|
+
Vy(a);
|
|
18620
18880
|
return;
|
|
18621
18881
|
}
|
|
18622
|
-
let
|
|
18882
|
+
let s = await $y(a.canvas, {
|
|
18623
18883
|
format: "webm",
|
|
18624
|
-
frameRate:
|
|
18625
|
-
quality:
|
|
18884
|
+
frameRate: l,
|
|
18885
|
+
quality: d
|
|
18626
18886
|
});
|
|
18627
|
-
if (
|
|
18628
|
-
await
|
|
18887
|
+
if (de || le !== n) {
|
|
18888
|
+
await s.cancel(), Vy(a);
|
|
18629
18889
|
return;
|
|
18630
18890
|
}
|
|
18631
|
-
if (
|
|
18632
|
-
await
|
|
18891
|
+
if (U = a, ee = s, G = i.performance.now(), ue = 0, By(a, e, Ty(i)), await s.addFrame(0, 1 / l), de || le !== n) {
|
|
18892
|
+
await ke(!0);
|
|
18633
18893
|
return;
|
|
18634
18894
|
}
|
|
18635
|
-
|
|
18895
|
+
me({
|
|
18636
18896
|
status: "recording",
|
|
18637
18897
|
elapsed: 0
|
|
18638
|
-
}), o.style.pointerEvents = "
|
|
18639
|
-
|
|
18640
|
-
}, { once: !0 }),
|
|
18641
|
-
|
|
18642
|
-
},
|
|
18898
|
+
}), o.style.pointerEvents = "none", c(!0), Ce(e), L.textContent = "00:00", Ee(e), Fe(a, s, n), a.track.addEventListener("ended", () => {
|
|
18899
|
+
le === n && B.status === "recording" && Pe().catch(() => void 0);
|
|
18900
|
+
}, { once: !0 }), se = i.setTimeout(() => {
|
|
18901
|
+
le === n && B.status === "recording" && Pe().catch(() => void 0);
|
|
18902
|
+
}, u * 1e3), await t.hook.emit("recording:start", {
|
|
18643
18903
|
rect: { ...e },
|
|
18644
|
-
frameRate:
|
|
18645
|
-
maxDurationSeconds:
|
|
18904
|
+
frameRate: l,
|
|
18905
|
+
maxDurationSeconds: u
|
|
18646
18906
|
});
|
|
18647
18907
|
} catch (t) {
|
|
18648
|
-
if (await
|
|
18908
|
+
if (await ke(!0), _e(), le !== n || de) return;
|
|
18649
18909
|
let r = t instanceof DOMException && t.name === "AbortError", i = r ? null : t instanceof Error ? t.message : "Could not start the recording.";
|
|
18650
|
-
throw
|
|
18910
|
+
throw me({
|
|
18651
18911
|
status: r ? "idle" : "error",
|
|
18652
18912
|
rect: r ? null : e,
|
|
18653
18913
|
error: i
|
|
18654
|
-
}), r ||
|
|
18914
|
+
}), r || Oe(t), t;
|
|
18655
18915
|
}
|
|
18656
|
-
},
|
|
18657
|
-
|
|
18916
|
+
}, Le = () => {
|
|
18917
|
+
B.status !== "selecting" && (++le, Ne.dismiss(), H = null, W = null, re = !1, ie = null, ge(), xe(null), m.style.display = "block", m.style.pointerEvents = "auto", v.style.removeProperty("display"), o.style.pointerEvents = "auto", me({
|
|
18658
18918
|
status: "selecting",
|
|
18659
18919
|
elapsed: 0,
|
|
18660
18920
|
rect: null,
|
|
@@ -18663,23 +18923,23 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18663
18923
|
height: null,
|
|
18664
18924
|
error: null
|
|
18665
18925
|
}));
|
|
18666
|
-
},
|
|
18667
|
-
if (
|
|
18668
|
-
await
|
|
18926
|
+
}, Re = async (e) => {
|
|
18927
|
+
if (B.status === "recording") {
|
|
18928
|
+
await Pe();
|
|
18669
18929
|
return;
|
|
18670
18930
|
}
|
|
18671
|
-
if (
|
|
18672
|
-
await
|
|
18931
|
+
if (B.status === "selecting") {
|
|
18932
|
+
await ze();
|
|
18673
18933
|
return;
|
|
18674
18934
|
}
|
|
18675
18935
|
if (!e) {
|
|
18676
|
-
|
|
18936
|
+
Le();
|
|
18677
18937
|
return;
|
|
18678
18938
|
}
|
|
18679
18939
|
if (e.width < 4 || e.height < 4) throw Error("Recording selection must be at least 4px by 4px.");
|
|
18680
|
-
await
|
|
18681
|
-
},
|
|
18682
|
-
++
|
|
18940
|
+
await Ie(e);
|
|
18941
|
+
}, ze = async () => {
|
|
18942
|
+
++le, Te(), await ke(!0), _e(), B.status !== "ready" && me({
|
|
18683
18943
|
status: "idle",
|
|
18684
18944
|
elapsed: 0,
|
|
18685
18945
|
rect: null,
|
|
@@ -18688,26 +18948,64 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18688
18948
|
height: null,
|
|
18689
18949
|
error: null
|
|
18690
18950
|
});
|
|
18691
|
-
},
|
|
18692
|
-
|
|
18951
|
+
}, Be = (e, t, n) => {
|
|
18952
|
+
let r = W;
|
|
18953
|
+
!re || !r || e.button !== 0 || (e.preventDefault(), e.stopPropagation(), ie = {
|
|
18954
|
+
kind: t,
|
|
18955
|
+
handle: n,
|
|
18956
|
+
pointerId: e.pointerId,
|
|
18957
|
+
startX: e.clientX,
|
|
18958
|
+
startY: e.clientY,
|
|
18959
|
+
rect: { ...r }
|
|
18960
|
+
}, m.setPointerCapture?.(e.pointerId));
|
|
18961
|
+
}, Ve = (e) => {
|
|
18962
|
+
B.status === "selecting" && e.button === 0 && (re && W && be(W, {
|
|
18693
18963
|
x: e.clientX,
|
|
18694
18964
|
y: e.clientY
|
|
18695
|
-
},
|
|
18696
|
-
width: i.innerWidth,
|
|
18697
|
-
height: i.innerHeight
|
|
18698
|
-
})), f.setPointerCapture?.(e.pointerId));
|
|
18699
|
-
}, fe = (e) => {
|
|
18700
|
-
y.status !== "selecting" || !T || V(qa(T, {
|
|
18965
|
+
}) || (e.preventDefault(), e.stopPropagation(), re = !1, W = null, me({ rect: null }), m.style.cursor = "crosshair", ne = {
|
|
18701
18966
|
x: e.clientX,
|
|
18702
18967
|
y: e.clientY
|
|
18703
|
-
}, {
|
|
18968
|
+
}, xe(qa(ne, ne, {
|
|
18704
18969
|
width: i.innerWidth,
|
|
18705
18970
|
height: i.innerHeight
|
|
18706
|
-
}));
|
|
18707
|
-
},
|
|
18708
|
-
|
|
18709
|
-
|
|
18710
|
-
|
|
18971
|
+
})), m.setPointerCapture?.(e.pointerId)));
|
|
18972
|
+
}, He = (e) => {
|
|
18973
|
+
if (B.status === "selecting") {
|
|
18974
|
+
if (ie) {
|
|
18975
|
+
let t = ie, n = e.clientX - t.startX, r = e.clientY - t.startY, a = i.innerWidth, o = i.innerHeight;
|
|
18976
|
+
if (t.kind === "move") {
|
|
18977
|
+
Se({
|
|
18978
|
+
...t.rect,
|
|
18979
|
+
left: t.rect.left + n,
|
|
18980
|
+
top: t.rect.top + r
|
|
18981
|
+
});
|
|
18982
|
+
return;
|
|
18983
|
+
}
|
|
18984
|
+
let s = t.handle ?? "", c = t.rect.left, l = t.rect.top, u = t.rect.left + t.rect.width, d = t.rect.top + t.rect.height;
|
|
18985
|
+
s.includes("w") && (c = Math.min(u - 4, Math.max(0, t.rect.left + n))), s.includes("e") && (u = Math.max(c + 4, Math.min(a, t.rect.left + t.rect.width + n))), s.includes("n") && (l = Math.min(d - 4, Math.max(0, t.rect.top + r))), s.includes("s") && (d = Math.max(l + 4, Math.min(o, t.rect.top + t.rect.height + r))), Se({
|
|
18986
|
+
left: c,
|
|
18987
|
+
top: l,
|
|
18988
|
+
width: u - c,
|
|
18989
|
+
height: d - l
|
|
18990
|
+
});
|
|
18991
|
+
return;
|
|
18992
|
+
}
|
|
18993
|
+
ne && xe(qa(ne, {
|
|
18994
|
+
x: e.clientX,
|
|
18995
|
+
y: e.clientY
|
|
18996
|
+
}, {
|
|
18997
|
+
width: i.innerWidth,
|
|
18998
|
+
height: i.innerHeight
|
|
18999
|
+
}));
|
|
19000
|
+
}
|
|
19001
|
+
}, Ue = (e) => {
|
|
19002
|
+
if (ie) {
|
|
19003
|
+
ie = null, m.hasPointerCapture?.(e.pointerId) && m.releasePointerCapture(e.pointerId), W && xe(W);
|
|
19004
|
+
return;
|
|
19005
|
+
}
|
|
19006
|
+
let t = ne;
|
|
19007
|
+
if (ne = null, B.status !== "selecting" || !t) return;
|
|
19008
|
+
m.hasPointerCapture?.(e.pointerId) && m.releasePointerCapture(e.pointerId);
|
|
18711
19009
|
let n = qa(t, {
|
|
18712
19010
|
x: e.clientX,
|
|
18713
19011
|
y: e.clientY
|
|
@@ -18716,66 +19014,91 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18716
19014
|
height: i.innerHeight
|
|
18717
19015
|
});
|
|
18718
19016
|
if (n.width < 4 || n.height < 4) {
|
|
18719
|
-
|
|
19017
|
+
W = null, re = !1, me({ rect: null }), xe(null);
|
|
19018
|
+
return;
|
|
19019
|
+
}
|
|
19020
|
+
W = ye(n), re = !0, m.style.cursor = "default", me({ rect: W }), xe(W);
|
|
19021
|
+
}, We = (e) => {
|
|
19022
|
+
ne = null, ie = null, m.hasPointerCapture?.(e.pointerId) && m.releasePointerCapture(e.pointerId), xe(W && re ? W : null);
|
|
19023
|
+
}, Ge = (e) => {
|
|
19024
|
+
if (e.key === "Enter" && B.status === "selecting" && re && W) {
|
|
19025
|
+
e.preventDefault(), e.stopImmediatePropagation(), Ie(W).catch(() => void 0);
|
|
18720
19026
|
return;
|
|
18721
19027
|
}
|
|
18722
|
-
ce(n).catch(() => void 0);
|
|
18723
|
-
}, me = (e) => {
|
|
18724
|
-
T = null, f.hasPointerCapture?.(e.pointerId) && f.releasePointerCapture(e.pointerId), V(null);
|
|
18725
|
-
}, he = (e) => {
|
|
18726
19028
|
if (e.key === "Escape") {
|
|
18727
|
-
if (
|
|
18728
|
-
e.preventDefault(), e.stopImmediatePropagation(),
|
|
19029
|
+
if (B.status === "selecting") {
|
|
19030
|
+
e.preventDefault(), e.stopImmediatePropagation(), ze();
|
|
18729
19031
|
return;
|
|
18730
19032
|
}
|
|
18731
|
-
|
|
19033
|
+
B.status === "recording" && (e.preventDefault(), e.stopImmediatePropagation(), Pe().catch(() => void 0));
|
|
18732
19034
|
}
|
|
18733
19035
|
};
|
|
18734
|
-
|
|
18735
|
-
|
|
19036
|
+
m.addEventListener("pointerdown", Ve), m.addEventListener("pointermove", He), m.addEventListener("pointerup", Ue), m.addEventListener("pointercancel", We), i.addEventListener("keydown", Ge, !0), g.addEventListener("pointerdown", (e) => {
|
|
19037
|
+
let t = e.target;
|
|
19038
|
+
t instanceof Element && t.closest("[data-mesurer-recording-resize]") || Be(e, "move");
|
|
19039
|
+
});
|
|
19040
|
+
for (let e of P) e.addEventListener("pointerdown", (t) => {
|
|
19041
|
+
Be(t, "resize", e.dataset.mesurerRecordingResize);
|
|
19042
|
+
});
|
|
19043
|
+
y.addEventListener("pointerdown", (e) => {
|
|
19044
|
+
e.stopPropagation();
|
|
19045
|
+
}), y.addEventListener("click", (e) => {
|
|
19046
|
+
e.stopPropagation();
|
|
18736
19047
|
});
|
|
18737
|
-
let
|
|
18738
|
-
|
|
19048
|
+
let Ke = (e, t) => {
|
|
19049
|
+
let n = W, r = Number(e.value);
|
|
19050
|
+
!n || !Number.isFinite(r) || Se({
|
|
19051
|
+
...n,
|
|
19052
|
+
[t]: r
|
|
19053
|
+
});
|
|
19054
|
+
};
|
|
19055
|
+
C.addEventListener("change", () => Ke(C, "width")), w.addEventListener("change", () => Ke(w, "height")), O.addEventListener("change", () => Ke(O, "left")), k.addEventListener("change", () => Ke(k, "top")), j.addEventListener("click", () => {
|
|
19056
|
+
B.status === "selecting" && re && W && Ie(W).catch(() => void 0);
|
|
19057
|
+
}), R.addEventListener("click", () => {
|
|
19058
|
+
B.status === "recording" && Pe().catch(() => void 0);
|
|
19059
|
+
});
|
|
19060
|
+
let qe = {
|
|
19061
|
+
snapshot: () => Ob(B),
|
|
18739
19062
|
subscribe(e) {
|
|
18740
|
-
return
|
|
19063
|
+
return V.add(e), () => V.delete(e);
|
|
18741
19064
|
},
|
|
18742
|
-
formats:
|
|
18743
|
-
start:
|
|
18744
|
-
stop:
|
|
18745
|
-
cancel:
|
|
18746
|
-
discard:
|
|
18747
|
-
export:
|
|
19065
|
+
formats: je,
|
|
19066
|
+
start: Re,
|
|
19067
|
+
stop: Pe,
|
|
19068
|
+
cancel: ze,
|
|
19069
|
+
discard: Ae,
|
|
19070
|
+
export: Me
|
|
18748
19071
|
};
|
|
18749
19072
|
t.tool.register({
|
|
18750
19073
|
id: "recording",
|
|
18751
19074
|
label: "Record",
|
|
18752
19075
|
shortcut: "Shift+R",
|
|
18753
19076
|
order: 72,
|
|
18754
|
-
command:
|
|
19077
|
+
command: yb,
|
|
18755
19078
|
toolbarMode: "select",
|
|
18756
|
-
icon:
|
|
18757
|
-
active:
|
|
18758
|
-
hidden: () => !
|
|
19079
|
+
icon: Eb,
|
|
19080
|
+
active: he,
|
|
19081
|
+
hidden: () => !f().toolEnabled,
|
|
18759
19082
|
menu: {
|
|
18760
19083
|
label: "Recording options",
|
|
18761
19084
|
items: [
|
|
18762
19085
|
{
|
|
18763
19086
|
id: "new",
|
|
18764
19087
|
label: "New recording",
|
|
18765
|
-
disabled: () =>
|
|
18766
|
-
run: () =>
|
|
19088
|
+
disabled: () => B.status === "recording" || B.status === "exporting",
|
|
19089
|
+
run: () => Re()
|
|
18767
19090
|
},
|
|
18768
19091
|
{
|
|
18769
19092
|
id: "stop",
|
|
18770
19093
|
label: "Stop recording",
|
|
18771
|
-
disabled: () =>
|
|
18772
|
-
run: () =>
|
|
19094
|
+
disabled: () => B.status !== "recording",
|
|
19095
|
+
run: () => Pe().then(() => void 0)
|
|
18773
19096
|
},
|
|
18774
19097
|
{
|
|
18775
19098
|
id: "discard",
|
|
18776
19099
|
label: "Discard clip",
|
|
18777
|
-
disabled: () =>
|
|
18778
|
-
run:
|
|
19100
|
+
disabled: () => H === null,
|
|
19101
|
+
run: Ae
|
|
18779
19102
|
}
|
|
18780
19103
|
]
|
|
18781
19104
|
}
|
|
@@ -18788,26 +19111,26 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18788
19111
|
id: "tool",
|
|
18789
19112
|
label: "Recording tool",
|
|
18790
19113
|
description: "Show selected-region video recording in the Select toolbar.",
|
|
18791
|
-
value: () =>
|
|
19114
|
+
value: () => f().toolEnabled,
|
|
18792
19115
|
set: async (e) => {
|
|
18793
|
-
|
|
19116
|
+
p({ toolEnabled: e }), !e && he() && await ze();
|
|
18794
19117
|
}
|
|
18795
19118
|
}]
|
|
18796
|
-
}), t.command.register(
|
|
18797
|
-
let t = await
|
|
18798
|
-
return
|
|
18799
|
-
}), t.service.provide(
|
|
18800
|
-
|
|
19119
|
+
}), t.command.register(yb, async () => (await Re(), Nb(B))), t.command.register(bb, async () => Fb(await Pe())), t.command.register(xb, () => (Ae(), Nb(B))), t.command.register(Sb, async (e) => {
|
|
19120
|
+
let t = await Me(Mb(e));
|
|
19121
|
+
return Ib(t, r, i), Pb(t);
|
|
19122
|
+
}), t.service.provide(gb, qe), t.lifecycle.onDispose(() => {
|
|
19123
|
+
de = !0, ++le, V.clear(), m.removeEventListener("pointerdown", Ve), m.removeEventListener("pointermove", He), m.removeEventListener("pointerup", Ue), m.removeEventListener("pointercancel", We), i.removeEventListener("keydown", Ge, !0), ce && i.clearTimeout(ce), Ne.dispose(), Te(), _e(), ke(!0), a.dispose();
|
|
18801
19124
|
});
|
|
18802
19125
|
}
|
|
18803
|
-
}),
|
|
19126
|
+
}), Rb = 144, zb = 96, Bb = 8, Vb = 4, Hb = 1800, Ub = (e, t) => {
|
|
18804
19127
|
for (let [n, r] of Object.entries(t)) e.style.setProperty(n, r);
|
|
18805
|
-
},
|
|
18806
|
-
left: Math.min(Math.max(
|
|
18807
|
-
top: Math.min(Math.max(
|
|
18808
|
-
}),
|
|
19128
|
+
}, Wb = (e, t) => ({
|
|
19129
|
+
left: Math.min(Math.max(Bb, e.left), Math.max(Bb, t.innerWidth - Rb - Bb)),
|
|
19130
|
+
top: Math.min(Math.max(Bb, e.top), Math.max(Bb, t.innerHeight - zb - Bb))
|
|
19131
|
+
}), Gb = (e, t) => {
|
|
18809
19132
|
let n = e.createElement("button");
|
|
18810
|
-
return n.type = "button", n.textContent = t,
|
|
19133
|
+
return n.type = "button", n.textContent = t, Ub(n, {
|
|
18811
19134
|
height: "32px",
|
|
18812
19135
|
padding: "0 12px",
|
|
18813
19136
|
border: "1px solid rgb(255 255 255 / 18%)",
|
|
@@ -18819,11 +19142,11 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18819
19142
|
"font-weight": "500",
|
|
18820
19143
|
cursor: "pointer"
|
|
18821
19144
|
}), n;
|
|
18822
|
-
},
|
|
19145
|
+
}, Kb = ({ copied: e, downloaded: t, copyFailed: n, downloadFailed: r }) => e && t ? "Copied and saved screenshot" : e && r ? "Copied screenshot · Save unavailable" : t && n ? "Saved screenshot · Copy unavailable" : e ? "Copied screenshot" : t ? "Saved screenshot" : n && r ? "Screenshot captured · Copy and save unavailable" : n ? "Screenshot captured · Copy unavailable" : r ? "Screenshot captured · Save unavailable" : "Screenshot captured", qb = (e) => e !== null && (e.nodeType === 1 || e.nodeType === 11), Jb = ({ ownerDocument: e, ownerWindow: t, root: n, previewDurationMs: r }) => {
|
|
18823
19146
|
let i = n.closest("[data-mesurer-root='true']")?.parentNode ?? n.parentNode;
|
|
18824
|
-
if (!
|
|
19147
|
+
if (!qb(i)) throw Error("Screenshot preview requires a mounted Mesurer host.");
|
|
18825
19148
|
let a = e.createElement("div");
|
|
18826
|
-
a.dataset.mesurerInspectorUi = "true", a.dataset.mesurerScreenshotInteractive = "true",
|
|
19149
|
+
a.dataset.mesurerInspectorUi = "true", a.dataset.mesurerScreenshotInteractive = "true", Ub(a, {
|
|
18827
19150
|
position: "fixed",
|
|
18828
19151
|
left: "0",
|
|
18829
19152
|
top: "0",
|
|
@@ -18835,12 +19158,12 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18835
19158
|
"font-family": "ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif"
|
|
18836
19159
|
}), i.append(a);
|
|
18837
19160
|
let o = e.createElement("div");
|
|
18838
|
-
o.dataset.mesurerScreenshotPreview = "true", o.setAttribute("role", "button"), o.setAttribute("aria-label", "Open captured screenshot"), o.tabIndex = 0,
|
|
19161
|
+
o.dataset.mesurerScreenshotPreview = "true", o.setAttribute("role", "button"), o.setAttribute("aria-label", "Open captured screenshot"), o.tabIndex = 0, Ub(o, {
|
|
18839
19162
|
position: "fixed",
|
|
18840
19163
|
display: "none",
|
|
18841
19164
|
"z-index": "96",
|
|
18842
|
-
width: `${
|
|
18843
|
-
height: `${
|
|
19165
|
+
width: `${Rb}px`,
|
|
19166
|
+
height: `${zb}px`,
|
|
18844
19167
|
"box-sizing": "border-box",
|
|
18845
19168
|
overflow: "hidden",
|
|
18846
19169
|
"border-radius": "10px",
|
|
@@ -18853,7 +19176,7 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18853
19176
|
"touch-action": "none"
|
|
18854
19177
|
});
|
|
18855
19178
|
let s = e.createElement("img");
|
|
18856
|
-
s.dataset.mesurerScreenshotPreviewImage = "true", s.alt = "Captured screenshot", s.draggable = !1, s.title = "Click to open · Right-click for browser image actions",
|
|
19179
|
+
s.dataset.mesurerScreenshotPreviewImage = "true", s.alt = "Captured screenshot", s.draggable = !1, s.title = "Click to open · Right-click for browser image actions", Ub(s, {
|
|
18857
19180
|
display: "block",
|
|
18858
19181
|
width: "100%",
|
|
18859
19182
|
height: "100%",
|
|
@@ -18861,7 +19184,7 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18861
19184
|
"background-color": "white"
|
|
18862
19185
|
}), o.append(s);
|
|
18863
19186
|
let c = e.createElement("button");
|
|
18864
|
-
c.dataset.mesurerScreenshotPreviewDismiss = "true", c.type = "button", c.setAttribute("aria-label", "Dismiss screenshot preview"), c.title = "Dismiss",
|
|
19187
|
+
c.dataset.mesurerScreenshotPreviewDismiss = "true", c.type = "button", c.setAttribute("aria-label", "Dismiss screenshot preview"), c.title = "Dismiss", Ub(c, {
|
|
18865
19188
|
position: "absolute",
|
|
18866
19189
|
top: "8px",
|
|
18867
19190
|
right: "8px",
|
|
@@ -18887,7 +19210,7 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18887
19210
|
let u = e.createElementNS("http://www.w3.org/2000/svg", "path");
|
|
18888
19211
|
u.setAttribute("d", "m4 4 8 8M12 4l-8 8"), u.setAttribute("stroke", "currentColor"), u.setAttribute("stroke-width", "1.75"), u.setAttribute("stroke-linecap", "round"), l.append(u), c.append(l), o.append(c), a.append(o);
|
|
18889
19212
|
let d = e.createElement("div");
|
|
18890
|
-
d.dataset.mesurerScreenshotViewer = "true", d.setAttribute("role", "dialog"), d.setAttribute("aria-modal", "true"), d.setAttribute("aria-label", "Screenshot viewer"),
|
|
19213
|
+
d.dataset.mesurerScreenshotViewer = "true", d.setAttribute("role", "dialog"), d.setAttribute("aria-modal", "true"), d.setAttribute("aria-label", "Screenshot viewer"), Ub(d, {
|
|
18891
19214
|
position: "fixed",
|
|
18892
19215
|
inset: "0",
|
|
18893
19216
|
display: "none",
|
|
@@ -18901,7 +19224,7 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18901
19224
|
"pointer-events": "auto"
|
|
18902
19225
|
});
|
|
18903
19226
|
let f = e.createElement("img");
|
|
18904
|
-
f.dataset.mesurerScreenshotViewerImage = "true", f.alt = "Captured screenshot",
|
|
19227
|
+
f.dataset.mesurerScreenshotViewerImage = "true", f.alt = "Captured screenshot", Ub(f, {
|
|
18905
19228
|
display: "block",
|
|
18906
19229
|
"max-width": "calc(100vw - 96px)",
|
|
18907
19230
|
"max-height": "calc(100vh - 112px)",
|
|
@@ -18912,7 +19235,7 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18912
19235
|
"box-shadow": "0 8px 30px rgb(0 0 0 / 28%)"
|
|
18913
19236
|
}), d.append(f);
|
|
18914
19237
|
let p = e.createElement("div");
|
|
18915
|
-
p.dataset.mesurerScreenshotViewerControls = "true",
|
|
19238
|
+
p.dataset.mesurerScreenshotViewerControls = "true", Ub(p, {
|
|
18916
19239
|
position: "fixed",
|
|
18917
19240
|
top: "16px",
|
|
18918
19241
|
right: "16px",
|
|
@@ -18920,14 +19243,14 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18920
19243
|
gap: "8px",
|
|
18921
19244
|
"pointer-events": "auto"
|
|
18922
19245
|
});
|
|
18923
|
-
let m =
|
|
19246
|
+
let m = Gb(e, "Copy");
|
|
18924
19247
|
m.dataset.mesurerScreenshotViewerCopy = "true", m.setAttribute("aria-label", "Copy screenshot");
|
|
18925
|
-
let h =
|
|
19248
|
+
let h = Gb(e, "Save");
|
|
18926
19249
|
h.dataset.mesurerScreenshotViewerSave = "true", h.setAttribute("aria-label", "Save screenshot");
|
|
18927
|
-
let g =
|
|
19250
|
+
let g = Gb(e, "Close");
|
|
18928
19251
|
g.dataset.mesurerScreenshotViewerClose = "true", g.setAttribute("aria-label", "Close screenshot viewer"), p.append(m, h, g), d.append(p), a.append(d);
|
|
18929
19252
|
let _ = e.createElement("div");
|
|
18930
|
-
_.dataset.mesurerScreenshotToast = "true", _.setAttribute("role", "status"),
|
|
19253
|
+
_.dataset.mesurerScreenshotToast = "true", _.setAttribute("role", "status"), Ub(_, {
|
|
18931
19254
|
position: "fixed",
|
|
18932
19255
|
left: "50%",
|
|
18933
19256
|
bottom: "20px",
|
|
@@ -18949,18 +19272,18 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18949
19272
|
}, D = (e, n = !1) => {
|
|
18950
19273
|
E(), _.textContent = e, _.style.backgroundColor = n ? "#b42318" : "rgb(28 28 30 / 90%)", _.style.display = "block", C = t.setTimeout(() => {
|
|
18951
19274
|
C = 0, _.style.display = "none";
|
|
18952
|
-
},
|
|
19275
|
+
}, Hb);
|
|
18953
19276
|
}, O = () => {
|
|
18954
19277
|
d.style.display = "none";
|
|
18955
19278
|
}, k = () => {
|
|
18956
19279
|
y && globalThis.URL.revokeObjectURL(y), y = null, v = null, s.removeAttribute("src"), f.removeAttribute("src");
|
|
18957
19280
|
}, A = () => {
|
|
18958
19281
|
T(), O(), o.style.display = "none", k();
|
|
18959
|
-
}, j = () =>
|
|
18960
|
-
left: t.innerWidth -
|
|
18961
|
-
top: t.innerHeight -
|
|
19282
|
+
}, j = () => Wb({
|
|
19283
|
+
left: t.innerWidth - Rb - Bb,
|
|
19284
|
+
top: t.innerHeight - zb - Bb
|
|
18962
19285
|
}, t), M = (e) => {
|
|
18963
|
-
let n =
|
|
19286
|
+
let n = Wb(e, t);
|
|
18964
19287
|
b = n, o.style.left = `${n.left}px`, o.style.top = `${n.top}px`;
|
|
18965
19288
|
}, N = () => {
|
|
18966
19289
|
!v || !y || (T(), d.style.display = "flex", g.focus());
|
|
@@ -18994,7 +19317,7 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
18994
19317
|
let n = x;
|
|
18995
19318
|
if (!n) return;
|
|
18996
19319
|
let r = e - n.startX, i = t - n.startY;
|
|
18997
|
-
!n.moved && Math.hypot(r, i) >=
|
|
19320
|
+
!n.moved && Math.hypot(r, i) >= Vb && (n.moved = !0), n.moved && M({
|
|
18998
19321
|
left: n.left + r,
|
|
18999
19322
|
top: n.top + i
|
|
19000
19323
|
});
|
|
@@ -19038,25 +19361,25 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
19038
19361
|
if (w) return;
|
|
19039
19362
|
T(), O(), k(), v = e;
|
|
19040
19363
|
let i = globalThis.URL.createObjectURL(e);
|
|
19041
|
-
y = i, s.src = i, f.src = i, o.style.display = "block", M(b ?? j()), D(
|
|
19364
|
+
y = i, s.src = i, f.src = i, o.style.display = "block", M(b ?? j()), D(Kb(n)), r > 0 && (S = t.setTimeout(A, r));
|
|
19042
19365
|
},
|
|
19043
19366
|
dismiss: A,
|
|
19044
19367
|
dispose() {
|
|
19045
19368
|
w || (w = !0, T(), E(), A(), t.removeEventListener("mousemove", V, !0), t.removeEventListener("mouseup", H, !0), t.removeEventListener("pointermove", ee, !0), t.removeEventListener("pointerup", te, !0), t.removeEventListener("pointercancel", ne, !0), t.removeEventListener("keydown", ae, !0), o.removeEventListener("mousedown", B), o.removeEventListener("pointerdown", U), o.removeEventListener("keydown", W), o.removeEventListener("contextmenu", re), d.removeEventListener("click", ie), a.remove());
|
|
19046
19369
|
}
|
|
19047
19370
|
};
|
|
19048
|
-
},
|
|
19371
|
+
}, Yb = "mesurer.screenshot", Xb = "screenshot", Zb = "mesurer.screenshot.settings", Qb = "mesurer.screenshot.active", $b = "runtime:solid", ex = "screenshot.toggle", tx = 2500, nx = 0, rx = [
|
|
19049
19372
|
"[data-mesurer-measurement='true']",
|
|
19050
19373
|
"[data-mesurer-selected-measurement='true']",
|
|
19051
19374
|
"[data-mesurer-selection-spacing-target='true']",
|
|
19052
19375
|
"[data-mesurer-guide='true']",
|
|
19053
19376
|
"[data-mesurer-distance='true']"
|
|
19054
|
-
].join(","),
|
|
19377
|
+
].join(","), ix = `${rx},[data-mesurer-rulers='true']`, ax = {
|
|
19055
19378
|
viewBox: "0 0 256 256",
|
|
19056
19379
|
paths: ["m 96,50 a 6.0006,6.0006 0 0 0 -4.992188,2.671875 L 76.789062,74 H 40 C 27.920803,74 18,83.920803 18,96 v 96 c 0,12.0792 9.920803,22 22,22 h 176 c 12.0792,0 22,-9.9208 22,-22 V 96 C 238,83.920803 228.0792,74 216,74 H 179.21094 L 164.99219,52.671875 A 6.0006,6.0006 0 0 0 160,50 Z m 3.210937,12 h 57.578123 l 14.21875,21.328125 A 6.0006,6.0006 0 0 0 176,86 h 40 c 5.59392,0 10,4.406085 10,10 v 96 c 0,5.59392 -4.40608,10 -10,10 H 40 c -5.593915,0 -10,-4.40608 -10,-10 V 96 c 0,-5.593915 4.406085,-10 10,-10 h 40 a 6.0006,6.0006 0 0 0 4.992187,-2.671875 z", "m 128,94 c -23.12489,0 -42,18.87511 -42,42 0,23.12489 18.87511,42 42,42 23.12489,0 42,-18.87511 42,-42 0,-23.12489 -18.87511,-42 -42,-42 z m 0,12 c 16.63961,0 30,13.36039 30,30 0,16.63961 -13.36039,30 -30,30 -16.63961,0 -30,-13.36039 -30,-30 0,-16.63961 13.36039,-30 30,-30 z"]
|
|
19057
|
-
}, ax = (e, t) => {
|
|
19058
|
-
for (let [n, r] of Object.entries(t)) e.style.setProperty(n, r);
|
|
19059
19380
|
}, ox = (e, t) => {
|
|
19381
|
+
for (let [n, r] of Object.entries(t)) e.style.setProperty(n, r);
|
|
19382
|
+
}, sx = (e, t) => {
|
|
19060
19383
|
for (let n of [
|
|
19061
19384
|
"left",
|
|
19062
19385
|
"top",
|
|
@@ -19068,63 +19391,63 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
19068
19391
|
let r = t[n];
|
|
19069
19392
|
r === void 0 ? e.style.removeProperty(n) : e.style.setProperty(n, `${r}px`);
|
|
19070
19393
|
}
|
|
19071
|
-
},
|
|
19072
|
-
let t = e(
|
|
19394
|
+
}, cx = (e) => {
|
|
19395
|
+
let t = e(Zb);
|
|
19073
19396
|
return {
|
|
19074
19397
|
toolEnabled: t?.toolEnabled ?? !0,
|
|
19075
19398
|
copy: t?.copy ?? !0,
|
|
19076
19399
|
download: t?.download ?? !1,
|
|
19077
19400
|
includeMeasurements: t?.includeMeasurements ?? !1
|
|
19078
19401
|
};
|
|
19079
|
-
},
|
|
19402
|
+
}, lx = (e) => ({
|
|
19080
19403
|
value: e.style.getPropertyValue("display"),
|
|
19081
19404
|
priority: e.style.getPropertyPriority("display")
|
|
19082
|
-
}),
|
|
19405
|
+
}), ux = (e, t) => {
|
|
19083
19406
|
t.value || t.priority ? e.style.setProperty("display", t.value, t.priority) : e.style.removeProperty("display");
|
|
19084
|
-
},
|
|
19407
|
+
}, dx = (e, t) => {
|
|
19085
19408
|
let n = e;
|
|
19086
19409
|
for (; n.parentElement && n.parentElement !== t;) n = n.parentElement;
|
|
19087
19410
|
return n.parentElement === t ? n : null;
|
|
19088
|
-
},
|
|
19411
|
+
}, fx = (e) => {
|
|
19089
19412
|
let t = e.querySelector("[data-mesurer-root='true']");
|
|
19090
19413
|
if (!t) return () => void 0;
|
|
19091
19414
|
let n = /* @__PURE__ */ new Set();
|
|
19092
19415
|
for (let e of t.querySelectorAll("[data-mesurer-rulers='true']")) {
|
|
19093
|
-
let r =
|
|
19416
|
+
let r = dx(e, t);
|
|
19094
19417
|
r && n.add(r);
|
|
19095
19418
|
}
|
|
19096
|
-
for (let e of t.querySelectorAll(
|
|
19097
|
-
let r =
|
|
19419
|
+
for (let e of t.querySelectorAll(rx)) {
|
|
19420
|
+
let r = dx(e, t);
|
|
19098
19421
|
r && n.add(r);
|
|
19099
19422
|
}
|
|
19100
19423
|
let r = [];
|
|
19101
19424
|
for (let e of n) e.dataset.mesurerInspectorUi !== "true" && (r.push({
|
|
19102
19425
|
element: e,
|
|
19103
|
-
display:
|
|
19426
|
+
display: lx(e)
|
|
19104
19427
|
}), e.style.setProperty("display", "none", "important"));
|
|
19105
19428
|
return () => {
|
|
19106
|
-
for (let e of r)
|
|
19429
|
+
for (let e of r) ux(e.element, e.display);
|
|
19107
19430
|
};
|
|
19108
|
-
},
|
|
19431
|
+
}, px = (e) => Array.from(e.querySelectorAll(ix)).filter((e) => e.dataset.mesurerInspectorUi === "true").map((e) => ({
|
|
19109
19432
|
element: e,
|
|
19110
|
-
display:
|
|
19111
|
-
})),
|
|
19112
|
-
for (let t of e) t.element.isConnected &&
|
|
19113
|
-
},
|
|
19114
|
-
id:
|
|
19433
|
+
display: lx(e)
|
|
19434
|
+
})), mx = (e) => {
|
|
19435
|
+
for (let t of e) t.element.isConnected && ux(t.element, t.display);
|
|
19436
|
+
}, hx = (e = {}) => Ta({
|
|
19437
|
+
id: Yb,
|
|
19115
19438
|
version: "0.1.0",
|
|
19116
|
-
requires: [
|
|
19439
|
+
requires: [$b],
|
|
19117
19440
|
provides: [
|
|
19118
19441
|
"tool:screenshot",
|
|
19119
19442
|
"capture:screenshot",
|
|
19120
19443
|
"settings:screenshot"
|
|
19121
19444
|
],
|
|
19122
19445
|
setup(t) {
|
|
19123
|
-
let n = t.service.get(
|
|
19446
|
+
let n = t.service.get($b);
|
|
19124
19447
|
if (!n) throw Error("Screenshot plugin requires the Solid renderer runtime.");
|
|
19125
|
-
let { ownerDocument: r, ownerWindow: i } = n, a = n.createWorkspaceRuntime(), o = n.createInspectorMount(), s = e.capture ?? e.captureVisibleTab, c = s ?? _o, l = e.previewDurationMs ??
|
|
19448
|
+
let { ownerDocument: r, ownerWindow: i } = n, a = n.createWorkspaceRuntime(), o = n.createInspectorMount(), s = e.capture ?? e.captureVisibleTab, c = s ?? _o, l = e.previewDurationMs ?? nx;
|
|
19126
19449
|
t.state.register({
|
|
19127
|
-
id:
|
|
19450
|
+
id: Zb,
|
|
19128
19451
|
initial: {
|
|
19129
19452
|
toolEnabled: e.toolEnabled ?? !0,
|
|
19130
19453
|
copy: e.copy ?? !0,
|
|
@@ -19133,11 +19456,11 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
19133
19456
|
},
|
|
19134
19457
|
persist: !0
|
|
19135
19458
|
}), t.state.register({
|
|
19136
|
-
id:
|
|
19459
|
+
id: Qb,
|
|
19137
19460
|
initial: !1
|
|
19138
19461
|
});
|
|
19139
19462
|
let u = o.element;
|
|
19140
|
-
u.dataset.mesurerScreenshot = "true",
|
|
19463
|
+
u.dataset.mesurerScreenshot = "true", ox(u, {
|
|
19141
19464
|
position: "fixed",
|
|
19142
19465
|
inset: "0",
|
|
19143
19466
|
"z-index": "85",
|
|
@@ -19145,7 +19468,7 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
19145
19468
|
"font-family": "ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, sans-serif"
|
|
19146
19469
|
});
|
|
19147
19470
|
let d = r.createElement("div");
|
|
19148
|
-
d.dataset.mesurerScreenshotSelect = "true", d.setAttribute("role", "application"), d.setAttribute("aria-label", "Screenshot selection"),
|
|
19471
|
+
d.dataset.mesurerScreenshotSelect = "true", d.setAttribute("role", "application"), d.setAttribute("aria-label", "Screenshot selection"), ox(d, {
|
|
19149
19472
|
position: "fixed",
|
|
19150
19473
|
inset: "0",
|
|
19151
19474
|
display: "none",
|
|
@@ -19157,13 +19480,13 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
19157
19480
|
}), u.append(d);
|
|
19158
19481
|
let f = Array.from({ length: 4 }, () => {
|
|
19159
19482
|
let e = r.createElement("div");
|
|
19160
|
-
return
|
|
19483
|
+
return ox(e, {
|
|
19161
19484
|
position: "fixed",
|
|
19162
19485
|
"background-color": "rgb(0 0 0 / 40%)",
|
|
19163
19486
|
"pointer-events": "none"
|
|
19164
19487
|
}), d.append(e), e;
|
|
19165
19488
|
}), p = r.createElement("div");
|
|
19166
|
-
|
|
19489
|
+
ox(p, {
|
|
19167
19490
|
position: "fixed",
|
|
19168
19491
|
display: "none",
|
|
19169
19492
|
border: "1px solid #0d99ff",
|
|
@@ -19171,7 +19494,7 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
19171
19494
|
"pointer-events": "none"
|
|
19172
19495
|
}), d.append(p);
|
|
19173
19496
|
let m = r.createElement("div");
|
|
19174
|
-
|
|
19497
|
+
ox(m, {
|
|
19175
19498
|
position: "fixed",
|
|
19176
19499
|
display: "none",
|
|
19177
19500
|
"z-index": "86",
|
|
@@ -19185,7 +19508,7 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
19185
19508
|
"pointer-events": "none"
|
|
19186
19509
|
}), d.append(m);
|
|
19187
19510
|
let h = r.createElement("div");
|
|
19188
|
-
h.textContent = "Drag to select · Esc to cancel",
|
|
19511
|
+
h.textContent = "Drag to select · Esc to cancel", ox(h, {
|
|
19189
19512
|
position: "fixed",
|
|
19190
19513
|
left: "50%",
|
|
19191
19514
|
bottom: "16px",
|
|
@@ -19198,7 +19521,7 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
19198
19521
|
"pointer-events": "none"
|
|
19199
19522
|
}), d.append(h);
|
|
19200
19523
|
let g = r.createElement("div");
|
|
19201
|
-
g.dataset.mesurerScreenshotError = "true", g.setAttribute("role", "status"), g.textContent = "Could not save screenshot",
|
|
19524
|
+
g.dataset.mesurerScreenshotError = "true", g.setAttribute("role", "status"), g.textContent = "Could not save screenshot", ox(g, {
|
|
19202
19525
|
position: "fixed",
|
|
19203
19526
|
display: "none",
|
|
19204
19527
|
"z-index": "97",
|
|
@@ -19209,8 +19532,8 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
19209
19532
|
"font-size": "11px",
|
|
19210
19533
|
"pointer-events": "none"
|
|
19211
19534
|
}), u.append(g);
|
|
19212
|
-
let _ = null, v = null, y = 0, b = 0, x = !1, S = !1, C = !1, w = () => t.state.get("mesurer.screenshot.active") ?? !1, T = () =>
|
|
19213
|
-
t.state.update(
|
|
19535
|
+
let _ = null, v = null, y = 0, b = 0, x = !1, S = !1, C = !1, w = () => t.state.get("mesurer.screenshot.active") ?? !1, T = () => cx(t.state.get), E = (e) => {
|
|
19536
|
+
t.state.update(Zb, (t) => {
|
|
19214
19537
|
let n = { ...t };
|
|
19215
19538
|
return e.toolEnabled !== void 0 && (n.toolEnabled = e.toolEnabled), e.copy !== void 0 && (n.copy = e.copy), e.download !== void 0 && (n.download = e.download), e.includeMeasurements !== void 0 && (n.includeMeasurements = e.includeMeasurements), n;
|
|
19216
19539
|
});
|
|
@@ -19233,13 +19556,13 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
19233
19556
|
}, A = (e) => {
|
|
19234
19557
|
let t = i.innerWidth, n = i.innerHeight;
|
|
19235
19558
|
if (!e || e.width <= 0 || e.height <= 0) {
|
|
19236
|
-
|
|
19559
|
+
sx(f[0], {
|
|
19237
19560
|
left: 0,
|
|
19238
19561
|
top: 0,
|
|
19239
19562
|
width: t,
|
|
19240
19563
|
height: n
|
|
19241
19564
|
});
|
|
19242
|
-
for (let e of f.slice(1))
|
|
19565
|
+
for (let e of f.slice(1)) sx(e, {
|
|
19243
19566
|
left: 0,
|
|
19244
19567
|
top: 0,
|
|
19245
19568
|
width: 0,
|
|
@@ -19248,31 +19571,31 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
19248
19571
|
p.style.display = "none", m.style.display = "none";
|
|
19249
19572
|
return;
|
|
19250
19573
|
}
|
|
19251
|
-
|
|
19574
|
+
sx(f[0], {
|
|
19252
19575
|
left: 0,
|
|
19253
19576
|
top: 0,
|
|
19254
19577
|
width: t,
|
|
19255
19578
|
height: e.top
|
|
19256
|
-
}),
|
|
19579
|
+
}), sx(f[1], {
|
|
19257
19580
|
left: 0,
|
|
19258
19581
|
top: e.top,
|
|
19259
19582
|
width: e.left,
|
|
19260
19583
|
height: e.height
|
|
19261
|
-
}),
|
|
19584
|
+
}), sx(f[2], {
|
|
19262
19585
|
left: e.left + e.width,
|
|
19263
19586
|
top: e.top,
|
|
19264
19587
|
width: Math.max(0, t - e.left - e.width),
|
|
19265
19588
|
height: e.height
|
|
19266
|
-
}),
|
|
19589
|
+
}), sx(f[3], {
|
|
19267
19590
|
left: 0,
|
|
19268
19591
|
top: e.top + e.height,
|
|
19269
19592
|
width: t,
|
|
19270
19593
|
height: Math.max(0, n - e.top - e.height)
|
|
19271
|
-
}), p.style.display = "block",
|
|
19594
|
+
}), p.style.display = "block", sx(p, e), m.style.display = "block", m.textContent = `${Math.round(e.width)} × ${Math.round(e.height)}`, sx(m, {
|
|
19272
19595
|
left: e.left + e.width / 2,
|
|
19273
19596
|
top: Math.min(n - 22, e.top + e.height + 6)
|
|
19274
19597
|
});
|
|
19275
|
-
}, j = () => n.portalTarget.querySelector("[data-mesurer-tool-id='screenshot']")?.getBoundingClientRect() ?? null, M =
|
|
19598
|
+
}, j = () => n.portalTarget.querySelector("[data-mesurer-tool-id='screenshot']")?.getBoundingClientRect() ?? null, M = Jb({
|
|
19276
19599
|
ownerDocument: r,
|
|
19277
19600
|
ownerWindow: i,
|
|
19278
19601
|
root: u,
|
|
@@ -19283,7 +19606,7 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
19283
19606
|
}, P = () => {
|
|
19284
19607
|
y && i.clearTimeout(y), g.style.display = "block", N(g), y = i.setTimeout(() => {
|
|
19285
19608
|
y = 0, g.style.display = "none";
|
|
19286
|
-
},
|
|
19609
|
+
}, tx);
|
|
19287
19610
|
}, F = () => {
|
|
19288
19611
|
_ = null, A(null), d.style.visibility = "", d.style.display = "none", u.style.pointerEvents = "none", D(!1), k();
|
|
19289
19612
|
}, I = () => {
|
|
@@ -19292,8 +19615,8 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
19292
19615
|
if (x) throw Error("A screenshot capture is already running.");
|
|
19293
19616
|
if (e.width < 4 || e.height < 4) throw Error("Screenshot selection must be at least 4px by 4px.");
|
|
19294
19617
|
x = !0;
|
|
19295
|
-
let o = ++b, s = T(), l = s.includeMeasurements ?
|
|
19296
|
-
a.prepareCapture(), s.includeMeasurements &&
|
|
19618
|
+
let o = ++b, s = T(), l = s.includeMeasurements ? px(r) : [], u = s.includeMeasurements ? () => void 0 : fx(n.portalTarget);
|
|
19619
|
+
a.prepareCapture(), s.includeMeasurements && mx(l);
|
|
19297
19620
|
try {
|
|
19298
19621
|
d.style.visibility = "hidden", await Qa(i);
|
|
19299
19622
|
let n = await Ja(await c({
|
|
@@ -19401,9 +19724,9 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
19401
19724
|
label: "Screenshot",
|
|
19402
19725
|
shortcut: "Shift+S",
|
|
19403
19726
|
order: 70,
|
|
19404
|
-
command:
|
|
19727
|
+
command: ex,
|
|
19405
19728
|
toolbarMode: "select",
|
|
19406
|
-
icon:
|
|
19729
|
+
icon: ax,
|
|
19407
19730
|
active: w,
|
|
19408
19731
|
hidden: () => !T().toolEnabled,
|
|
19409
19732
|
menu: {
|
|
@@ -19469,31 +19792,31 @@ var Kv = "mesurer.layout-guides", qv = "layout-guides:v1", Jv = "mesurer.layout-
|
|
|
19469
19792
|
set: (e) => E({ includeMeasurements: e })
|
|
19470
19793
|
}
|
|
19471
19794
|
]
|
|
19472
|
-
}), t.command.register(
|
|
19795
|
+
}), t.command.register(ex, R), t.service.provide(Xb, ee), t.lifecycle.onDispose(() => {
|
|
19473
19796
|
C = !0, b += 1, d.removeEventListener("pointerdown", z), d.removeEventListener("pointermove", B), d.removeEventListener("pointerup", V), d.removeEventListener("pointercancel", H), i.removeEventListener("keydown", U, !0), y && i.clearTimeout(y), M.dispose(), k(), vo(i), a.finishCapture(), a.dispose(), o.dispose();
|
|
19474
19797
|
});
|
|
19475
19798
|
}
|
|
19476
|
-
}),
|
|
19799
|
+
}), gx = (e) => Number.parseFloat(e) || 0, _x = 0, vx = (e, t) => {
|
|
19477
19800
|
let n = t.CSS;
|
|
19478
19801
|
return n?.escape ? n.escape(e) : e.replace(/[^a-zA-Z0-9_-]/g, (e) => `\\${e}`);
|
|
19479
|
-
},
|
|
19480
|
-
function
|
|
19802
|
+
}, yx = (e) => e.nodeType === 9, bx = (e) => e.nodeType === 11;
|
|
19803
|
+
function xx(e) {
|
|
19481
19804
|
let t = e.getRootNode();
|
|
19482
|
-
return
|
|
19805
|
+
return bx(t) ? t : e.ownerDocument;
|
|
19483
19806
|
}
|
|
19484
|
-
var
|
|
19485
|
-
if (
|
|
19486
|
-
let n =
|
|
19487
|
-
return
|
|
19488
|
-
},
|
|
19807
|
+
var Sx = (e, t) => {
|
|
19808
|
+
if (yx(e) || bx(e)) return e;
|
|
19809
|
+
let n = xx(e);
|
|
19810
|
+
return bx(n) ? n : t;
|
|
19811
|
+
}, Cx = 600, wx = "audio, canvas, embed, iframe, img, input, object, picture, select, textarea, video", Tx = /* @__PURE__ */ new WeakMap(), Ex = (e) => {
|
|
19489
19812
|
let t = e;
|
|
19490
19813
|
for (; t;) {
|
|
19491
|
-
if ((
|
|
19814
|
+
if ((Tx.get(t) ?? 0) > 0) return !0;
|
|
19492
19815
|
let e = t.getRootNode();
|
|
19493
|
-
t =
|
|
19816
|
+
t = bx(e) ? e.host : t.parentElement;
|
|
19494
19817
|
}
|
|
19495
19818
|
return !1;
|
|
19496
|
-
},
|
|
19819
|
+
}, Dx = (e, t) => t.x >= e.left && t.x <= e.right && t.y >= e.top && t.y <= e.bottom, Ox = (e, t) => Array.from(e.getClientRects()).some((e) => Dx(e, t)), kx = (e, t, n) => {
|
|
19497
19820
|
let r = e;
|
|
19498
19821
|
for (; r;) {
|
|
19499
19822
|
let e = n.getComputedStyle(r);
|
|
@@ -19502,7 +19825,7 @@ var xx = (e, t) => {
|
|
|
19502
19825
|
r = r.parentElement;
|
|
19503
19826
|
}
|
|
19504
19827
|
return !0;
|
|
19505
|
-
},
|
|
19828
|
+
}, Ax = (e, t) => {
|
|
19506
19829
|
if (e.matches("img, picture, video, canvas, svg image, path, circle, ellipse, line, polygon, polyline, rect, text, use")) return !0;
|
|
19507
19830
|
let n = t.getComputedStyle(e), r = n.backgroundImage !== "none" || n.backgroundColor !== "transparent" && n.backgroundColor !== "rgba(0, 0, 0, 0)", i = [
|
|
19508
19831
|
"top",
|
|
@@ -19511,7 +19834,7 @@ var xx = (e, t) => {
|
|
|
19511
19834
|
"left"
|
|
19512
19835
|
].some((e) => Number.parseFloat(n.getPropertyValue(`border-${e}-width`)) > 0 && n.getPropertyValue(`border-${e}-style`) !== "none");
|
|
19513
19836
|
return r || i || n.boxShadow !== "none" || n.outlineStyle !== "none";
|
|
19514
|
-
},
|
|
19837
|
+
}, jx = (e, t) => !!e.textContent?.trim() || Ax(e, t), Mx = (e, t, n) => {
|
|
19515
19838
|
let r = t, i = r.caretRangeFromPoint?.(e.x, e.y)?.startContainer ?? r.caretPositionFromPoint?.(e.x, e.y)?.offsetNode;
|
|
19516
19839
|
if (!i) return null;
|
|
19517
19840
|
let a = t.defaultView?.Element;
|
|
@@ -19522,11 +19845,11 @@ var xx = (e, t) => {
|
|
|
19522
19845
|
o = o.parentElement;
|
|
19523
19846
|
}
|
|
19524
19847
|
return o === n ? n : null;
|
|
19525
|
-
},
|
|
19848
|
+
}, Nx = (e, t, n) => {
|
|
19526
19849
|
let r = n.defaultView, i = r?.Element;
|
|
19527
19850
|
if (!r || !i) return [];
|
|
19528
19851
|
let a = [], o = /* @__PURE__ */ new Set(), s = (n, i, s) => {
|
|
19529
|
-
if (o.has(n) ||
|
|
19852
|
+
if (o.has(n) || Ex(n) || r.getComputedStyle(n).pointerEvents !== "none" || kx(n, e, r) || !Ox(n, t)) return;
|
|
19530
19853
|
let c = n.getBoundingClientRect();
|
|
19531
19854
|
o.add(n), a.push({
|
|
19532
19855
|
element: n,
|
|
@@ -19535,7 +19858,7 @@ var xx = (e, t) => {
|
|
|
19535
19858
|
order: s
|
|
19536
19859
|
});
|
|
19537
19860
|
}, c = n.createTreeWalker(e, 1), l = c.nextNode(), u = 1;
|
|
19538
|
-
for (; l && u <=
|
|
19861
|
+
for (; l && u <= Cx;) {
|
|
19539
19862
|
if (l instanceof i) {
|
|
19540
19863
|
let t = l;
|
|
19541
19864
|
if (r.getComputedStyle(t).pointerEvents === "none") {
|
|
@@ -19546,9 +19869,9 @@ var xx = (e, t) => {
|
|
|
19546
19869
|
}
|
|
19547
19870
|
u += 1, l = c.nextNode();
|
|
19548
19871
|
}
|
|
19549
|
-
let d =
|
|
19872
|
+
let d = Mx(t, n, e);
|
|
19550
19873
|
return d && r.getComputedStyle(d).pointerEvents === "none" && s(d, 1e4, u), a.sort((e, t) => t.depth - e.depth || e.area - t.area || t.order - e.order).map(({ element: e }) => e);
|
|
19551
|
-
},
|
|
19874
|
+
}, Px = (e, t, n) => {
|
|
19552
19875
|
let r = t.ownerDocument.defaultView;
|
|
19553
19876
|
if (!r) return [];
|
|
19554
19877
|
let i = [...new Set(e)], a = /* @__PURE__ */ new Map();
|
|
@@ -19557,7 +19880,7 @@ var xx = (e, t) => {
|
|
|
19557
19880
|
t && (a.set(e, e.getAttribute("style")), t.style.setProperty("pointer-events", "auto", "important"));
|
|
19558
19881
|
}
|
|
19559
19882
|
try {
|
|
19560
|
-
let e =
|
|
19883
|
+
let e = xx(t).elementsFromPoint(n.x, n.y), r = e.findIndex((e) => e === t), a = new Map(e.map((e, t) => [e, t]));
|
|
19561
19884
|
return i.filter((e) => {
|
|
19562
19885
|
let t = a.get(e);
|
|
19563
19886
|
return t !== void 0 && (r < 0 || t < r);
|
|
@@ -19565,31 +19888,31 @@ var xx = (e, t) => {
|
|
|
19565
19888
|
} finally {
|
|
19566
19889
|
for (let [e, t] of a) t === null ? e.removeAttribute("style") : e.setAttribute("style", t);
|
|
19567
19890
|
}
|
|
19568
|
-
},
|
|
19891
|
+
}, Fx = (e, t) => {
|
|
19569
19892
|
let n = e;
|
|
19570
19893
|
for (; n.parentElement && n.parentElement !== t;) n = n.parentElement;
|
|
19571
19894
|
return n.parentElement === t ? n : null;
|
|
19572
|
-
},
|
|
19895
|
+
}, Ix = (e, t, n, r) => {
|
|
19573
19896
|
let i = r.defaultView;
|
|
19574
19897
|
if (!i) return [];
|
|
19575
|
-
let a = Nx(
|
|
19898
|
+
let a = Px(Nx(e, t, r).filter((e) => jx(e, i)), e, t);
|
|
19576
19899
|
if (a.length > 0) return a;
|
|
19577
|
-
if (e.textContent?.trim() && !e.matches(
|
|
19578
|
-
let o = [], s = /* @__PURE__ */ new Set(), c = !
|
|
19900
|
+
if (e.textContent?.trim() && !e.matches(wx) || e.matches("a, button, input, select, textarea, label, summary, [contenteditable='true']")) return [];
|
|
19901
|
+
let o = [], s = /* @__PURE__ */ new Set(), c = !yx(n) && !bx(n) ? n : null, l = e.parentElement;
|
|
19579
19902
|
for (; l && l !== r.body && l !== r.documentElement && !(c && l !== c && !c.contains(l));) {
|
|
19580
|
-
let a = l, u =
|
|
19581
|
-
if (!
|
|
19582
|
-
let t =
|
|
19903
|
+
let a = l, u = Fx(e, a), d = Nx(a, t, r).filter((e) => {
|
|
19904
|
+
if (!Rx(e, n) || e.closest("[aria-hidden='true'], [inert]")) return !1;
|
|
19905
|
+
let t = Fx(e, a);
|
|
19583
19906
|
return t === null || t !== u;
|
|
19584
19907
|
});
|
|
19585
|
-
for (let e of d) s.has(e) || !
|
|
19908
|
+
for (let e of d) s.has(e) || !jx(e, i) || (s.add(e), o.push(e));
|
|
19586
19909
|
if (a === c) break;
|
|
19587
19910
|
l = a.parentElement;
|
|
19588
19911
|
}
|
|
19589
|
-
return
|
|
19912
|
+
return Px(o, e, t);
|
|
19590
19913
|
};
|
|
19591
|
-
function
|
|
19592
|
-
let r =
|
|
19914
|
+
function Lx(e, t, n = yx(t) ? t : t.ownerDocument ?? document) {
|
|
19915
|
+
let r = Sx(t, n), i = n.defaultView;
|
|
19593
19916
|
if (!i) return null;
|
|
19594
19917
|
let a = r.elementsFromPoint(e.x, e.y);
|
|
19595
19918
|
for (let r of a) {
|
|
@@ -19599,28 +19922,28 @@ function Ix(e, t, n = vx(t) ? t : t.ownerDocument ?? document) {
|
|
|
19599
19922
|
if (!t || t === a) break;
|
|
19600
19923
|
a = t;
|
|
19601
19924
|
}
|
|
19602
|
-
if (!a || !
|
|
19603
|
-
let o =
|
|
19925
|
+
if (!a || !Rx(a, t)) continue;
|
|
19926
|
+
let o = Ix(a, e, t, n);
|
|
19604
19927
|
if (o.length > 0) return o[0];
|
|
19605
19928
|
if (i.getComputedStyle(a).pointerEvents !== "none") return a;
|
|
19606
19929
|
}
|
|
19607
19930
|
return null;
|
|
19608
19931
|
}
|
|
19609
|
-
function
|
|
19610
|
-
if (
|
|
19932
|
+
function Rx(e, t) {
|
|
19933
|
+
if (yx(t)) return !0;
|
|
19611
19934
|
let n = e;
|
|
19612
19935
|
for (; n;) {
|
|
19613
19936
|
if (t === n || t.contains(n)) return !0;
|
|
19614
19937
|
let e = n.getRootNode();
|
|
19615
|
-
if (!
|
|
19938
|
+
if (!bx(e)) return !1;
|
|
19616
19939
|
n = e.host;
|
|
19617
19940
|
}
|
|
19618
19941
|
return !1;
|
|
19619
19942
|
}
|
|
19620
|
-
function
|
|
19943
|
+
function zx(e, t) {
|
|
19621
19944
|
if (!e) return t();
|
|
19622
|
-
let n =
|
|
19623
|
-
|
|
19945
|
+
let n = Tx.get(e) ?? 0;
|
|
19946
|
+
Tx.set(e, n + 1);
|
|
19624
19947
|
let r = [e, ...e.querySelectorAll("*")], i = r.map((e) => [
|
|
19625
19948
|
e,
|
|
19626
19949
|
e.style.getPropertyValue("pointer-events"),
|
|
@@ -19630,13 +19953,13 @@ function Rx(e, t) {
|
|
|
19630
19953
|
try {
|
|
19631
19954
|
return t();
|
|
19632
19955
|
} finally {
|
|
19633
|
-
n === 0 ?
|
|
19956
|
+
n === 0 ? Tx.delete(e) : Tx.set(e, n);
|
|
19634
19957
|
for (let [e, t, n] of i) t ? e.style.setProperty("pointer-events", t, n) : e.style.removeProperty("pointer-events");
|
|
19635
19958
|
}
|
|
19636
19959
|
}
|
|
19637
|
-
function
|
|
19960
|
+
function Bx(e) {
|
|
19638
19961
|
let t = e.ownerDocument.defaultView ?? window;
|
|
19639
|
-
if (e.id) return `#${
|
|
19962
|
+
if (e.id) return `#${vx(e.id, t)}`;
|
|
19640
19963
|
let n = e.getAttribute("data-testid");
|
|
19641
19964
|
if (n) return `[data-testid=${JSON.stringify(n)}]`;
|
|
19642
19965
|
let r = [], i = e;
|
|
@@ -19650,17 +19973,17 @@ function zx(e) {
|
|
|
19650
19973
|
}
|
|
19651
19974
|
return r.join(" > ");
|
|
19652
19975
|
}
|
|
19653
|
-
function
|
|
19976
|
+
function Vx(e, t, n = `dom-inspection-${++_x}`) {
|
|
19654
19977
|
let r = e.getBoundingClientRect(), i = t.getComputedStyle(e), a = {
|
|
19655
|
-
top:
|
|
19656
|
-
right:
|
|
19657
|
-
bottom:
|
|
19658
|
-
left:
|
|
19978
|
+
top: gx(i.paddingTop),
|
|
19979
|
+
right: gx(i.paddingRight),
|
|
19980
|
+
bottom: gx(i.paddingBottom),
|
|
19981
|
+
left: gx(i.paddingLeft)
|
|
19659
19982
|
}, o = {
|
|
19660
|
-
top:
|
|
19661
|
-
right:
|
|
19662
|
-
bottom:
|
|
19663
|
-
left:
|
|
19983
|
+
top: gx(i.marginTop),
|
|
19984
|
+
right: gx(i.marginRight),
|
|
19985
|
+
bottom: gx(i.marginBottom),
|
|
19986
|
+
left: gx(i.marginLeft)
|
|
19664
19987
|
}, s = {
|
|
19665
19988
|
left: r.left + a.left,
|
|
19666
19989
|
top: r.top + a.top,
|
|
@@ -19688,8 +20011,8 @@ function Bx(e, t, n = `dom-inspection-${++gx}`) {
|
|
|
19688
20011
|
elementRef: e
|
|
19689
20012
|
};
|
|
19690
20013
|
}
|
|
19691
|
-
function
|
|
19692
|
-
let t = e.ownerDocument.defaultView ?? window, n = t.getComputedStyle(e), r = e instanceof t.HTMLElement ? e : null, i = e.getBoundingClientRect(), a = r ?
|
|
20014
|
+
function Hx(e) {
|
|
20015
|
+
let t = e.ownerDocument.defaultView ?? window, n = t.getComputedStyle(e), r = e instanceof t.HTMLElement ? e : null, i = e.getBoundingClientRect(), a = r ? Vx(r, t) : null, o = (e) => {
|
|
19693
20016
|
let t = Number.parseFloat(e);
|
|
19694
20017
|
return Number.isFinite(t) ? t : 0;
|
|
19695
20018
|
}, s = (e) => ({
|
|
@@ -19699,7 +20022,7 @@ function Vx(e) {
|
|
|
19699
20022
|
left: o(n.getPropertyValue(`${e}-left${e === "border" ? "-width" : ""}`))
|
|
19700
20023
|
});
|
|
19701
20024
|
return {
|
|
19702
|
-
selector:
|
|
20025
|
+
selector: Bx(e),
|
|
19703
20026
|
tag: e.localName,
|
|
19704
20027
|
id: e.id || null,
|
|
19705
20028
|
classes: [...e.classList],
|
|
@@ -19761,10 +20084,10 @@ function Vx(e) {
|
|
|
19761
20084
|
}
|
|
19762
20085
|
//#endregion
|
|
19763
20086
|
//#region src/agent.ts
|
|
19764
|
-
var
|
|
19765
|
-
function
|
|
19766
|
-
let t = e.root ?? e.ownerDocument, n = e.ownerDocument.defaultView ?? window, r = (e, n = 0) => t.querySelectorAll(e).item(n) || null, i = (n) => t === e.ownerDocument ||
|
|
19767
|
-
let t = (e.getPluginHost() ?? await e.waitForPluginHost()).service.get(
|
|
20087
|
+
var Ux = "text-edit", Wx = (e) => Hx(e);
|
|
20088
|
+
function Gx(e) {
|
|
20089
|
+
let t = e.root ?? e.ownerDocument, n = e.ownerDocument.defaultView ?? window, r = (e, n = 0) => t.querySelectorAll(e).item(n) || null, i = (n) => t === e.ownerDocument || Rx(n, t), a = async () => {
|
|
20090
|
+
let t = (e.getPluginHost() ?? await e.waitForPluginHost()).service.get(Ux);
|
|
19768
20091
|
if (!t) throw Error("Mesurer text editing service is unavailable.");
|
|
19769
20092
|
return t;
|
|
19770
20093
|
}, o = () => {
|
|
@@ -19793,25 +20116,25 @@ function Wx(e) {
|
|
|
19793
20116
|
},
|
|
19794
20117
|
inspect(e, t = 0) {
|
|
19795
20118
|
let n = r(e, t);
|
|
19796
|
-
return n ?
|
|
20119
|
+
return n ? Wx(n) : null;
|
|
19797
20120
|
},
|
|
19798
20121
|
inspectAll(e, n = 50) {
|
|
19799
|
-
return [...t.querySelectorAll(e)].slice(0, Math.max(0, n)).map(
|
|
20122
|
+
return [...t.querySelectorAll(e)].slice(0, Math.max(0, n)).map(Wx);
|
|
19800
20123
|
},
|
|
19801
20124
|
at(n, r) {
|
|
19802
20125
|
let a = t.querySelector?.("[data-mesurer-island]") ?? null;
|
|
19803
|
-
return
|
|
19804
|
-
let a =
|
|
20126
|
+
return zx(a?.shadowRoot?.querySelector("[data-mesurer-root='true']") ?? a, () => {
|
|
20127
|
+
let a = Lx({
|
|
19805
20128
|
x: n,
|
|
19806
20129
|
y: r
|
|
19807
20130
|
}, t, e.ownerDocument);
|
|
19808
|
-
return a && i(a) ?
|
|
20131
|
+
return a && i(a) ? Wx(a) : null;
|
|
19809
20132
|
});
|
|
19810
20133
|
},
|
|
19811
20134
|
distance(e, t) {
|
|
19812
20135
|
let n = r(e), i = r(t);
|
|
19813
20136
|
if (!n || !i) return null;
|
|
19814
|
-
let a =
|
|
20137
|
+
let a = Wx(n), o = Wx(i), s = a.rect, c = o.rect;
|
|
19815
20138
|
return {
|
|
19816
20139
|
a,
|
|
19817
20140
|
b: o,
|
|
@@ -19827,7 +20150,7 @@ function Wx(e) {
|
|
|
19827
20150
|
let r = e.getPluginHost() ?? await e.waitForPluginHost();
|
|
19828
20151
|
return {
|
|
19829
20152
|
viewport: o(),
|
|
19830
|
-
elements: n.flatMap((e) => [...t.querySelectorAll(e)].slice(0, 50).map(
|
|
20153
|
+
elements: n.flatMap((e) => [...t.querySelectorAll(e)].slice(0, 50).map(Wx)),
|
|
19831
20154
|
plugins: r.describe(),
|
|
19832
20155
|
pluginState: r.state.serialize("all")
|
|
19833
20156
|
};
|
|
@@ -19852,10 +20175,10 @@ function Wx(e) {
|
|
|
19852
20175
|
}
|
|
19853
20176
|
//#endregion
|
|
19854
20177
|
//#region src/version.ts
|
|
19855
|
-
var
|
|
20178
|
+
var Kx = "0.2.1-beta.6", qx = Np, Jx = Pp, Yx = () => ({
|
|
19856
20179
|
...km(),
|
|
19857
|
-
version:
|
|
19858
|
-
}),
|
|
20180
|
+
version: Kx
|
|
20181
|
+
}), Xx = Jx, Zx = (e, t) => e.left <= t.left + t.width && e.left + e.width >= t.left && e.top <= t.top + t.height && e.top + e.height >= t.top, Qx = (e) => {
|
|
19859
20182
|
if (!e.length) return null;
|
|
19860
20183
|
let t = Math.min(...e.map((e) => e.left)), n = Math.min(...e.map((e) => e.top)), r = Math.max(...e.map((e) => e.left + e.width)), i = Math.max(...e.map((e) => e.top + e.height));
|
|
19861
20184
|
return {
|
|
@@ -19864,36 +20187,36 @@ var Gx = "0.2.1-beta.4", Kx = Np, qx = Pp, Jx = () => ({
|
|
|
19864
20187
|
width: r - t,
|
|
19865
20188
|
height: i - n
|
|
19866
20189
|
};
|
|
19867
|
-
},
|
|
19868
|
-
function
|
|
20190
|
+
}, $x = (e, t, n) => t.some((t) => e.orientation === "vertical" ? e.position >= t.left - n && e.position <= t.left + t.width + n : e.position >= t.top - n && e.position <= t.top + t.height + n), eS = (e) => [...e.measurements, ...e.activeMeasurement && !e.measurements.some((t) => t.id === e.activeMeasurement?.id) ? [e.activeMeasurement] : []];
|
|
20191
|
+
function tS(e) {
|
|
19869
20192
|
let { workspace: t, scope: n, guideTolerance: r } = e;
|
|
19870
20193
|
if (n.kind === "workspace") return {
|
|
19871
20194
|
guides: t.guides.map((e) => ({ ...e })),
|
|
19872
|
-
measurements:
|
|
20195
|
+
measurements: eS(t),
|
|
19873
20196
|
distances: [...t.distances]
|
|
19874
20197
|
};
|
|
19875
|
-
let i = new Set(n.elements), a = (e) => e != null && i.has(e), o = (e) => n.regions.some((t) =>
|
|
20198
|
+
let i = new Set(n.elements), a = (e) => e != null && i.has(e), o = (e) => n.regions.some((t) => Zx(e, t));
|
|
19876
20199
|
return {
|
|
19877
|
-
guides: t.guides.filter((e) =>
|
|
19878
|
-
measurements:
|
|
20200
|
+
guides: t.guides.filter((e) => $x(e, n.regions, r)).map((e) => ({ ...e })),
|
|
20201
|
+
measurements: eS(t).filter((e) => a(e.elementRef) || o(e.rect)),
|
|
19879
20202
|
distances: t.distances.filter((e) => a(e.elementRefA) || a(e.elementRefB) || o(e.rectA) || o(e.rectB))
|
|
19880
20203
|
};
|
|
19881
20204
|
}
|
|
19882
20205
|
//#endregion
|
|
19883
20206
|
//#region ../mesurer-core/dist/domain.js
|
|
19884
|
-
var
|
|
20207
|
+
var nS = {
|
|
19885
20208
|
opacity: 1,
|
|
19886
20209
|
width: 1,
|
|
19887
20210
|
pattern: "solid",
|
|
19888
20211
|
dashLength: 6,
|
|
19889
20212
|
gap: 4
|
|
19890
|
-
},
|
|
20213
|
+
}, rS = {
|
|
19891
20214
|
opacity: 1,
|
|
19892
20215
|
edgeReveal: !1
|
|
19893
20216
|
};
|
|
19894
20217
|
//#endregion
|
|
19895
20218
|
//#region ../mesurer-core/dist/events.js
|
|
19896
|
-
function
|
|
20219
|
+
function iS() {
|
|
19897
20220
|
let e = /* @__PURE__ */ new Map();
|
|
19898
20221
|
return {
|
|
19899
20222
|
on(t, n) {
|
|
@@ -19911,12 +20234,12 @@ function rS() {
|
|
|
19911
20234
|
}
|
|
19912
20235
|
};
|
|
19913
20236
|
}
|
|
19914
|
-
({ ...
|
|
20237
|
+
({ ...nS }), { ...rS };
|
|
19915
20238
|
//#endregion
|
|
19916
20239
|
//#region ../mesurer-core/dist/plugins.js
|
|
19917
|
-
var
|
|
19918
|
-
function
|
|
19919
|
-
let e = 1, t = 0, n =
|
|
20240
|
+
var aS = 50;
|
|
20241
|
+
function oS() {
|
|
20242
|
+
let e = 1, t = 0, n = iS(), r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(), p = [], m = [], h = (e, t) => {
|
|
19920
20243
|
n.emit("changed", {
|
|
19921
20244
|
pluginId: e,
|
|
19922
20245
|
reason: t
|
|
@@ -19979,15 +20302,15 @@ function aS() {
|
|
|
19979
20302
|
}
|
|
19980
20303
|
if (o && s) {
|
|
19981
20304
|
let e = y("history");
|
|
19982
|
-
x(s, e) || (p.push(s), p.length >
|
|
20305
|
+
x(s, e) || (p.push(s), p.length > aS && p.shift(), m.length = 0);
|
|
19983
20306
|
}
|
|
19984
20307
|
return l;
|
|
19985
20308
|
}, w = () => {
|
|
19986
20309
|
let e = p.pop();
|
|
19987
|
-
return e ? (m.push(y("history")), m.length >
|
|
20310
|
+
return e ? (m.push(y("history")), m.length > aS && m.shift(), b(e, "history"), h(void 0, "history"), !0) : !1;
|
|
19988
20311
|
}, T = () => {
|
|
19989
20312
|
let e = m.pop();
|
|
19990
|
-
return e ? (p.push(y("history")), p.length >
|
|
20313
|
+
return e ? (p.push(y("history")), p.length > aS && p.shift(), b(e, "history"), h(void 0, "history"), !0) : !1;
|
|
19991
20314
|
}, E = async (e, t) => {
|
|
19992
20315
|
for (let n of [...l.values()].filter((t) => t.name === e)) await n.handler(t);
|
|
19993
20316
|
}, D = (e) => [...u.values()].reverse().find((t) => t.id === e)?.value, O = {
|
|
@@ -20144,8 +20467,8 @@ function aS() {
|
|
|
20144
20467
|
}
|
|
20145
20468
|
//#endregion
|
|
20146
20469
|
//#region ../mesurer-core/dist/runtime.js
|
|
20147
|
-
async function
|
|
20148
|
-
let t =
|
|
20470
|
+
async function sS(e = {}) {
|
|
20471
|
+
let t = oS();
|
|
20149
20472
|
try {
|
|
20150
20473
|
for (let n of e.plugins ?? []) await t.load(n);
|
|
20151
20474
|
return t;
|
|
@@ -20155,17 +20478,17 @@ async function oS(e = {}) {
|
|
|
20155
20478
|
}
|
|
20156
20479
|
//#endregion
|
|
20157
20480
|
//#region src/context.ts
|
|
20158
|
-
var
|
|
20481
|
+
var cS = 10, lS = (e) => ({
|
|
20159
20482
|
left: e.left,
|
|
20160
20483
|
top: e.top,
|
|
20161
20484
|
width: e.width,
|
|
20162
20485
|
height: e.height
|
|
20163
|
-
}),
|
|
20486
|
+
}), uS = (e) => {
|
|
20164
20487
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
20165
20488
|
for (let r of e) !r?.isConnected || t.has(r) || (t.add(r), n.push(r));
|
|
20166
20489
|
return n;
|
|
20167
|
-
},
|
|
20168
|
-
function
|
|
20490
|
+
}, dS = (e) => e.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random().toString(36).slice(2)}`;
|
|
20491
|
+
function fS(e) {
|
|
20169
20492
|
let { runtime: t, ownerDocument: n, ownerWindow: r } = e, i = e.request ?? { scope: "workspace" }, a = t.snapshot();
|
|
20170
20493
|
if (!a) throw Error("Mesurer workspace is not ready yet.");
|
|
20171
20494
|
let o = [], s = [], c = { kind: "workspace" }, l = /* @__PURE__ */ new Map();
|
|
@@ -20173,7 +20496,7 @@ function dS(e) {
|
|
|
20173
20496
|
let e = t.annotation(i.annotation);
|
|
20174
20497
|
if (!e) throw Error(`Mesurer annotation not found: ${i.annotation}`);
|
|
20175
20498
|
for (let t of e.resolvedTargets) t.element?.isConnected && l.set(t.element, t.target.id);
|
|
20176
|
-
o =
|
|
20499
|
+
o = uS(e.resolvedTargets.map((e) => e.element));
|
|
20177
20500
|
let n = t.annotationRect(e.id);
|
|
20178
20501
|
n && (s = [n]);
|
|
20179
20502
|
let r = e.resolvedTargets.length, a = e.resolvedTargets.filter((e) => e.element?.isConnected).length, u = e.anchor.kind === "region" ? "connected" : r === 0 || a === 0 ? "stale" : a === r ? "connected" : "partial";
|
|
@@ -20185,15 +20508,15 @@ function dS(e) {
|
|
|
20185
20508
|
};
|
|
20186
20509
|
} else if (i.scope === "selection") {
|
|
20187
20510
|
let e = t.currentSelection();
|
|
20188
|
-
if (o =
|
|
20189
|
-
s = e.region ? [e.region] : o.map((e) =>
|
|
20190
|
-
} else o =
|
|
20511
|
+
if (o = uS(e.elements), !o.length && !e.region) throw Error("Mesurer has no current selection.");
|
|
20512
|
+
s = e.region ? [e.region] : o.map((e) => lS(e.getBoundingClientRect())), c = { kind: "selection" };
|
|
20513
|
+
} else o = uS([
|
|
20191
20514
|
...t.currentSelection().elements,
|
|
20192
20515
|
...a.measurements.map((e) => e.elementRef),
|
|
20193
20516
|
a.activeMeasurement?.elementRef,
|
|
20194
20517
|
...a.heldDistances.flatMap((e) => [e.elementRefA, e.elementRefB])
|
|
20195
20518
|
]);
|
|
20196
|
-
let u = c.kind === "workspace" ? [] : s.length ? s : o.map((e) =>
|
|
20519
|
+
let u = c.kind === "workspace" ? [] : s.length ? s : o.map((e) => lS(e.getBoundingClientRect())), d = tS({
|
|
20197
20520
|
workspace: {
|
|
20198
20521
|
guides: a.guides,
|
|
20199
20522
|
measurements: a.measurements,
|
|
@@ -20205,8 +20528,8 @@ function dS(e) {
|
|
|
20205
20528
|
elements: o,
|
|
20206
20529
|
regions: u
|
|
20207
20530
|
},
|
|
20208
|
-
guideTolerance: a.guideRelevanceTolerance ??
|
|
20209
|
-
}), f = d.measurements, p = d.distances, m = d.guides, h =
|
|
20531
|
+
guideTolerance: a.guideRelevanceTolerance ?? cS
|
|
20532
|
+
}), f = d.measurements, p = d.distances, m = d.guides, h = uS([
|
|
20210
20533
|
...o,
|
|
20211
20534
|
...f.map((e) => e.elementRef),
|
|
20212
20535
|
...p.flatMap((e) => [e.elementRefA, e.elementRefB])
|
|
@@ -20218,12 +20541,12 @@ function dS(e) {
|
|
|
20218
20541
|
let t = l.get(e) ?? y();
|
|
20219
20542
|
return g.set(e, t), {
|
|
20220
20543
|
ref: t,
|
|
20221
|
-
inspection:
|
|
20544
|
+
inspection: Hx(e)
|
|
20222
20545
|
};
|
|
20223
20546
|
}), x = f.map((e) => {
|
|
20224
20547
|
let t = {
|
|
20225
20548
|
id: e.id,
|
|
20226
|
-
rect:
|
|
20549
|
+
rect: lS(e.rect),
|
|
20227
20550
|
deltaX: e.deltaX,
|
|
20228
20551
|
deltaY: e.deltaY
|
|
20229
20552
|
};
|
|
@@ -20233,8 +20556,8 @@ function dS(e) {
|
|
|
20233
20556
|
}), S = p.map((e) => {
|
|
20234
20557
|
let t = {
|
|
20235
20558
|
id: e.id,
|
|
20236
|
-
rectA:
|
|
20237
|
-
rectB:
|
|
20559
|
+
rectA: lS(e.rectA),
|
|
20560
|
+
rectB: lS(e.rectB),
|
|
20238
20561
|
horizontal: e.horizontal ? { ...e.horizontal } : null,
|
|
20239
20562
|
vertical: e.vertical ? { ...e.vertical } : null
|
|
20240
20563
|
}, n = e.elementRefA ? g.get(e.elementRefA) : void 0, r = e.elementRefB ? g.get(e.elementRefB) : void 0;
|
|
@@ -20242,7 +20565,7 @@ function dS(e) {
|
|
|
20242
20565
|
});
|
|
20243
20566
|
return {
|
|
20244
20567
|
schema: "mesurer.context/v1",
|
|
20245
|
-
id:
|
|
20568
|
+
id: dS(r),
|
|
20246
20569
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
20247
20570
|
scope: c,
|
|
20248
20571
|
page: {
|
|
@@ -20257,7 +20580,7 @@ function dS(e) {
|
|
|
20257
20580
|
scrollY: r.scrollY
|
|
20258
20581
|
},
|
|
20259
20582
|
coordinateSpace: "viewport-css-px",
|
|
20260
|
-
regions: c.kind === "workspace" ? [] : s.map(
|
|
20583
|
+
regions: c.kind === "workspace" ? [] : s.map(lS),
|
|
20261
20584
|
visualState: {
|
|
20262
20585
|
rulersVisible: a.rulersVisible,
|
|
20263
20586
|
xrayVisible: a.xrayVisible
|
|
@@ -20271,48 +20594,48 @@ function dS(e) {
|
|
|
20271
20594
|
}
|
|
20272
20595
|
};
|
|
20273
20596
|
}
|
|
20274
|
-
var
|
|
20275
|
-
function
|
|
20597
|
+
var pS = (e) => `${Math.round(e * 100) / 100}px`, mS = (e) => `x=${pS(e.left)} y=${pS(e.top)} w=${pS(e.width)} h=${pS(e.height)}`;
|
|
20598
|
+
function hS(e) {
|
|
20276
20599
|
let t = [
|
|
20277
20600
|
"Mesurer visual context",
|
|
20278
20601
|
"",
|
|
20279
20602
|
`Page: ${e.page.url}`,
|
|
20280
20603
|
`Viewport: ${e.viewport.width} × ${e.viewport.height} CSS px; scroll x=${e.viewport.scrollX} y=${e.viewport.scrollY}`
|
|
20281
20604
|
];
|
|
20282
|
-
if (e.scope.kind === "annotation" ? t.push("", "Annotation", e.scope.note, `Target status: ${e.scope.targetStatus}`) : t.push("", `Scope: ${e.scope.kind}`), e.regions.length && (t.push("", "Requested regions"), e.regions.forEach((e, n) => t.push(`- region-${n + 1}: ${
|
|
20605
|
+
if (e.scope.kind === "annotation" ? t.push("", "Annotation", e.scope.note, `Target status: ${e.scope.targetStatus}`) : t.push("", `Scope: ${e.scope.kind}`), e.regions.length && (t.push("", "Requested regions"), e.regions.forEach((e, n) => t.push(`- region-${n + 1}: ${mS(e)}`))), (e.visualState.rulersVisible || e.visualState.xrayVisible) && t.push("", `Visual state: rulers=${e.visualState.rulersVisible ? "on" : "off"}; x-ray=${e.visualState.xrayVisible ? "on" : "off"}`), e.targets.length) {
|
|
20283
20606
|
t.push("", "Targets");
|
|
20284
20607
|
for (let n of e.targets) {
|
|
20285
20608
|
let e = n.inspection;
|
|
20286
|
-
t.push(`[${n.ref}] ${e.selector}`, ` rect: ${
|
|
20609
|
+
t.push(`[${n.ref}] ${e.selector}`, ` rect: ${mS(e.rect)}`, ` margin: ${pS(e.margin.top)} ${pS(e.margin.right)} ${pS(e.margin.bottom)} ${pS(e.margin.left)}`, ` padding: ${pS(e.padding.top)} ${pS(e.padding.right)} ${pS(e.padding.bottom)} ${pS(e.padding.left)}`, ` layout: display=${e.layout.display}; position=${e.layout.position}; gap=${e.layout.gap}`, ` typography: ${e.typography.fontSize} / ${e.typography.lineHeight}; weight=${e.typography.fontWeight}; align=${e.typography.textAlign}`), e.text && t.push(` text: ${JSON.stringify(e.text)}`);
|
|
20287
20610
|
}
|
|
20288
20611
|
}
|
|
20289
20612
|
if (e.visualContext.guides.length) {
|
|
20290
20613
|
t.push("", "Relevant guides");
|
|
20291
|
-
for (let n of e.visualContext.guides) t.push(`- ${n.orientation} ${n.orientation === "vertical" ? "x" : "y"}=${
|
|
20614
|
+
for (let n of e.visualContext.guides) t.push(`- ${n.orientation} ${n.orientation === "vertical" ? "x" : "y"}=${pS(n.position)}`);
|
|
20292
20615
|
}
|
|
20293
20616
|
if (e.visualContext.layoutGuides.length) {
|
|
20294
20617
|
t.push("", "Layout guides");
|
|
20295
20618
|
for (let n of e.visualContext.layoutGuides) {
|
|
20296
20619
|
if (!n.visible) continue;
|
|
20297
|
-
let e = n.kind === "grid" ? `grid ${
|
|
20620
|
+
let e = n.kind === "grid" ? `grid ${pS(n.size)}` : `${n.count} ${n.kind}; gutter=${pS(n.gutter)}; offset=${pS(n.offset)}; align=${n.align}`;
|
|
20298
20621
|
t.push(`- ${e}; color=${n.color}; opacity=${Math.round(n.opacity * 100)}%`);
|
|
20299
20622
|
}
|
|
20300
20623
|
}
|
|
20301
20624
|
if (e.visualContext.measurements.length) {
|
|
20302
20625
|
t.push("", "Relevant measurements");
|
|
20303
|
-
for (let n of e.visualContext.measurements) t.push(`- ${n.targetRef ? `${n.targetRef}: ` : ""}${
|
|
20626
|
+
for (let n of e.visualContext.measurements) t.push(`- ${n.targetRef ? `${n.targetRef}: ` : ""}${mS(n.rect)}; delta=${pS(n.deltaX)} × ${pS(n.deltaY)}`);
|
|
20304
20627
|
}
|
|
20305
20628
|
if (e.visualContext.distances.length) {
|
|
20306
20629
|
t.push("", "Relevant distances");
|
|
20307
20630
|
for (let n of e.visualContext.distances) {
|
|
20308
|
-
let e = [n.targetARef, n.targetBRef].filter(Boolean).join(" → "), r = [n.horizontal ? `horizontal=${
|
|
20631
|
+
let e = [n.targetARef, n.targetBRef].filter(Boolean).join(" → "), r = [n.horizontal ? `horizontal=${pS(n.horizontal.value)}` : null, n.vertical ? `vertical=${pS(n.vertical.value)}` : null].filter(Boolean).join("; ");
|
|
20309
20632
|
t.push(`- ${e ? `${e}: ` : ""}${r || "overlapping"}`);
|
|
20310
20633
|
}
|
|
20311
20634
|
}
|
|
20312
20635
|
return t.join("\n").trimEnd();
|
|
20313
20636
|
}
|
|
20314
|
-
function
|
|
20315
|
-
let t =
|
|
20637
|
+
function gS(e) {
|
|
20638
|
+
let t = Qx([
|
|
20316
20639
|
...e.regions,
|
|
20317
20640
|
...e.targets.map((e) => e.inspection.rect),
|
|
20318
20641
|
...e.visualContext.measurements.map((e) => e.rect),
|
|
@@ -20342,7 +20665,7 @@ function hS(e) {
|
|
|
20342
20665
|
captures: n
|
|
20343
20666
|
};
|
|
20344
20667
|
}
|
|
20345
|
-
var
|
|
20668
|
+
var _S = (e, t, n, r, i) => {
|
|
20346
20669
|
!Number.isFinite(r) || !Number.isFinite(i) || Math.abs(r - i) < .01 || e.push({
|
|
20347
20670
|
kind: t,
|
|
20348
20671
|
label: n,
|
|
@@ -20351,16 +20674,16 @@ var gS = (e, t, n, r, i) => {
|
|
|
20351
20674
|
delta: i - r,
|
|
20352
20675
|
unit: "px"
|
|
20353
20676
|
});
|
|
20354
|
-
},
|
|
20677
|
+
}, vS = (e, t, n, r) => e.push({
|
|
20355
20678
|
kind: "missing",
|
|
20356
20679
|
evidence: t,
|
|
20357
20680
|
id: n,
|
|
20358
20681
|
label: r
|
|
20359
|
-
}),
|
|
20360
|
-
function
|
|
20682
|
+
}), yS = (e, t) => Math.abs(e.left - t.left) < .01 && Math.abs(e.top - t.top) < .01 && Math.abs(e.width - t.width) < .01 && Math.abs(e.height - t.height) < .01;
|
|
20683
|
+
function bS(e) {
|
|
20361
20684
|
let t = e.runtime.annotation(e.annotationId);
|
|
20362
20685
|
if (!t) throw Error(`Mesurer annotation not found: ${e.annotationId}`);
|
|
20363
|
-
let n =
|
|
20686
|
+
let n = fS({
|
|
20364
20687
|
runtime: e.runtime,
|
|
20365
20688
|
ownerDocument: e.ownerDocument,
|
|
20366
20689
|
ownerWindow: e.ownerWindow,
|
|
@@ -20370,42 +20693,42 @@ function yS(e) {
|
|
|
20370
20693
|
if (n.scope.kind !== "annotation") throw Error("Mesurer annotation context invariant failed.");
|
|
20371
20694
|
let r = e.runtime.snapshot();
|
|
20372
20695
|
if (!r) throw Error("Mesurer workspace is not ready yet.");
|
|
20373
|
-
let i =
|
|
20696
|
+
let i = eS({
|
|
20374
20697
|
measurements: r.measurements,
|
|
20375
20698
|
activeMeasurement: r.activeMeasurement
|
|
20376
20699
|
}), a = [];
|
|
20377
20700
|
for (let e of t.baseline.targets) {
|
|
20378
20701
|
let t = n.targets.find((t) => t.ref === e.id);
|
|
20379
20702
|
if (!t) {
|
|
20380
|
-
|
|
20703
|
+
vS(a, "target", e.id, e.selector);
|
|
20381
20704
|
continue;
|
|
20382
20705
|
}
|
|
20383
|
-
|
|
20706
|
+
_S(a, "target-rect", `${t.inspection.selector} left`, e.rect.left, t.inspection.rect.left), _S(a, "target-rect", `${t.inspection.selector} top`, e.rect.top, t.inspection.rect.top), _S(a, "target-rect", `${t.inspection.selector} width`, e.rect.width, t.inspection.rect.width), _S(a, "target-rect", `${t.inspection.selector} height`, e.rect.height, t.inspection.rect.height);
|
|
20384
20707
|
}
|
|
20385
20708
|
for (let e of t.baseline.guides) {
|
|
20386
20709
|
let t = n.visualContext.guides.find((t) => t.id === e.id) ?? r.guides.find((t) => t.id === e.id);
|
|
20387
20710
|
if (!t) {
|
|
20388
|
-
|
|
20711
|
+
vS(a, "guide", e.id, `${e.orientation} guide ${e.id}`);
|
|
20389
20712
|
continue;
|
|
20390
20713
|
}
|
|
20391
|
-
|
|
20714
|
+
_S(a, "guide", `${e.orientation} guide ${e.id}`, e.position, t.position);
|
|
20392
20715
|
}
|
|
20393
20716
|
for (let e of t.baseline.measurements) {
|
|
20394
20717
|
let r = n.visualContext.measurements.find((t) => t.id === e.id) ?? i.find((t) => t.id === e.id);
|
|
20395
20718
|
if (!r) {
|
|
20396
|
-
let r = t.baseline.targets.find((t) =>
|
|
20397
|
-
r && n.targets.some((e) => e.ref === r.id) ||
|
|
20719
|
+
let r = t.baseline.targets.find((t) => yS(t.rect, e.rect));
|
|
20720
|
+
r && n.targets.some((e) => e.ref === r.id) || vS(a, "measurement", e.id, e.id);
|
|
20398
20721
|
continue;
|
|
20399
20722
|
}
|
|
20400
|
-
|
|
20723
|
+
_S(a, "measurement", `${e.id} width`, e.rect.width, r.rect.width), _S(a, "measurement", `${e.id} height`, e.rect.height, r.rect.height);
|
|
20401
20724
|
}
|
|
20402
20725
|
for (let e of t.baseline.distances) {
|
|
20403
20726
|
let t = n.visualContext.distances.find((t) => t.id === e.id) ?? r.heldDistances.find((t) => t.id === e.id);
|
|
20404
20727
|
if (!t) {
|
|
20405
|
-
|
|
20728
|
+
vS(a, "distance", e.id, e.id);
|
|
20406
20729
|
continue;
|
|
20407
20730
|
}
|
|
20408
|
-
e.horizontal && t.horizontal ?
|
|
20731
|
+
e.horizontal && t.horizontal ? _S(a, "distance", `${e.id} horizontal`, e.horizontal.value, t.horizontal.value) : e.horizontal && !t.horizontal && vS(a, "distance", e.id, `${e.id} horizontal`), e.vertical && t.vertical ? _S(a, "distance", `${e.id} vertical`, e.vertical.value, t.vertical.value) : e.vertical && !t.vertical && vS(a, "distance", e.id, `${e.id} vertical`);
|
|
20409
20732
|
}
|
|
20410
20733
|
return {
|
|
20411
20734
|
schema: "mesurer.review/v1",
|
|
@@ -20417,7 +20740,7 @@ function yS(e) {
|
|
|
20417
20740
|
changes: a
|
|
20418
20741
|
};
|
|
20419
20742
|
}
|
|
20420
|
-
async function
|
|
20743
|
+
async function xS(e, t, n) {
|
|
20421
20744
|
try {
|
|
20422
20745
|
if (t.navigator.clipboard?.writeText) {
|
|
20423
20746
|
await t.navigator.clipboard.writeText(n);
|
|
@@ -20431,43 +20754,43 @@ async function bS(e, t, n) {
|
|
|
20431
20754
|
}
|
|
20432
20755
|
//#endregion
|
|
20433
20756
|
//#region src/layout-guides.ts
|
|
20434
|
-
var
|
|
20757
|
+
var SS = Kv, CS = qv, wS = () => ({
|
|
20435
20758
|
...yy(),
|
|
20436
|
-
version:
|
|
20437
|
-
}),
|
|
20759
|
+
version: Kx
|
|
20760
|
+
}), TS = "mesurer.context", ES = "context:v1", DS = "mesurer.context.settings", OS = "context.ui", kS = "data-mesurer-direct-text-edit-active", AS = {
|
|
20438
20761
|
viewBox: "0 0 256 256",
|
|
20439
20762
|
paths: ["M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"]
|
|
20440
|
-
},
|
|
20763
|
+
}, jS = {
|
|
20441
20764
|
viewBox: "0 0 256 256",
|
|
20442
20765
|
paths: ["M152,40a8,8,0,0,1-8,8H112a8,8,0,0,1,0-16h32A8,8,0,0,1,152,40Zm-8,168H112a8,8,0,0,0,0,16h32a8,8,0,0,0,0-16ZM208,32H184a8,8,0,0,0,0,16h24V72a8,8,0,0,0,16,0V48A16,16,0,0,0,208,32Zm8,72a8,8,0,0,0-8,8v32a8,8,0,0,0,16,0V112A8,8,0,0,0,216,104Zm0,72a8,8,0,0,0-8,8v24H184a8,8,0,0,0,0,16h24a16,16,0,0,0,16-16V184A8,8,0,0,0,216,176ZM40,152a8,8,0,0,0,8-8V112a8,8,0,0,0-16,0v32A8,8,0,0,0,40,152Zm32,56H48V184a8,8,0,0,0-16,0v24a16,16,0,0,0,16,16H72a8,8,0,0,0,0-16ZM72,32H48A16,16,0,0,0,32,48V72a8,8,0,0,0,16,0V48H72a8,8,0,0,0,0-16Z"]
|
|
20443
|
-
},
|
|
20766
|
+
}, MS = {
|
|
20444
20767
|
viewBox: "0 0 256 256",
|
|
20445
20768
|
paths: ["M229.66,58.34l-32-32a8,8,0,0,0-11.32,0l-96,96A8,8,0,0,0,88,128v32a8,8,0,0,0,8,8h32a8,8,0,0,0,5.66-2.34l96-96A8,8,0,0,0,229.66,58.34ZM124.69,152H104V131.31l64-64L188.69,88ZM200,76.69,179.31,56,192,43.31,212.69,64ZM224,128v80a16,16,0,0,1-16,16H48a16,16,0,0,1-16-16V48A16,16,0,0,1,48,32h80a8,8,0,0,1,0,16H48V208H208V128a8,8,0,0,1,16,0Z"]
|
|
20446
|
-
},
|
|
20769
|
+
}, NS = async (e, t, n = 1) => {
|
|
20447
20770
|
await e.fonts?.ready;
|
|
20448
20771
|
for (let e = 0; e < Math.max(1, n); e += 1) await new Promise((e) => t.requestAnimationFrame(() => e()));
|
|
20449
|
-
},
|
|
20450
|
-
let i = async (i) =>
|
|
20772
|
+
}, PS = (e, t, n, r) => {
|
|
20773
|
+
let i = async (i) => fS({
|
|
20451
20774
|
runtime: e,
|
|
20452
20775
|
ownerDocument: t,
|
|
20453
20776
|
ownerWindow: n,
|
|
20454
20777
|
request: i,
|
|
20455
20778
|
layoutGuides: r()
|
|
20456
|
-
}), a = async (e) =>
|
|
20779
|
+
}), a = async (e) => hS(await i(e));
|
|
20457
20780
|
return {
|
|
20458
20781
|
context: i,
|
|
20459
20782
|
contextText: a,
|
|
20460
|
-
copyContext: async (e) =>
|
|
20783
|
+
copyContext: async (e) => xS(t, n, await a(e)),
|
|
20461
20784
|
select: async (r) => {
|
|
20462
20785
|
let a = Array.isArray(r) ? [...r] : [String(r)];
|
|
20463
|
-
return e.select(a), await
|
|
20786
|
+
return e.select(a), await NS(t, n), i({ scope: "selection" });
|
|
20464
20787
|
},
|
|
20465
20788
|
annotations: async () => e.annotations(),
|
|
20466
20789
|
removeAnnotation: async (r) => {
|
|
20467
|
-
e.removeAnnotation(r), await
|
|
20790
|
+
e.removeAnnotation(r), await NS(t, n);
|
|
20468
20791
|
},
|
|
20469
20792
|
review: async (i) => {
|
|
20470
|
-
if (await
|
|
20793
|
+
if (await NS(t, n), i) return bS({
|
|
20471
20794
|
runtime: e,
|
|
20472
20795
|
ownerDocument: t,
|
|
20473
20796
|
ownerWindow: n,
|
|
@@ -20475,7 +20798,7 @@ var xS = Kv, SS = qv, CS = () => ({
|
|
|
20475
20798
|
layoutGuides: r()
|
|
20476
20799
|
});
|
|
20477
20800
|
let a = r();
|
|
20478
|
-
return e.annotations().map((r) =>
|
|
20801
|
+
return e.annotations().map((r) => bS({
|
|
20479
20802
|
runtime: e,
|
|
20480
20803
|
ownerDocument: t,
|
|
20481
20804
|
ownerWindow: n,
|
|
@@ -20483,38 +20806,38 @@ var xS = Kv, SS = qv, CS = () => ({
|
|
|
20483
20806
|
layoutGuides: a
|
|
20484
20807
|
}));
|
|
20485
20808
|
},
|
|
20486
|
-
capturePlan: async (e) =>
|
|
20809
|
+
capturePlan: async (e) => gS(await i(e)),
|
|
20487
20810
|
prepareCapture: async () => {
|
|
20488
|
-
e.prepareCapture(), await
|
|
20811
|
+
e.prepareCapture(), await NS(t, n);
|
|
20489
20812
|
},
|
|
20490
20813
|
finishCapture: async () => {
|
|
20491
|
-
e.finishCapture(), await
|
|
20814
|
+
e.finishCapture(), await NS(t, n);
|
|
20492
20815
|
}
|
|
20493
20816
|
};
|
|
20494
|
-
},
|
|
20817
|
+
}, FS = (e) => {
|
|
20495
20818
|
let t = e.currentSelection();
|
|
20496
20819
|
return t.elements.length > 0 || t.region !== null;
|
|
20497
20820
|
};
|
|
20498
|
-
function
|
|
20821
|
+
function IS(e = {}) {
|
|
20499
20822
|
return {
|
|
20500
|
-
id:
|
|
20501
|
-
version:
|
|
20823
|
+
id: TS,
|
|
20824
|
+
version: Kx,
|
|
20502
20825
|
requires: ["runtime:solid"],
|
|
20503
|
-
provides: [
|
|
20826
|
+
provides: [ES],
|
|
20504
20827
|
setup(t) {
|
|
20505
20828
|
let n = t.service.get("runtime:solid");
|
|
20506
20829
|
if (!n) throw Error("Mesurer context plugin requires the renderer runtime service.");
|
|
20507
|
-
let r = n.createWorkspaceRuntime(
|
|
20508
|
-
t.service.provide(
|
|
20509
|
-
id:
|
|
20830
|
+
let r = n.createWorkspaceRuntime(TS), i = PS(r, n.ownerDocument, n.ownerWindow, () => t.service.get(CS)?.list() ?? []);
|
|
20831
|
+
t.service.provide(ES, i), t.state.register({
|
|
20832
|
+
id: DS,
|
|
20510
20833
|
initial: { ui: e.ui ?? !0 },
|
|
20511
20834
|
persist: !0
|
|
20512
20835
|
}), t.state.register({
|
|
20513
|
-
id:
|
|
20514
|
-
initial: { hasSelection:
|
|
20836
|
+
id: OS,
|
|
20837
|
+
initial: { hasSelection: FS(r) }
|
|
20515
20838
|
});
|
|
20516
|
-
let a = () => t.state.get("mesurer.context.settings")?.ui ?? !0, o = () => t.state.get(
|
|
20517
|
-
t.state.update(
|
|
20839
|
+
let a = () => t.state.get("mesurer.context.settings")?.ui ?? !0, o = () => t.state.get(OS)?.hasSelection === !0, s = (e) => {
|
|
20840
|
+
t.state.update(DS, (t) => ({
|
|
20518
20841
|
...t,
|
|
20519
20842
|
ui: e
|
|
20520
20843
|
}));
|
|
@@ -20528,12 +20851,12 @@ function FS(e = {}) {
|
|
|
20528
20851
|
region: e.region ? { ...e.region } : null
|
|
20529
20852
|
}, r.selectGestureActive() ? c?.abandonNoteComposer() : n && c?.closeNoteComposer();
|
|
20530
20853
|
let i = e.elements.length > 0 || e.region !== null;
|
|
20531
|
-
i !== (t.state.get(
|
|
20854
|
+
i !== (t.state.get(OS)?.hasSelection ?? !1) && t.state.update(OS, () => ({ hasSelection: i }));
|
|
20532
20855
|
});
|
|
20533
20856
|
t.command.register("context.copy", () => i.copyContext()), t.command.register("context.copy-selection", () => i.copyContext({ scope: "selection" }));
|
|
20534
20857
|
let g = () => {
|
|
20535
20858
|
let e = u?.element;
|
|
20536
|
-
e && (n.rendererRoot?.hasAttribute(
|
|
20859
|
+
e && (n.rendererRoot?.hasAttribute(kS) ? e.setAttribute(kS, "true") : e.removeAttribute(kS));
|
|
20537
20860
|
}, _ = () => {
|
|
20538
20861
|
d?.disconnect(), d = null, c = null, l?.(), l = null, u?.dispose(), u = null;
|
|
20539
20862
|
}, v = () => {
|
|
@@ -20542,7 +20865,7 @@ function FS(e = {}) {
|
|
|
20542
20865
|
let e = new n.ownerWindow.MutationObserver(g);
|
|
20543
20866
|
d = e, e.observe(n.rendererRoot, {
|
|
20544
20867
|
attributes: !0,
|
|
20545
|
-
attributeFilter: [
|
|
20868
|
+
attributeFilter: [kS]
|
|
20546
20869
|
}), g();
|
|
20547
20870
|
}
|
|
20548
20871
|
let e = {
|
|
@@ -20566,7 +20889,7 @@ function FS(e = {}) {
|
|
|
20566
20889
|
command: "context.copy",
|
|
20567
20890
|
order: 70,
|
|
20568
20891
|
toolbarMode: "always",
|
|
20569
|
-
icon:
|
|
20892
|
+
icon: AS,
|
|
20570
20893
|
hidden: () => !a()
|
|
20571
20894
|
}), t.tool.register({
|
|
20572
20895
|
id: "context.copy-selection",
|
|
@@ -20575,7 +20898,7 @@ function FS(e = {}) {
|
|
|
20575
20898
|
command: "context.copy-selection",
|
|
20576
20899
|
order: 71,
|
|
20577
20900
|
toolbarMode: "always",
|
|
20578
|
-
icon:
|
|
20901
|
+
icon: jS,
|
|
20579
20902
|
hidden: () => !a(),
|
|
20580
20903
|
disabled: () => !o()
|
|
20581
20904
|
}), t.tool.register({
|
|
@@ -20585,7 +20908,7 @@ function FS(e = {}) {
|
|
|
20585
20908
|
command: "context.add-note",
|
|
20586
20909
|
order: 72,
|
|
20587
20910
|
toolbarMode: "always",
|
|
20588
|
-
icon:
|
|
20911
|
+
icon: MS,
|
|
20589
20912
|
hidden: () => !a(),
|
|
20590
20913
|
disabled: () => !o()
|
|
20591
20914
|
}), t.settings.register({
|
|
@@ -20608,7 +20931,7 @@ function FS(e = {}) {
|
|
|
20608
20931
|
}
|
|
20609
20932
|
//#endregion
|
|
20610
20933
|
//#region src/host-layer.ts
|
|
20611
|
-
var
|
|
20934
|
+
var LS = {
|
|
20612
20935
|
display: "block",
|
|
20613
20936
|
position: "fixed",
|
|
20614
20937
|
inset: "0",
|
|
@@ -20624,7 +20947,7 @@ var IS = {
|
|
|
20624
20947
|
overflow: "visible",
|
|
20625
20948
|
background: "transparent",
|
|
20626
20949
|
"box-sizing": "border-box",
|
|
20627
|
-
"pointer-events": "
|
|
20950
|
+
"pointer-events": "none",
|
|
20628
20951
|
"z-index": "2147483647",
|
|
20629
20952
|
opacity: "1",
|
|
20630
20953
|
visibility: "visible",
|
|
@@ -20650,48 +20973,48 @@ var IS = {
|
|
|
20650
20973
|
"letter-spacing": "normal",
|
|
20651
20974
|
direction: "ltr"
|
|
20652
20975
|
};
|
|
20653
|
-
function LS(e) {
|
|
20654
|
-
for (let [t, n] of Object.entries(IS)) e.style.setProperty(t, n, "important");
|
|
20655
|
-
}
|
|
20656
20976
|
function RS(e) {
|
|
20977
|
+
for (let [t, n] of Object.entries(LS)) e.style.setProperty(t, n, "important");
|
|
20978
|
+
}
|
|
20979
|
+
function zS(e) {
|
|
20657
20980
|
return "popover" in e && "showPopover" in e && typeof e.showPopover == "function" && "hidePopover" in e && typeof e.hidePopover == "function";
|
|
20658
20981
|
}
|
|
20659
|
-
var
|
|
20660
|
-
function
|
|
20661
|
-
if (!
|
|
20982
|
+
var BS = (e) => "newState" in e, VS = (e) => e.localName === "dialog";
|
|
20983
|
+
function HS(e) {
|
|
20984
|
+
if (!VS(e) || !e.open) return !1;
|
|
20662
20985
|
try {
|
|
20663
20986
|
return e.matches(":modal");
|
|
20664
20987
|
} catch {
|
|
20665
20988
|
return !1;
|
|
20666
20989
|
}
|
|
20667
20990
|
}
|
|
20668
|
-
function
|
|
20669
|
-
|
|
20991
|
+
function US(e, t, n = !0) {
|
|
20992
|
+
RS(e);
|
|
20670
20993
|
let r = e.ownerDocument, i = r.defaultView ?? window, a = t, o = !1, s = "fixed", c = !1, l = 0, u = [];
|
|
20671
|
-
if (n &&
|
|
20994
|
+
if (n && zS(e) && (e.popover = "manual"), t.append(e), n && zS(e)) try {
|
|
20672
20995
|
e.showPopover(), c = e.matches(":popover-open"), c && (s = "top-layer");
|
|
20673
20996
|
} catch {
|
|
20674
20997
|
e.removeAttribute("popover");
|
|
20675
20998
|
}
|
|
20676
20999
|
let d = () => {
|
|
20677
|
-
if (!(!c || !
|
|
21000
|
+
if (!(!c || !zS(e))) try {
|
|
20678
21001
|
e.matches(":popover-open") || e.showPopover();
|
|
20679
21002
|
} catch {}
|
|
20680
21003
|
}, f = (t) => {
|
|
20681
21004
|
if (e.parentNode === t) return;
|
|
20682
|
-
let n = c &&
|
|
20683
|
-
if (n &&
|
|
21005
|
+
let n = c && zS(e) && e.matches(":popover-open");
|
|
21006
|
+
if (n && zS(e)) try {
|
|
20684
21007
|
e.hidePopover();
|
|
20685
21008
|
} catch {}
|
|
20686
|
-
t.append(e),
|
|
21009
|
+
t.append(e), RS(e), n && d();
|
|
20687
21010
|
}, p = () => {
|
|
20688
|
-
u = u.filter((e) => e.isConnected &&
|
|
21011
|
+
u = u.filter((e) => e.isConnected && HS(e)), f(u.at(-1) ?? a);
|
|
20689
21012
|
}, m = (e) => {
|
|
20690
21013
|
u = u.filter((t) => t !== e), u.push(e), p();
|
|
20691
21014
|
}, h = (e) => {
|
|
20692
21015
|
u = u.filter((t) => t !== e), p();
|
|
20693
21016
|
}, g = () => {
|
|
20694
|
-
if (!(o || !c || !
|
|
21017
|
+
if (!(o || !c || !zS(e))) try {
|
|
20695
21018
|
e.matches(":popover-open") && e.hidePopover(), e.showPopover();
|
|
20696
21019
|
} catch {}
|
|
20697
21020
|
}, _ = () => {
|
|
@@ -20700,27 +21023,27 @@ function HS(e, t, n = !0) {
|
|
|
20700
21023
|
}));
|
|
20701
21024
|
}, v = (t) => {
|
|
20702
21025
|
if (!c || t.target === e) return;
|
|
20703
|
-
let n =
|
|
21026
|
+
let n = BS(t) ? t.newState : void 0, r = t.target;
|
|
20704
21027
|
if (r instanceof i.Element) {
|
|
20705
|
-
if (
|
|
20706
|
-
n === "open" &&
|
|
21028
|
+
if (VS(r)) {
|
|
21029
|
+
n === "open" && HS(r) ? (m(r), _()) : n === "closed" ? h(r) : n === "open" && _();
|
|
20707
21030
|
return;
|
|
20708
21031
|
}
|
|
20709
21032
|
n === "open" && r.hasAttribute("popover") && _();
|
|
20710
21033
|
}
|
|
20711
21034
|
}, y = (e) => {
|
|
20712
21035
|
let t = e.target;
|
|
20713
|
-
t instanceof i.Element &&
|
|
21036
|
+
t instanceof i.Element && VS(t) && h(t);
|
|
20714
21037
|
}, b = () => {
|
|
20715
21038
|
r.fullscreenElement && _();
|
|
20716
21039
|
}, x = (e) => {
|
|
20717
|
-
|
|
20718
|
-
for (let t of e.querySelectorAll("dialog"))
|
|
21040
|
+
HS(e) && m(e);
|
|
21041
|
+
for (let t of e.querySelectorAll("dialog")) HS(t) && m(t);
|
|
20719
21042
|
}, S = new i.MutationObserver((e) => {
|
|
20720
21043
|
if (c) for (let t of e) {
|
|
20721
21044
|
if (t.type === "attributes") {
|
|
20722
21045
|
let e = t.target;
|
|
20723
|
-
e instanceof i.Element &&
|
|
21046
|
+
e instanceof i.Element && VS(e) && (HS(e) ? m(e) : h(e));
|
|
20724
21047
|
}
|
|
20725
21048
|
for (let e of t.addedNodes) e instanceof i.Element && x(e);
|
|
20726
21049
|
u.some((e) => !e.isConnected) && p();
|
|
@@ -20736,7 +21059,7 @@ function HS(e, t, n = !0) {
|
|
|
20736
21059
|
bringToFront: g,
|
|
20737
21060
|
dispose() {
|
|
20738
21061
|
if (!o) {
|
|
20739
|
-
if (o = !0, l && i.cancelAnimationFrame(l), r.removeEventListener("toggle", v, !0), r.removeEventListener("close", y, !0), r.removeEventListener("fullscreenchange", b, !0), S.disconnect(), c &&
|
|
21062
|
+
if (o = !0, l && i.cancelAnimationFrame(l), r.removeEventListener("toggle", v, !0), r.removeEventListener("close", y, !0), r.removeEventListener("fullscreenchange", b, !0), S.disconnect(), c && zS(e) && e.matches(":popover-open")) try {
|
|
20740
21063
|
e.hidePopover();
|
|
20741
21064
|
} catch {}
|
|
20742
21065
|
u = [];
|
|
@@ -20746,28 +21069,28 @@ function HS(e, t, n = !0) {
|
|
|
20746
21069
|
}
|
|
20747
21070
|
//#endregion
|
|
20748
21071
|
//#region src/plugins/codex/index.ts
|
|
20749
|
-
var
|
|
21072
|
+
var WS = "mesurer.codex", GS = "codex:v1", KS = "mesurer.plugin.before-disable", qS = 2e3, JS = 750, YS = 1800, XS = 2e3, ZS = 12e4, QS = 10, $S = 5, eC = "Codex host connection is unavailable. Electron apps must expose window.__MESURER_HOST__.codexBridge from preload.", tC = [
|
|
20750
21073
|
"Implement the current human feedback from Mesurer in this project.",
|
|
20751
21074
|
"Treat the rendered page as the source of truth, preserve unrelated Mesurer review state,",
|
|
20752
21075
|
"and verify the affected UI in the live page with Mesurer before claiming completion."
|
|
20753
|
-
].join(" "),
|
|
21076
|
+
].join(" "), nC = {
|
|
20754
21077
|
viewBox: "0 0 256 256",
|
|
20755
21078
|
paths: ["M224,48,32,120l88,32,32,88Z M120,152l104-104"]
|
|
20756
|
-
},
|
|
21079
|
+
}, rC = {
|
|
20757
21080
|
viewBox: "0 0 256 256",
|
|
20758
21081
|
paths: ["M72,32H184a8,8,0,0,1,0,16h-8v20.69a40,40,0,0,1-11.72,28.28L137.25,124l27.03,27.03A40,40,0,0,1,176,179.31V208h8a8,8,0,0,1,0,16H72a8,8,0,0,1,0-16h8V179.31a40,40,0,0,1,11.72-28.28L118.75,124,91.72,96.97A40,40,0,0,1,80,68.69V48H72a8,8,0,0,1,0-16Zm24,16V68.69a24,24,0,0,0,7.03,16.97L128,110.63l24.97-24.97A24,24,0,0,0,160,68.69V48Zm32,90.63-24.97,24.97A24,24,0,0,0,96,180.57V208h64V180.57a24,24,0,0,0-7.03-16.97Z"]
|
|
20759
|
-
},
|
|
21082
|
+
}, iC = {
|
|
20760
21083
|
viewBox: "0 0 256 256",
|
|
20761
21084
|
paths: ["M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"]
|
|
20762
|
-
},
|
|
21085
|
+
}, aC = () => {
|
|
20763
21086
|
try {
|
|
20764
21087
|
let e = globalThis.location;
|
|
20765
21088
|
return e?.origin ? `mesurer-codex-ui:v2:${e.origin}${e.pathname}` : null;
|
|
20766
21089
|
} catch {
|
|
20767
21090
|
return null;
|
|
20768
21091
|
}
|
|
20769
|
-
},
|
|
20770
|
-
let e =
|
|
21092
|
+
}, oC = () => {
|
|
21093
|
+
let e = aC();
|
|
20771
21094
|
if (!e) return null;
|
|
20772
21095
|
try {
|
|
20773
21096
|
let t = globalThis.sessionStorage?.getItem(e);
|
|
@@ -20792,18 +21115,18 @@ var US = "mesurer.codex", WS = "codex:v1", GS = "mesurer.plugin.before-disable",
|
|
|
20792
21115
|
} catch {
|
|
20793
21116
|
return null;
|
|
20794
21117
|
}
|
|
20795
|
-
},
|
|
20796
|
-
let t =
|
|
21118
|
+
}, sC = (e) => {
|
|
21119
|
+
let t = aC();
|
|
20797
21120
|
if (t) try {
|
|
20798
21121
|
globalThis.sessionStorage?.setItem(t, JSON.stringify(e));
|
|
20799
21122
|
} catch {}
|
|
20800
|
-
},
|
|
21123
|
+
}, cC = async (e) => {
|
|
20801
21124
|
let t = window.__MESURER_HOST__?.codexBridge;
|
|
20802
|
-
if (!t) throw Error(
|
|
21125
|
+
if (!t) throw Error(eC);
|
|
20803
21126
|
let n = await t(e);
|
|
20804
21127
|
if (n.ok === !1) throw Error(n.error ?? "Codex Bridge request failed.");
|
|
20805
21128
|
return n;
|
|
20806
|
-
},
|
|
21129
|
+
}, lC = (e) => {
|
|
20807
21130
|
let t = e.runtime;
|
|
20808
21131
|
return !t || ![
|
|
20809
21132
|
"shared",
|
|
@@ -20821,10 +21144,10 @@ var US = "mesurer.codex", WS = "codex:v1", GS = "mesurer.plugin.before-disable",
|
|
|
20821
21144
|
available: t.available === !0,
|
|
20822
21145
|
reason: t.reason
|
|
20823
21146
|
};
|
|
20824
|
-
},
|
|
21147
|
+
}, uC = (e) => ({
|
|
20825
21148
|
thread: e.thread?.trim() || null,
|
|
20826
21149
|
threads: Array.isArray(e.threads) ? e.threads.filter((e) => e.trim().length > 0) : []
|
|
20827
|
-
}),
|
|
21150
|
+
}), dC = (e) => {
|
|
20828
21151
|
let t = e.deliveryId?.trim(), n = e.thread?.trim(), r = e.status;
|
|
20829
21152
|
if (!t || !n || !r) throw Error("Codex Bridge returned an invalid delivery state.");
|
|
20830
21153
|
let i = {
|
|
@@ -20836,7 +21159,7 @@ var US = "mesurer.codex", WS = "codex:v1", GS = "mesurer.plugin.before-disable",
|
|
|
20836
21159
|
updatedAt: Number.isFinite(e.updatedAt) ? Number(e.updatedAt) : 0
|
|
20837
21160
|
};
|
|
20838
21161
|
return e.queuedSubmissionId !== void 0 && (i.queuedSubmissionId = e.queuedSubmissionId?.trim() || null), e.dispatch !== void 0 && (i.dispatch = e.dispatch), e.dispatchError !== void 0 && (i.dispatchError = e.dispatchError?.trim() || null), i;
|
|
20839
|
-
},
|
|
21162
|
+
}, fC = (e) => ({
|
|
20840
21163
|
thread: e.thread?.trim() || null,
|
|
20841
21164
|
threads: Array.isArray(e.threadDetails) ? e.threadDetails.flatMap((e) => {
|
|
20842
21165
|
let t = e.id?.trim() ?? "";
|
|
@@ -20848,7 +21171,7 @@ var US = "mesurer.codex", WS = "codex:v1", GS = "mesurer.plugin.before-disable",
|
|
|
20848
21171
|
}] : [];
|
|
20849
21172
|
}) : [],
|
|
20850
21173
|
hasMore: e.hasMore === !0
|
|
20851
|
-
}),
|
|
21174
|
+
}), pC = async (e, t, n) => {
|
|
20852
21175
|
let r = t?.instruction?.trim() || n, i = await e.annotations(), a = t?.annotationIds, o = a ? a.flatMap((e) => {
|
|
20853
21176
|
let t = i.find((t) => t.id === e);
|
|
20854
21177
|
return t ? [t] : [];
|
|
@@ -20871,18 +21194,18 @@ var US = "mesurer.codex", WS = "codex:v1", GS = "mesurer.plugin.before-disable",
|
|
|
20871
21194
|
])
|
|
20872
21195
|
].join("\n").trimEnd()
|
|
20873
21196
|
};
|
|
20874
|
-
},
|
|
20875
|
-
function
|
|
20876
|
-
let t = e.instruction?.trim() ||
|
|
21197
|
+
}, mC = (e) => e.length > 16 ? `${e.slice(0, 8)}…${e.slice(-4)}` : e, hC = (e, t = 42) => e.length > t ? `${e.slice(0, t - 1)}…` : e, gC = (e) => e instanceof Error && (e.message === eC || e.message === "Codex Bridge is unavailable in this host." || e.message.includes("Codex Bridge lease"));
|
|
21198
|
+
function _C(e = {}) {
|
|
21199
|
+
let t = e.instruction?.trim() || tC, n = e.ui ?? !0, r = e.clearCompletedAnnotations ?? !0;
|
|
20877
21200
|
return {
|
|
20878
|
-
id:
|
|
20879
|
-
version:
|
|
20880
|
-
requires: [
|
|
20881
|
-
provides: [
|
|
21201
|
+
id: WS,
|
|
21202
|
+
version: Kx,
|
|
21203
|
+
requires: [ES],
|
|
21204
|
+
provides: [GS],
|
|
20882
21205
|
async setup(e) {
|
|
20883
|
-
let i = e.service.get(
|
|
21206
|
+
let i = e.service.get(ES);
|
|
20884
21207
|
if (!i) throw Error("Mesurer Codex plugin requires context() from mesurer-solid/plugins.");
|
|
20885
|
-
let a = n ?
|
|
21208
|
+
let a = n ? oC() : null, o = "unknown", s = null, c = !1, l = a?.originThread ?? null, u = a?.selectedThread ?? a?.originThread ?? null, d = !1, f = null, p = [], m = [], h = !1, g = $S, _, v = "", y = null, b = a?.delivery ? {
|
|
20886
21209
|
id: a.delivery.id,
|
|
20887
21210
|
thread: a.delivery.thread,
|
|
20888
21211
|
status: a.delivery.status,
|
|
@@ -20891,38 +21214,38 @@ function gC(e = {}) {
|
|
|
20891
21214
|
dispatch: a.delivery.dispatch ?? null,
|
|
20892
21215
|
dispatchError: a.delivery.dispatchError ?? null
|
|
20893
21216
|
} : null, x = 0, S = 0, C = null, w = !1, T = null, E = async (e) => {
|
|
20894
|
-
if (e.action === "activate" || e.action === "runtime") return
|
|
21217
|
+
if (e.action === "activate" || e.action === "runtime") return cC(e);
|
|
20895
21218
|
if (!T) throw Error("Codex Bridge lease is not active for this plugin.");
|
|
20896
|
-
return
|
|
21219
|
+
return cC({
|
|
20897
21220
|
...e,
|
|
20898
21221
|
leaseId: T
|
|
20899
21222
|
});
|
|
20900
21223
|
}, D = async () => {
|
|
20901
21224
|
let e = T;
|
|
20902
21225
|
if (e) {
|
|
20903
|
-
if ((await
|
|
21226
|
+
if ((await cC({
|
|
20904
21227
|
action: "deactivate",
|
|
20905
21228
|
leaseId: e
|
|
20906
21229
|
})).released !== !0) throw Error("Codex Bridge did not confirm lease release.");
|
|
20907
21230
|
T = null;
|
|
20908
21231
|
}
|
|
20909
|
-
}, O = await
|
|
21232
|
+
}, O = await cC({
|
|
20910
21233
|
action: "activate",
|
|
20911
21234
|
thread: u ?? l ?? void 0
|
|
20912
21235
|
}), k = O.leaseId?.trim();
|
|
20913
21236
|
if (!k) throw Error("Codex Bridge did not return an activation lease.");
|
|
20914
|
-
T = k, o = "available", s =
|
|
20915
|
-
let A =
|
|
21237
|
+
T = k, o = "available", s = lC(O);
|
|
21238
|
+
let A = uC(O);
|
|
20916
21239
|
c = !0, f = A.thread, p = A.threads, e.lifecycle.onDispose(() => {
|
|
20917
21240
|
T && D().catch((e) => {
|
|
20918
21241
|
let t = e instanceof Error ? e.message : String(e);
|
|
20919
21242
|
console.error(`[Mesurer] Failed to release Codex host lease: ${t}`);
|
|
20920
21243
|
});
|
|
20921
|
-
}), e.hook.on(
|
|
21244
|
+
}), e.hook.on(KS, async (e) => {
|
|
20922
21245
|
e === "mesurer.codex" && await D();
|
|
20923
21246
|
});
|
|
20924
21247
|
let j = async () => {
|
|
20925
|
-
let e =
|
|
21248
|
+
let e = lC(await E({ action: "runtime" }));
|
|
20926
21249
|
if (!e) throw Error("Codex Bridge returned an invalid runtime state.");
|
|
20927
21250
|
return s = e, e;
|
|
20928
21251
|
}, M = async () => {
|
|
@@ -20930,8 +21253,8 @@ function gC(e = {}) {
|
|
|
20930
21253
|
action: "health",
|
|
20931
21254
|
thread: u ?? l ?? void 0
|
|
20932
21255
|
});
|
|
20933
|
-
return s =
|
|
20934
|
-
}, N = M, P = async (e) =>
|
|
21256
|
+
return s = lC(e) ?? s, uC(e);
|
|
21257
|
+
}, N = M, P = async (e) => dC(await E({
|
|
20935
21258
|
action: "delivery",
|
|
20936
21259
|
deliveryId: e
|
|
20937
21260
|
})), F = async (e) => {
|
|
@@ -20941,13 +21264,13 @@ function gC(e = {}) {
|
|
|
20941
21264
|
deliveryId: e.id,
|
|
20942
21265
|
thread: e.thread
|
|
20943
21266
|
};
|
|
20944
|
-
return e.queuedSubmissionId && (t.queuedSubmissionId = e.queuedSubmissionId),
|
|
21267
|
+
return e.queuedSubmissionId && (t.queuedSubmissionId = e.queuedSubmissionId), dC(await E(t));
|
|
20945
21268
|
}, I = async (e = {}) => {
|
|
20946
21269
|
let t = {
|
|
20947
21270
|
action: "threads",
|
|
20948
|
-
limit: e.limit ??
|
|
21271
|
+
limit: e.limit ?? QS
|
|
20949
21272
|
}, n = e.thread?.trim();
|
|
20950
|
-
return n && (t.thread = n),
|
|
21273
|
+
return n && (t.thread = n), fC(await E(t));
|
|
20951
21274
|
}, L = () => u ?? l ?? (d ? null : f), R = () => {
|
|
20952
21275
|
if (!n) return;
|
|
20953
21276
|
let e = b?.id && (b.status === "queued" || b.status === "working" || b.status === "interrupted") ? {
|
|
@@ -20959,7 +21282,7 @@ function gC(e = {}) {
|
|
|
20959
21282
|
dispatch: b.dispatch,
|
|
20960
21283
|
dispatchError: b.dispatchError
|
|
20961
21284
|
} : null;
|
|
20962
|
-
|
|
21285
|
+
sC({
|
|
20963
21286
|
version: 1,
|
|
20964
21287
|
originThread: l,
|
|
20965
21288
|
selectedThread: u,
|
|
@@ -20977,12 +21300,12 @@ function gC(e = {}) {
|
|
|
20977
21300
|
"queueing",
|
|
20978
21301
|
"queued",
|
|
20979
21302
|
"working"
|
|
20980
|
-
].includes(b.status) ?
|
|
21303
|
+
].includes(b.status) ? rC : b.status === "completed" ? iC : nC : nC, ee = () => {
|
|
20981
21304
|
let e = [], t = /* @__PURE__ */ new Set(), n = (n) => {
|
|
20982
21305
|
t.has(n.id) || (t.add(n.id), e.push(n));
|
|
20983
21306
|
}, r = (e) => ({
|
|
20984
21307
|
id: e,
|
|
20985
|
-
title: `Codex ${
|
|
21308
|
+
title: `Codex ${mC(e)}`,
|
|
20986
21309
|
updatedAt: null,
|
|
20987
21310
|
connected: !0
|
|
20988
21311
|
});
|
|
@@ -21010,7 +21333,7 @@ function gC(e = {}) {
|
|
|
21010
21333
|
let t = e.id === l ? "Current · " : e.connected ? "Loaded · " : "", r = b?.thread === e.id ? ` · ${V(b.status)}` : "";
|
|
21011
21334
|
return {
|
|
21012
21335
|
id: `codex.thread.${e.id}`,
|
|
21013
|
-
label: `${t}${
|
|
21336
|
+
label: `${t}${hC(e.title)}${r}`,
|
|
21014
21337
|
checked: () => n === e.id,
|
|
21015
21338
|
disabled: () => B(),
|
|
21016
21339
|
run() {
|
|
@@ -21018,15 +21341,15 @@ function gC(e = {}) {
|
|
|
21018
21341
|
}
|
|
21019
21342
|
};
|
|
21020
21343
|
});
|
|
21021
|
-
return g <
|
|
21344
|
+
return g < QS && (e.length > g || h) && r.push({
|
|
21022
21345
|
id: "codex.thread.show-more",
|
|
21023
21346
|
label: "Show 5 more…",
|
|
21024
21347
|
run() {
|
|
21025
|
-
g =
|
|
21348
|
+
g = QS, W();
|
|
21026
21349
|
}
|
|
21027
21350
|
}), b?.queuedSubmissionId && b.status === "queued" && (b.dispatch === "desktop-opened" || b.dispatch === "desktop-wake-failed") && r.push({
|
|
21028
21351
|
id: "codex.delivery.receipt",
|
|
21029
|
-
label: `Receipt · ${
|
|
21352
|
+
label: `Receipt · ${mC(b.queuedSubmissionId)}`,
|
|
21030
21353
|
disabled: () => !0,
|
|
21031
21354
|
run: () => void 0
|
|
21032
21355
|
}), r;
|
|
@@ -21063,7 +21386,7 @@ function gC(e = {}) {
|
|
|
21063
21386
|
}, re = async (e) => {
|
|
21064
21387
|
if (o !== "available") return;
|
|
21065
21388
|
let t = await I({
|
|
21066
|
-
limit:
|
|
21389
|
+
limit: QS,
|
|
21067
21390
|
thread: e ?? void 0
|
|
21068
21391
|
});
|
|
21069
21392
|
m = t.threads, h = t.hasMore, p = t.threads.filter((e) => e.connected).map((e) => e.id), f = t.thread;
|
|
@@ -21085,7 +21408,7 @@ function gC(e = {}) {
|
|
|
21085
21408
|
}, ae = () => {
|
|
21086
21409
|
S && globalThis.clearTimeout(S), S = globalThis.setTimeout(() => {
|
|
21087
21410
|
S = 0, b?.status === "completed" && (b = null, R(), W());
|
|
21088
|
-
},
|
|
21411
|
+
}, YS);
|
|
21089
21412
|
}, oe = async (e) => {
|
|
21090
21413
|
if (!(!b || b.id !== e.id)) {
|
|
21091
21414
|
if (b = {
|
|
@@ -21107,14 +21430,14 @@ function gC(e = {}) {
|
|
|
21107
21430
|
if (e.status === "interrupted") {
|
|
21108
21431
|
R(), W();
|
|
21109
21432
|
let t = e.updatedAt > 0 ? e.updatedAt : Date.now();
|
|
21110
|
-
Date.now() - t <
|
|
21433
|
+
Date.now() - t < ZS && (x = globalThis.setTimeout(() => {
|
|
21111
21434
|
x = 0, se(e.id);
|
|
21112
|
-
},
|
|
21435
|
+
}, XS));
|
|
21113
21436
|
return;
|
|
21114
21437
|
}
|
|
21115
21438
|
W(), x = globalThis.setTimeout(() => {
|
|
21116
21439
|
x = 0, se(e.id);
|
|
21117
|
-
},
|
|
21440
|
+
}, JS);
|
|
21118
21441
|
}
|
|
21119
21442
|
}, se = async (e) => {
|
|
21120
21443
|
if (!(w || b?.id !== e)) try {
|
|
@@ -21138,7 +21461,7 @@ function gC(e = {}) {
|
|
|
21138
21461
|
b = {
|
|
21139
21462
|
...b,
|
|
21140
21463
|
status: "failed"
|
|
21141
|
-
}, R(),
|
|
21464
|
+
}, R(), gC(n) && (o = "unavailable"), W();
|
|
21142
21465
|
}
|
|
21143
21466
|
}, ce = {
|
|
21144
21467
|
health: M,
|
|
@@ -21150,11 +21473,11 @@ function gC(e = {}) {
|
|
|
21150
21473
|
let n = await E({
|
|
21151
21474
|
action: "target",
|
|
21152
21475
|
thread: t
|
|
21153
|
-
}), r =
|
|
21154
|
-
return s =
|
|
21476
|
+
}), r = uC(n);
|
|
21477
|
+
return s = lC(n) ?? s, z(t, !l), f = r.thread, p = r.threads, o = "available", c = !0, W(), r;
|
|
21155
21478
|
},
|
|
21156
21479
|
async queue(e) {
|
|
21157
|
-
let r = await
|
|
21480
|
+
let r = await pC(i, e, t), a = e?.thread?.trim(), s = a || (n ? L() : null);
|
|
21158
21481
|
if (n && !a && (d || !s)) throw Error("Choose a Codex thread before queueing feedback.");
|
|
21159
21482
|
let c = { message: r.message };
|
|
21160
21483
|
s && (c.thread = s);
|
|
@@ -21174,14 +21497,14 @@ function gC(e = {}) {
|
|
|
21174
21497
|
};
|
|
21175
21498
|
return e.queuedSubmissionId !== void 0 && (n.queuedSubmissionId = e.queuedSubmissionId?.trim() || null), e.dispatch !== void 0 && (n.dispatch = e.dispatch), e.dispatchError !== void 0 && (n.dispatchError = e.dispatchError?.trim() || null), n;
|
|
21176
21499
|
} catch (e) {
|
|
21177
|
-
throw n &&
|
|
21500
|
+
throw n && gC(e) && (o = "unavailable", W()), e;
|
|
21178
21501
|
}
|
|
21179
21502
|
},
|
|
21180
21503
|
send(e) {
|
|
21181
21504
|
return ce.queue(e);
|
|
21182
21505
|
}
|
|
21183
21506
|
};
|
|
21184
|
-
e.service.provide(
|
|
21507
|
+
e.service.provide(GS, ce);
|
|
21185
21508
|
let le = async () => {
|
|
21186
21509
|
if (!(C || B())) return ie(), b = {
|
|
21187
21510
|
id: null,
|
|
@@ -21212,9 +21535,9 @@ function gC(e = {}) {
|
|
|
21212
21535
|
updatedAt: 0
|
|
21213
21536
|
}) : x = globalThis.setTimeout(() => {
|
|
21214
21537
|
x = 0, se(e.deliveryId);
|
|
21215
|
-
},
|
|
21538
|
+
}, JS) : S = globalThis.setTimeout(() => {
|
|
21216
21539
|
S = 0, b?.id === null && b?.status === "queued" && (b = null, R(), W());
|
|
21217
|
-
},
|
|
21540
|
+
}, YS);
|
|
21218
21541
|
} catch (e) {
|
|
21219
21542
|
b = null, R(), W();
|
|
21220
21543
|
let t = e instanceof Error ? e.message : String(e);
|
|
@@ -21242,7 +21565,7 @@ function gC(e = {}) {
|
|
|
21242
21565
|
}, 0));
|
|
21243
21566
|
let t = globalThis.setInterval(() => {
|
|
21244
21567
|
c && te().catch(() => void 0);
|
|
21245
|
-
},
|
|
21568
|
+
}, qS);
|
|
21246
21569
|
e.lifecycle.onDispose(() => {
|
|
21247
21570
|
w = !0, ie(), globalThis.clearInterval(t), _?.dispose(), _ = void 0;
|
|
21248
21571
|
});
|
|
@@ -21252,66 +21575,66 @@ function gC(e = {}) {
|
|
|
21252
21575
|
}
|
|
21253
21576
|
//#endregion
|
|
21254
21577
|
//#region src/recording.ts
|
|
21255
|
-
var
|
|
21256
|
-
...
|
|
21257
|
-
version:
|
|
21258
|
-
}),
|
|
21259
|
-
...
|
|
21260
|
-
version:
|
|
21261
|
-
}),
|
|
21578
|
+
var vC = hb, yC = (e = {}) => ({
|
|
21579
|
+
...Lb(e),
|
|
21580
|
+
version: Kx
|
|
21581
|
+
}), bC = Yb, xC = (e = {}) => ({
|
|
21582
|
+
...hx(e),
|
|
21583
|
+
version: Kx
|
|
21584
|
+
}), SC = () => globalThis.window?.__MESURER_HOST__?.codexBridge !== void 0, CC = [
|
|
21262
21585
|
{
|
|
21263
|
-
id:
|
|
21586
|
+
id: TS,
|
|
21264
21587
|
label: "Context",
|
|
21265
21588
|
order: 30,
|
|
21266
|
-
create:
|
|
21589
|
+
create: IS,
|
|
21267
21590
|
settingsIds: ["context"],
|
|
21268
21591
|
hiddenSettingsControlIds: ["ui"]
|
|
21269
21592
|
},
|
|
21270
21593
|
{
|
|
21271
|
-
id:
|
|
21594
|
+
id: qx,
|
|
21272
21595
|
label: "Edit",
|
|
21273
21596
|
order: 35,
|
|
21274
|
-
create:
|
|
21597
|
+
create: Yx,
|
|
21275
21598
|
settingsIds: ["arrange"]
|
|
21276
21599
|
},
|
|
21277
21600
|
{
|
|
21278
|
-
id:
|
|
21601
|
+
id: SS,
|
|
21279
21602
|
label: "Layout Guides",
|
|
21280
21603
|
order: 38,
|
|
21281
|
-
create:
|
|
21604
|
+
create: wS
|
|
21282
21605
|
},
|
|
21283
21606
|
{
|
|
21284
|
-
id:
|
|
21607
|
+
id: bC,
|
|
21285
21608
|
label: "Screenshot",
|
|
21286
21609
|
order: 40,
|
|
21287
|
-
create:
|
|
21610
|
+
create: xC,
|
|
21288
21611
|
settingsIds: ["screenshot"],
|
|
21289
21612
|
hiddenSettingsControlIds: ["tool"]
|
|
21290
21613
|
},
|
|
21291
21614
|
{
|
|
21292
|
-
id:
|
|
21615
|
+
id: vC,
|
|
21293
21616
|
label: "Recording",
|
|
21294
21617
|
description: "Record a selected page region and trim, resize, or export it through MediaBunny.",
|
|
21295
21618
|
order: 42,
|
|
21296
|
-
create:
|
|
21619
|
+
create: yC,
|
|
21297
21620
|
settingsIds: ["recording"],
|
|
21298
21621
|
hiddenSettingsControlIds: ["tool"]
|
|
21299
21622
|
},
|
|
21300
21623
|
{
|
|
21301
|
-
id:
|
|
21624
|
+
id: WS,
|
|
21302
21625
|
label: "Codex",
|
|
21303
21626
|
description: "Connects Mesurer to open Codex threads on this computer. Electron hosts provide the native Codex connection through preload.",
|
|
21304
21627
|
order: 45,
|
|
21305
|
-
create:
|
|
21628
|
+
create: _C
|
|
21306
21629
|
}
|
|
21307
|
-
],
|
|
21308
|
-
let t = e !== void 0, n = new Map((e ?? []).map((e) => [e.id, e])), r = new Set(
|
|
21630
|
+
], wC = (e) => {
|
|
21631
|
+
let t = e !== void 0, n = new Map((e ?? []).map((e) => [e.id, e])), r = new Set(CC.map((e) => e.id)), i = CC.map((e) => {
|
|
21309
21632
|
let r = n.get(e.id);
|
|
21310
21633
|
return {
|
|
21311
21634
|
...e,
|
|
21312
21635
|
settingsIds: e.settingsIds ? [...e.settingsIds] : void 0,
|
|
21313
21636
|
hiddenSettingsControlIds: e.hiddenSettingsControlIds ? [...e.hiddenSettingsControlIds] : void 0,
|
|
21314
|
-
enabled: t ? !!r : e.id === "mesurer.codex" ?
|
|
21637
|
+
enabled: t ? !!r : e.id === "mesurer.codex" ? SC() : e.enabled !== !1,
|
|
21315
21638
|
create: r ? () => r : e.create
|
|
21316
21639
|
};
|
|
21317
21640
|
});
|
|
@@ -21322,16 +21645,16 @@ var _C = mb, vC = (e = {}) => ({
|
|
|
21322
21645
|
create: () => n
|
|
21323
21646
|
});
|
|
21324
21647
|
return i;
|
|
21325
|
-
},
|
|
21326
|
-
function
|
|
21327
|
-
return
|
|
21648
|
+
}, TC = (e) => e;
|
|
21649
|
+
function EC() {
|
|
21650
|
+
return oS();
|
|
21328
21651
|
}
|
|
21329
|
-
async function
|
|
21330
|
-
return
|
|
21652
|
+
async function DC(e = {}) {
|
|
21653
|
+
return sS(e);
|
|
21331
21654
|
}
|
|
21332
21655
|
//#endregion
|
|
21333
21656
|
//#region src/index.tsx
|
|
21334
|
-
var
|
|
21657
|
+
var OC = {
|
|
21335
21658
|
select: "select",
|
|
21336
21659
|
xray: "xray",
|
|
21337
21660
|
colorPicker: "color-picker",
|
|
@@ -21341,14 +21664,14 @@ var DC = {
|
|
|
21341
21664
|
distance: "distance",
|
|
21342
21665
|
settings: "settings"
|
|
21343
21666
|
};
|
|
21344
|
-
function
|
|
21667
|
+
function kC(e = {}) {
|
|
21345
21668
|
if (!("document" in globalThis)) throw Error("mountMesurer() requires a browser or Electron renderer document.");
|
|
21346
21669
|
let { target: t = document.body, isolate: n = !0, shadowMode: r = "open", topLayer: i = !0, agent: a = !1, signal: o, onPluginHost: s, onPluginsReady: c, plugins: l, excludeBuiltins: u, excludePlugins: d, ...f } = e;
|
|
21347
21670
|
if (o?.aborted) throw o.reason ?? new DOMException("Mesurer mount aborted.", "AbortError");
|
|
21348
21671
|
if (!t) throw Error("mountMesurer() requires document.body to exist or an explicit target.");
|
|
21349
21672
|
let p = t.ownerDocument ?? document, m = p.defaultView ?? window, h = p.createElement("div");
|
|
21350
21673
|
h.dataset.mesurerIsland = "true";
|
|
21351
|
-
let g =
|
|
21674
|
+
let g = US(h, t, i), _ = h, v = h, y = h;
|
|
21352
21675
|
if (n) {
|
|
21353
21676
|
let e = h.attachShadow({ mode: r });
|
|
21354
21677
|
v = p.createElement("div"), v.dataset.mesurerIslandMount = "true", e.append(v), _ = e, y = e;
|
|
@@ -21359,7 +21682,7 @@ function OC(e = {}) {
|
|
|
21359
21682
|
C = e, w = t;
|
|
21360
21683
|
});
|
|
21361
21684
|
D.catch(() => void 0), O.catch(() => void 0);
|
|
21362
|
-
let k = async () => (await (b ? Promise.resolve(b) : D), O), A = a === !0 ? {} : a === !1 ? null : a, j =
|
|
21685
|
+
let k = async () => (await (b ? Promise.resolve(b) : D), O), A = a === !0 ? {} : a === !1 ? null : a, j = Gx({
|
|
21363
21686
|
ownerDocument: p,
|
|
21364
21687
|
root: A?.root ?? (t.nodeType === 11 ? t : p),
|
|
21365
21688
|
getPluginHost: () => b,
|
|
@@ -21371,12 +21694,12 @@ function OC(e = {}) {
|
|
|
21371
21694
|
return t;
|
|
21372
21695
|
}, N = async () => {
|
|
21373
21696
|
await j.ready();
|
|
21374
|
-
let e = b?.service.get(
|
|
21697
|
+
let e = b?.service.get(ES);
|
|
21375
21698
|
if (!e) throw Error("Mesurer Context is disabled. Enable it in Settings or include context() in plugins.");
|
|
21376
21699
|
return e;
|
|
21377
21700
|
}, P = async () => {
|
|
21378
21701
|
await j.ready();
|
|
21379
|
-
let e = b?.service.get(
|
|
21702
|
+
let e = b?.service.get(Xx);
|
|
21380
21703
|
if (!e) throw Error("Mesurer Edit is disabled. Enable it in Settings or include edit() in plugins.");
|
|
21381
21704
|
return e;
|
|
21382
21705
|
}, F = async (e) => (await N()).context(e), I = async (e) => (await N()).contextText(e), L = async (e) => (await N()).copyContext(e), R = async (e) => (await N()).select(e), z = async () => (await N()).annotations(), B = async (e) => (await N()).review(e), V = async (e) => (await N()).capturePlan(e), H = async () => (await N()).prepareCapture(), U = async () => (await N()).finishCapture(), ee = async () => (await P()).intents(), te = async (e) => {
|
|
@@ -21387,7 +21710,7 @@ function OC(e = {}) {
|
|
|
21387
21710
|
(await P()).show(e, t);
|
|
21388
21711
|
}, W = async (e, t) => (await P()).capturePlan(e, t), re = async (e, t) => (await P()).review(e, t), ie = () => j.textEdits(), ae = (e) => j.textEdit(e), oe = Object.assign(j, {
|
|
21389
21712
|
capabilities: () => {
|
|
21390
|
-
let e = !!b?.service.get(
|
|
21713
|
+
let e = !!b?.service.get(ES);
|
|
21391
21714
|
return {
|
|
21392
21715
|
protocol: "mesurer.agent/v1",
|
|
21393
21716
|
contextSchema: "mesurer.context/v1",
|
|
@@ -21397,8 +21720,8 @@ function OC(e = {}) {
|
|
|
21397
21720
|
annotations: e,
|
|
21398
21721
|
review: e,
|
|
21399
21722
|
capturePlan: e,
|
|
21400
|
-
arrange: !!b?.service.get(
|
|
21401
|
-
textEdit: !!b?.service.get(
|
|
21723
|
+
arrange: !!b?.service.get(Xx),
|
|
21724
|
+
textEdit: !!b?.service.get(Ux)
|
|
21402
21725
|
}
|
|
21403
21726
|
};
|
|
21404
21727
|
},
|
|
@@ -21417,9 +21740,9 @@ function OC(e = {}) {
|
|
|
21417
21740
|
reviewArrange: re
|
|
21418
21741
|
}), se = {
|
|
21419
21742
|
...f,
|
|
21420
|
-
version:
|
|
21421
|
-
plugins:
|
|
21422
|
-
excludePlugins: u ? u.map((e) =>
|
|
21743
|
+
version: Kx,
|
|
21744
|
+
plugins: wC(l),
|
|
21745
|
+
excludePlugins: u ? u.map((e) => OC[e]) : [...d ?? []]
|
|
21423
21746
|
}, ce = Oi(() => Yr(rv, Di(se, {
|
|
21424
21747
|
portalTarget: y,
|
|
21425
21748
|
pageTarget: t,
|
|
@@ -21488,6 +21811,6 @@ function OC(e = {}) {
|
|
|
21488
21811
|
}
|
|
21489
21812
|
return he;
|
|
21490
21813
|
}
|
|
21491
|
-
var
|
|
21814
|
+
var AC = kC;
|
|
21492
21815
|
//#endregion
|
|
21493
|
-
export {
|
|
21816
|
+
export { Ux as MESURER_TEXT_EDIT_SERVICE_ID, Kx as MESURER_VERSION, fS as captureMesurerContext, xS as copyTextToClipboard, Gx as createMesurerAgentHarness, gS as createMesurerCapturePlan, EC as createMesurerPluginHost, DC as createMesurerRuntime, TC as defineMesurerPlugin, hS as formatMesurerContext, AC as mountMeasurer, kC as mountMesurer, bS as reviewMesurerAnnotation };
|