@backmatter/studio 0.0.20 → 0.0.21
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-C269OA8v.js → UiKitApp-CMMcsaX4.js} +2 -2
- package/dist/chunks/{WorkspaceRoutes-B4B5jjje.js → WorkspaceRoutes-DW0sLdpJ.js} +27141 -26241
- package/dist/chunks/dashboard-By0P4Yny.js +1879 -0
- package/dist/chunks/{index-7-TtXaMq.js → index-DTPUqaHE.js} +1 -1
- package/dist/dashboard.js +2 -2
- package/dist/index.js +205 -194
- package/dist/site-widget.css +208 -0
- package/dist/site-widget.js +10495 -9947
- package/dist/studio.css +276 -32
- package/package.json +2 -2
- package/src/App.tsx +7 -1
- package/src/api.ts +106 -13
- package/src/chat/ChatFiles.tsx +261 -0
- package/src/chat/ChatMessage.tsx +5 -0
- package/src/chat/ChatPanel.tsx +218 -14
- package/src/chat/ChatProvider.tsx +72 -22
- package/src/chat/Composer.tsx +83 -6
- package/src/chat/PendingFileRow.tsx +188 -0
- package/src/chat/chat-context.ts +7 -1
- package/src/chat/chat-helpers.ts +49 -0
- package/src/chat/chat-state.ts +17 -6
- package/src/chat/icons.tsx +28 -0
- package/src/chat/model-copy.ts +41 -0
- package/src/chat/pending-files.ts +236 -0
- package/src/chat/side-width.ts +48 -0
- package/src/chrome/AppShell.tsx +9 -1
- package/src/chrome/CommandPalette.tsx +7 -0
- package/src/chrome/ContentExplorerSidebar.tsx +43 -74
- package/src/chrome/folder-create-context.ts +56 -11
- package/src/chrome/hotkeys.ts +8 -0
- package/src/fields/FieldControl.tsx +331 -115
- package/src/fields/LinkFieldInput.tsx +13 -6
- package/src/fields/array-item-title.ts +28 -0
- package/src/fields/field-label.ts +8 -0
- package/src/host-pointer.ts +2 -0
- package/src/install-preview-pointer.ts +1 -0
- package/src/pages/BlockPicker.tsx +362 -0
- package/src/pages/BlocksList.tsx +39 -67
- package/src/pages/CliAuthorizePage.tsx +138 -25
- package/src/pages/DocEditorPage.tsx +95 -18
- package/src/pages/EmbedPublishPage.tsx +40 -2
- package/src/pages/LoginPage.tsx +118 -31
- package/src/pages/SettingsSchemaPage.tsx +19 -3
- package/src/pages/WorkspaceLayout.tsx +16 -1
- package/src/pages/block-picker.ts +116 -0
- package/src/pages/editor-grab.ts +61 -13
- package/src/pages/preview-split.ts +24 -0
- package/src/pages/session-preview.ts +1 -0
- package/src/replica/types.ts +2 -0
- package/src/sign-in-link.ts +45 -0
- package/src/site-pointer.ts +14 -1
- package/src/site-widget.tsx +12 -1
- package/src/ui/Field.tsx +26 -0
- package/src/workspace/schema-source.tsx +126 -0
- package/dist/chunks/dashboard-DeNgythd.js +0 -1779
- package/src/site-devbar-overlay-inject.ts +0 -15
- package/src/site-publish-menu.tsx +0 -33
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Rs = Object.defineProperty;
|
|
2
2
|
var Es = (r, e, t) => e in r ? Rs(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
3
|
var M = (r, e, t) => Es(r, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import {
|
|
4
|
+
import { aP as Bt, aQ as Bs, aR as a0, aS as ct, aT as xt, aU as ea, aV as Gn, aW as Is, aX as Ls, aY as Ds, aZ as La, a_ as Ps, a$ as Os, b0 as Le, b1 as qs } from "./WorkspaceRoutes-DW0sLdpJ.js";
|
|
5
5
|
function Fs() {
|
|
6
6
|
return {
|
|
7
7
|
enter: {
|
package/dist/dashboard.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as a, i as s } from "./chunks/dashboard-
|
|
2
|
-
import { G as t, H as f } from "./chunks/WorkspaceRoutes-
|
|
1
|
+
import { A as a, i as s } from "./chunks/dashboard-By0P4Yny.js";
|
|
2
|
+
import { G as t, H as f } from "./chunks/WorkspaceRoutes-DW0sLdpJ.js";
|
|
3
3
|
export {
|
|
4
4
|
a as DashboardApp,
|
|
5
5
|
t as configureStudio,
|
package/dist/index.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { jsx as t, jsxs as u } from "react/jsx-runtime";
|
|
2
|
-
import { useLayoutEffect as
|
|
3
|
-
import { i as
|
|
4
|
-
import { X as
|
|
5
|
-
import { u as
|
|
6
|
-
import { d as
|
|
1
|
+
import { jsx as t, jsxs as u, Fragment as he } from "react/jsx-runtime";
|
|
2
|
+
import { useLayoutEffect as pe, useEffect as p, useRef as ee, useState as m, useMemo as fe } from "react";
|
|
3
|
+
import { i as te, T as ge, E as be, C as ye, a as we, b as ve, u as ke, D as V, c as ne, d as H, e as qe, f as re, g as W, h as ze, p as Ee, j as Ce, k as w, l as v, m as Ne, n as Se, o as L, s as Le, r as Pe, q as Re, t as je, v as Ue, w as Te, x as Me, y as $e, z as Fe, B as Be, A as Oe, S as Ae, F as De, G as ie, H as U, I as Ge, J as _e, K as Ie, R as Ke, L as Ve, M as He, N as We, O as P, P as X, Q as Xe, U as Je, V as J, W as Qe } from "./chunks/WorkspaceRoutes-DW0sLdpJ.js";
|
|
4
|
+
import { X as kt } from "./chunks/WorkspaceRoutes-DW0sLdpJ.js";
|
|
5
|
+
import { u as Ye, S as Ze } from "./chunks/define-studio-DlYjgrwr.js";
|
|
6
|
+
import { d as zt } from "./chunks/define-studio-DlYjgrwr.js";
|
|
7
7
|
const R = {
|
|
8
8
|
accent: "var(--x11n7hvk)",
|
|
9
9
|
accentHover: "var(--x1vnpaut)",
|
|
10
10
|
focus: "var(--x1nzi8h4)"
|
|
11
11
|
};
|
|
12
|
-
function
|
|
12
|
+
function et(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 tt = [R.accent, R.accentHover, R.focus];
|
|
17
|
+
function nt() {
|
|
18
|
+
var n, o;
|
|
19
|
+
const e = (o = (n = Ye().theme) == null ? void 0 : n.accent) == null ? void 0 : o.trim();
|
|
20
|
+
return pe(() => {
|
|
21
21
|
if (!e) return;
|
|
22
|
-
const
|
|
23
|
-
for (const
|
|
22
|
+
const i = document.documentElement, a = tt.map(et).filter((s) => !!s);
|
|
23
|
+
for (const s of a) i.style.setProperty(s, e);
|
|
24
24
|
return () => {
|
|
25
|
-
for (const
|
|
25
|
+
for (const s of a) i.style.removeProperty(s);
|
|
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 rt({ workspaceId: e }) {
|
|
30
|
+
return p(() => te(), []), /* @__PURE__ */ t(ge, { children: /* @__PURE__ */ t(be, { children: /* @__PURE__ */ t(ye, { workspaceId: e, startOpen: !0, pointer: !0, children: /* @__PURE__ */ u(we, { children: [
|
|
31
|
+
/* @__PURE__ */ t(it, {}),
|
|
32
|
+
/* @__PURE__ */ t(at, {}),
|
|
33
|
+
/* @__PURE__ */ t(ot, {}),
|
|
34
|
+
/* @__PURE__ */ t(ve, { fill: !0 })
|
|
35
35
|
] }) }) }) });
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function q() {
|
|
38
38
|
if (!document.referrer) return "";
|
|
39
39
|
try {
|
|
40
40
|
return new URL(document.referrer).origin;
|
|
@@ -42,69 +42,69 @@ function v() {
|
|
|
42
42
|
return "";
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
const { setFocus: e } =
|
|
47
|
-
return
|
|
48
|
-
const n =
|
|
49
|
-
function
|
|
50
|
-
if (!n ||
|
|
51
|
-
const
|
|
52
|
-
if ((
|
|
53
|
-
const
|
|
54
|
-
!(
|
|
55
|
-
docRef: { type:
|
|
45
|
+
function it() {
|
|
46
|
+
const { setFocus: e } = ke();
|
|
47
|
+
return p(() => {
|
|
48
|
+
const n = q();
|
|
49
|
+
function o(i) {
|
|
50
|
+
if (!n || i.origin !== n) return;
|
|
51
|
+
const a = i.data;
|
|
52
|
+
if ((a == null ? void 0 : a.type) !== "backmatter:focus") return;
|
|
53
|
+
const s = a.doc;
|
|
54
|
+
!(s != null && s.type) || !s.slug || e({
|
|
55
|
+
docRef: { type: s.type, slug: s.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
|
|
65
|
-
const
|
|
66
|
-
!n || !(
|
|
61
|
+
return window.addEventListener("message", o), n && window.parent.postMessage({ type: "backmatter:chat-ready" }, n), () => window.removeEventListener("message", o);
|
|
62
|
+
}, [e]), p(() => {
|
|
63
|
+
const n = q();
|
|
64
|
+
function o(i) {
|
|
65
|
+
const a = i.detail;
|
|
66
|
+
!n || !(a != null && a.docRef) || window.parent.postMessage({ type: "backmatter:doc-changed", doc: a.docRef }, n);
|
|
67
67
|
}
|
|
68
|
-
return window.addEventListener(
|
|
68
|
+
return window.addEventListener(V, o), () => window.removeEventListener(V, o);
|
|
69
69
|
}, []), null;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
const { addPointer: e } =
|
|
73
|
-
return
|
|
74
|
-
const n =
|
|
75
|
-
function
|
|
76
|
-
if (!n ||
|
|
77
|
-
const
|
|
78
|
-
if ((
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
71
|
+
function at() {
|
|
72
|
+
const { addPointer: e } = ne();
|
|
73
|
+
return p(() => {
|
|
74
|
+
const n = q();
|
|
75
|
+
function o(i) {
|
|
76
|
+
if (!n || i.origin !== n || i.source !== window.parent) return;
|
|
77
|
+
const a = i.data;
|
|
78
|
+
if ((a == null ? void 0 : a.type) !== "backmatter:pointer-grab") return;
|
|
79
|
+
const s = qe(
|
|
80
|
+
a.doc ?? {},
|
|
81
|
+
a.grab
|
|
82
82
|
);
|
|
83
|
-
|
|
83
|
+
s && e(s);
|
|
84
84
|
}
|
|
85
|
-
return window.addEventListener("message",
|
|
85
|
+
return window.addEventListener("message", o), () => window.removeEventListener("message", o);
|
|
86
86
|
}, [e]), null;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
const { panel: e, dispatch: n } =
|
|
90
|
-
return
|
|
91
|
-
const
|
|
92
|
-
if (!
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
}, [
|
|
96
|
-
const
|
|
97
|
-
function
|
|
98
|
-
var
|
|
99
|
-
!
|
|
88
|
+
function ot() {
|
|
89
|
+
const { panel: e, dispatch: n } = ne(), o = e.mode, i = ee(o);
|
|
90
|
+
return p(() => {
|
|
91
|
+
const a = q();
|
|
92
|
+
if (!a || window.parent === window) return;
|
|
93
|
+
const s = H(i.current);
|
|
94
|
+
i.current = o, s && !H(o) && window.parent.postMessage({ type: "backmatter:chat-closed" }, a);
|
|
95
|
+
}, [o]), p(() => {
|
|
96
|
+
const a = q();
|
|
97
|
+
function s(f) {
|
|
98
|
+
var h;
|
|
99
|
+
!a || f.origin !== a || ((h = f.data) == null ? void 0 : h.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", s), () => window.removeEventListener("message", s);
|
|
104
104
|
}, [n]), null;
|
|
105
105
|
}
|
|
106
|
-
const
|
|
107
|
-
function
|
|
106
|
+
const st = 8e3;
|
|
107
|
+
function Q() {
|
|
108
108
|
if (!document.referrer) return "";
|
|
109
109
|
try {
|
|
110
110
|
return new URL(document.referrer).origin;
|
|
@@ -112,111 +112,111 @@ function X() {
|
|
|
112
112
|
return "";
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function j(e) {
|
|
116
116
|
return `${e.type}/${e.slug}`;
|
|
117
117
|
}
|
|
118
|
-
const
|
|
118
|
+
const ct = {
|
|
119
119
|
modified: "modified",
|
|
120
120
|
added: "new",
|
|
121
121
|
conflict: "conflict",
|
|
122
122
|
deleted: "deleted"
|
|
123
123
|
};
|
|
124
|
-
function
|
|
124
|
+
function lt({
|
|
125
125
|
workspaceId: e,
|
|
126
126
|
onStatus: n,
|
|
127
|
-
onPublished:
|
|
127
|
+
onPublished: o
|
|
128
128
|
}) {
|
|
129
|
-
|
|
130
|
-
const [
|
|
131
|
-
|
|
129
|
+
p(() => te(), []);
|
|
130
|
+
const [i, a] = m(null), [s, f] = m("viewer"), [h, g] = m(""), [c, b] = m(null), [oe, T] = m(null), [C, M] = m(!1), [z, $] = m(null), [F, N] = m(null), [se, ce] = m(0);
|
|
131
|
+
p(() => {
|
|
132
132
|
let r = !1;
|
|
133
|
-
return
|
|
133
|
+
return re(e).then((l) => {
|
|
134
134
|
r || f(l.workspace.role);
|
|
135
135
|
}).catch(() => {
|
|
136
|
-
r ||
|
|
136
|
+
r || b("Could not load this workspace");
|
|
137
137
|
}), () => {
|
|
138
138
|
r = !0;
|
|
139
139
|
};
|
|
140
140
|
}, [e]);
|
|
141
|
-
const
|
|
142
|
-
|
|
141
|
+
const E = ee(n);
|
|
142
|
+
E.current = n, p(() => {
|
|
143
143
|
let r = !1;
|
|
144
144
|
const l = () => {
|
|
145
|
-
|
|
146
|
-
var
|
|
145
|
+
L(e).then((x) => {
|
|
146
|
+
var K;
|
|
147
147
|
if (r) return;
|
|
148
|
-
|
|
149
|
-
const
|
|
150
|
-
(
|
|
151
|
-
changeCount:
|
|
152
|
-
conflictCount:
|
|
148
|
+
a(x), N(null);
|
|
149
|
+
const G = x.changes.length, _ = W(x);
|
|
150
|
+
(K = E.current) == null || K.call(E, {
|
|
151
|
+
changeCount: G,
|
|
152
|
+
conflictCount: _
|
|
153
153
|
});
|
|
154
|
-
const
|
|
155
|
-
!
|
|
154
|
+
const I = Q();
|
|
155
|
+
!I || window.parent === window || window.parent.postMessage({
|
|
156
156
|
type: "backmatter:git",
|
|
157
|
-
changeCount:
|
|
158
|
-
conflictCount:
|
|
159
|
-
},
|
|
157
|
+
changeCount: G,
|
|
158
|
+
conflictCount: _
|
|
159
|
+
}, I);
|
|
160
160
|
}).catch((x) => {
|
|
161
|
-
r ||
|
|
161
|
+
r || N(x instanceof Error ? x.message : "Git status failed");
|
|
162
162
|
});
|
|
163
163
|
};
|
|
164
164
|
l();
|
|
165
|
-
const
|
|
165
|
+
const y = window.setInterval(l, st);
|
|
166
166
|
return () => {
|
|
167
|
-
r = !0, window.clearInterval(
|
|
167
|
+
r = !0, window.clearInterval(y);
|
|
168
168
|
};
|
|
169
|
-
}, [e]);
|
|
170
|
-
const d = (
|
|
171
|
-
failure:
|
|
172
|
-
checking:
|
|
173
|
-
} =
|
|
169
|
+
}, [e, se]);
|
|
170
|
+
const d = (i == null ? void 0 : i.changes) ?? [], le = W(i), k = Le(le, $e(s)), {
|
|
171
|
+
failure: B,
|
|
172
|
+
checking: ue
|
|
173
|
+
} = ze(e, k === "commit", Ee(d)), S = oe ?? B, O = je({
|
|
174
174
|
committing: C,
|
|
175
|
-
checking:
|
|
176
|
-
failure:
|
|
177
|
-
}),
|
|
175
|
+
checking: ue,
|
|
176
|
+
failure: B
|
|
177
|
+
}), A = fe(() => d.filter((r) => r.status === "conflict"), [d]), de = Ce(d);
|
|
178
178
|
async function D(r, l) {
|
|
179
|
-
const
|
|
180
|
-
|
|
179
|
+
const y = `${j(r)}:${l}`;
|
|
180
|
+
$(y), b(null);
|
|
181
181
|
try {
|
|
182
|
-
await
|
|
182
|
+
await Pe(e, r.type, r.slug, l), Re({
|
|
183
183
|
workspaceId: e,
|
|
184
184
|
type: r.type,
|
|
185
185
|
slug: r.slug,
|
|
186
186
|
status: l === "theirs" ? "clean" : "modified"
|
|
187
187
|
});
|
|
188
|
-
const x = await
|
|
189
|
-
|
|
188
|
+
const x = await L(e);
|
|
189
|
+
a(x);
|
|
190
190
|
} catch (x) {
|
|
191
|
-
|
|
191
|
+
b(x instanceof Error ? x.message : "Resolve failed");
|
|
192
192
|
} finally {
|
|
193
|
-
|
|
193
|
+
$(null);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
|
-
async function
|
|
197
|
-
if (r.preventDefault(), !(C ||
|
|
198
|
-
|
|
196
|
+
async function xe(r) {
|
|
197
|
+
if (r.preventDefault(), !(C || k !== "commit" || d.length === 0)) {
|
|
198
|
+
M(!0), b(null), T(null);
|
|
199
199
|
try {
|
|
200
|
-
const l = await
|
|
201
|
-
|
|
202
|
-
const
|
|
203
|
-
|
|
200
|
+
const l = await Ue(e, h);
|
|
201
|
+
g(""), Te(e, l.files), o == null || o();
|
|
202
|
+
const y = Q();
|
|
203
|
+
y && window.parent !== window && window.parent.postMessage({
|
|
204
204
|
type: "backmatter:published"
|
|
205
|
-
},
|
|
205
|
+
}, y), a(await L(e));
|
|
206
206
|
} catch (l) {
|
|
207
|
-
|
|
207
|
+
T(Me(l));
|
|
208
208
|
} finally {
|
|
209
|
-
|
|
209
|
+
M(!1);
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
-
const
|
|
214
|
-
return
|
|
215
|
-
/* @__PURE__ */ t("p", { ...
|
|
213
|
+
const me = (i == null ? void 0 : i.currentBranch) ?? "main";
|
|
214
|
+
return i ? A.length > 0 ? /* @__PURE__ */ u("div", { className: "x78zum5 xdt5ytf xmqd7ac x1hb2obb xqjzbou", children: [
|
|
215
|
+
/* @__PURE__ */ t("p", { ...w(v.groupLabel), children: "Resolve conflicts" }),
|
|
216
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." }),
|
|
217
217
|
c ? /* @__PURE__ */ t("p", { className: "x1ghz6dp x173sf5p xq98a72 x10qp4ay x1trrqm4", children: c }) : null,
|
|
218
|
-
/* @__PURE__ */ t("ul", { className: "x1ghz6dp x1717udv xe8uvvx x1odjw0f x1kbliiw xq3t0pi", children:
|
|
219
|
-
const l =
|
|
218
|
+
/* @__PURE__ */ t("ul", { className: "x1ghz6dp x1717udv xe8uvvx x1odjw0f x1kbliiw xq3t0pi", children: A.map((r) => {
|
|
219
|
+
const l = j(r);
|
|
220
220
|
return /* @__PURE__ */ u("li", { className: "x78zum5 xdt5ytf xpw8yq9 x1l8q8zy x1om5956 x1ar5oo6 x10qp4ay", children: [
|
|
221
221
|
/* @__PURE__ */ u("span", { className: "xeuugli x98rzlu xb3r6kr xlyipyv xuxw1ft", children: [
|
|
222
222
|
r.type,
|
|
@@ -224,16 +224,16 @@ function it({
|
|
|
224
224
|
r.slug
|
|
225
225
|
] }),
|
|
226
226
|
/* @__PURE__ */ u("div", { className: "x78zum5 xpw8yq9", children: [
|
|
227
|
-
/* @__PURE__ */ t("button", { type: "button", disabled:
|
|
228
|
-
/* @__PURE__ */ t("button", { type: "button", disabled:
|
|
227
|
+
/* @__PURE__ */ t("button", { type: "button", disabled: z !== null, onClick: () => void D(r, "mine"), className: "xxk0z11 x1l8q8zy xmkeg23 x1y0btm7 x1j0qoeq x13oidi x1hb2obb xqjzbou x10qp4ay x1ypdohk xk0mbs4 x1s07b3s x784prv x9v5kkp x1yxvn1h x13iak60", children: z === `${l}:mine` ? "Keeping…" : "Keep mine" }),
|
|
228
|
+
/* @__PURE__ */ t("button", { type: "button", disabled: z !== null, onClick: () => void D(r, "theirs"), className: "xxk0z11 x1l8q8zy xmkeg23 x1y0btm7 x13oidi x1hb2obb x10qp4ay x1ypdohk xk0mbs4 x1s07b3s x784prv x9v5kkp x1yxvn1h x13iak60 x1nf6o4h x1trrqm4", children: z === `${l}:theirs` ? "Taking…" : "Take theirs" })
|
|
229
229
|
] })
|
|
230
230
|
] }, l);
|
|
231
231
|
}) })
|
|
232
|
-
] }) : /* @__PURE__ */ u("form", { className: "x78zum5 xdt5ytf xmqd7ac x1hb2obb xqjzbou", onSubmit: (r) => void
|
|
233
|
-
/* @__PURE__ */ t("p", { ...
|
|
234
|
-
|
|
232
|
+
] }) : /* @__PURE__ */ u("form", { className: "x78zum5 xdt5ytf xmqd7ac x1hb2obb xqjzbou", onSubmit: (r) => void xe(r), children: [
|
|
233
|
+
/* @__PURE__ */ t("p", { ...w(v.groupLabel), children: d.length === 0 ? "Nothing to publish" : `${d.length} ${d.length === 1 ? "file" : "files"} → ${me}` }),
|
|
234
|
+
S ? /* @__PURE__ */ t(Ne, { failure: S }) : null,
|
|
235
235
|
d.length > 0 ? /* @__PURE__ */ t("ul", { className: "x1ghz6dp x1717udv xe8uvvx xctk3hg x1odjw0f x1kbliiw", children: d.map((r) => {
|
|
236
|
-
const l =
|
|
236
|
+
const l = Se(S, `${r.type}/${r.slug}`).length > 0;
|
|
237
237
|
return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ u("div", { className: "x78zum5 x6s0dn4 x3smv4v x1rz828m x1ghz6dp x1obou79 x1l8q8zy x1om5956 x1ar5oo6 x10qp4ay x111yfic", children: [
|
|
238
238
|
/* @__PURE__ */ u("span", { ...{
|
|
239
239
|
0: {
|
|
@@ -247,34 +247,45 @@ function it({
|
|
|
247
247
|
"/",
|
|
248
248
|
r.slug
|
|
249
249
|
] }),
|
|
250
|
-
/* @__PURE__ */ t("span", { ...
|
|
251
|
-
] }) },
|
|
250
|
+
/* @__PURE__ */ t("span", { ...w(v.itemMeta), children: ct[r.status] })
|
|
251
|
+
] }) }, j(r));
|
|
252
252
|
}) }) : null,
|
|
253
|
-
d.length > 0 ? /* @__PURE__ */ t("div", { ...
|
|
253
|
+
d.length > 0 ? /* @__PURE__ */ t("div", { ...w(v.separator) }) : null,
|
|
254
254
|
d.length > 0 ? /* @__PURE__ */ u("div", { className: "x78zum5 xdt5ytf x1qjc9v5 x1ndbd79 x173sf5p x1l7y7l0 xreod0t", children: [
|
|
255
|
-
/* @__PURE__ */ t("input", { value:
|
|
255
|
+
/* @__PURE__ */ t("input", { value: h, onChange: (r) => g(r.target.value), placeholder: de, "aria-label": "Publish message", autoComplete: "off", spellCheck: !1, "data-no-ring": !0, "data-1p-ignore": !0, "data-lpignore": !0, disabled: C || k !== "commit", className: "xh8yej3 x9f619 xe0p6wg x1l8q8zy x1om5956 xmkeg23 x1y0btm7 x1j0qoeq x13oidi xawfm1v xqjzbou x1vrk1b5 x1a2a7pz x1uvtmcs x1t8xw5s xk2swo9 xk0mbs4 x9ecp23" }),
|
|
256
256
|
c ? /* @__PURE__ */ t("p", { className: "x1ghz6dp x10qp4ay x1trrqm4 xnjsko4 x18d9i69", children: c }) : null,
|
|
257
|
-
|
|
257
|
+
k === "blocked" ? /* @__PURE__ */ t("p", { className: "x1ghz6dp x173sf5p xq98a72 x10qp4ay x37zpob x111yfic", children: "Writers cannot publish" }) : /* @__PURE__ */ t("button", { type: "submit", disabled: k !== "commit" || O.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: O.label })
|
|
258
258
|
] }) : c ? /* @__PURE__ */ t("p", { className: "x1ghz6dp x173sf5p xq98a72 x10qp4ay x1trrqm4", children: c }) : null
|
|
259
|
-
] })
|
|
259
|
+
] }) : /* @__PURE__ */ t("div", { className: "x78zum5 xdt5ytf xmqd7ac x1hb2obb xqjzbou", children: F ? /* @__PURE__ */ u(he, { children: [
|
|
260
|
+
/* @__PURE__ */ t("p", { ...w(v.groupLabel), children: "Could not load changes" }),
|
|
261
|
+
/* @__PURE__ */ t("p", { role: "alert", className: "x1ghz6dp x173sf5p xq98a72 x10qp4ay x1trrqm4", children: F }),
|
|
262
|
+
/* @__PURE__ */ t("div", { className: "x78zum5 xdt5ytf x1qjc9v5 x1ndbd79 x173sf5p x1l7y7l0 xreod0t", children: /* @__PURE__ */ t("button", { type: "button", onClick: () => {
|
|
263
|
+
N(null), ce((r) => r + 1);
|
|
264
|
+
}, className: "xxk0z11 x1l8q8zy xmkeg23 x1y0btm7 x1j0qoeq x13oidi x1hb2obb xqjzbou x10qp4ay x1ypdohk xk0mbs4 x1s07b3s x784prv x9v5kkp x1yxvn1h x13iak60", children: "Try again" }) })
|
|
265
|
+
] }) : /* @__PURE__ */ t("p", { role: "status", ...w(v.groupLabel, ut.loading), children: "Loading changes…" }) });
|
|
260
266
|
}
|
|
261
|
-
const
|
|
262
|
-
|
|
267
|
+
const ut = {
|
|
268
|
+
loading: {
|
|
269
|
+
kGO01o: "x1y1hw3e",
|
|
270
|
+
$$css: !0
|
|
271
|
+
}
|
|
272
|
+
}, Y = "backmatter:enter-at", dt = 1e4;
|
|
273
|
+
function ae(e, n) {
|
|
263
274
|
if (typeof window > "u") return !1;
|
|
264
|
-
const
|
|
265
|
-
if (
|
|
275
|
+
const o = !!(window.top && window.top !== window);
|
|
276
|
+
if (Oe(o) === "parent")
|
|
266
277
|
return window.parent.postMessage({
|
|
267
|
-
type:
|
|
278
|
+
type: Ae
|
|
268
279
|
}, window.location.origin), !0;
|
|
269
|
-
const
|
|
270
|
-
return Date.now() -
|
|
280
|
+
const i = Number(window.sessionStorage.getItem(Y) ?? 0);
|
|
281
|
+
return Date.now() - i < dt ? !1 : (window.sessionStorage.setItem(Y, String(Date.now())), window.location.assign(De(n, {
|
|
271
282
|
workspaceId: e,
|
|
272
283
|
returnUrl: window.location.href
|
|
273
284
|
})), !0);
|
|
274
285
|
}
|
|
275
|
-
function
|
|
286
|
+
function xt(e) {
|
|
276
287
|
const n = e.dashboardUrl ?? "https://dash.backmatter.app";
|
|
277
|
-
return
|
|
288
|
+
return ie({
|
|
278
289
|
baseUrl: e.proxyPath ?? "/api/backmatter/cms",
|
|
279
290
|
publicApiUrl: e.apiUrl,
|
|
280
291
|
credentials: "same-origin",
|
|
@@ -282,79 +293,79 @@ function st(e) {
|
|
|
282
293
|
version: e.version,
|
|
283
294
|
dashboardUrl: n,
|
|
284
295
|
onUnauthorized: ({
|
|
285
|
-
status:
|
|
296
|
+
status: o
|
|
286
297
|
}) => {
|
|
287
|
-
|
|
298
|
+
o === 401 && ae(e.workspaceId, n);
|
|
288
299
|
}
|
|
289
300
|
}), U();
|
|
290
301
|
}
|
|
291
|
-
function
|
|
292
|
-
const n = e.basePath ?? "/backmatter", [
|
|
293
|
-
return /* @__PURE__ */ t(
|
|
294
|
-
/* @__PURE__ */ t(
|
|
295
|
-
/* @__PURE__ */ t(
|
|
302
|
+
function yt(e) {
|
|
303
|
+
const n = e.basePath ?? "/backmatter", [o] = m(() => xt(e));
|
|
304
|
+
return /* @__PURE__ */ t(Ze, { definition: e.studio, children: /* @__PURE__ */ u(Fe, { children: [
|
|
305
|
+
/* @__PURE__ */ t(nt, {}),
|
|
306
|
+
/* @__PURE__ */ t(Be, { basename: n, children: /* @__PURE__ */ t(mt, { ...e }) })
|
|
296
307
|
] }) });
|
|
297
308
|
}
|
|
298
|
-
function
|
|
299
|
-
const n =
|
|
300
|
-
if (
|
|
301
|
-
let
|
|
302
|
-
const
|
|
303
|
-
return
|
|
309
|
+
function mt(e) {
|
|
310
|
+
const n = Ge(), o = e.dashboardUrl ?? "https://dash.backmatter.app", [i, a] = m("loading");
|
|
311
|
+
if (p(() => {
|
|
312
|
+
let h = !1;
|
|
313
|
+
const g = U().onUnauthorized;
|
|
314
|
+
return ie({
|
|
304
315
|
...U(),
|
|
305
316
|
onUnauthorized: (c) => {
|
|
306
|
-
c.status === 426 ?
|
|
317
|
+
c.status === 426 ? a("outdated") : g == null || g(c);
|
|
307
318
|
}
|
|
308
|
-
}),
|
|
309
|
-
if (
|
|
319
|
+
}), _e().then(async (c) => {
|
|
320
|
+
if (h) return;
|
|
310
321
|
if (!(c != null && c.user)) {
|
|
311
|
-
|
|
322
|
+
ae(e.workspaceId, o) || a("unauthorized");
|
|
312
323
|
return;
|
|
313
324
|
}
|
|
314
325
|
const {
|
|
315
|
-
workspace:
|
|
316
|
-
} = await
|
|
317
|
-
|
|
326
|
+
workspace: b
|
|
327
|
+
} = await re(e.workspaceId);
|
|
328
|
+
h || a({
|
|
318
329
|
user: {
|
|
319
330
|
id: c.user.id,
|
|
320
331
|
email: c.user.email
|
|
321
332
|
},
|
|
322
|
-
slug:
|
|
333
|
+
slug: b.slug
|
|
323
334
|
});
|
|
324
335
|
}).catch(() => {
|
|
325
|
-
|
|
336
|
+
h || a((c) => c === "outdated" ? c : "unauthorized");
|
|
326
337
|
}), () => {
|
|
327
|
-
|
|
338
|
+
h = !0;
|
|
328
339
|
};
|
|
329
|
-
}, [e.workspaceId,
|
|
330
|
-
if (
|
|
331
|
-
return /* @__PURE__ */ u(
|
|
340
|
+
}, [e.workspaceId, o]), i === "loading") return /* @__PURE__ */ t(Ie, {});
|
|
341
|
+
if (i === "outdated")
|
|
342
|
+
return /* @__PURE__ */ u(Z, { title: "This site's editor is out of date", children: [
|
|
332
343
|
"Update ",
|
|
333
344
|
/* @__PURE__ */ t("code", { children: "@backmatter/studio" }),
|
|
334
345
|
" and ",
|
|
335
346
|
/* @__PURE__ */ t("code", { children: "@backmatter/next" }),
|
|
336
347
|
" on the site, then reload."
|
|
337
348
|
] });
|
|
338
|
-
if (
|
|
339
|
-
return /* @__PURE__ */ u(
|
|
349
|
+
if (i === "unauthorized")
|
|
350
|
+
return /* @__PURE__ */ u(Z, { title: "Could not start editing", children: [
|
|
340
351
|
"The site did not receive a session from the dashboard. Check that this site's origin is listed in the workspace settings and that ",
|
|
341
352
|
/* @__PURE__ */ t("code", { children: "/api/backmatter" }),
|
|
342
353
|
" routes are deployed."
|
|
343
354
|
] });
|
|
344
|
-
const
|
|
345
|
-
if (
|
|
346
|
-
return /* @__PURE__ */ t(
|
|
355
|
+
const s = n.pathname.match(/^\/embed\/chat\/([^/]+)\/?$/);
|
|
356
|
+
if (s != null && s[1])
|
|
357
|
+
return /* @__PURE__ */ t(rt, { workspaceId: decodeURIComponent(s[1]) });
|
|
347
358
|
const f = n.pathname.match(/^\/embed\/publish\/([^/]+)\/?$/);
|
|
348
|
-
return f != null && f[1] ? /* @__PURE__ */ t(
|
|
349
|
-
|
|
350
|
-
}, children: /* @__PURE__ */ u(
|
|
351
|
-
/* @__PURE__ */ t(P, { path: "/", element: /* @__PURE__ */ t(
|
|
352
|
-
/* @__PURE__ */ t(P, { path: "/workspaces/:workspaceId/*", element: /* @__PURE__ */ t(
|
|
353
|
-
|
|
354
|
-
/* @__PURE__ */ t(P, { path: "*", element: /* @__PURE__ */ t(
|
|
359
|
+
return f != null && f[1] ? /* @__PURE__ */ t(lt, { workspaceId: decodeURIComponent(f[1]) }) : /* @__PURE__ */ t(Ke, { user: i.user, children: /* @__PURE__ */ t(Ve, { children: /* @__PURE__ */ t(He, { userId: i.user.id, email: i.user.email, onLogout: () => {
|
|
360
|
+
ht(e.previewEntryPath ?? "/api/backmatter/preview", o);
|
|
361
|
+
}, children: /* @__PURE__ */ u(We, { children: [
|
|
362
|
+
/* @__PURE__ */ t(P, { path: "/", element: /* @__PURE__ */ t(X, { to: `/${i.slug}`, replace: !0 }) }),
|
|
363
|
+
/* @__PURE__ */ t(P, { path: "/workspaces/:workspaceId/*", element: /* @__PURE__ */ t(Xe, {}) }),
|
|
364
|
+
Je(),
|
|
365
|
+
/* @__PURE__ */ t(P, { path: "*", element: /* @__PURE__ */ t(X, { to: "/", replace: !0 }) })
|
|
355
366
|
] }) }) }) });
|
|
356
367
|
}
|
|
357
|
-
async function
|
|
368
|
+
async function ht(e, n) {
|
|
358
369
|
try {
|
|
359
370
|
await fetch(e, {
|
|
360
371
|
method: "POST",
|
|
@@ -362,23 +373,23 @@ async function ct(e, n) {
|
|
|
362
373
|
});
|
|
363
374
|
} catch {
|
|
364
375
|
}
|
|
365
|
-
|
|
376
|
+
Qe.wipe(), window.location.assign(n);
|
|
366
377
|
}
|
|
367
|
-
function
|
|
378
|
+
function Z({
|
|
368
379
|
title: e,
|
|
369
380
|
children: n
|
|
370
381
|
}) {
|
|
371
382
|
return /* @__PURE__ */ t("div", { className: "x1ov3xa9 xrvj5dj x1ku5rj1 x1t7e3gq", children: /* @__PURE__ */ u("div", { className: "x78zum5 xdt5ytf x1ndbd79 xq2pcee x1t7e3gq x4pepcl x1d0qn7y", children: [
|
|
372
|
-
/* @__PURE__ */ t(
|
|
373
|
-
/* @__PURE__ */ t(
|
|
383
|
+
/* @__PURE__ */ t(J, { size: "lg", weight: "medium", children: e }),
|
|
384
|
+
/* @__PURE__ */ t(J, { tone: "muted", children: n })
|
|
374
385
|
] }) });
|
|
375
386
|
}
|
|
376
387
|
export {
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
388
|
+
yt as SiteStudio,
|
|
389
|
+
kt as apiUrl,
|
|
390
|
+
ae as bounceToEnter,
|
|
391
|
+
xt as configureSiteStudio,
|
|
392
|
+
ie as configureStudio,
|
|
393
|
+
zt as defineStudio,
|
|
383
394
|
U as studioConfig
|
|
384
395
|
};
|