@backmatter/studio 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{UiKitApp-b8qFsmA-.js → UiKitApp-BxvTwsko.js} +195 -186
- package/dist/chunks/{dashboard-BNUcbYU0.js → dashboard-8rjkfEXl.js} +1 -1
- package/dist/dashboard.js +1 -1
- package/dist/site-widget.js +84 -75
- package/package.json +1 -1
- package/src/preview-frame.tsx +19 -4
- package/src/site-bar.tsx +21 -2
|
@@ -1701,7 +1701,7 @@ function kr(e) {
|
|
|
1701
1701
|
const t = e.replace(/\/$/, "") || "/";
|
|
1702
1702
|
return t === "/__ui" || /^\/__ui\/[^/]+$/.test(t);
|
|
1703
1703
|
}
|
|
1704
|
-
const Sr = et(() => import("./UiKitApp-
|
|
1704
|
+
const Sr = et(() => import("./UiKitApp-BxvTwsko.js").then((e) => ({
|
|
1705
1705
|
default: e.UiKitApp
|
|
1706
1706
|
})));
|
|
1707
1707
|
function Pr() {
|
package/dist/dashboard.js
CHANGED
package/dist/site-widget.js
CHANGED
|
@@ -29204,6 +29204,11 @@ function Vu(e, t) {
|
|
|
29204
29204
|
}
|
|
29205
29205
|
const ei = "backmatter-preview-frame";
|
|
29206
29206
|
function xL() {
|
|
29207
|
+
if (typeof navigator > "u") return Promise.resolve(void 0);
|
|
29208
|
+
const e = navigator.userAgentData;
|
|
29209
|
+
return e != null && e.getHighEntropyValues ? e.getHighEntropyValues(["platformVersion"]).then((t) => t.platformVersion) : Promise.resolve(void 0);
|
|
29210
|
+
}
|
|
29211
|
+
function vL() {
|
|
29207
29212
|
return typeof navigator > "u" ? Ev : Vu(navigator.userAgent);
|
|
29208
29213
|
}
|
|
29209
29214
|
function pm(e) {
|
|
@@ -29215,10 +29220,10 @@ function pm(e) {
|
|
|
29215
29220
|
if (Number.isFinite(n) && n >= 0) return n;
|
|
29216
29221
|
}
|
|
29217
29222
|
}
|
|
29218
|
-
return
|
|
29223
|
+
return vL();
|
|
29219
29224
|
}
|
|
29220
29225
|
const Rv = "oklch(0.56 0.21 295)";
|
|
29221
|
-
function
|
|
29226
|
+
function wL({
|
|
29222
29227
|
active: e,
|
|
29223
29228
|
radius: t
|
|
29224
29229
|
}) {
|
|
@@ -29229,10 +29234,8 @@ function vL({
|
|
|
29229
29234
|
return;
|
|
29230
29235
|
}
|
|
29231
29236
|
const s = navigator.userAgent;
|
|
29232
|
-
i(Vu(s))
|
|
29233
|
-
|
|
29234
|
-
a != null && a.getHighEntropyValues && a.getHighEntropyValues(["platformVersion"]).then((u) => {
|
|
29235
|
-
i(Vu(s, u.platformVersion));
|
|
29237
|
+
i(Vu(s)), xL().then((a) => {
|
|
29238
|
+
a !== void 0 && i(Vu(s, a));
|
|
29236
29239
|
});
|
|
29237
29240
|
}, [t]), Cn(() => {
|
|
29238
29241
|
const s = n.current, a = r.current;
|
|
@@ -29245,7 +29248,7 @@ function vL({
|
|
|
29245
29248
|
{ duration: 700, delay: 180, easing: vo }
|
|
29246
29249
|
);
|
|
29247
29250
|
}, [e]), /* @__PURE__ */ V(At, { children: [
|
|
29248
|
-
/* @__PURE__ */ k("style", { children:
|
|
29251
|
+
/* @__PURE__ */ k("style", { children: kL }),
|
|
29249
29252
|
/* @__PURE__ */ k(
|
|
29250
29253
|
"div",
|
|
29251
29254
|
{
|
|
@@ -29259,7 +29262,7 @@ function vL({
|
|
|
29259
29262
|
)
|
|
29260
29263
|
] });
|
|
29261
29264
|
}
|
|
29262
|
-
const
|
|
29265
|
+
const kL = `
|
|
29263
29266
|
.${ei} {
|
|
29264
29267
|
position: fixed;
|
|
29265
29268
|
inset: 0;
|
|
@@ -29287,11 +29290,11 @@ const wL = `
|
|
|
29287
29290
|
opacity: 1;
|
|
29288
29291
|
}
|
|
29289
29292
|
}
|
|
29290
|
-
`, T = "backmatter-devbar",
|
|
29293
|
+
`, T = "backmatter-devbar", SL = "/api/backmatter/preview", EL = 10, CL = 360;
|
|
29291
29294
|
function hm(e, t) {
|
|
29292
29295
|
return `${e}:${t.trim().toLowerCase()}`;
|
|
29293
29296
|
}
|
|
29294
|
-
function
|
|
29297
|
+
function RL({
|
|
29295
29298
|
label: e,
|
|
29296
29299
|
branch: t,
|
|
29297
29300
|
tree: n,
|
|
@@ -29302,7 +29305,7 @@ function CL({
|
|
|
29302
29305
|
changeCount: a,
|
|
29303
29306
|
lineDiff: u,
|
|
29304
29307
|
activity: l = null,
|
|
29305
|
-
previewEntryPath: c =
|
|
29308
|
+
previewEntryPath: c = SL,
|
|
29306
29309
|
siteMode: f = "preview",
|
|
29307
29310
|
frame: p = !1,
|
|
29308
29311
|
frameRadius: d,
|
|
@@ -29387,7 +29390,7 @@ function CL({
|
|
|
29387
29390
|
return document.addEventListener("pointerdown", X), () => document.removeEventListener("pointerdown", X);
|
|
29388
29391
|
}, [Z]), Cn(() => {
|
|
29389
29392
|
const X = D.current, se = A.current;
|
|
29390
|
-
!X || !se || Z !== "settings" ||
|
|
29393
|
+
!X || !se || Z !== "settings" || ML(X, se);
|
|
29391
29394
|
}, [Z, I, ut]), Cn(() => {
|
|
29392
29395
|
if (!C) return;
|
|
29393
29396
|
const X = z.current;
|
|
@@ -29401,7 +29404,7 @@ function CL({
|
|
|
29401
29404
|
};
|
|
29402
29405
|
}, [s, C, ut, I]), Oe(() => {
|
|
29403
29406
|
function X(se) {
|
|
29404
|
-
if (!
|
|
29407
|
+
if (!OL(se.composedPath()[0] ?? null)) {
|
|
29405
29408
|
if ((se.metaKey || se.ctrlKey) && se.key === ".") {
|
|
29406
29409
|
se.preventDefault(), ae.current.toggleHidden();
|
|
29407
29410
|
return;
|
|
@@ -29556,7 +29559,7 @@ function CL({
|
|
|
29556
29559
|
s && v(), O((X) => X === "page" ? null : "page");
|
|
29557
29560
|
}
|
|
29558
29561
|
const Xe = !!o || We === "live" && !y, Et = !r || a <= 0, tt = /* @__PURE__ */ k(
|
|
29559
|
-
|
|
29562
|
+
IL,
|
|
29560
29563
|
{
|
|
29561
29564
|
mode: We,
|
|
29562
29565
|
disabled: Xe,
|
|
@@ -29578,7 +29581,7 @@ function CL({
|
|
|
29578
29581
|
tt,
|
|
29579
29582
|
/* @__PURE__ */ k("span", { className: `${T}-steps`, children: l.steps.map((X, se) => /* @__PURE__ */ V("span", { className: `${T}-step`, children: [
|
|
29580
29583
|
se > 0 ? /* @__PURE__ */ k("span", { className: `${T}-dash`, "aria-hidden": !0, children: "—" }) : null,
|
|
29581
|
-
/* @__PURE__ */ k(
|
|
29584
|
+
/* @__PURE__ */ k(_L, { state: X.state }),
|
|
29582
29585
|
/* @__PURE__ */ k("span", { children: X.label })
|
|
29583
29586
|
] }, `${X.label}:${se}`)) })
|
|
29584
29587
|
] }) : (l == null ? void 0 : l.type) === "published" ? gt = /* @__PURE__ */ V(At, { children: [
|
|
@@ -29605,7 +29608,7 @@ function CL({
|
|
|
29605
29608
|
] }) : gt = /* @__PURE__ */ V(At, { children: [
|
|
29606
29609
|
tt,
|
|
29607
29610
|
/* @__PURE__ */ k(
|
|
29608
|
-
|
|
29611
|
+
BL,
|
|
29609
29612
|
{
|
|
29610
29613
|
label: e,
|
|
29611
29614
|
doc: r,
|
|
@@ -29627,7 +29630,7 @@ function CL({
|
|
|
29627
29630
|
}
|
|
29628
29631
|
),
|
|
29629
29632
|
/* @__PURE__ */ k(
|
|
29630
|
-
|
|
29633
|
+
TL,
|
|
29631
29634
|
{
|
|
29632
29635
|
buttonRef: z,
|
|
29633
29636
|
open: s,
|
|
@@ -29637,7 +29640,7 @@ function CL({
|
|
|
29637
29640
|
}
|
|
29638
29641
|
),
|
|
29639
29642
|
/* @__PURE__ */ k(
|
|
29640
|
-
|
|
29643
|
+
$L,
|
|
29641
29644
|
{
|
|
29642
29645
|
buttonRef: A,
|
|
29643
29646
|
open: Z === "settings",
|
|
@@ -29646,7 +29649,7 @@ function CL({
|
|
|
29646
29649
|
)
|
|
29647
29650
|
] });
|
|
29648
29651
|
const vt = /* @__PURE__ */ V(At, { children: [
|
|
29649
|
-
/* @__PURE__ */ k("style", { children:
|
|
29652
|
+
/* @__PURE__ */ k("style", { children: WL }),
|
|
29650
29653
|
/* @__PURE__ */ V(
|
|
29651
29654
|
"div",
|
|
29652
29655
|
{
|
|
@@ -29655,7 +29658,7 @@ function CL({
|
|
|
29655
29658
|
"data-mode": We,
|
|
29656
29659
|
"data-branch": t || void 0,
|
|
29657
29660
|
children: [
|
|
29658
|
-
p ? /* @__PURE__ */ k(
|
|
29661
|
+
p ? /* @__PURE__ */ k(wL, { active: We === "preview", radius: d }) : null,
|
|
29659
29662
|
/* @__PURE__ */ V(
|
|
29660
29663
|
"footer",
|
|
29661
29664
|
{
|
|
@@ -29684,7 +29687,7 @@ function CL({
|
|
|
29684
29687
|
}
|
|
29685
29688
|
),
|
|
29686
29689
|
/* @__PURE__ */ k(
|
|
29687
|
-
|
|
29690
|
+
AL,
|
|
29688
29691
|
{
|
|
29689
29692
|
open: Z === "settings",
|
|
29690
29693
|
pane: Pe,
|
|
@@ -29711,7 +29714,7 @@ function CL({
|
|
|
29711
29714
|
}
|
|
29712
29715
|
),
|
|
29713
29716
|
t ? /* @__PURE__ */ k(
|
|
29714
|
-
|
|
29717
|
+
VL,
|
|
29715
29718
|
{
|
|
29716
29719
|
branch: t,
|
|
29717
29720
|
tree: n,
|
|
@@ -29727,11 +29730,17 @@ function CL({
|
|
|
29727
29730
|
)
|
|
29728
29731
|
] });
|
|
29729
29732
|
return /* @__PURE__ */ V("div", { ref: Y, className: `${T}-host`, "data-backmatter-devbar": "", children: [
|
|
29730
|
-
/* @__PURE__ */ k("style", { children:
|
|
29731
|
-
U ? ia(vt, U) : /* @__PURE__ */ k(
|
|
29733
|
+
/* @__PURE__ */ k("style", { children: ZL }),
|
|
29734
|
+
U ? ia(vt, U) : /* @__PURE__ */ k(
|
|
29735
|
+
"template",
|
|
29736
|
+
{
|
|
29737
|
+
shadowrootmode: "open",
|
|
29738
|
+
children: vt
|
|
29739
|
+
}
|
|
29740
|
+
)
|
|
29732
29741
|
] });
|
|
29733
29742
|
}
|
|
29734
|
-
function
|
|
29743
|
+
function IL({
|
|
29735
29744
|
mode: e,
|
|
29736
29745
|
disabled: t,
|
|
29737
29746
|
buttonRef: n,
|
|
@@ -29751,7 +29760,7 @@ function RL({
|
|
|
29751
29760
|
disabled: t,
|
|
29752
29761
|
onClick: r,
|
|
29753
29762
|
children: [
|
|
29754
|
-
/* @__PURE__ */ k(
|
|
29763
|
+
/* @__PURE__ */ k(PL, { exit: o }),
|
|
29755
29764
|
o ? "Exit preview" : "Enter preview"
|
|
29756
29765
|
]
|
|
29757
29766
|
}
|
|
@@ -29783,7 +29792,7 @@ function mm({
|
|
|
29783
29792
|
}
|
|
29784
29793
|
);
|
|
29785
29794
|
}
|
|
29786
|
-
function
|
|
29795
|
+
function TL({
|
|
29787
29796
|
buttonRef: e,
|
|
29788
29797
|
open: t,
|
|
29789
29798
|
count: n,
|
|
@@ -29813,13 +29822,13 @@ function IL({
|
|
|
29813
29822
|
}
|
|
29814
29823
|
);
|
|
29815
29824
|
}
|
|
29816
|
-
function
|
|
29825
|
+
function PL({ exit: e }) {
|
|
29817
29826
|
return e ? /* @__PURE__ */ k("svg", { className: `${T}-mark`, width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": !0, children: /* @__PURE__ */ k("path", { d: "M3 3l6 6M9 3 3 9", stroke: "currentColor", strokeWidth: "1.25", strokeLinecap: "round" }) }) : /* @__PURE__ */ V("svg", { className: `${T}-mark`, width: "12", height: "12", viewBox: "0 0 12 12", "aria-hidden": !0, children: [
|
|
29818
29827
|
/* @__PURE__ */ k("circle", { cx: "6", cy: "6", r: "3.25", stroke: "currentColor", strokeWidth: "1.25" }),
|
|
29819
29828
|
/* @__PURE__ */ k("circle", { cx: "6", cy: "6", r: "1.35", fill: "currentColor" })
|
|
29820
29829
|
] });
|
|
29821
29830
|
}
|
|
29822
|
-
function
|
|
29831
|
+
function _L({ state: e }) {
|
|
29823
29832
|
return e === "done" ? /* @__PURE__ */ k("span", { className: `${T}-done`, "aria-hidden": !0, children: "✓" }) : e === "active" ? /* @__PURE__ */ k("span", { className: `${T}-spin`, "aria-hidden": !0 }) : /* @__PURE__ */ k("span", { className: `${T}-ring`, "aria-hidden": !0 });
|
|
29824
29833
|
}
|
|
29825
29834
|
function Hl(e, t = {}) {
|
|
@@ -29838,12 +29847,12 @@ function Hl(e, t = {}) {
|
|
|
29838
29847
|
);
|
|
29839
29848
|
});
|
|
29840
29849
|
}
|
|
29841
|
-
function
|
|
29850
|
+
function OL(e) {
|
|
29842
29851
|
if (!(e instanceof HTMLElement)) return !1;
|
|
29843
29852
|
const t = e.tagName;
|
|
29844
29853
|
return t === "INPUT" || t === "TEXTAREA" || t === "SELECT" ? !0 : e.isContentEditable;
|
|
29845
29854
|
}
|
|
29846
|
-
function
|
|
29855
|
+
function $L({
|
|
29847
29856
|
buttonRef: e,
|
|
29848
29857
|
open: t,
|
|
29849
29858
|
onClick: n
|
|
@@ -29862,7 +29871,7 @@ function OL({
|
|
|
29862
29871
|
}
|
|
29863
29872
|
);
|
|
29864
29873
|
}
|
|
29865
|
-
function
|
|
29874
|
+
function AL({
|
|
29866
29875
|
open: e,
|
|
29867
29876
|
pane: t,
|
|
29868
29877
|
hostName: n,
|
|
@@ -29908,18 +29917,18 @@ function $L({
|
|
|
29908
29917
|
E ? /* @__PURE__ */ k("span", { className: `${T}-settings-place`, children: E }) : null
|
|
29909
29918
|
] }),
|
|
29910
29919
|
/* @__PURE__ */ V("div", { className: `${T}-settings-row`, children: [
|
|
29911
|
-
/* @__PURE__ */ k(
|
|
29920
|
+
/* @__PURE__ */ k(zL, {}),
|
|
29912
29921
|
/* @__PURE__ */ k("span", { children: "Highlight editable blocks" }),
|
|
29913
29922
|
/* @__PURE__ */ k(gm, { on: i, label: "Highlight editable blocks", onClick: () => u(!i) })
|
|
29914
29923
|
] }),
|
|
29915
29924
|
/* @__PURE__ */ V("div", { className: `${T}-settings-row`, children: [
|
|
29916
|
-
/* @__PURE__ */ k(
|
|
29925
|
+
/* @__PURE__ */ k(DL, {}),
|
|
29917
29926
|
/* @__PURE__ */ k("span", { children: "Preview when Agent edits" }),
|
|
29918
29927
|
/* @__PURE__ */ k(gm, { on: s, label: "Preview when Agent edits", onClick: () => l(!s) })
|
|
29919
29928
|
] }),
|
|
29920
29929
|
/* @__PURE__ */ k("div", { className: `${T}-settings-rule` }),
|
|
29921
29930
|
a ? /* @__PURE__ */ V("button", { type: "button", className: `${T}-settings-action`, onClick: p, children: [
|
|
29922
|
-
/* @__PURE__ */ k(
|
|
29931
|
+
/* @__PURE__ */ k(LL, {}),
|
|
29923
29932
|
/* @__PURE__ */ k("span", { children: "Open in dashboard" }),
|
|
29924
29933
|
/* @__PURE__ */ V("kbd", { className: `${T}-kbd`, children: [
|
|
29925
29934
|
v,
|
|
@@ -29932,12 +29941,12 @@ function $L({
|
|
|
29932
29941
|
r ? /* @__PURE__ */ k("span", { className: `${T}-settings-email`, children: r }) : null
|
|
29933
29942
|
] }) : null,
|
|
29934
29943
|
/* @__PURE__ */ V("button", { type: "button", className: `${T}-settings-action`, onClick: c, children: [
|
|
29935
|
-
/* @__PURE__ */ k(
|
|
29944
|
+
/* @__PURE__ */ k(jL, {}),
|
|
29936
29945
|
/* @__PURE__ */ k("span", { children: "Keyboard shortcuts" }),
|
|
29937
29946
|
/* @__PURE__ */ k("kbd", { className: `${T}-kbd`, children: "?" })
|
|
29938
29947
|
] }),
|
|
29939
29948
|
/* @__PURE__ */ V("button", { type: "button", className: `${T}-settings-action`, "aria-keyshortcuts": "Meta+. Control+.", onClick: d, children: [
|
|
29940
|
-
/* @__PURE__ */ k(
|
|
29949
|
+
/* @__PURE__ */ k(FL, {}),
|
|
29941
29950
|
/* @__PURE__ */ k("span", { children: "Hide toolbar" }),
|
|
29942
29951
|
/* @__PURE__ */ V("kbd", { className: `${T}-kbd`, children: [
|
|
29943
29952
|
v,
|
|
@@ -29947,7 +29956,7 @@ function $L({
|
|
|
29947
29956
|
m ? /* @__PURE__ */ V(At, { children: [
|
|
29948
29957
|
/* @__PURE__ */ k("div", { className: `${T}-settings-rule` }),
|
|
29949
29958
|
/* @__PURE__ */ V("button", { type: "button", className: `${T}-settings-action`, onClick: m, children: [
|
|
29950
|
-
/* @__PURE__ */ k(
|
|
29959
|
+
/* @__PURE__ */ k(qL, {}),
|
|
29951
29960
|
/* @__PURE__ */ k("span", { children: "Sign out" }),
|
|
29952
29961
|
y ? /* @__PURE__ */ k("span", { className: `${T}-settings-email`, children: y }) : null
|
|
29953
29962
|
] })
|
|
@@ -29975,44 +29984,44 @@ function gm({ on: e, label: t, onClick: n }) {
|
|
|
29975
29984
|
}
|
|
29976
29985
|
);
|
|
29977
29986
|
}
|
|
29978
|
-
function
|
|
29987
|
+
function ML(e, t) {
|
|
29979
29988
|
const n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
29980
29989
|
e.style.setProperty("--menu-right", `${Math.max(0, n.right - r.right)}px`);
|
|
29981
29990
|
}
|
|
29982
|
-
function
|
|
29983
|
-
const n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), o = Math.min(
|
|
29991
|
+
function NL(e, t) {
|
|
29992
|
+
const n = e.getBoundingClientRect(), r = t.getBoundingClientRect(), o = Math.min(CL, window.innerWidth - 32);
|
|
29984
29993
|
let s = r.left + r.width / 2 - n.left - o / 2;
|
|
29985
29994
|
const a = 16, u = a - n.left, l = window.innerWidth - a - o - n.left;
|
|
29986
29995
|
e.style.setProperty("--menu-x", `${Math.max(u, Math.min(s, l))}px`);
|
|
29987
29996
|
}
|
|
29988
|
-
function
|
|
29997
|
+
function zL() {
|
|
29989
29998
|
return /* @__PURE__ */ V("svg", { className: `${T}-settings-icon`, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": !0, children: [
|
|
29990
29999
|
/* @__PURE__ */ k("path", { d: "M3 3h4.2v4.2H3zM8.8 3H13v4.2H8.8zM3 8.8h4.2V13H3z", fill: "none", stroke: "currentColor", strokeWidth: "1.3" }),
|
|
29991
30000
|
/* @__PURE__ */ k("path", { d: "M8.8 10.2h4.2", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeDasharray: "1.4 1.5" })
|
|
29992
30001
|
] });
|
|
29993
30002
|
}
|
|
29994
|
-
function
|
|
30003
|
+
function DL() {
|
|
29995
30004
|
return /* @__PURE__ */ V("svg", { className: `${T}-settings-icon`, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": !0, children: [
|
|
29996
30005
|
/* @__PURE__ */ k("path", { d: "M1.6 8S4 3.8 8 3.8 14.4 8 14.4 8 12 12.2 8 12.2 1.6 8 1.6 8Z", fill: "none", stroke: "currentColor", strokeWidth: "1.3" }),
|
|
29997
30006
|
/* @__PURE__ */ k("circle", { cx: "8", cy: "8", r: "1.8", fill: "none", stroke: "currentColor", strokeWidth: "1.3" })
|
|
29998
30007
|
] });
|
|
29999
30008
|
}
|
|
30000
|
-
function
|
|
30009
|
+
function LL() {
|
|
30001
30010
|
return /* @__PURE__ */ k("svg", { className: `${T}-settings-icon`, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": !0, children: /* @__PURE__ */ k("path", { d: "M2.5 2.5h4.2v4.2H2.5zM9.3 2.5h4.2v4.2H9.3zM2.5 9.3h4.2v4.2H2.5zM9.3 9.3h4.2v4.2H9.3z", fill: "none", stroke: "currentColor", strokeWidth: "1.3" }) });
|
|
30002
30011
|
}
|
|
30003
|
-
function
|
|
30012
|
+
function jL() {
|
|
30004
30013
|
return /* @__PURE__ */ V("svg", { className: `${T}-settings-icon`, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": !0, children: [
|
|
30005
30014
|
/* @__PURE__ */ k("rect", { x: "1.8", y: "3.6", width: "12.4", height: "8.8", rx: "1.4", fill: "none", stroke: "currentColor", strokeWidth: "1.3" }),
|
|
30006
30015
|
/* @__PURE__ */ k("path", { d: "M4 6.2h.1M6.4 6.2h.1M8.8 6.2h.1M11.2 6.2h.1M4.8 8.4h6.4", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round" })
|
|
30007
30016
|
] });
|
|
30008
30017
|
}
|
|
30009
|
-
function
|
|
30018
|
+
function FL() {
|
|
30010
30019
|
return /* @__PURE__ */ V("svg", { className: `${T}-settings-icon`, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": !0, children: [
|
|
30011
30020
|
/* @__PURE__ */ k("path", { d: "M2 8s2.2-3.6 6-3.6S14 8 14 8s-2.2 3.6-6 3.6S2 8 2 8Z", fill: "none", stroke: "currentColor", strokeWidth: "1.3" }),
|
|
30012
30021
|
/* @__PURE__ */ k("path", { d: "M3 13 13 3", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round" })
|
|
30013
30022
|
] });
|
|
30014
30023
|
}
|
|
30015
|
-
function
|
|
30024
|
+
function qL() {
|
|
30016
30025
|
return /* @__PURE__ */ V("svg", { className: `${T}-settings-icon`, width: "16", height: "16", viewBox: "0 0 16 16", "aria-hidden": !0, children: [
|
|
30017
30026
|
/* @__PURE__ */ k("path", { d: "M6.5 3.2H3.8v9.6h2.7", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round" }),
|
|
30018
30027
|
/* @__PURE__ */ k("path", { d: "M7 8h6.2M11 5.4 13.6 8 11 10.6", fill: "none", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
@@ -30030,7 +30039,7 @@ function ym(e) {
|
|
|
30030
30039
|
const t = typeof matchMedia == "function" && matchMedia("(prefers-color-scheme: dark)").matches, n = pL(e, t) === "dark", r = document.documentElement;
|
|
30031
30040
|
r.dataset.theme = n ? "dark" : "light", r.style.colorScheme = e === "system" ? "light dark" : n ? "dark" : "light", r.classList.toggle("dark", n), r.classList.toggle("light", !n);
|
|
30032
30041
|
}
|
|
30033
|
-
function
|
|
30042
|
+
function BL({
|
|
30034
30043
|
label: e,
|
|
30035
30044
|
doc: t,
|
|
30036
30045
|
dashboardHref: n,
|
|
@@ -30048,7 +30057,7 @@ function qL({
|
|
|
30048
30057
|
}, [o]), Cn(() => {
|
|
30049
30058
|
const $ = E.current;
|
|
30050
30059
|
if (!o || !r || !$) return;
|
|
30051
|
-
const z = () =>
|
|
30060
|
+
const z = () => NL(r, $);
|
|
30052
30061
|
return z(), window.addEventListener("resize", z), () => window.removeEventListener("resize", z);
|
|
30053
30062
|
}, [o, r]);
|
|
30054
30063
|
const _ = He(
|
|
@@ -30057,7 +30066,7 @@ function qL({
|
|
|
30057
30066
|
const F = ++R.current, U = y.trim(), B = hm(t.workspaceId, U);
|
|
30058
30067
|
z ? h(!0) : A != null && A.silent || p(!0), S2(t.workspaceId, {
|
|
30059
30068
|
q: U || void 0,
|
|
30060
|
-
limit:
|
|
30069
|
+
limit: EL,
|
|
30061
30070
|
offset: $,
|
|
30062
30071
|
current: t
|
|
30063
30072
|
}).then((Y) => {
|
|
@@ -30167,7 +30176,7 @@ function qL({
|
|
|
30167
30176
|
N && r ? ia(N, r) : null
|
|
30168
30177
|
] });
|
|
30169
30178
|
}
|
|
30170
|
-
function
|
|
30179
|
+
function VL({
|
|
30171
30180
|
branch: e,
|
|
30172
30181
|
tree: t,
|
|
30173
30182
|
workspaceId: n,
|
|
@@ -30192,7 +30201,7 @@ function BL({
|
|
|
30192
30201
|
v = !0;
|
|
30193
30202
|
};
|
|
30194
30203
|
}, [i, n, a, e]), !i || !o) return null;
|
|
30195
|
-
const x = a ?
|
|
30204
|
+
const x = a ? UL(a.map((v) => ({ key: v, label: v })), m) : null;
|
|
30196
30205
|
return ia(
|
|
30197
30206
|
/* @__PURE__ */ k("div", { id: y, role: "menu", "aria-label": "Branches", className: `${T}-menu ${T}-page-menu`, children: n ? /* @__PURE__ */ k(
|
|
30198
30207
|
Iv,
|
|
@@ -30217,7 +30226,7 @@ function BL({
|
|
|
30217
30226
|
s();
|
|
30218
30227
|
return;
|
|
30219
30228
|
}
|
|
30220
|
-
h(!0), p(null),
|
|
30229
|
+
h(!0), p(null), HL({
|
|
30221
30230
|
workspaceId: n,
|
|
30222
30231
|
branch: v.label,
|
|
30223
30232
|
tree: t,
|
|
@@ -30276,11 +30285,11 @@ function Iv({
|
|
|
30276
30285
|
function Tv() {
|
|
30277
30286
|
return /* @__PURE__ */ k("svg", { className: `${T}-chevron`, width: "10", height: "10", viewBox: "0 0 12 12", fill: "none", "aria-hidden": !0, children: /* @__PURE__ */ k("path", { d: "M2.5 4.5 6 8l3.5-3.5", stroke: "currentColor", strokeWidth: "1.25", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
30278
30287
|
}
|
|
30279
|
-
function
|
|
30288
|
+
function UL(e, t) {
|
|
30280
30289
|
const n = t.trim().toLowerCase();
|
|
30281
30290
|
return n ? e.filter((r) => r.label.toLowerCase().includes(n)) : [...e];
|
|
30282
30291
|
}
|
|
30283
|
-
async function
|
|
30292
|
+
async function HL(e) {
|
|
30284
30293
|
const t = e.checkout ?? y2, n = e.ticket ?? g2, r = e.assign ?? ((s) => location.assign(s));
|
|
30285
30294
|
await t(e.workspaceId, e.branch);
|
|
30286
30295
|
let o;
|
|
@@ -30297,7 +30306,7 @@ async function UL(e) {
|
|
|
30297
30306
|
const i = e.previewEntryPath.includes("?") ? "&" : "?";
|
|
30298
30307
|
r(`${e.previewEntryPath}${i}ticket=${encodeURIComponent(o.ticket)}`);
|
|
30299
30308
|
}
|
|
30300
|
-
const
|
|
30309
|
+
const ZL = `
|
|
30301
30310
|
.${T}-host {
|
|
30302
30311
|
position: absolute;
|
|
30303
30312
|
width: 0;
|
|
@@ -30316,7 +30325,7 @@ html.backmatter-blocks [data-backmatter-block] {
|
|
|
30316
30325
|
outline: 1.5px solid oklch(0.56 0.21 295);
|
|
30317
30326
|
outline-offset: 2px;
|
|
30318
30327
|
}
|
|
30319
|
-
`,
|
|
30328
|
+
`, WL = `
|
|
30320
30329
|
.${T}-root {
|
|
30321
30330
|
--preview: ${Rv};
|
|
30322
30331
|
--preview-hover: oklch(0.50 0.20 295);
|
|
@@ -30924,17 +30933,17 @@ html.backmatter-blocks [data-backmatter-block] {
|
|
|
30924
30933
|
:host(.${T}-pointing) .${T},
|
|
30925
30934
|
:host(.${T}-pointing) .${T} * { cursor: pointer !important; }
|
|
30926
30935
|
:host(.${T}-pointing) .${T} button:disabled { cursor: default !important; }
|
|
30927
|
-
`,
|
|
30936
|
+
`, KL = {
|
|
30928
30937
|
x17w6cid: "x145rjjm x17w6cid",
|
|
30929
30938
|
$$css: !0
|
|
30930
30939
|
};
|
|
30931
|
-
function
|
|
30940
|
+
function YL(e, t) {
|
|
30932
30941
|
const n = (t == null ? void 0 : t.split(/\s+/).filter(Boolean)) ?? [];
|
|
30933
30942
|
return n.length > 0 && e.classList.add(...n), () => {
|
|
30934
30943
|
n.length > 0 && e.classList.remove(...n);
|
|
30935
30944
|
};
|
|
30936
30945
|
}
|
|
30937
|
-
function
|
|
30946
|
+
function aj({
|
|
30938
30947
|
doc: e,
|
|
30939
30948
|
branch: t,
|
|
30940
30949
|
tree: n,
|
|
@@ -30964,7 +30973,7 @@ function sj({
|
|
|
30964
30973
|
var z;
|
|
30965
30974
|
$ === 401 && ((z = b.current) == null || z.call(b));
|
|
30966
30975
|
}
|
|
30967
|
-
}), !0)), Cn(() =>
|
|
30976
|
+
}), !0)), Cn(() => YL(document.documentElement, Mt(KL).className), []);
|
|
30968
30977
|
const [y, x] = le(!1), [v, E] = le(!1), [w, g] = le(0), [R, C] = le(null), _ = e ? `${e.type}/${e.slug}` : "No document", M = He(($) => {
|
|
30969
30978
|
C($);
|
|
30970
30979
|
}, []);
|
|
@@ -30986,17 +30995,17 @@ function sj({
|
|
|
30986
30995
|
}
|
|
30987
30996
|
return document.addEventListener("pointerdown", $), () => document.removeEventListener("pointerdown", $);
|
|
30988
30997
|
}, [v]);
|
|
30989
|
-
const N = /* @__PURE__ */ k(
|
|
30998
|
+
const N = /* @__PURE__ */ k(RL, { label: _, branch: t, tree: n, doc: e, siteMode: r, exiting: o, chatOpen: y, publishOpen: v, changeCount: w, previewEntryPath: c, onExit: i, onEnterPreview: s, frame: !!f, frameRadius: p, onToggleChat: () => x(($) => !$), onTogglePublish: () => E(($) => !$), dashboardHref: h, onSignOut: m, onPublishAnchor: M });
|
|
30990
30999
|
return /* @__PURE__ */ V(At, { children: [
|
|
30991
31000
|
e ? /* @__PURE__ */ k(sk, { children: /* @__PURE__ */ k(N2, { children: /* @__PURE__ */ V(hz, { workspaceId: e.workspaceId, pointer: !0, children: [
|
|
30992
|
-
/* @__PURE__ */ k(
|
|
30993
|
-
/* @__PURE__ */ k(
|
|
30994
|
-
/* @__PURE__ */ k(
|
|
30995
|
-
/* @__PURE__ */ k(
|
|
30996
|
-
/* @__PURE__ */ k(
|
|
31001
|
+
/* @__PURE__ */ k(JL, { doc: e }),
|
|
31002
|
+
/* @__PURE__ */ k(GL, { onDocChanged: D }),
|
|
31003
|
+
/* @__PURE__ */ k(XL, { open: y }),
|
|
31004
|
+
/* @__PURE__ */ k(QL, { onClose: () => x(!1) }),
|
|
31005
|
+
/* @__PURE__ */ k(ej, { doc: e }),
|
|
30997
31006
|
/* @__PURE__ */ k(mz, { children: y ? /* @__PURE__ */ k(H4, { site: !0 }) : null })
|
|
30998
31007
|
] }) }) }) : null,
|
|
30999
|
-
e && v ? /* @__PURE__ */ k("div", { "data-backmatter-panel": "", style:
|
|
31008
|
+
e && v ? /* @__PURE__ */ k("div", { "data-backmatter-panel": "", style: tj(R), children: /* @__PURE__ */ k(Q4, { workspaceId: e.workspaceId, onStatus: ({
|
|
31000
31009
|
changeCount: $
|
|
31001
31010
|
}) => g($), onPublished: () => {
|
|
31002
31011
|
E(!1), g(0), D();
|
|
@@ -31004,7 +31013,7 @@ function sj({
|
|
|
31004
31013
|
N
|
|
31005
31014
|
] });
|
|
31006
31015
|
}
|
|
31007
|
-
function
|
|
31016
|
+
function JL({
|
|
31008
31017
|
doc: e
|
|
31009
31018
|
}) {
|
|
31010
31019
|
const {
|
|
@@ -31023,7 +31032,7 @@ function YL({
|
|
|
31023
31032
|
});
|
|
31024
31033
|
}, [e.locale, e.type, e.slug, t]), null;
|
|
31025
31034
|
}
|
|
31026
|
-
function
|
|
31035
|
+
function GL({
|
|
31027
31036
|
onDocChanged: e
|
|
31028
31037
|
}) {
|
|
31029
31038
|
const t = Ee(e);
|
|
@@ -31034,7 +31043,7 @@ function JL({
|
|
|
31034
31043
|
return window.addEventListener(Du, n), () => window.removeEventListener(Du, n);
|
|
31035
31044
|
}, []), null;
|
|
31036
31045
|
}
|
|
31037
|
-
function
|
|
31046
|
+
function XL({
|
|
31038
31047
|
open: e
|
|
31039
31048
|
}) {
|
|
31040
31049
|
const {
|
|
@@ -31048,7 +31057,7 @@ function GL({
|
|
|
31048
31057
|
});
|
|
31049
31058
|
}, [e, t]), null;
|
|
31050
31059
|
}
|
|
31051
|
-
function
|
|
31060
|
+
function QL({
|
|
31052
31061
|
onClose: e
|
|
31053
31062
|
}) {
|
|
31054
31063
|
const {
|
|
@@ -31059,7 +31068,7 @@ function XL({
|
|
|
31059
31068
|
r.current = n, i && !ra(n) && o.current();
|
|
31060
31069
|
}, [n]), null;
|
|
31061
31070
|
}
|
|
31062
|
-
function
|
|
31071
|
+
function ej({
|
|
31063
31072
|
doc: e
|
|
31064
31073
|
}) {
|
|
31065
31074
|
const {
|
|
@@ -31093,7 +31102,7 @@ function QL({
|
|
|
31093
31102
|
};
|
|
31094
31103
|
}, [t]), null;
|
|
31095
31104
|
}
|
|
31096
|
-
function
|
|
31105
|
+
function tj(e) {
|
|
31097
31106
|
const t = e ? Math.max(16, window.innerWidth - e.right) : 16, n = e ? Math.max(52, window.innerHeight - e.top + 8) : 52;
|
|
31098
31107
|
return {
|
|
31099
31108
|
position: "fixed",
|
|
@@ -31110,5 +31119,5 @@ function ej(e) {
|
|
|
31110
31119
|
};
|
|
31111
31120
|
}
|
|
31112
31121
|
export {
|
|
31113
|
-
|
|
31122
|
+
aj as SiteWidget
|
|
31114
31123
|
};
|
package/package.json
CHANGED
package/src/preview-frame.tsx
CHANGED
|
@@ -12,6 +12,22 @@ import { PREVIEW_FRAME_RADIUS_DEFAULT, previewFrameRadiusFromUserAgent } from ".
|
|
|
12
12
|
|
|
13
13
|
export const PREVIEW_FRAME_CLASS = "backmatter-preview-frame";
|
|
14
14
|
|
|
15
|
+
type NavigatorWithUaData = Navigator & {
|
|
16
|
+
userAgentData?: {
|
|
17
|
+
getHighEntropyValues: (
|
|
18
|
+
hints: readonly string[],
|
|
19
|
+
) => Promise<{ platformVersion?: string }>;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** Chromium `platformVersion` when Client Hints are available (not in all TS `Navigator` libs). */
|
|
24
|
+
function readNavigatorPlatformVersion(): Promise<string | undefined> {
|
|
25
|
+
if (typeof navigator === "undefined") return Promise.resolve(undefined);
|
|
26
|
+
const uad = (navigator as NavigatorWithUaData).userAgentData;
|
|
27
|
+
if (!uad?.getHighEntropyValues) return Promise.resolve(undefined);
|
|
28
|
+
return uad.getHighEntropyValues(["platformVersion"]).then((hints) => hints.platformVersion);
|
|
29
|
+
}
|
|
30
|
+
|
|
15
31
|
/** Bottom window corner radius when the host does not set `devBar.previewFrameRadius`. */
|
|
16
32
|
export function guessPreviewFrameRadius(): number {
|
|
17
33
|
if (typeof navigator === "undefined") return PREVIEW_FRAME_RADIUS_DEFAULT;
|
|
@@ -54,10 +70,9 @@ export function PreviewFrame({
|
|
|
54
70
|
const ua = navigator.userAgent;
|
|
55
71
|
setCorner(previewFrameRadiusFromUserAgent(ua));
|
|
56
72
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
setCorner(previewFrameRadiusFromUserAgent(ua, hints.platformVersion));
|
|
73
|
+
void readNavigatorPlatformVersion().then((platformVersion) => {
|
|
74
|
+
if (platformVersion === undefined) return;
|
|
75
|
+
setCorner(previewFrameRadiusFromUserAgent(ua, platformVersion));
|
|
61
76
|
});
|
|
62
77
|
}, [radius]);
|
|
63
78
|
|
package/src/site-bar.tsx
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
useMemo,
|
|
11
11
|
useRef,
|
|
12
12
|
useState,
|
|
13
|
+
type HTMLAttributes,
|
|
13
14
|
type MouseEvent,
|
|
14
15
|
type ReactNode,
|
|
15
16
|
type Ref,
|
|
@@ -74,6 +75,14 @@ function pageMenuCacheKey(workspaceId: string, query: string) {
|
|
|
74
75
|
|
|
75
76
|
type MenuState = "page" | "branch" | "settings" | null;
|
|
76
77
|
|
|
78
|
+
type DevbarHotkeyHandlers = {
|
|
79
|
+
toggleHidden: () => void;
|
|
80
|
+
onModeKey: (origin: HTMLElement) => void;
|
|
81
|
+
onEscape: () => void;
|
|
82
|
+
openDashboard: () => boolean;
|
|
83
|
+
openShortcuts: () => void;
|
|
84
|
+
};
|
|
85
|
+
|
|
77
86
|
export function SiteBar({
|
|
78
87
|
label,
|
|
79
88
|
branch,
|
|
@@ -161,7 +170,7 @@ export function SiteBar({
|
|
|
161
170
|
const widthRef = useRef(0);
|
|
162
171
|
const widthReady = useRef(false);
|
|
163
172
|
const rose = useRef(false);
|
|
164
|
-
const handlers = useRef({
|
|
173
|
+
const handlers = useRef<DevbarHotkeyHandlers>({
|
|
165
174
|
toggleHidden: () => {},
|
|
166
175
|
onModeKey: (_origin: HTMLElement) => {},
|
|
167
176
|
onEscape: () => {},
|
|
@@ -703,7 +712,17 @@ export function SiteBar({
|
|
|
703
712
|
return (
|
|
704
713
|
<div ref={attachHost} className={`${DEVBAR_CLASS}-host`} data-backmatter-devbar="">
|
|
705
714
|
<style>{LIGHT_CSS}</style>
|
|
706
|
-
{shadow
|
|
715
|
+
{shadow
|
|
716
|
+
? createPortal(body, shadow)
|
|
717
|
+
: (
|
|
718
|
+
<template
|
|
719
|
+
{...({ shadowrootmode: "open" } as HTMLAttributes<HTMLTemplateElement> & {
|
|
720
|
+
shadowrootmode?: "open" | "closed";
|
|
721
|
+
})}
|
|
722
|
+
>
|
|
723
|
+
{body}
|
|
724
|
+
</template>
|
|
725
|
+
)}
|
|
707
726
|
</div>
|
|
708
727
|
);
|
|
709
728
|
}
|