@backmatter/studio 0.0.18 → 0.0.19

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.
Files changed (40) hide show
  1. package/dist/chunks/{UiKitApp-DkuQBiQZ.js → UiKitApp-B1ANqCac.js} +528 -481
  2. package/dist/chunks/{WorkspaceRoutes-DVvb3N-V.js → WorkspaceRoutes-BHNGrf-j.js} +24371 -23915
  3. package/dist/chunks/{dashboard-B4FITg6c.js → dashboard-b-W6dGm5.js} +586 -565
  4. package/dist/chunks/{index-CegtXnEI.js → index-HYioDjux.js} +104 -104
  5. package/dist/dashboard.js +2 -2
  6. package/dist/index.js +166 -159
  7. package/dist/site-widget.css +25 -6
  8. package/dist/site-widget.js +6925 -6840
  9. package/dist/studio.css +159 -36
  10. package/package.json +2 -2
  11. package/src/api.ts +41 -1
  12. package/src/chat/ChatMessage.tsx +4 -4
  13. package/src/chat/ChatProvider.tsx +6 -0
  14. package/src/chat/chat-helpers.ts +54 -2
  15. package/src/chrome/CommandPalette.tsx +3 -3
  16. package/src/chrome/ContentExplorerSidebar.tsx +421 -74
  17. package/src/chrome/WorkspaceStatusBar.tsx +24 -24
  18. package/src/chrome/commit-error.ts +48 -60
  19. package/src/chrome/commit-failure.tsx +2 -2
  20. package/src/chrome/content-path-tree.ts +4 -0
  21. package/src/chrome/explorer-row-menu.ts +28 -0
  22. package/src/chrome/folder-create-context.ts +14 -0
  23. package/src/chrome/use-publish-check.ts +75 -0
  24. package/src/fields/FieldControl.tsx +173 -62
  25. package/src/pages/DocEditorPage.tsx +47 -64
  26. package/src/pages/EmbedPublishPage.tsx +13 -5
  27. package/src/pages/GithubConnectPage.tsx +1 -1
  28. package/src/pages/LoginPage.tsx +67 -5
  29. package/src/pages/MediaFieldInput.tsx +155 -63
  30. package/src/pages/MediaGalleryPage.tsx +56 -3
  31. package/src/pages/PreviewAddress.tsx +30 -0
  32. package/src/pages/WorkspaceHomePage.tsx +1 -1
  33. package/src/pages/ui-kit/colors.tsx +2 -0
  34. package/src/pages/ui-kit/fields.tsx +60 -0
  35. package/src/styles/themes.ts +2 -0
  36. package/src/styles/tokens.stylex.ts +1 -0
  37. package/src/ui/Button.tsx +14 -0
  38. package/src/ui/Field.tsx +12 -1
  39. package/src/ui/Input.tsx +191 -97
  40. package/src/ui/popup.ts +13 -6
package/dist/index.js CHANGED
@@ -1,40 +1,40 @@
1
1
  import { jsx as t, jsxs as u } from "react/jsx-runtime";
