@backmatter/studio 0.0.17 → 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.
- package/dist/chunks/{UiKitApp-D7vllRQE.js → UiKitApp-B1ANqCac.js} +528 -481
- package/dist/chunks/{WorkspaceRoutes-DH1LD-2Q.js → WorkspaceRoutes-BHNGrf-j.js} +24955 -24119
- package/dist/chunks/{dashboard-Dsaeud2x.js → dashboard-b-W6dGm5.js} +586 -565
- package/dist/chunks/{index-CGMqw2NH.js → index-HYioDjux.js} +104 -104
- package/dist/dashboard.js +2 -2
- package/dist/index.js +166 -159
- package/dist/site-widget.css +25 -6
- package/dist/site-widget.js +6925 -6840
- package/dist/studio.css +171 -42
- package/package.json +2 -2
- package/src/api.ts +44 -1
- package/src/chat/ChatMessage.tsx +4 -4
- package/src/chat/ChatProvider.tsx +6 -0
- package/src/chat/chat-helpers.ts +54 -2
- package/src/chrome/CommandPalette.tsx +3 -3
- package/src/chrome/ContentExplorerSidebar.tsx +421 -74
- package/src/chrome/WorkspaceStatusBar.tsx +24 -24
- package/src/chrome/commit-error.ts +48 -60
- package/src/chrome/commit-failure.tsx +2 -2
- package/src/chrome/content-path-tree.ts +4 -0
- package/src/chrome/explorer-row-menu.ts +28 -0
- package/src/chrome/folder-create-context.ts +14 -0
- package/src/chrome/use-publish-check.ts +75 -0
- package/src/{pages/code-session-routes.ts → content-routes.ts} +6 -6
- package/src/fields/FieldControl.tsx +198 -64
- package/src/fields/LinkFieldInput.tsx +315 -0
- package/src/fields/choose-field-input.ts +5 -0
- package/src/fields/link-targets.ts +60 -0
- package/src/host-path.ts +13 -0
- package/src/pages/CodeSessionPage.tsx +6 -241
- package/src/pages/DocEditorPage.tsx +121 -178
- package/src/pages/EmbedPublishPage.tsx +13 -5
- package/src/pages/GithubConnectPage.tsx +1 -1
- package/src/pages/LoginPage.tsx +67 -5
- package/src/pages/MediaFieldInput.tsx +712 -37
- package/src/pages/MediaGalleryPage.tsx +69 -5
- package/src/pages/PreviewAddress.tsx +293 -0
- package/src/pages/WorkspaceHomePage.tsx +1 -1
- package/src/pages/code-session-boot.ts +0 -12
- package/src/pages/media-selection.ts +79 -0
- package/src/pages/ui-kit/colors.tsx +2 -0
- package/src/pages/ui-kit/fields.tsx +60 -0
- package/src/styles/themes.ts +2 -0
- package/src/styles/tokens.stylex.ts +1 -0
- package/src/ui/Button.tsx +14 -0
- package/src/ui/Field.tsx +12 -1
- package/src/ui/Input.tsx +191 -97
- 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
|
|
3
|
-
import { i as
|
|
4
|
-
import {
|
|
5
|
-
import { u as
|
|
6
|
-
import { d as
|
|
7
|
-
const
|
|
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
|
|
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
|
|
17
|
-
function
|
|
18
|
-
var n,
|
|
19
|
-
const e = (
|
|
20
|
-
return
|
|
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
|
|
23
|
-
for (const
|
|
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
|
|
25
|
+
for (const o of i) a.style.removeProperty(o);
|
|
26
26
|
};
|
|
27
27
|
}, [e]), null;
|
|
28
28
|
}
|
|
29
|
-
function
|
|
30
|
-
return
|
|
31
|
-
/* @__PURE__ */ t(
|
|
32
|
-
/* @__PURE__ */ t(
|
|
33
|
-
/* @__PURE__ */ t(
|
|
34
|
-
/* @__PURE__ */ t(
|
|
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
|
|
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
|
|
46
|
-
const { setFocus: e } =
|
|
47
|
-
return
|
|
48
|
-
const n =
|
|
49
|
-
function a
|
|
50
|
-
if (!n ||
|
|
51
|
-
const i =
|
|
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
|
|
54
|
-
!(
|
|
55
|
-
docRef: { type:
|
|
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",
|
|
62
|
-
}, [e]),
|
|
63
|
-
const n =
|
|
64
|
-
function a
|
|
65
|
-
const i =
|
|
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(
|
|
68
|
+
return window.addEventListener(I, s), () => window.removeEventListener(I, s);
|
|
69
69
|
}, []), null;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
const { addPointer: e } =
|
|
73
|
-
return
|
|
74
|
-
const n =
|
|
75
|
-
function a
|
|
76
|
-
if (!n ||
|
|
77
|
-
const i =
|
|
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
|
|
79
|
+
const o = be(
|
|
80
80
|
i.doc ?? {},
|
|
81
81
|
i.grab
|
|
82
82
|
);
|
|
83
|
-
|
|
83
|
+
o && e(o);
|
|
84
84
|
}
|
|
85
|
-
return window.addEventListener("message",
|
|
85
|
+
return window.addEventListener("message", s), () => window.removeEventListener("message", s);
|
|
86
86
|
}, [e]), null;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
const { panel: e, dispatch: n } =
|
|
90
|
-
return
|
|
91
|
-
const i =
|
|
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
|
|
94
|
-
|
|
95
|
-
}, [
|
|
96
|
-
const i =
|
|
97
|
-
function
|
|
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 ||
|
|
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",
|
|
103
|
+
return window.addEventListener("message", o), () => window.removeEventListener("message", o);
|
|
104
104
|
}, [n]), null;
|
|
105
105
|
}
|
|
106
|
-
const
|
|
107
|
-
function
|
|
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
|
|
118
|
+
const rt = {
|
|
119
119
|
modified: "modified",
|
|
120
120
|
added: "new",
|
|
121
121
|
conflict: "conflict",
|
|
122
122
|
deleted: "deleted"
|
|
123
123
|
};
|
|
124
|
-
function
|
|
124
|
+
function it({
|
|
125
125
|
workspaceId: e,
|
|
126
126
|
onStatus: n,
|
|
127
|
-
onPublished:
|
|
127
|
+
onPublished: s
|
|
128
128
|
}) {
|
|
129
|
-
|
|
130
|
-
const [
|
|
131
|
-
|
|
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
|
|
134
|
-
r ||
|
|
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 =
|
|
142
|
-
q.current = n,
|
|
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
|
|
146
|
+
var G;
|
|
147
147
|
if (r) return;
|
|
148
148
|
i(x);
|
|
149
|
-
const
|
|
150
|
-
(
|
|
151
|
-
changeCount:
|
|
152
|
-
conflictCount:
|
|
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
|
|
155
|
-
!
|
|
154
|
+
const _ = X();
|
|
155
|
+
!_ || window.parent === window || window.parent.postMessage({
|
|
156
156
|
type: "backmatter:git",
|
|
157
|
-
changeCount:
|
|
158
|
-
conflictCount:
|
|
159
|
-
},
|
|
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
|
|
165
|
+
const w = window.setInterval(l, nt);
|
|
166
166
|
return () => {
|
|
167
|
-
r = !0, window.clearInterval(
|
|
167
|
+
r = !0, window.clearInterval(w);
|
|
168
168
|
};
|
|
169
169
|
}, [e]);
|
|
170
|
-
const 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
|
|
173
|
-
M(
|
|
179
|
+
const w = `${L(r)}:${l}`;
|
|
180
|
+
M(w), g(null);
|
|
174
181
|
try {
|
|
175
|
-
await
|
|
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
|
|
190
|
-
if (r.preventDefault(), !(
|
|
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
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
|
|
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
|
-
},
|
|
205
|
+
}, w), i(await S(e));
|
|
199
206
|
} catch (l) {
|
|
200
|
-
j(
|
|
207
|
+
j(Re(l));
|
|
201
208
|
} finally {
|
|
202
209
|
T(!1);
|
|
203
210
|
}
|
|
204
211
|
}
|
|
205
212
|
}
|
|
206
|
-
const
|
|
207
|
-
return
|
|
208
|
-
/* @__PURE__ */ t("p", { ...E
|
|
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:
|
|
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
|
|
226
|
-
/* @__PURE__ */ t("p", { ...E
|
|
227
|
-
N ? /* @__PURE__ */ t(
|
|
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 =
|
|
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
|
|
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
|
|
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) =>
|
|
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
|
-
|
|
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
|
|
255
|
-
function
|
|
261
|
+
const J = "backmatter:enter-at", at = 1e4;
|
|
262
|
+
function re(e, n) {
|
|
256
263
|
if (typeof window > "u") return !1;
|
|
257
|
-
const
|
|
258
|
-
if (
|
|
264
|
+
const s = !!(window.top && window.top !== window);
|
|
265
|
+
if (Te(s) === "parent")
|
|
259
266
|
return window.parent.postMessage({
|
|
260
|
-
type:
|
|
267
|
+
type: Me
|
|
261
268
|
}, window.location.origin), !0;
|
|
262
|
-
const
|
|
263
|
-
return Date.now() -
|
|
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
|
|
275
|
+
function st(e) {
|
|
269
276
|
const n = e.dashboardUrl ?? "https://dash.backmatter.app";
|
|
270
|
-
return
|
|
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:
|
|
285
|
+
status: s
|
|
279
286
|
}) => {
|
|
280
|
-
|
|
287
|
+
s === 401 && re(e.workspaceId, n);
|
|
281
288
|
}
|
|
282
289
|
}), U();
|
|
283
290
|
}
|
|
284
|
-
function
|
|
285
|
-
const n = e.basePath ?? "/backmatter", [
|
|
286
|
-
return /* @__PURE__ */ t(
|
|
287
|
-
/* @__PURE__ */ t(
|
|
288
|
-
/* @__PURE__ */ t(
|
|
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
|
|
292
|
-
const n =
|
|
293
|
-
if (
|
|
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
|
|
296
|
-
return
|
|
302
|
+
const b = U().onUnauthorized;
|
|
303
|
+
return ne({
|
|
297
304
|
...U(),
|
|
298
305
|
onUnauthorized: (c) => {
|
|
299
|
-
c.status === 426 ? i("outdated") :
|
|
306
|
+
c.status === 426 ? i("outdated") : b == null || b(c);
|
|
300
307
|
}
|
|
301
|
-
}),
|
|
308
|
+
}), Fe().then(async (c) => {
|
|
302
309
|
if (m) return;
|
|
303
310
|
if (!(c != null && c.user)) {
|
|
304
|
-
|
|
311
|
+
re(e.workspaceId, s) || i("unauthorized");
|
|
305
312
|
return;
|
|
306
313
|
}
|
|
307
314
|
const {
|
|
308
315
|
workspace: g
|
|
309
|
-
} = await
|
|
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,
|
|
323
|
-
if (
|
|
324
|
-
return /* @__PURE__ */ u(
|
|
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 (
|
|
332
|
-
return /* @__PURE__ */ u(
|
|
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
|
|
338
|
-
if (
|
|
339
|
-
return /* @__PURE__ */ t(
|
|
340
|
-
const
|
|
341
|
-
return
|
|
342
|
-
|
|
343
|
-
}, children: /* @__PURE__ */ u(
|
|
344
|
-
/* @__PURE__ */ t(
|
|
345
|
-
/* @__PURE__ */ t(
|
|
346
|
-
|
|
347
|
-
/* @__PURE__ */ t(
|
|
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
|
|
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
|
-
|
|
365
|
+
Ve.wipe(), window.location.assign(n);
|
|
359
366
|
}
|
|
360
|
-
function
|
|
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(
|
|
366
|
-
/* @__PURE__ */ t(
|
|
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
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
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
|
};
|
package/dist/site-widget.css
CHANGED
|
@@ -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
|
-
.
|
|
1440
|
-
border-bottom-color: var(--
|
|
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
|
-
.
|
|
1448
|
-
border-bottom-color: var(--
|
|
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
|
-
.
|
|
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
|
-
.
|
|
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;
|