@backmatter/studio 0.0.4 → 0.0.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/dist/chunks/{EmbedPublishPage-hx1xoAhI.js → EmbedPublishPage-DazYJLaD.js} +13 -13
- package/dist/chunks/{UiKitPage-BOunq6mr.js → UiKitPage-DyVyBp0I.js} +9 -9
- package/dist/chunks/{WorkspaceRoutes-CTFTWu3L.js → WorkspaceRoutes-CPvkgvxe.js} +10869 -10957
- package/dist/chunks/{dashboard-upmiawx5.js → dashboard-6aSS8oyj.js} +194 -194
- package/dist/chunks/{index-CBvevwfT.js → index-DgTNL4t3.js} +2 -2
- package/dist/chunks/{status-bar-action-DiXhfcj3.js → status-bar-action-RNBujSgk.js} +5655 -5427
- package/dist/dashboard.js +2 -2
- package/dist/index.js +18 -18
- package/dist/site-widget.js +790 -234
- package/dist/studio.css +4 -4
- package/package.json +2 -2
- package/src/WorkspaceRoutes.tsx +2 -0
- package/src/api.ts +24 -0
- package/src/chat/ChatPanel.tsx +1 -1
- package/src/chrome/icons.tsx +13 -0
- package/src/pages/SettingsLayout.tsx +7 -1
- package/src/pages/SettingsUsagePage.tsx +168 -0
- package/src/preview-frame.tsx +78 -0
- package/src/site-bar.tsx +769 -0
- package/src/site-widget.tsx +38 -163
package/dist/site-widget.js
CHANGED
|
@@ -1,229 +1,839 @@
|
|
|
1
|
-
import { jsxs as p,
|
|
2
|
-
import { useRef as
|
|
3
|
-
import {
|
|
4
|
-
import { E as
|
|
5
|
-
const
|
|
6
|
-
function
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { jsxs as p, Fragment as B, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as P, useState as k, useEffect as N, useId as V, useLayoutEffect as j } from "react";
|
|
3
|
+
import { S as H, m as J, P as K, k as T, l as Q, o as O, b as Y, G as _, q as Z, t as X, u as ee, v as te, w as ne, x as re, p as ae, y as oe, T as ie, E as se, C as le, z as ce, A as ue, D as de, F as D, H as M, I as z, J as F, K as pe, L as fe } from "./chunks/status-bar-action-RNBujSgk.js";
|
|
4
|
+
import { E as he } from "./chunks/EmbedPublishPage-DazYJLaD.js";
|
|
5
|
+
const I = "backmatter-preview-frame", A = "#d97706";
|
|
6
|
+
function me() {
|
|
7
|
+
return /* @__PURE__ */ p("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": !0, children: [
|
|
8
|
+
/* @__PURE__ */ n(
|
|
9
|
+
"path",
|
|
10
|
+
{
|
|
11
|
+
d: "M1.5 8s2.5-4.5 6.5-4.5S14.5 8 14.5 8s-2.5 4.5-6.5 4.5S1.5 8 1.5 8Z",
|
|
12
|
+
stroke: "currentColor",
|
|
13
|
+
strokeWidth: "1.25",
|
|
14
|
+
strokeLinejoin: "round"
|
|
15
|
+
}
|
|
16
|
+
),
|
|
17
|
+
/* @__PURE__ */ n("circle", { cx: "8", cy: "8", r: "1.75", stroke: "currentColor", strokeWidth: "1.25" })
|
|
18
|
+
] });
|
|
19
|
+
}
|
|
20
|
+
function be() {
|
|
21
|
+
return /* @__PURE__ */ p(B, { children: [
|
|
22
|
+
/* @__PURE__ */ n("style", { children: xe }),
|
|
23
|
+
/* @__PURE__ */ n(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
className: I,
|
|
27
|
+
"data-backmatter-preview-frame": "",
|
|
28
|
+
"aria-hidden": !0,
|
|
29
|
+
children: /* @__PURE__ */ p("div", { className: `${I}-badge`, children: [
|
|
30
|
+
/* @__PURE__ */ n(me, {}),
|
|
31
|
+
/* @__PURE__ */ n("span", { children: "Preview" })
|
|
32
|
+
] })
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
] });
|
|
36
|
+
}
|
|
37
|
+
const xe = `
|
|
38
|
+
.${I} {
|
|
39
|
+
position: fixed;
|
|
40
|
+
inset: 0;
|
|
41
|
+
z-index: 2147482999;
|
|
42
|
+
pointer-events: none;
|
|
43
|
+
box-shadow: inset 0 0 0 2px ${A};
|
|
44
|
+
overflow: visible;
|
|
45
|
+
}
|
|
46
|
+
.${I}-badge {
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: env(safe-area-inset-top, 0px);
|
|
49
|
+
right: env(safe-area-inset-right, 0px);
|
|
50
|
+
display: inline-flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
gap: 6px;
|
|
53
|
+
padding: 6px 12px;
|
|
54
|
+
border: 2px solid ${A};
|
|
55
|
+
border-top: 0;
|
|
56
|
+
border-radius: 0 0 14px 14px;
|
|
57
|
+
background: #fff7ed;
|
|
58
|
+
color: #9a3412;
|
|
59
|
+
font: 500 12px/1 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
60
|
+
white-space: nowrap;
|
|
61
|
+
-webkit-font-smoothing: antialiased;
|
|
62
|
+
}
|
|
63
|
+
@keyframes backmatter-preview-frame-in {
|
|
64
|
+
from { opacity: 0; }
|
|
65
|
+
to { opacity: 1; }
|
|
66
|
+
}
|
|
67
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
68
|
+
.${I} {
|
|
69
|
+
animation: backmatter-preview-frame-in 240ms cubic-bezier(0.23, 1, 0.32, 1) both;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
@media (prefers-reduced-motion: reduce) {
|
|
73
|
+
.${I} { animation: none; }
|
|
74
|
+
}
|
|
75
|
+
`, e = "backmatter-devbar", ge = "/api/backmatter/preview";
|
|
76
|
+
function ve(t) {
|
|
77
|
+
const a = new Map(t.models.map((r) => [r.type, r])), l = new Set(t.docs.map((r) => r.locale)).size > 1, s = [];
|
|
78
|
+
for (const r of t.docs) {
|
|
79
|
+
const i = a.get(r.type);
|
|
80
|
+
if (!i || !Z(i)) continue;
|
|
81
|
+
const f = X(i, r.locale, r.slug);
|
|
82
|
+
if (!f) continue;
|
|
83
|
+
const u = `${r.type}/${r.slug}`;
|
|
84
|
+
s.push({
|
|
85
|
+
key: `${r.locale}/${r.type}/${r.slug}`,
|
|
86
|
+
label: l ? `${u} · ${r.locale}` : u,
|
|
87
|
+
href: f,
|
|
88
|
+
current: !!(t.current && t.current.locale === r.locale && t.current.type === r.type && t.current.slug === r.slug)
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return s.sort((r, i) => r.label.localeCompare(i.label)), s;
|
|
92
|
+
}
|
|
93
|
+
function $e({
|
|
94
|
+
label: t,
|
|
95
|
+
branch: a,
|
|
96
|
+
tree: o,
|
|
97
|
+
doc: l,
|
|
98
|
+
exiting: s,
|
|
99
|
+
chatOpen: r,
|
|
100
|
+
publishOpen: i,
|
|
101
|
+
changeCount: f,
|
|
102
|
+
previewEntryPath: u = ge,
|
|
103
|
+
siteMode: v = "preview",
|
|
104
|
+
onExit: w,
|
|
105
|
+
onEnterPreview: y,
|
|
106
|
+
onToggleChat: C,
|
|
107
|
+
onTogglePublish: m
|
|
108
|
+
}) {
|
|
109
|
+
const h = P(null), [c, b] = k(null);
|
|
110
|
+
N(() => {
|
|
111
|
+
if (!c) return;
|
|
112
|
+
function $(R) {
|
|
113
|
+
var L;
|
|
114
|
+
const E = R.target;
|
|
115
|
+
E instanceof Node && ((L = h.current) != null && L.contains(E) || b(null));
|
|
116
|
+
}
|
|
117
|
+
function S(R) {
|
|
118
|
+
R.key === "Escape" && b(null);
|
|
119
|
+
}
|
|
120
|
+
return document.addEventListener("pointerdown", $), document.addEventListener("keydown", S), () => {
|
|
121
|
+
document.removeEventListener("pointerdown", $), document.removeEventListener("keydown", S);
|
|
122
|
+
};
|
|
123
|
+
}, [c]), N(() => {
|
|
124
|
+
function $(S) {
|
|
125
|
+
T(S) === "chat" && b(null);
|
|
126
|
+
}
|
|
127
|
+
return document.addEventListener("keydown", $, !0), () => document.removeEventListener("keydown", $, !0);
|
|
128
|
+
}, []);
|
|
129
|
+
function g() {
|
|
130
|
+
r && C(), i && m();
|
|
131
|
+
}
|
|
132
|
+
function d($) {
|
|
133
|
+
b((S) => S === $ ? null : (g(), $));
|
|
134
|
+
}
|
|
135
|
+
const x = i || f > 0;
|
|
136
|
+
return /* @__PURE__ */ p(B, { children: [
|
|
137
|
+
/* @__PURE__ */ n("style", { children: Ce }),
|
|
138
|
+
/* @__PURE__ */ p("footer", { ref: h, "aria-label": "Backmatter", className: e, children: [
|
|
139
|
+
/* @__PURE__ */ p("div", { className: `${e}-mode`, role: "group", "aria-label": "Site view", children: [
|
|
140
|
+
/* @__PURE__ */ n(
|
|
141
|
+
"button",
|
|
142
|
+
{
|
|
143
|
+
type: "button",
|
|
144
|
+
"aria-pressed": v === "live",
|
|
145
|
+
title: "View the published site",
|
|
146
|
+
disabled: s || v === "live",
|
|
147
|
+
onClick: () => {
|
|
148
|
+
b(null), w();
|
|
149
|
+
},
|
|
150
|
+
children: "Live"
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
/* @__PURE__ */ p(
|
|
154
|
+
"button",
|
|
155
|
+
{
|
|
156
|
+
type: "button",
|
|
157
|
+
"aria-pressed": v === "preview",
|
|
158
|
+
title: "View draft content",
|
|
159
|
+
disabled: s || v === "preview" || !y,
|
|
160
|
+
onClick: () => {
|
|
161
|
+
b(null), y == null || y();
|
|
162
|
+
},
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ n(ke, {}),
|
|
165
|
+
"Preview"
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
] }),
|
|
170
|
+
/* @__PURE__ */ n(
|
|
171
|
+
we,
|
|
172
|
+
{
|
|
173
|
+
label: t,
|
|
174
|
+
doc: l,
|
|
175
|
+
open: c === "page",
|
|
176
|
+
onToggle: () => d("page")
|
|
177
|
+
}
|
|
178
|
+
),
|
|
179
|
+
a ? /* @__PURE__ */ n(
|
|
180
|
+
ye,
|
|
181
|
+
{
|
|
182
|
+
branch: a,
|
|
183
|
+
tree: o,
|
|
184
|
+
workspaceId: (l == null ? void 0 : l.workspaceId) ?? null,
|
|
185
|
+
previewEntryPath: u,
|
|
186
|
+
open: c === "branch",
|
|
187
|
+
onToggle: () => d("branch")
|
|
188
|
+
}
|
|
189
|
+
) : null,
|
|
190
|
+
/* @__PURE__ */ n("span", { className: `${e}-rule`, "aria-hidden": !0 }),
|
|
191
|
+
/* @__PURE__ */ p("div", { className: `${e}-actions`, children: [
|
|
192
|
+
/* @__PURE__ */ p(
|
|
193
|
+
"button",
|
|
194
|
+
{
|
|
195
|
+
type: "button",
|
|
196
|
+
className: `${e}-btn ${e}-agent${r ? ` ${e}-on` : ""}`,
|
|
197
|
+
"aria-pressed": r,
|
|
198
|
+
"aria-keyshortcuts": "Meta+J Control+J",
|
|
199
|
+
disabled: !l,
|
|
200
|
+
onClick: () => {
|
|
201
|
+
b(null), i && m(), C();
|
|
202
|
+
},
|
|
203
|
+
children: [
|
|
204
|
+
/* @__PURE__ */ n(H, {}),
|
|
205
|
+
/* @__PURE__ */ n("span", { children: "Agent" }),
|
|
206
|
+
/* @__PURE__ */ p("kbd", { children: [
|
|
207
|
+
J(),
|
|
208
|
+
"J"
|
|
209
|
+
] })
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
),
|
|
213
|
+
/* @__PURE__ */ p(
|
|
214
|
+
"button",
|
|
215
|
+
{
|
|
216
|
+
type: "button",
|
|
217
|
+
className: `${e}-btn${x ? ` ${e}-on` : ""}`,
|
|
218
|
+
"aria-pressed": i,
|
|
219
|
+
disabled: !l,
|
|
220
|
+
onClick: () => {
|
|
221
|
+
b(null), r && C(), m();
|
|
222
|
+
},
|
|
223
|
+
children: [
|
|
224
|
+
/* @__PURE__ */ n(K, {}),
|
|
225
|
+
/* @__PURE__ */ p("span", { children: [
|
|
226
|
+
"Publish",
|
|
227
|
+
f ? /* @__PURE__ */ p("span", { className: `${e}-count`, children: [
|
|
228
|
+
" ",
|
|
229
|
+
f
|
|
230
|
+
] }) : null
|
|
231
|
+
] })
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
)
|
|
235
|
+
] })
|
|
236
|
+
] })
|
|
237
|
+
] });
|
|
238
|
+
}
|
|
239
|
+
function ke() {
|
|
240
|
+
return /* @__PURE__ */ n("span", { className: `${e}-dot`, "aria-hidden": !0 });
|
|
241
|
+
}
|
|
242
|
+
function G() {
|
|
243
|
+
return /* @__PURE__ */ n("svg", { className: `${e}-chevron`, width: "10", height: "10", viewBox: "0 0 12 12", fill: "none", "aria-hidden": !0, children: /* @__PURE__ */ n("path", { d: "M2.5 4.5 6 8l3.5-3.5", stroke: "currentColor", strokeWidth: "1.25", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
244
|
+
}
|
|
245
|
+
function we({
|
|
246
|
+
label: t,
|
|
247
|
+
doc: a,
|
|
248
|
+
open: o,
|
|
249
|
+
onToggle: l
|
|
16
250
|
}) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
251
|
+
const [s, r] = k(null), [i, f] = k(null), [u, v] = k(null), [w, y] = k(""), C = V();
|
|
252
|
+
N(() => {
|
|
253
|
+
o || y("");
|
|
254
|
+
}, [o]), N(() => {
|
|
255
|
+
if (!o || !a || s) return;
|
|
256
|
+
let c = !1;
|
|
257
|
+
return Promise.all([Q(a.workspaceId), O(a.workspaceId)]).then(([b, g]) => {
|
|
258
|
+
var d;
|
|
259
|
+
c || (r(b.docs), f(
|
|
260
|
+
(((d = g.schema) == null ? void 0 : d.payload.models) ?? []).map((x) => ({
|
|
261
|
+
type: x.type,
|
|
262
|
+
...x.route !== void 0 ? { route: x.route } : {},
|
|
263
|
+
...x.indexSlug ? { indexSlug: x.indexSlug } : {}
|
|
264
|
+
}))
|
|
265
|
+
));
|
|
266
|
+
}).catch(() => {
|
|
267
|
+
c || v("Couldn't load pages");
|
|
268
|
+
}), () => {
|
|
269
|
+
c = !0;
|
|
270
|
+
};
|
|
271
|
+
}, [o, a, s]);
|
|
272
|
+
const m = s && i ? ve({ docs: s, models: i, current: a }) : null, h = m ? W(m, w) : null;
|
|
273
|
+
return a ? /* @__PURE__ */ p("div", { className: `${e}-pop`, children: [
|
|
274
|
+
/* @__PURE__ */ p(
|
|
275
|
+
"button",
|
|
276
|
+
{
|
|
277
|
+
type: "button",
|
|
278
|
+
className: `${e}-crumb ${e}-page`,
|
|
279
|
+
"aria-haspopup": "menu",
|
|
280
|
+
"aria-expanded": o,
|
|
281
|
+
"aria-controls": C,
|
|
282
|
+
onClick: l,
|
|
283
|
+
children: [
|
|
284
|
+
/* @__PURE__ */ n("span", { children: t }),
|
|
285
|
+
/* @__PURE__ */ n(G, {})
|
|
286
|
+
]
|
|
287
|
+
}
|
|
288
|
+
),
|
|
289
|
+
o ? /* @__PURE__ */ n("div", { id: C, role: "menu", "aria-label": "Pages", className: `${e}-menu`, children: /* @__PURE__ */ n(
|
|
290
|
+
U,
|
|
291
|
+
{
|
|
292
|
+
query: w,
|
|
293
|
+
onQuery: y,
|
|
294
|
+
showFilter: ((m == null ? void 0 : m.length) ?? 0) > 7,
|
|
295
|
+
empty: (h == null ? void 0 : h.length) === 0,
|
|
296
|
+
emptyLabel: w.trim() ? "Nothing matches" : "No pages",
|
|
297
|
+
error: u,
|
|
298
|
+
loading: h === null && !u,
|
|
299
|
+
children: h == null ? void 0 : h.map((c) => /* @__PURE__ */ n(
|
|
300
|
+
"button",
|
|
301
|
+
{
|
|
302
|
+
type: "button",
|
|
303
|
+
role: "menuitem",
|
|
304
|
+
className: `${e}-option${c.current ? ` ${e}-current` : ""}`,
|
|
305
|
+
"aria-current": c.current ? "page" : void 0,
|
|
306
|
+
onClick: () => {
|
|
307
|
+
if (c.current || c.href === location.pathname) {
|
|
308
|
+
l();
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
location.assign(c.href);
|
|
312
|
+
},
|
|
313
|
+
children: /* @__PURE__ */ n("span", { children: c.label })
|
|
314
|
+
},
|
|
315
|
+
c.key
|
|
316
|
+
))
|
|
317
|
+
}
|
|
318
|
+
) }) : null
|
|
319
|
+
] }) : /* @__PURE__ */ n("span", { className: `${e}-crumb`, children: t });
|
|
320
|
+
}
|
|
321
|
+
function ye({
|
|
322
|
+
branch: t,
|
|
323
|
+
tree: a,
|
|
324
|
+
workspaceId: o,
|
|
325
|
+
previewEntryPath: l,
|
|
326
|
+
open: s,
|
|
327
|
+
onToggle: r
|
|
328
|
+
}) {
|
|
329
|
+
const [i, f] = k(null), [u, v] = k(null), [w, y] = k(null), [C, m] = k(!1), [h, c] = k(""), b = V();
|
|
330
|
+
N(() => {
|
|
331
|
+
s || c("");
|
|
332
|
+
}, [s]), N(() => {
|
|
333
|
+
if (!s || !o || i) return;
|
|
334
|
+
let d = !1;
|
|
335
|
+
return Y(o).then((x) => {
|
|
336
|
+
if (d) return;
|
|
337
|
+
const $ = x.branches.map((S) => S.name);
|
|
338
|
+
$.includes(t) || $.unshift(t), f($), v(x.defaultBranch);
|
|
339
|
+
}).catch(() => {
|
|
340
|
+
d || y("Couldn't load branches");
|
|
341
|
+
}), () => {
|
|
342
|
+
d = !0;
|
|
343
|
+
};
|
|
344
|
+
}, [s, o, i, t]);
|
|
345
|
+
const g = i ? W(i.map((d) => ({ key: d, label: d })), h) : null;
|
|
346
|
+
return o ? /* @__PURE__ */ p("div", { className: `${e}-pop`, children: [
|
|
347
|
+
/* @__PURE__ */ p(
|
|
348
|
+
"button",
|
|
349
|
+
{
|
|
350
|
+
type: "button",
|
|
351
|
+
className: `${e}-crumb ${e}-branch`,
|
|
352
|
+
"aria-haspopup": "menu",
|
|
353
|
+
"aria-expanded": s,
|
|
354
|
+
"aria-controls": b,
|
|
355
|
+
"aria-label": `Branch ${t}`,
|
|
356
|
+
"aria-busy": C,
|
|
357
|
+
disabled: C,
|
|
358
|
+
onClick: r,
|
|
359
|
+
children: [
|
|
360
|
+
/* @__PURE__ */ n(_, {}),
|
|
361
|
+
/* @__PURE__ */ n("span", { children: t }),
|
|
362
|
+
/* @__PURE__ */ n(G, {})
|
|
363
|
+
]
|
|
364
|
+
}
|
|
365
|
+
),
|
|
366
|
+
s ? /* @__PURE__ */ n("div", { id: b, role: "menu", "aria-label": "Branches", className: `${e}-menu ${e}-menu-end`, children: /* @__PURE__ */ n(
|
|
367
|
+
U,
|
|
368
|
+
{
|
|
369
|
+
query: h,
|
|
370
|
+
onQuery: c,
|
|
371
|
+
showFilter: ((i == null ? void 0 : i.length) ?? 0) > 7,
|
|
372
|
+
empty: (g == null ? void 0 : g.length) === 0,
|
|
373
|
+
emptyLabel: h.trim() ? "Nothing matches" : "No branches",
|
|
374
|
+
error: w,
|
|
375
|
+
loading: g === null && !w,
|
|
376
|
+
children: g == null ? void 0 : g.map((d) => /* @__PURE__ */ p(
|
|
377
|
+
"button",
|
|
378
|
+
{
|
|
379
|
+
type: "button",
|
|
380
|
+
role: "menuitem",
|
|
381
|
+
className: `${e}-option${d.label === t ? ` ${e}-current` : ""}`,
|
|
382
|
+
"aria-current": d.label === t ? "true" : void 0,
|
|
383
|
+
disabled: C,
|
|
384
|
+
onClick: () => {
|
|
385
|
+
if (d.label === t) {
|
|
386
|
+
r();
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
m(!0), y(null), Ee({
|
|
390
|
+
workspaceId: o,
|
|
391
|
+
branch: d.label,
|
|
392
|
+
tree: a,
|
|
393
|
+
redirect: location.pathname + location.search + location.hash,
|
|
394
|
+
previewEntryPath: l
|
|
395
|
+
}).catch((x) => {
|
|
396
|
+
m(!1), y(x instanceof Error ? x.message : "Couldn't switch branch");
|
|
397
|
+
});
|
|
398
|
+
},
|
|
399
|
+
children: [
|
|
400
|
+
/* @__PURE__ */ n("span", { children: d.label }),
|
|
401
|
+
d.label === u ? /* @__PURE__ */ n("span", { className: `${e}-meta`, children: "default" }) : null
|
|
402
|
+
]
|
|
403
|
+
},
|
|
404
|
+
d.key
|
|
405
|
+
))
|
|
406
|
+
}
|
|
407
|
+
) }) : null
|
|
408
|
+
] }) : /* @__PURE__ */ p("span", { className: `${e}-crumb ${e}-branch`, children: [
|
|
409
|
+
/* @__PURE__ */ n(_, {}),
|
|
410
|
+
/* @__PURE__ */ n("span", { children: t })
|
|
411
|
+
] });
|
|
412
|
+
}
|
|
413
|
+
function U({
|
|
414
|
+
query: t,
|
|
415
|
+
onQuery: a,
|
|
416
|
+
showFilter: o,
|
|
417
|
+
empty: l,
|
|
418
|
+
emptyLabel: s,
|
|
419
|
+
error: r,
|
|
420
|
+
loading: i,
|
|
421
|
+
children: f
|
|
422
|
+
}) {
|
|
423
|
+
return /* @__PURE__ */ p(B, { children: [
|
|
424
|
+
o ? /* @__PURE__ */ n(
|
|
425
|
+
"input",
|
|
426
|
+
{
|
|
427
|
+
value: t,
|
|
428
|
+
onChange: (u) => a(u.target.value),
|
|
429
|
+
placeholder: "Filter",
|
|
430
|
+
"aria-label": "Filter",
|
|
431
|
+
autoComplete: "off",
|
|
432
|
+
spellCheck: !1
|
|
433
|
+
}
|
|
434
|
+
) : null,
|
|
435
|
+
r ? /* @__PURE__ */ n("p", { className: `${e}-note ${e}-note-error`, children: r }) : null,
|
|
436
|
+
i ? /* @__PURE__ */ n("p", { className: `${e}-note`, children: "Loading…" }) : null,
|
|
437
|
+
l && !r ? /* @__PURE__ */ n("p", { className: `${e}-note`, children: s }) : null,
|
|
438
|
+
f
|
|
439
|
+
] });
|
|
440
|
+
}
|
|
441
|
+
function W(t, a) {
|
|
442
|
+
const o = a.trim().toLowerCase();
|
|
443
|
+
return o ? t.filter((l) => l.label.toLowerCase().includes(o)) : [...t];
|
|
444
|
+
}
|
|
445
|
+
async function Ee(t) {
|
|
446
|
+
const a = t.checkout ?? te, o = t.ticket ?? ee, l = t.assign ?? ((i) => location.assign(i));
|
|
447
|
+
await a(t.workspaceId, t.branch);
|
|
448
|
+
let s;
|
|
449
|
+
try {
|
|
450
|
+
s = await o(t.workspaceId, {
|
|
451
|
+
redirect: t.redirect,
|
|
452
|
+
branch: t.branch,
|
|
453
|
+
tree: t.tree
|
|
454
|
+
});
|
|
455
|
+
} catch (i) {
|
|
456
|
+
const f = i instanceof Error ? i.message : "Couldn't open the branch";
|
|
457
|
+
throw new Error(`Checked out ${t.branch}, but the preview didn't update. ${f}`);
|
|
458
|
+
}
|
|
459
|
+
const r = t.previewEntryPath.includes("?") ? "&" : "?";
|
|
460
|
+
l(`${t.previewEntryPath}${r}ticket=${encodeURIComponent(s.ticket)}`);
|
|
461
|
+
}
|
|
462
|
+
const Ce = `
|
|
463
|
+
@keyframes backmatter-devbar-in {
|
|
464
|
+
from { opacity: 0; transform: translateY(8px); }
|
|
465
|
+
to { opacity: 1; transform: none; }
|
|
466
|
+
}
|
|
467
|
+
.${e} {
|
|
468
|
+
position: fixed;
|
|
469
|
+
right: max(16px, env(safe-area-inset-right, 0px));
|
|
470
|
+
bottom: 0;
|
|
471
|
+
z-index: 2147483000;
|
|
472
|
+
isolation: isolate;
|
|
473
|
+
display: flex;
|
|
474
|
+
align-items: center;
|
|
475
|
+
gap: 8px;
|
|
476
|
+
width: max-content;
|
|
477
|
+
max-width: calc(100vw - 32px);
|
|
478
|
+
min-height: 40px;
|
|
479
|
+
padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px)) 4px;
|
|
480
|
+
box-sizing: border-box;
|
|
481
|
+
border: 2px solid ${A};
|
|
482
|
+
border-bottom: 0;
|
|
483
|
+
border-radius: 14px 14px 0 0;
|
|
484
|
+
background: #ffffff;
|
|
485
|
+
color: #71717a;
|
|
486
|
+
box-shadow: 0 10px 28px rgba(24, 24, 27, 0.12), 0 1px 2px rgba(24, 24, 27, 0.06);
|
|
487
|
+
font: 500 13px/1 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
488
|
+
-webkit-font-smoothing: antialiased;
|
|
489
|
+
font-variant-numeric: tabular-nums;
|
|
490
|
+
animation: backmatter-devbar-in 240ms cubic-bezier(0.23, 1, 0.32, 1) both;
|
|
491
|
+
}
|
|
492
|
+
@media (prefers-reduced-motion: reduce) {
|
|
493
|
+
.${e} { animation: none; }
|
|
494
|
+
}
|
|
495
|
+
.${e}-mode {
|
|
496
|
+
display: inline-flex;
|
|
497
|
+
flex-shrink: 0;
|
|
498
|
+
align-items: center;
|
|
499
|
+
gap: 2px;
|
|
500
|
+
padding: 2px;
|
|
501
|
+
border-radius: 9px;
|
|
502
|
+
background: #f4f4f5;
|
|
503
|
+
}
|
|
504
|
+
.${e}-mode button {
|
|
505
|
+
display: inline-flex;
|
|
506
|
+
align-items: center;
|
|
507
|
+
gap: 6px;
|
|
508
|
+
height: 26px;
|
|
509
|
+
padding: 0 8px;
|
|
510
|
+
border: 0;
|
|
511
|
+
border-radius: 7px;
|
|
512
|
+
background: transparent;
|
|
513
|
+
color: #71717a;
|
|
514
|
+
font: inherit;
|
|
515
|
+
cursor: pointer;
|
|
516
|
+
}
|
|
517
|
+
.${e}-mode button[aria-pressed="true"] {
|
|
518
|
+
background: #f4efe4;
|
|
519
|
+
color: #18181b;
|
|
520
|
+
}
|
|
521
|
+
.${e}-dot {
|
|
522
|
+
width: 6px;
|
|
523
|
+
height: 6px;
|
|
524
|
+
border-radius: 999px;
|
|
525
|
+
background: #c4841d;
|
|
526
|
+
flex-shrink: 0;
|
|
527
|
+
}
|
|
528
|
+
.${e}-pop { position: relative; min-width: 0; }
|
|
529
|
+
.${e}-crumb {
|
|
530
|
+
display: inline-flex;
|
|
531
|
+
align-items: center;
|
|
532
|
+
gap: 6px;
|
|
533
|
+
min-width: 0;
|
|
534
|
+
max-width: min(180px, 100%);
|
|
535
|
+
height: 28px;
|
|
536
|
+
padding: 0 6px;
|
|
537
|
+
border: 0;
|
|
538
|
+
border-radius: 7px;
|
|
539
|
+
background: transparent;
|
|
540
|
+
color: #18181b;
|
|
541
|
+
font: inherit;
|
|
542
|
+
}
|
|
543
|
+
button.${e}-crumb { cursor: pointer; }
|
|
544
|
+
.${e}-crumb > span {
|
|
545
|
+
min-width: 0;
|
|
546
|
+
overflow: hidden;
|
|
547
|
+
text-overflow: ellipsis;
|
|
548
|
+
white-space: nowrap;
|
|
549
|
+
}
|
|
550
|
+
.${e}-branch { color: #52525b; }
|
|
551
|
+
.${e}-chevron { flex-shrink: 0; color: #a1a1aa; }
|
|
552
|
+
.${e}-rule {
|
|
553
|
+
width: 1px;
|
|
554
|
+
height: 16px;
|
|
555
|
+
flex-shrink: 0;
|
|
556
|
+
background: #e4e4e7;
|
|
557
|
+
}
|
|
558
|
+
.${e}-actions {
|
|
559
|
+
display: inline-flex;
|
|
560
|
+
flex-shrink: 0;
|
|
561
|
+
align-items: center;
|
|
562
|
+
gap: 6px;
|
|
563
|
+
}
|
|
564
|
+
.${e}-btn {
|
|
565
|
+
display: inline-flex;
|
|
566
|
+
align-items: center;
|
|
567
|
+
gap: 6px;
|
|
568
|
+
height: 28px;
|
|
569
|
+
padding: 0 10px;
|
|
570
|
+
border: 1px solid #e4e4e7;
|
|
571
|
+
border-radius: 8px;
|
|
572
|
+
background: #ffffff;
|
|
573
|
+
color: #18181b;
|
|
574
|
+
font: inherit;
|
|
575
|
+
font-size: 13px;
|
|
576
|
+
cursor: pointer;
|
|
577
|
+
}
|
|
578
|
+
.${e}-agent {
|
|
579
|
+
border-color: transparent;
|
|
580
|
+
background: #f4f4f5;
|
|
581
|
+
}
|
|
582
|
+
.${e}-agent kbd {
|
|
583
|
+
font-family: Geist Mono, ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
584
|
+
font-size: 11px;
|
|
585
|
+
font-weight: 400;
|
|
586
|
+
color: #71717a;
|
|
587
|
+
}
|
|
588
|
+
.${e}-count { font-variant-numeric: tabular-nums; }
|
|
589
|
+
.${e} button.${e}-on,
|
|
590
|
+
.${e} button.${e}-on:hover:not(:disabled) {
|
|
591
|
+
background: #18181b;
|
|
592
|
+
border-color: #18181b;
|
|
593
|
+
color: #fafafa;
|
|
594
|
+
}
|
|
595
|
+
.${e}-on kbd { color: #d4d4d8; }
|
|
596
|
+
.${e}-menu {
|
|
597
|
+
position: absolute;
|
|
598
|
+
bottom: calc(100% + 8px);
|
|
599
|
+
left: 0;
|
|
600
|
+
z-index: 2;
|
|
601
|
+
display: flex;
|
|
602
|
+
flex-direction: column;
|
|
603
|
+
width: 240px;
|
|
604
|
+
max-height: 280px;
|
|
605
|
+
overflow: auto;
|
|
606
|
+
padding: 4px;
|
|
607
|
+
border: 1px solid #e4e4e7;
|
|
608
|
+
border-radius: 10px;
|
|
609
|
+
background: #ffffff;
|
|
610
|
+
box-shadow: 0 16px 40px rgba(24, 24, 27, 0.14), 0 2px 8px rgba(24, 24, 27, 0.06);
|
|
611
|
+
}
|
|
612
|
+
.${e}-menu-end { left: auto; right: 0; }
|
|
613
|
+
.${e}-menu input {
|
|
614
|
+
width: 100%;
|
|
615
|
+
box-sizing: border-box;
|
|
616
|
+
height: 32px;
|
|
617
|
+
margin: 2px 0 4px;
|
|
618
|
+
padding: 0 8px;
|
|
619
|
+
border: 1px solid #e4e4e7;
|
|
620
|
+
border-radius: 7px;
|
|
621
|
+
background: #ffffff;
|
|
622
|
+
color: #18181b;
|
|
623
|
+
font: inherit;
|
|
624
|
+
font-size: 16px;
|
|
625
|
+
}
|
|
626
|
+
.${e}-option {
|
|
627
|
+
display: flex;
|
|
628
|
+
align-items: center;
|
|
629
|
+
gap: 8px;
|
|
630
|
+
width: 100%;
|
|
631
|
+
min-height: 32px;
|
|
632
|
+
padding: 0 8px;
|
|
633
|
+
border: 0;
|
|
634
|
+
border-radius: 7px;
|
|
635
|
+
background: transparent;
|
|
636
|
+
color: #18181b;
|
|
637
|
+
font: inherit;
|
|
638
|
+
font-size: 13px;
|
|
639
|
+
text-align: left;
|
|
640
|
+
cursor: pointer;
|
|
641
|
+
}
|
|
642
|
+
.${e}-option > span:first-child {
|
|
643
|
+
min-width: 0;
|
|
644
|
+
overflow: hidden;
|
|
645
|
+
text-overflow: ellipsis;
|
|
646
|
+
white-space: nowrap;
|
|
647
|
+
}
|
|
648
|
+
.${e}-current { background: #f4f4f5; }
|
|
649
|
+
.${e}-meta {
|
|
650
|
+
margin-left: auto;
|
|
651
|
+
flex-shrink: 0;
|
|
652
|
+
color: #71717a;
|
|
653
|
+
font-size: 11px;
|
|
654
|
+
font-weight: 400;
|
|
655
|
+
}
|
|
656
|
+
.${e}-note {
|
|
657
|
+
margin: 0;
|
|
658
|
+
padding: 8px;
|
|
659
|
+
color: #71717a;
|
|
660
|
+
font-size: 12px;
|
|
661
|
+
font-weight: 400;
|
|
662
|
+
}
|
|
663
|
+
.${e}-note-error { color: #b91c1c; }
|
|
664
|
+
@media (hover: hover) {
|
|
665
|
+
.${e}-mode button:hover:not(:disabled):not([aria-pressed="true"]) { color: #18181b; }
|
|
666
|
+
.${e}-crumb:hover:not(:disabled) { background: #f4f4f5; }
|
|
667
|
+
.${e}-btn:hover:not(:disabled):not(.${e}-on) { background: #fafafa; }
|
|
668
|
+
.${e}-agent:hover:not(:disabled):not(.${e}-on) { background: #ececee; }
|
|
669
|
+
.${e}-option:hover:not(:disabled) { background: #f4f4f5; }
|
|
670
|
+
}
|
|
671
|
+
.${e} button:focus-visible {
|
|
672
|
+
outline: 2px solid #18181b;
|
|
673
|
+
outline-offset: 2px;
|
|
674
|
+
}
|
|
675
|
+
.${e} button:disabled { cursor: default; opacity: 0.5; }
|
|
676
|
+
.${e}-menu input:focus-visible {
|
|
677
|
+
outline: 2px solid #18181b;
|
|
678
|
+
outline-offset: 1px;
|
|
679
|
+
}
|
|
680
|
+
html.backmatter-pointing, html.backmatter-pointing * { cursor: crosshair !important; }
|
|
681
|
+
html.backmatter-pointing .${e},
|
|
682
|
+
html.backmatter-pointing .${e} *,
|
|
683
|
+
html.backmatter-pointing [data-backmatter-panel],
|
|
684
|
+
html.backmatter-pointing [data-backmatter-panel] * { cursor: pointer !important; }
|
|
685
|
+
html.backmatter-pointing .${e} button:disabled { cursor: default !important; }
|
|
686
|
+
`;
|
|
687
|
+
function Me({
|
|
688
|
+
doc: t,
|
|
689
|
+
branch: a,
|
|
690
|
+
tree: o,
|
|
691
|
+
siteMode: l = "preview",
|
|
692
|
+
exiting: s,
|
|
693
|
+
onExit: r,
|
|
694
|
+
onEnterPreview: i,
|
|
695
|
+
onDocChanged: f,
|
|
696
|
+
onSessionExpired: u,
|
|
697
|
+
proxyPath: v = "/api/backmatter/cms",
|
|
698
|
+
previewEntryPath: w,
|
|
699
|
+
previewFrame: y,
|
|
700
|
+
version: C
|
|
701
|
+
}) {
|
|
702
|
+
const m = P(u);
|
|
703
|
+
m.current = u, k(() => (ne({
|
|
704
|
+
baseUrl: v.replace(/\/+$/, ""),
|
|
20
705
|
credentials: "same-origin",
|
|
21
706
|
dev: !1,
|
|
22
|
-
version:
|
|
707
|
+
version: C,
|
|
23
708
|
onUnauthorized: ({
|
|
24
|
-
status:
|
|
709
|
+
status: E
|
|
25
710
|
}) => {
|
|
26
|
-
var
|
|
27
|
-
|
|
711
|
+
var L;
|
|
712
|
+
E === 401 && ((L = m.current) == null || L.call(m));
|
|
28
713
|
}
|
|
29
|
-
}), !0)),
|
|
30
|
-
const [
|
|
31
|
-
function
|
|
32
|
-
|
|
714
|
+
}), !0)), j(() => re(document.documentElement, ae(oe).className), []);
|
|
715
|
+
const [h, c] = k(!1), [b, g] = k(!1), [d, x] = k(0), $ = t ? `${t.type}/${t.slug}` : "No document";
|
|
716
|
+
function S() {
|
|
717
|
+
f == null || f();
|
|
33
718
|
}
|
|
34
|
-
|
|
35
|
-
function
|
|
36
|
-
|
|
719
|
+
N(() => {
|
|
720
|
+
function E(L) {
|
|
721
|
+
T(L) === "chat" && (L.preventDefault(), g(!1), c((q) => !q));
|
|
37
722
|
}
|
|
38
|
-
return document.addEventListener("keydown",
|
|
723
|
+
return document.addEventListener("keydown", E, !0), () => document.removeEventListener("keydown", E, !0);
|
|
39
724
|
}, []);
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
/* @__PURE__ */ n(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
/* @__PURE__ */ n(
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
"Publish",
|
|
51
|
-
C ? ` ${C}` : ""
|
|
52
|
-
] })
|
|
53
|
-
] }),
|
|
54
|
-
/* @__PURE__ */ p("button", { type: "button", className: `${t}-btn ${t}-agent${d ? ` ${t}-on` : ""}`, "aria-pressed": d, "aria-keyshortcuts": "Meta+J Control+J", disabled: !e, onClick: () => {
|
|
55
|
-
v(!1), g((a) => !a);
|
|
56
|
-
}, children: [
|
|
57
|
-
/* @__PURE__ */ n(D, {}),
|
|
58
|
-
/* @__PURE__ */ n("span", { children: "Agent" }),
|
|
59
|
-
/* @__PURE__ */ p("kbd", { children: [
|
|
60
|
-
H(),
|
|
61
|
-
"J"
|
|
62
|
-
] })
|
|
63
|
-
] }),
|
|
64
|
-
/* @__PURE__ */ n("button", { type: "button", "aria-label": "Exit preview", disabled: c, onClick: u, style: re, children: "Exit" })
|
|
65
|
-
] });
|
|
66
|
-
return /* @__PURE__ */ p(N, { children: [
|
|
67
|
-
/* @__PURE__ */ n("style", { children: le }),
|
|
68
|
-
e ? /* @__PURE__ */ n(M, { children: /* @__PURE__ */ n(V, { children: /* @__PURE__ */ p(G, { workspaceId: e.workspaceId, pointer: !0, children: [
|
|
69
|
-
/* @__PURE__ */ n(X, { doc: e }),
|
|
70
|
-
/* @__PURE__ */ n(Z, { onDocChanged: R }),
|
|
71
|
-
/* @__PURE__ */ n(ee, { open: d }),
|
|
72
|
-
/* @__PURE__ */ n(te, { onClose: () => g(!1) }),
|
|
73
|
-
/* @__PURE__ */ n(ne, { doc: e }),
|
|
74
|
-
/* @__PURE__ */ n(U, { children: d ? /* @__PURE__ */ n(j, { site: !0 }) : null })
|
|
725
|
+
const R = /* @__PURE__ */ n($e, { label: $, branch: a, tree: o, doc: t, siteMode: l, exiting: s, chatOpen: h, publishOpen: b, changeCount: d, previewEntryPath: w, onExit: r, onEnterPreview: i, onToggleChat: () => c((E) => !E), onTogglePublish: () => g((E) => !E) });
|
|
726
|
+
return /* @__PURE__ */ p(B, { children: [
|
|
727
|
+
y ? /* @__PURE__ */ n(be, {}) : null,
|
|
728
|
+
t ? /* @__PURE__ */ n(ie, { children: /* @__PURE__ */ n(se, { children: /* @__PURE__ */ p(le, { workspaceId: t.workspaceId, pointer: !0, children: [
|
|
729
|
+
/* @__PURE__ */ n(Ne, { doc: t }),
|
|
730
|
+
/* @__PURE__ */ n(Se, { onDocChanged: S }),
|
|
731
|
+
/* @__PURE__ */ n(Le, { open: h }),
|
|
732
|
+
/* @__PURE__ */ n(Pe, { onClose: () => c(!1) }),
|
|
733
|
+
/* @__PURE__ */ n(Ie, { doc: t }),
|
|
734
|
+
/* @__PURE__ */ n(ce, { children: h ? /* @__PURE__ */ n(ue, { site: !0 }) : null })
|
|
75
735
|
] }) }) }) : null,
|
|
76
|
-
|
|
77
|
-
changeCount:
|
|
78
|
-
}) =>
|
|
79
|
-
|
|
736
|
+
t ? /* @__PURE__ */ n("div", { "data-backmatter-panel": "", hidden: !b, style: Re, children: /* @__PURE__ */ n(he, { workspaceId: t.workspaceId, onStatus: ({
|
|
737
|
+
changeCount: E
|
|
738
|
+
}) => x(E), onPublished: () => {
|
|
739
|
+
g(!1), x(0), S();
|
|
80
740
|
} }) }) : null,
|
|
81
|
-
|
|
741
|
+
R
|
|
82
742
|
] });
|
|
83
743
|
}
|
|
84
|
-
function
|
|
85
|
-
doc:
|
|
744
|
+
function Ne({
|
|
745
|
+
doc: t
|
|
86
746
|
}) {
|
|
87
747
|
const {
|
|
88
|
-
setFocus:
|
|
89
|
-
} =
|
|
90
|
-
return
|
|
91
|
-
|
|
748
|
+
setFocus: a
|
|
749
|
+
} = de();
|
|
750
|
+
return N(() => {
|
|
751
|
+
a({
|
|
92
752
|
docRef: {
|
|
93
|
-
locale:
|
|
94
|
-
type:
|
|
95
|
-
slug:
|
|
753
|
+
locale: t.locale,
|
|
754
|
+
type: t.type,
|
|
755
|
+
slug: t.slug
|
|
96
756
|
},
|
|
97
757
|
frontmatter: {},
|
|
98
758
|
body: "",
|
|
99
759
|
selection: null
|
|
100
760
|
});
|
|
101
|
-
}, [
|
|
761
|
+
}, [t.locale, t.type, t.slug, a]), null;
|
|
102
762
|
}
|
|
103
|
-
function
|
|
104
|
-
onDocChanged:
|
|
763
|
+
function Se({
|
|
764
|
+
onDocChanged: t
|
|
105
765
|
}) {
|
|
106
|
-
const
|
|
107
|
-
return
|
|
108
|
-
function
|
|
109
|
-
|
|
766
|
+
const a = P(t);
|
|
767
|
+
return a.current = t, N(() => {
|
|
768
|
+
function o() {
|
|
769
|
+
a.current();
|
|
110
770
|
}
|
|
111
|
-
return window.addEventListener(
|
|
771
|
+
return window.addEventListener(D, o), () => window.removeEventListener(D, o);
|
|
112
772
|
}, []), null;
|
|
113
773
|
}
|
|
114
|
-
function
|
|
115
|
-
open:
|
|
774
|
+
function Le({
|
|
775
|
+
open: t
|
|
116
776
|
}) {
|
|
117
777
|
const {
|
|
118
|
-
dispatch:
|
|
119
|
-
} =
|
|
120
|
-
return
|
|
121
|
-
|
|
122
|
-
type:
|
|
123
|
-
}),
|
|
778
|
+
dispatch: a
|
|
779
|
+
} = M();
|
|
780
|
+
return N(() => {
|
|
781
|
+
a({
|
|
782
|
+
type: t ? "open" : "close"
|
|
783
|
+
}), t && requestAnimationFrame(() => {
|
|
124
784
|
window.dispatchEvent(new Event("backmatter:chat-focus"));
|
|
125
785
|
});
|
|
126
|
-
}, [
|
|
786
|
+
}, [t, a]), null;
|
|
127
787
|
}
|
|
128
|
-
function
|
|
129
|
-
onClose:
|
|
788
|
+
function Pe({
|
|
789
|
+
onClose: t
|
|
130
790
|
}) {
|
|
131
791
|
const {
|
|
132
|
-
panel:
|
|
133
|
-
} =
|
|
134
|
-
return
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
}, [
|
|
138
|
-
}
|
|
139
|
-
function
|
|
140
|
-
doc:
|
|
792
|
+
panel: a
|
|
793
|
+
} = M(), o = a.mode, l = P(o), s = P(t);
|
|
794
|
+
return s.current = t, N(() => {
|
|
795
|
+
const r = z(l.current);
|
|
796
|
+
l.current = o, r && !z(o) && s.current();
|
|
797
|
+
}, [o]), null;
|
|
798
|
+
}
|
|
799
|
+
function Ie({
|
|
800
|
+
doc: t
|
|
141
801
|
}) {
|
|
142
802
|
const {
|
|
143
|
-
addPointer:
|
|
144
|
-
panel:
|
|
145
|
-
} =
|
|
146
|
-
return
|
|
147
|
-
const
|
|
148
|
-
bar: () => document.querySelector(`.${
|
|
149
|
-
ignore: (
|
|
150
|
-
onGrab: (
|
|
151
|
-
const
|
|
152
|
-
|
|
803
|
+
addPointer: a,
|
|
804
|
+
panel: o
|
|
805
|
+
} = M(), l = z(o.mode), s = P(l), r = P(t);
|
|
806
|
+
return s.current = l, r.current = t, N(() => {
|
|
807
|
+
const i = pe(document, {
|
|
808
|
+
bar: () => document.querySelector(`.${e}`),
|
|
809
|
+
ignore: (u) => !(u instanceof Element) || u.closest("[data-backmatter-panel]") ? !0 : u.closest("iframe") !== null,
|
|
810
|
+
onGrab: (u) => {
|
|
811
|
+
const v = fe(r.current, u);
|
|
812
|
+
v && (a(v), requestAnimationFrame(() => {
|
|
813
|
+
window.dispatchEvent(new Event("backmatter:chat-focus"));
|
|
814
|
+
}));
|
|
153
815
|
},
|
|
154
816
|
onEscape: () => {
|
|
155
|
-
window.dispatchEvent(new CustomEvent(
|
|
817
|
+
window.dispatchEvent(new CustomEvent(F, {
|
|
156
818
|
detail: {
|
|
157
819
|
on: !1
|
|
158
820
|
}
|
|
159
821
|
}));
|
|
160
822
|
}
|
|
161
823
|
});
|
|
162
|
-
function
|
|
163
|
-
var
|
|
164
|
-
((
|
|
824
|
+
function f(u) {
|
|
825
|
+
var w;
|
|
826
|
+
((w = u.detail) == null ? void 0 : w.on) && s.current ? i.arm() : i.disarm();
|
|
165
827
|
}
|
|
166
|
-
return window.addEventListener(
|
|
167
|
-
window.removeEventListener(
|
|
828
|
+
return window.addEventListener(F, f), () => {
|
|
829
|
+
window.removeEventListener(F, f), i.dispose();
|
|
168
830
|
};
|
|
169
|
-
}, [
|
|
831
|
+
}, [a]), null;
|
|
170
832
|
}
|
|
171
|
-
|
|
172
|
-
children: e
|
|
173
|
-
}) {
|
|
174
|
-
return /* @__PURE__ */ n("span", { style: ie, children: e });
|
|
175
|
-
}
|
|
176
|
-
const oe = {
|
|
177
|
-
position: "fixed",
|
|
178
|
-
right: "max(16px, env(safe-area-inset-right, 0px))",
|
|
179
|
-
bottom: 0,
|
|
180
|
-
zIndex: 2147483e3,
|
|
181
|
-
isolation: "isolate",
|
|
182
|
-
display: "flex",
|
|
183
|
-
alignItems: "center",
|
|
184
|
-
gap: 2,
|
|
185
|
-
width: "max-content",
|
|
186
|
-
maxWidth: "calc(100vw - 32px)",
|
|
187
|
-
minHeight: 36,
|
|
188
|
-
padding: "0 6px 0 10px",
|
|
189
|
-
boxSizing: "border-box",
|
|
190
|
-
border: "1px solid #e4e4e7",
|
|
191
|
-
borderRadius: "12px 12px 0 0",
|
|
192
|
-
background: "#ffffff",
|
|
193
|
-
color: "#71717a",
|
|
194
|
-
boxShadow: "0 10px 28px rgba(24, 24, 27, 0.12), 0 1px 2px rgba(24, 24, 27, 0.06)",
|
|
195
|
-
font: '12px/1 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif',
|
|
196
|
-
WebkitFontSmoothing: "antialiased"
|
|
197
|
-
}, re = {
|
|
198
|
-
border: 0,
|
|
199
|
-
borderRadius: 8,
|
|
200
|
-
background: "transparent",
|
|
201
|
-
color: "#18181b",
|
|
202
|
-
font: "inherit",
|
|
203
|
-
cursor: "pointer",
|
|
204
|
-
padding: "0 8px",
|
|
205
|
-
minHeight: 28
|
|
206
|
-
}, ae = {
|
|
207
|
-
fontWeight: 600,
|
|
208
|
-
color: "#18181b",
|
|
209
|
-
maxWidth: 200,
|
|
210
|
-
overflow: "hidden",
|
|
211
|
-
textOverflow: "ellipsis",
|
|
212
|
-
whiteSpace: "nowrap",
|
|
213
|
-
padding: "0 6px"
|
|
214
|
-
}, ie = {
|
|
215
|
-
color: "#71717a",
|
|
216
|
-
fontSize: 12,
|
|
217
|
-
margin: 0,
|
|
218
|
-
padding: "0 6px",
|
|
219
|
-
maxWidth: 140,
|
|
220
|
-
overflow: "hidden",
|
|
221
|
-
textOverflow: "ellipsis",
|
|
222
|
-
whiteSpace: "nowrap"
|
|
223
|
-
}, se = {
|
|
833
|
+
const Re = {
|
|
224
834
|
position: "fixed",
|
|
225
835
|
right: "max(16px, env(safe-area-inset-right, 0px))",
|
|
226
|
-
bottom: "calc(env(safe-area-inset-bottom, 0px)
|
|
836
|
+
bottom: "calc(48px + env(safe-area-inset-bottom, 0px))",
|
|
227
837
|
zIndex: 2147483001,
|
|
228
838
|
width: "min(320px, calc(100vw - 32px))",
|
|
229
839
|
maxHeight: "min(420px, calc(100vh - 80px))",
|
|
@@ -232,61 +842,7 @@ const oe = {
|
|
|
232
842
|
borderRadius: 10,
|
|
233
843
|
background: "#ffffff",
|
|
234
844
|
boxShadow: "0 16px 40px rgba(24, 24, 27, 0.14), 0 2px 8px rgba(24, 24, 27, 0.06)"
|
|
235
|
-
}
|
|
236
|
-
@keyframes backmatter-devbar-in {
|
|
237
|
-
from { opacity: 0; transform: translateY(10px) scale(0.98); }
|
|
238
|
-
to { opacity: 1; transform: none; }
|
|
239
|
-
}
|
|
240
|
-
.${t} { animation: backmatter-devbar-in 240ms cubic-bezier(0.23, 1, 0.32, 1) both; }
|
|
241
|
-
@media (prefers-reduced-motion: reduce) {
|
|
242
|
-
.${t} { animation: none; }
|
|
243
|
-
}
|
|
244
|
-
.${t}-btn {
|
|
245
|
-
display: inline-flex;
|
|
246
|
-
align-items: center;
|
|
247
|
-
gap: 6px;
|
|
248
|
-
height: 26px;
|
|
249
|
-
margin-inline: 4px;
|
|
250
|
-
padding: 0 8px;
|
|
251
|
-
border: 1px solid #e4e4e7;
|
|
252
|
-
border-radius: 6px;
|
|
253
|
-
background: #ffffff;
|
|
254
|
-
color: #18181b;
|
|
255
|
-
font-size: 11px;
|
|
256
|
-
font-weight: 500;
|
|
257
|
-
line-height: 1;
|
|
258
|
-
cursor: pointer;
|
|
259
|
-
}
|
|
260
|
-
.${t}-agent kbd {
|
|
261
|
-
font-family: Geist Mono, ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
262
|
-
font-size: 11px;
|
|
263
|
-
font-weight: 400;
|
|
264
|
-
opacity: 0.7;
|
|
265
|
-
}
|
|
266
|
-
.${t} button.${t}-on,
|
|
267
|
-
.${t} button.${t}-on:hover:not(:disabled) {
|
|
268
|
-
background: #18181b;
|
|
269
|
-
border-color: #18181b;
|
|
270
|
-
color: #fafafa;
|
|
271
|
-
}
|
|
272
|
-
@media (hover: hover) {
|
|
273
|
-
.${t} button:hover:not(:disabled) { background: #f4f4f5; }
|
|
274
|
-
.${t} button.${t}-btn:hover:not(:disabled) {
|
|
275
|
-
background: rgba(24, 24, 27, 0.05);
|
|
276
|
-
}
|
|
277
|
-
.${t} button.${t}-on:hover:not(:disabled) {
|
|
278
|
-
background: #18181b;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
.${t} button:focus-visible { outline: 2px solid #18181b; outline-offset: 2px; }
|
|
282
|
-
.${t} button:disabled { cursor: default; opacity: 0.5; }
|
|
283
|
-
html.backmatter-pointing, html.backmatter-pointing * { cursor: crosshair !important; }
|
|
284
|
-
html.backmatter-pointing .${t},
|
|
285
|
-
html.backmatter-pointing .${t} *,
|
|
286
|
-
html.backmatter-pointing [data-backmatter-panel],
|
|
287
|
-
html.backmatter-pointing [data-backmatter-panel] * { cursor: pointer !important; }
|
|
288
|
-
html.backmatter-pointing .${t} button:disabled { cursor: default !important; }
|
|
289
|
-
`;
|
|
845
|
+
};
|
|
290
846
|
export {
|
|
291
|
-
|
|
847
|
+
Me as SiteWidget
|
|
292
848
|
};
|