2
- import { useLayoutEffect as ae, useEffect as f, useRef as Q, useState as h, useMemo as se } from "react";
3
- import { i as X, T as ce, E as le, C as ue, a as de, b as xe, u as me, D as _, c as Y, d as I, e as fe, f as Z, g as G, h as pe, p as E, j as C, k as he, l as ge, m as S, r as we, n as be, s as ye, o as ve, q as ke, t as qe, v as ze, w as Ee, B as Ce, x as Ne, S as Se, y as Re, z as ee, A as U, F as Pe, G as Le, H as Ue, R as je, I as Te, J as Me, K as $e, L as R, N as K, M as De, O as Fe, P as H, Q as Oe } from "./chunks/WorkspaceRoutes-DVvb3N-V.js";
4
- import { U as lt } from "./chunks/WorkspaceRoutes-DVvb3N-V.js";
5
- import { u as Ae, S as Be } from "./chunks/define-studio-DlYjgrwr.js";
6
- import { d as dt } from "./chunks/define-studio-DlYjgrwr.js";
7
- const P = {
2
+ import { useLayoutEffect as ue, useEffect as h, useRef as Y, useState as p, useMemo as de } from "react";
3
+ import { i as Z, T as xe, E as me, C as he, a as fe, b as pe, u as ge, D as I, c as ee, d as K, e as be, f as te, g as V, h as we, p as ye, j as ve, k as z, l as E, m as ke, n as qe, o as S, s as ze, r as Ee, q as Ce, t as Ne, v as Se, w as Pe, x as Re, y as Le, z as Ue, B as je, A as Te, S as Me, F as $e, G as ne, H as U, I as Be, J as Fe, K as De, R as Oe, L as Ae, M as _e, N as Ge, O as P, P as H, Q as Ie, U as Ke, V as W, W as Ve } from "./chunks/WorkspaceRoutes-BHNGrf-j.js";
4
+ import { X as pt } from "./chunks/WorkspaceRoutes-BHNGrf-j.js";
5
+ import { u as He, S as We } from "./chunks/define-studio-DlYjgrwr.js";
6
+ import { d as bt } from "./chunks/define-studio-DlYjgrwr.js";
7
+ const R = {
8
8
  accent: "var(--x11n7hvk)",
9
9
  accentHover: "var(--x1vnpaut)",
10
10
  focus: "var(--x1nzi8h4)"
11
11
  };
12
- function _e(e) {
12
+ function Xe(e) {
13
13
  const n = /^var\((--[^,)]+)/.exec(e);
14
14
  return (n == null ? void 0 : n[1]) ?? null;
15
15
  }
16
- const Ie = [P.accent, P.accentHover, P.focus];
17
- function Ge() {
18
- var n, a;
19
- const e = (a = (n = Ae().theme) == null ? void 0 : n.accent) == null ? void 0 : a.trim();
20
- return ae(() => {
16
+ const Je = [R.accent, R.accentHover, R.focus];
17
+ function Qe() {
18
+ var n, s;
19
+ const e = (s = (n = He().theme) == null ? void 0 : n.accent) == null ? void 0 : s.trim();
20
+ return ue(() => {
21
21
  if (!e) return;
22
- const o = document.documentElement, i = Ie.map(_e).filter((s) => !!s);
23
- for (const s of i) o.style.setProperty(s, e);
22
+ const a = document.documentElement, i = Je.map(Xe).filter((o) => !!o);
23
+ for (const o of i) a.style.setProperty(o, e);
24
24
  return () => {
25
- for (const s of i) o.style.removeProperty(s);
25
+ for (const o of i) a.style.removeProperty(o);
26
26
  };
27
27
  }, [e]), null;
28
28
  }
29
- function Ke({ workspaceId: e }) {
30
- return f(() => X(), []), /* @__PURE__ */ t(ce, { children: /* @__PURE__ */ t(le, { children: /* @__PURE__ */ t(ue, { workspaceId: e, startOpen: !0, pointer: !0, children: /* @__PURE__ */ u(de, { children: [
31
- /* @__PURE__ */ t(He, {}),
32
- /* @__PURE__ */ t(Ve, {}),
33
- /* @__PURE__ */ t(We, {}),
34
- /* @__PURE__ */ t(xe, { fill: !0 })
29
+ function Ye({ workspaceId: e }) {
30
+ return h(() => Z(), []), /* @__PURE__ */ t(xe, { children: /* @__PURE__ */ t(me, { children: /* @__PURE__ */ t(he, { workspaceId: e, startOpen: !0, pointer: !0, children: /* @__PURE__ */ u(fe, { children: [
31
+ /* @__PURE__ */ t(Ze, {}),
32
+ /* @__PURE__ */ t(et, {}),
33
+ /* @__PURE__ */ t(tt, {}),
34
+ /* @__PURE__ */ t(pe, { fill: !0 })
35
35
  ] }) }) }) });
36
36
  }
37
- function y() {
37
+ function v() {
38
38
  if (!document.referrer) return "";
39
39
  try {
40
40
  return new URL(document.referrer).origin;
@@ -42,69 +42,69 @@ function y() {
42
42
  return "";
43
43
  }
44
44
  }
45
- function He() {
46
- const { setFocus: e } = me();
47
- return f(() => {
48
- const n = y();
49
- function a(o) {
50
- if (!n || o.origin !== n) return;
51
- const i = o.data;
45
+ function Ze() {
46
+ const { setFocus: e } = ge();
47
+ return h(() => {
48
+ const n = v();
49
+ function s(a) {
50
+ if (!n || a.origin !== n) return;
51
+ const i = a.data;
52
52
  if ((i == null ? void 0 : i.type) !== "backmatter:focus") return;
53
- const s = i.doc;
54
- !(s != null && s.type) || !s.slug || e({
55
- docRef: { type: s.type, slug: s.slug },
53
+ const o = i.doc;
54
+ !(o != null && o.type) || !o.slug || e({
55
+ docRef: { type: o.type, slug: o.slug },
56
56
  frontmatter: {},
57
57
  body: "",
58
58
  selection: null
59
59
  });
60
60
  }
61
- return window.addEventListener("message", a), n && window.parent.postMessage({ type: "backmatter:chat-ready" }, n), () => window.removeEventListener("message", a);
62
- }, [e]), f(() => {
63
- const n = y();
64
- function a(o) {
65
- const i = o.detail;
61
+ return window.addEventListener("message", s), n && window.parent.postMessage({ type: "backmatter:chat-ready" }, n), () => window.removeEventListener("message", s);
62
+ }, [e]), h(() => {
63
+ const n = v();
64
+ function s(a) {
65
+ const i = a.detail;
66
66
  !n || !(i != null && i.docRef) || window.parent.postMessage({ type: "backmatter:doc-changed", doc: i.docRef }, n);
67
67
  }
68
- return window.addEventListener(_, a), () => window.removeEventListener(_, a);
68
+ return window.addEventListener(I, s), () => window.removeEventListener(I, s);
69
69
  }, []), null;
70
70
  }
71
- function Ve() {
72
- const { addPointer: e } = Y();
73
- return f(() => {
74
- const n = y();
75
- function a(o) {
76
- if (!n || o.origin !== n || o.source !== window.parent) return;
77
- const i = o.data;
71
+ function et() {
72
+ const { addPointer: e } = ee();
73
+ return h(() => {
74
+ const n = v();
75
+ function s(a) {
76
+ if (!n || a.origin !== n || a.source !== window.parent) return;
77
+ const i = a.data;
78
78
  if ((i == null ? void 0 : i.type) !== "backmatter:pointer-grab") return;
79
- const s = fe(
79
+ const o = be(
80
80
  i.doc ?? {},
81
81
  i.grab
82
82
  );
83
- s && e(s);
83
+ o && e(o);
84
84
  }
85
- return window.addEventListener("message", a), () => window.removeEventListener("message", a);
85
+ return window.addEventListener("message", s), () => window.removeEventListener("message", s);
86
86
  }, [e]), null;
87
87
  }
88
- function We() {
89
- const { panel: e, dispatch: n } = Y(), a = e.mode, o = Q(a);
90
- return f(() => {
91
- const i = y();
88
+ function tt() {
89
+ const { panel: e, dispatch: n } = ee(), s = e.mode, a = Y(s);
90
+ return h(() => {
91
+ const i = v();
92
92
  if (!i || window.parent === window) return;
93
- const s = I(o.current);
94
- o.current = a, s && !I(a) && window.parent.postMessage({ type: "backmatter:chat-closed" }, i);
95
- }, [a]), f(() => {
96
- const i = y();
97
- function s(p) {
93
+ const o = K(a.current);
94
+ a.current = s, o && !K(s) && window.parent.postMessage({ type: "backmatter:chat-closed" }, i);
95
+ }, [s]), h(() => {
96
+ const i = v();
97
+ function o(f) {
98
98
  var m;
99
- !i || p.origin !== i || ((m = p.data) == null ? void 0 : m.type) === "backmatter:chat-open" && (n({ type: "open" }), requestAnimationFrame(() => {
99
+ !i || f.origin !== i || ((m = f.data) == null ? void 0 : m.type) === "backmatter:chat-open" && (n({ type: "open" }), requestAnimationFrame(() => {
100
100
  window.dispatchEvent(new Event("backmatter:chat-focus"));
101
101
  }));
102
102
  }
103
- return window.addEventListener("message", s), () => window.removeEventListener("message", s);
103
+ return window.addEventListener("message", o), () => window.removeEventListener("message", o);
104
104
  }, [n]), null;
105
105
  }
106
- const Je = 8e3;
107
- function V() {
106
+ const nt = 8e3;
107
+ function X() {
108
108
  if (!document.referrer) return "";
109
109
  try {
110
110
  return new URL(document.referrer).origin;
@@ -115,64 +115,71 @@ function V() {
115
115
  function L(e) {
116
116
  return `${e.type}/${e.slug}`;
117
117
  }
118
- const Qe = {
118
+ const rt = {
119
119
  modified: "modified",
120
120
  added: "new",
121
121
  conflict: "conflict",
122
122
  deleted: "deleted"
123
123
  };
124
- function Xe({
124
+ function it({
125
125
  workspaceId: e,
126
126
  onStatus: n,
127
- onPublished: a
127
+ onPublished: s
128
128
  }) {
129
- f(() => X(), []);
130
- const [o, i] = h(null), [s, p] = h("viewer"), [m, w] = h(""), [c, g] = h(null), [N, j] = h(null), [v, T] = h(!1), [k, M] = h(null);
131
- f(() => {
129
+ h(() => Z(), []);
130
+ const [a, i] = p(null), [o, f] = p("viewer"), [m, b] = p(""), [c, g] = p(null), [ie, j] = p(null), [C, T] = p(!1), [k, M] = p(null);
131
+ h(() => {
132
132
  let r = !1;
133
- return Z(e).then((l) => {
134
- r || p(l.workspace.role);
133
+ return te(e).then((l) => {
134
+ r || f(l.workspace.role);
135
135
  }).catch(() => {
136
136
  r || g("Could not load this workspace");
137
137
  }), () => {
138
138
  r = !0;
139
139
  };
140
140
  }, [e]);
141
- const q = Q(n);
142
- q.current = n, f(() => {
141
+ const q = Y(n);
142
+ q.current = n, h(() => {
143
143
  let r = !1;
144
144
  const l = () => {
145
145
  S(e).then((x) => {
146
- var B;
146
+ var G;
147
147
  if (r) return;
148
148
  i(x);
149
- const F = x.changes.length, O = G(x);
150
- (B = q.current) == null || B.call(q, {
151
- changeCount: F,
152
- conflictCount: O
149
+ const O = x.changes.length, A = V(x);
150
+ (G = q.current) == null || G.call(q, {
151
+ changeCount: O,
152
+ conflictCount: A
153
153
  });
154
- const A = V();
155
- !A || window.parent === window || window.parent.postMessage({
154
+ const _ = X();
155
+ !_ || window.parent === window || window.parent.postMessage({
156
156
  type: "backmatter:git",
157
- changeCount: F,
158
- conflictCount: O
159
- }, A);
157
+ changeCount: O,
158
+ conflictCount: A
159
+ }, _);
160
160
  }).catch((x) => {
161
161
  r || g(x instanceof Error ? x.message : "Git status failed");
162
162
  });
163
163
  };
164
164
  l();
165
- const b = window.setInterval(l, Je);
165
+ const w = window.setInterval(l, nt);
166
166
  return () => {
167
- r = !0, window.clearInterval(b);
167
+ r = !0, window.clearInterval(w);
168
168
  };
169
169
  }, [e]);
170
- const d = (o == null ? void 0 : o.changes) ?? [], ne = G(o), z = ye(ne, ze(s)), $ = se(() => d.filter((r) => r.status === "conflict"), [d]), re = pe(d);
170
+ const d = (a == null ? void 0 : a.changes) ?? [], ae = V(a), y = ze(ae, Le(o)), {
171
+ failure: $,
172
+ checking: se
173
+ } = we(e, y === "commit", ye(d)), N = ie ?? $, B = Ne({
174
+ committing: C,
175
+ checking: se,
176
+ failure: $
177
+ }), F = de(() => d.filter((r) => r.status === "conflict"), [d]), oe = ve(d);
171
178
  async function D(r, l) {
172
- const b = `${L(r)}:${l}`;
173
- M(b), g(null);
179
+ const w = `${L(r)}:${l}`;
180
+ M(w), g(null);
174
181
  try {
175
- await we(e, r.type, r.slug, l), be({
182
+ await Ee(e, r.type, r.slug, l), Ce({
176
183
  workspaceId: e,
177
184
  type: r.type,
178
185
  slug: r.slug,
@@ -186,29 +193,29 @@ function Xe({
186
193
  M(null);
187
194
  }
188
195
  }
189
- async function ie(r) {
190
- if (r.preventDefault(), !(v || z !== "commit" || d.length === 0)) {
196
+ async function ce(r) {
197
+ if (r.preventDefault(), !(C || y !== "commit" || d.length === 0)) {
191
198
  T(!0), g(null), j(null);
192
199
  try {
193
- const l = await ve(e, m);
194
- w(""), ke(e, l.files), a == null || a();
195
- const b = V();
196
- b && window.parent !== window && window.parent.postMessage({
200
+ const l = await Se(e, m);
201
+ b(""), Pe(e, l.files), s == null || s();
202
+ const w = X();
203
+ w && window.parent !== window && window.parent.postMessage({
197
204
  type: "backmatter:published"
198
- }, b), i(await S(e));
205
+ }, w), i(await S(e));
199
206
  } catch (l) {
200
- j(qe(l));
207
+ j(Re(l));
201
208
  } finally {
202
209
  T(!1);
203
210
  }
204
211
  }
205
212
  }
206
- const oe = (o == null ? void 0 : o.currentBranch) ?? "main";
207
- return $.length > 0 ? /* @__PURE__ */ u("div", { className: "x78zum5 xdt5ytf xmqd7ac x1hb2obb xqjzbou", children: [
208
- /* @__PURE__ */ t("p", { ...E(C.groupLabel), children: "Resolve conflicts" }),
213
+ const le = (a == null ? void 0 : a.currentBranch) ?? "main";
214
+ return F.length > 0 ? /* @__PURE__ */ u("div", { className: "x78zum5 xdt5ytf xmqd7ac x1hb2obb xqjzbou", children: [
215
+ /* @__PURE__ */ t("p", { ...z(E.groupLabel), children: "Resolve conflicts" }),
209
216
  /* @__PURE__ */ t("p", { className: "x1ghz6dp x173sf5p xq98a72 x10qp4ay x37zpob x111yfic", children: "Pick a side for each file. Commit stays blocked until every conflict is resolved." }),
210
217
  c ? /* @__PURE__ */ t("p", { className: "x1ghz6dp x173sf5p xq98a72 x10qp4ay x1trrqm4", children: c }) : null,
211
- /* @__PURE__ */ t("ul", { className: "x1ghz6dp x1717udv xe8uvvx x1odjw0f x1kbliiw xq3t0pi", children: $.map((r) => {
218
+ /* @__PURE__ */ t("ul", { className: "x1ghz6dp x1717udv xe8uvvx x1odjw0f x1kbliiw xq3t0pi", children: F.map((r) => {
212
219
  const l = L(r);
213
220
  return /* @__PURE__ */ u("li", { className: "x78zum5 xdt5ytf xpw8yq9 x1l8q8zy x1om5956 x1ar5oo6 x10qp4ay", children: [
214
221
  /* @__PURE__ */ u("span", { className: "xeuugli x98rzlu xb3r6kr xlyipyv xuxw1ft", children: [
@@ -222,11 +229,11 @@ function Xe({
222
229
  ] })
223
230
  ] }, l);
224
231
  }) })
225
- ] }) : /* @__PURE__ */ u("form", { className: "x78zum5 xdt5ytf xmqd7ac x1hb2obb xqjzbou", onSubmit: (r) => void ie(r), children: [
226
- /* @__PURE__ */ t("p", { ...E(C.groupLabel), children: d.length === 0 ? "Nothing to publish" : `${d.length} ${d.length === 1 ? "file" : "files"} → ${oe}` }),
227
- N ? /* @__PURE__ */ t(he, { failure: N }) : null,
232
+ ] }) : /* @__PURE__ */ u("form", { className: "x78zum5 xdt5ytf xmqd7ac x1hb2obb xqjzbou", onSubmit: (r) => void ce(r), children: [
233
+ /* @__PURE__ */ t("p", { ...z(E.groupLabel), children: d.length === 0 ? "Nothing to publish" : `${d.length} ${d.length === 1 ? "file" : "files"} → ${le}` }),
234
+ N ? /* @__PURE__ */ t(ke, { failure: N }) : null,
228
235
  d.length > 0 ? /* @__PURE__ */ t("ul", { className: "x1ghz6dp x1717udv xe8uvvx xctk3hg x1odjw0f x1kbliiw", children: d.map((r) => {
229
- const l = ge(N, `${r.type}/${r.slug}`).length > 0;
236
+ const l = qe(N, `${r.type}/${r.slug}`).length > 0;
230
237
  return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ u("div", { className: "x78zum5 x6s0dn4 x3smv4v x1rz828m x1ghz6dp x1obou79 x1l8q8zy x1om5956 x1ar5oo6 x10qp4ay x111yfic", children: [
231
238
  /* @__PURE__ */ u("span", { ...{
232
239
  0: {
@@ -240,34 +247,34 @@ function Xe({
240
247
  "/",
241
248
  r.slug
242
249
  ] }),
243
- /* @__PURE__ */ t("span", { ...E(C.itemMeta), children: Qe[r.status] })
250
+ /* @__PURE__ */ t("span", { ...z(E.itemMeta), children: rt[r.status] })
244
251
  ] }) }, L(r));
245
252
  }) }) : null,
246
- d.length > 0 ? /* @__PURE__ */ t("div", { ...E(C.separator) }) : null,
253
+ d.length > 0 ? /* @__PURE__ */ t("div", { ...z(E.separator) }) : null,
247
254
  d.length > 0 ? /* @__PURE__ */ u("div", { className: "x78zum5 xdt5ytf x1qjc9v5 x1ndbd79 x173sf5p x1l7y7l0 xreod0t", children: [
248
- /* @__PURE__ */ t("input", { value: m, onChange: (r) => w(r.target.value), placeholder: re, "aria-label": "Commit message", autoComplete: "off", spellCheck: !1, "data-no-ring": !0, "data-1p-ignore": !0, "data-lpignore": !0, disabled: v || z !== "commit", className: "xh8yej3 x9f619 xe0p6wg x1l8q8zy x1om5956 xmkeg23 x1y0btm7 x1j0qoeq x13oidi xawfm1v xqjzbou x1vrk1b5 x1a2a7pz x1uvtmcs x1t8xw5s xk2swo9 xk0mbs4 x9ecp23" }),
255
+ /* @__PURE__ */ t("input", { value: m, onChange: (r) => b(r.target.value), placeholder: oe, "aria-label": "Publish message", autoComplete: "off", spellCheck: !1, "data-no-ring": !0, "data-1p-ignore": !0, "data-lpignore": !0, disabled: C || y !== "commit", className: "xh8yej3 x9f619 xe0p6wg x1l8q8zy x1om5956 xmkeg23 x1y0btm7 x1j0qoeq x13oidi xawfm1v xqjzbou x1vrk1b5 x1a2a7pz x1uvtmcs x1t8xw5s xk2swo9 xk0mbs4 x9ecp23" }),
249
256
  c ? /* @__PURE__ */ t("p", { className: "x1ghz6dp x10qp4ay x1trrqm4 xnjsko4 x18d9i69", children: c }) : null,
250
- z === "blocked" ? /* @__PURE__ */ t("p", { className: "x1ghz6dp x173sf5p xq98a72 x10qp4ay x37zpob x111yfic", children: "Writers cannot publish" }) : /* @__PURE__ */ t("button", { type: "submit", disabled: v || z !== "commit", className: "x78zum5 xh8yej3 x6s0dn4 xl56j7k x1fgtraw x161b3w3 xmkeg23 x1y0btm7 x14aomtw x13oidi xrb6rkd xfja90d x10qp4ay xk50ysn xuxw1ft x1ypdohk x2q2s9b x1dih85f xk0mbs4 x1s07b3s xd3so5o x784prv x9v5kkp x1yxvn1h x13iak60 xb93eig", children: v ? "Committing…" : "Commit & push" })
257
+ y === "blocked" ? /* @__PURE__ */ t("p", { className: "x1ghz6dp x173sf5p xq98a72 x10qp4ay x37zpob x111yfic", children: "Writers cannot publish" }) : /* @__PURE__ */ t("button", { type: "submit", disabled: y !== "commit" || B.disabled, className: "x78zum5 xh8yej3 x6s0dn4 xl56j7k x1fgtraw x161b3w3 xmkeg23 x1y0btm7 x14aomtw x13oidi xrb6rkd xfja90d x10qp4ay xk50ysn xuxw1ft x1ypdohk x2q2s9b x1dih85f xk0mbs4 x1s07b3s xd3so5o x784prv x9v5kkp x1yxvn1h x13iak60 xb93eig", children: B.label })
251
258
  ] }) : c ? /* @__PURE__ */ t("p", { className: "x1ghz6dp x173sf5p xq98a72 x10qp4ay x1trrqm4", children: c }) : null
252
259
  ] });
253
260
  }
254
- const W = "backmatter:enter-at", Ye = 1e4;
255
- function te(e, n) {
261
+ const J = "backmatter:enter-at", at = 1e4;
262
+ function re(e, n) {
256
263
  if (typeof window > "u") return !1;
257
- const a = !!(window.top && window.top !== window);
258
- if (Ne(a) === "parent")
264
+ const s = !!(window.top && window.top !== window);
265
+ if (Te(s) === "parent")
259
266
  return window.parent.postMessage({
260
- type: Se
267
+ type: Me
261
268
  }, window.location.origin), !0;
262
- const o = Number(window.sessionStorage.getItem(W) ?? 0);
263
- return Date.now() - o < Ye ? !1 : (window.sessionStorage.setItem(W, String(Date.now())), window.location.assign(Re(n, {
269
+ const a = Number(window.sessionStorage.getItem(J) ?? 0);
270
+ return Date.now() - a < at ? !1 : (window.sessionStorage.setItem(J, String(Date.now())), window.location.assign($e(n, {
264
271
  workspaceId: e,
265
272
  returnUrl: window.location.href
266
273
  })), !0);
267
274
  }
268
- function Ze(e) {
275
+ function st(e) {
269
276
  const n = e.dashboardUrl ?? "https://dash.backmatter.app";
270
- return ee({
277
+ return ne({
271
278
  baseUrl: e.proxyPath ?? "/api/backmatter/cms",
272
279
  publicApiUrl: e.apiUrl,
273
280
  credentials: "same-origin",
@@ -275,38 +282,38 @@ function Ze(e) {
275
282
  version: e.version,
276
283
  dashboardUrl: n,
277
284
  onUnauthorized: ({
278
- status: a
285
+ status: s
279
286
  }) => {
280
- a === 401 && te(e.workspaceId, n);
287
+ s === 401 && re(e.workspaceId, n);
281
288
  }
282
289
  }), U();
283
290
  }
284
- function at(e) {
285
- const n = e.basePath ?? "/backmatter", [a] = h(() => Ze(e));
286
- return /* @__PURE__ */ t(Be, { definition: e.studio, children: /* @__PURE__ */ u(Ee, { children: [
287
- /* @__PURE__ */ t(Ge, {}),
288
- /* @__PURE__ */ t(Ce, { basename: n, children: /* @__PURE__ */ t(et, { ...e }) })
291
+ function mt(e) {
292
+ const n = e.basePath ?? "/backmatter", [s] = p(() => st(e));
293
+ return /* @__PURE__ */ t(We, { definition: e.studio, children: /* @__PURE__ */ u(Ue, { children: [
294
+ /* @__PURE__ */ t(Qe, {}),
295
+ /* @__PURE__ */ t(je, { basename: n, children: /* @__PURE__ */ t(ot, { ...e }) })
289
296
  ] }) });
290
297
  }
291
- function et(e) {
292
- const n = Pe(), a = e.dashboardUrl ?? "https://dash.backmatter.app", [o, i] = h("loading");
293
- if (f(() => {
298
+ function ot(e) {
299
+ const n = Be(), s = e.dashboardUrl ?? "https://dash.backmatter.app", [a, i] = p("loading");
300
+ if (h(() => {
294
301
  let m = !1;
295
- const w = U().onUnauthorized;
296
- return ee({
302
+ const b = U().onUnauthorized;
303
+ return ne({
297
304
  ...U(),
298
305
  onUnauthorized: (c) => {
299
- c.status === 426 ? i("outdated") : w == null || w(c);
306
+ c.status === 426 ? i("outdated") : b == null || b(c);
300
307
  }
301
- }), Le().then(async (c) => {
308
+ }), Fe().then(async (c) => {
302
309
  if (m) return;
303
310
  if (!(c != null && c.user)) {
304
- te(e.workspaceId, a) || i("unauthorized");
311
+ re(e.workspaceId, s) || i("unauthorized");
305
312
  return;
306
313
  }
307
314
  const {
308
315
  workspace: g
309
- } = await Z(e.workspaceId);
316
+ } = await te(e.workspaceId);
310
317
  m || i({
311
318
  user: {
312
319
  id: c.user.id,
@@ -319,35 +326,35 @@ function et(e) {
319
326
  }), () => {
320
327
  m = !0;
321
328
  };
322
- }, [e.workspaceId, a]), o === "loading") return /* @__PURE__ */ t(Ue, {});
323
- if (o === "outdated")
324
- return /* @__PURE__ */ u(J, { title: "This site's editor is out of date", children: [
329
+ }, [e.workspaceId, s]), a === "loading") return /* @__PURE__ */ t(De, {});
330
+ if (a === "outdated")
331
+ return /* @__PURE__ */ u(Q, { title: "This site's editor is out of date", children: [
325
332
  "Update ",
326
333
  /* @__PURE__ */ t("code", { children: "@backmatter/studio" }),
327
334
  " and ",
328
335
  /* @__PURE__ */ t("code", { children: "@backmatter/next" }),
329
336
  " on the site, then reload."
330
337
  ] });
331
- if (o === "unauthorized")
332
- return /* @__PURE__ */ u(J, { title: "Could not start editing", children: [
338
+ if (a === "unauthorized")
339
+ return /* @__PURE__ */ u(Q, { title: "Could not start editing", children: [
333
340
  "The site did not receive a session from the dashboard. Check that this site's origin is listed in the workspace settings and that ",
334
341
  /* @__PURE__ */ t("code", { children: "/api/backmatter" }),
335
342
  " routes are deployed."
336
343
  ] });
337
- const s = n.pathname.match(/^\/embed\/chat\/([^/]+)\/?$/);
338
- if (s != null && s[1])
339
- return /* @__PURE__ */ t(Ke, { workspaceId: decodeURIComponent(s[1]) });
340
- const p = n.pathname.match(/^\/embed\/publish\/([^/]+)\/?$/);
341
- return p != null && p[1] ? /* @__PURE__ */ t(Xe, { workspaceId: decodeURIComponent(p[1]) }) : /* @__PURE__ */ t(je, { user: o.user, children: /* @__PURE__ */ t(Te, { children: /* @__PURE__ */ t(Me, { userId: o.user.id, email: o.user.email, onLogout: () => {
342
- tt(e.previewEntryPath ?? "/api/backmatter/preview", a);
343
- }, children: /* @__PURE__ */ u($e, { children: [
344
- /* @__PURE__ */ t(R, { path: "/", element: /* @__PURE__ */ t(K, { to: `/${o.slug}`, replace: !0 }) }),
345
- /* @__PURE__ */ t(R, { path: "/workspaces/:workspaceId/*", element: /* @__PURE__ */ t(De, {}) }),
346
- Fe(),
347
- /* @__PURE__ */ t(R, { path: "*", element: /* @__PURE__ */ t(K, { to: "/", replace: !0 }) })
344
+ const o = n.pathname.match(/^\/embed\/chat\/([^/]+)\/?$/);
345
+ if (o != null && o[1])
346
+ return /* @__PURE__ */ t(Ye, { workspaceId: decodeURIComponent(o[1]) });
347
+ const f = n.pathname.match(/^\/embed\/publish\/([^/]+)\/?$/);
348
+ return f != null && f[1] ? /* @__PURE__ */ t(it, { workspaceId: decodeURIComponent(f[1]) }) : /* @__PURE__ */ t(Oe, { user: a.user, children: /* @__PURE__ */ t(Ae, { children: /* @__PURE__ */ t(_e, { userId: a.user.id, email: a.user.email, onLogout: () => {
349
+ ct(e.previewEntryPath ?? "/api/backmatter/preview", s);
350
+ }, children: /* @__PURE__ */ u(Ge, { children: [
351
+ /* @__PURE__ */ t(P, { path: "/", element: /* @__PURE__ */ t(H, { to: `/${a.slug}`, replace: !0 }) }),
352
+ /* @__PURE__ */ t(P, { path: "/workspaces/:workspaceId/*", element: /* @__PURE__ */ t(Ie, {}) }),
353
+ Ke(),
354
+ /* @__PURE__ */ t(P, { path: "*", element: /* @__PURE__ */ t(H, { to: "/", replace: !0 }) })
348
355
  ] }) }) }) });
349
356
  }
350
- async function tt(e, n) {
357
+ async function ct(e, n) {
351
358
  try {
352
359
  await fetch(e, {
353
360
  method: "POST",
@@ -355,23 +362,23 @@ async function tt(e, n) {
355
362
  });
356
363
  } catch {
357
364
  }
358
- Oe.wipe(), window.location.assign(n);
365
+ Ve.wipe(), window.location.assign(n);
359
366
  }
360
- function J({
367
+ function Q({
361
368
  title: e,
362
369
  children: n
363
370
  }) {
364
371
  return /* @__PURE__ */ t("div", { className: "x1ov3xa9 xrvj5dj x1ku5rj1 x1t7e3gq", children: /* @__PURE__ */ u("div", { className: "x78zum5 xdt5ytf x1ndbd79 xq2pcee x1t7e3gq x4pepcl x1d0qn7y", children: [
365
- /* @__PURE__ */ t(H, { size: "lg", weight: "medium", children: e }),
366
- /* @__PURE__ */ t(H, { tone: "muted", children: n })
372
+ /* @__PURE__ */ t(W, { size: "lg", weight: "medium", children: e }),
373
+ /* @__PURE__ */ t(W, { tone: "muted", children: n })
367
374
  ] }) });
368
375
  }
369
376
  export {
370
- at as SiteStudio,
371
- lt as apiUrl,
372
- te as bounceToEnter,
373
- Ze as configureSiteStudio,
374
- ee as configureStudio,
375
- dt as defineStudio,
377
+ mt as SiteStudio,
378
+ pt as apiUrl,
379
+ re as bounceToEnter,
380
+ st as configureSiteStudio,
381
+ ne as configureStudio,
382
+ bt as defineStudio,
376
383
  U as studioConfig
377
384
  };
@@ -53,6 +53,10 @@
53
53
  border-color: var(--xz3qvk5);
54
54
  }
55
55
 
56
+ .x2u8bby {
57
+ border-radius: 0;
58
+ }
59
+
56
60
  .x1q4ynmn {
57
61
  border-radius: 10px;
58
62
  }
@@ -345,6 +349,10 @@
345
349
  animation-timing-function: cubic-bezier(.23, 1, .32, 1);
346
350
  }
347
351
 
352
+ .xjyslct {
353
+ appearance: none;
354
+ }
355
+
348
356
  .x8dftg {
349
357
  background-color: #dc262614;
350
358
  }
@@ -1312,6 +1320,10 @@
1312
1320
  padding-left: calc(var(--x1ft7ks7) + var(--x1uiwg42));
1313
1321
  }
1314
1322
 
1323
+ .x19qf7k3 {
1324
+ padding-left: calc(var(--x1uiwg42) + var(--x1lzhbes) + 14px + var(--x1o7ezzp));
1325
+ }
1326
+
1315
1327
  .x1g65kkx {
1316
1328
  padding-left: var(--x1ft7ks7);
1317
1329
  }
@@ -1324,6 +1336,10 @@
1324
1336
  padding-right: 2px;
1325
1337
  }
1326
1338
 
1339
+ .x2zv159 {
1340
+ padding-right: var(--x1ft7ks7);
1341
+ }
1342
+
1327
1343
  .xznc5xv {
1328
1344
  padding-right: var(--x1lzhbes);
1329
1345
  }
@@ -1436,16 +1452,16 @@
1436
1452
  width: var(--anchor-width);
1437
1453
  }
1438
1454
 
1439
- .xo5mw66:focus-visible {
1440
- border-bottom-color: var(--xz3qvk5);
1455
+ .x1nthoga:focus-visible {
1456
+ border-bottom-color: var(--x1nzi8h4);
1441
1457
  }
1442
1458
 
1443
1459
  .xzboxd6:last-child {
1444
1460
  margin-bottom: 0;
1445
1461
  }
1446
1462
 
1447
- .xdq5akm:focus {
1448
- border-bottom-color: var(--xz3qvk5);
1463
+ .xqg1kb6:focus {
1464
+ border-bottom-color: var(--x1nzi8h4);
1449
1465
  }
1450
1466
  }
1451
1467
 
@@ -1607,6 +1623,7 @@
1607
1623
  --x1xbnvpt: #f4f4f5;
1608
1624
  --xbtbsdh: #ececef;
1609
1625
  --x1dudhym: #fff;
1626
+ --x13vbpmf: #fff;
1610
1627
  --xeg52a: #18181b0d;
1611
1628
  --xfamku2: #18181b14;
1612
1629
  --x1fg5qi: #fff;
@@ -1624,7 +1641,7 @@
1624
1641
  --x1nzi8h4: #18181b;
1625
1642
  }
1626
1643
 
1627
- .x145rjjm.x145rjjm, .x145rjjm.x145rjjm:root {
1644
+ .x1qwws05.x1qwws05, .x1qwws05.x1qwws05:root {
1628
1645
  --x11n7hvk: #18181b;
1629
1646
  --x1vnpaut: #3f3f46;
1630
1647
  --x1ljpve6: #f4f4f5;
@@ -1634,6 +1651,7 @@
1634
1651
  --x1fg5qi: #fff;
1635
1652
  --x1xbnvpt: #f4f4f5;
1636
1653
  --xbtbsdh: #ececef;
1654
+ --x13vbpmf: #fff;
1637
1655
  --xoa6ql4: #ececee;
1638
1656
  --x13g60fp: #f4f4f5;
1639
1657
  --x1dudhym: #fff;
@@ -1647,7 +1665,7 @@
1647
1665
  --xw4dauw: #71717a;
1648
1666
  }
1649
1667
 
1650
- .xohh2l7.xohh2l7, .xohh2l7.xohh2l7:root {
1668
+ .x1ht4xdt.x1ht4xdt, .x1ht4xdt.x1ht4xdt:root {
1651
1669
  --x11n7hvk: #fafafa;
1652
1670
  --x1vnpaut: #e4e4e7;
1653
1671
  --x1ljpve6: #ffffff1a;
@@ -1657,6 +1675,7 @@
1657
1675
  --x1fg5qi: #18181b;
1658
1676
  --x1xbnvpt: #131316;
1659
1677
  --xbtbsdh: #0f0f12;
1678
+ --x13vbpmf: #2c2c32;
1660
1679
  --xoa6ql4: #111113;
1661
1680
  --x13g60fp: #111113;
1662
1681
  --x1dudhym: #1f1f23;