@backmatter/studio 0.0.11 → 0.0.13

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 (34) hide show
  1. package/dist/chunks/{UiKitApp-Cu0CS1NU.js → UiKitApp-ZZXQt3zy.js} +29 -29
  2. package/dist/chunks/{WorkspaceRoutes-Dzpaj8ov.js → WorkspaceRoutes-CCDPtLla.js} +22396 -22185
  3. package/dist/chunks/{dashboard-kWmpeuAP.js → dashboard-Dw0zfTXg.js} +35 -35
  4. package/dist/chunks/{index-Bryt_VJQ.js → index-DhZGCAru.js} +1 -1
  5. package/dist/dashboard.js +2 -2
  6. package/dist/index.js +199 -193
  7. package/dist/site-widget.css +9 -1
  8. package/dist/site-widget.js +6060 -5936
  9. package/dist/studio.css +5 -25
  10. package/package.json +6 -2
  11. package/src/chat/ChatProvider.tsx +13 -2
  12. package/src/chat/Composer.tsx +2 -1
  13. package/src/chat/PointerChip.tsx +15 -2
  14. package/src/chat/chat-helpers.ts +6 -0
  15. package/src/chat/pointer-arm.ts +3 -0
  16. package/src/chrome/WorkspaceStatusBar.tsx +57 -19
  17. package/src/chrome/commit-error.ts +82 -0
  18. package/src/chrome/commit-failure.tsx +111 -0
  19. package/src/install-preview-pointer.ts +116 -0
  20. package/src/pages/BlocksList.tsx +17 -2
  21. package/src/pages/DocEditorPage.tsx +95 -1
  22. package/src/pages/EmbedPublishPage.tsx +27 -24
  23. package/src/pages/RenderedBody.tsx +141 -322
  24. package/src/pages/document-paint.ts +79 -0
  25. package/src/pages/editor-grab.ts +39 -0
  26. package/src/pages/html-to-markdown.ts +26 -0
  27. package/src/pages/preview-bridge.ts +8 -1
  28. package/src/pages/selection-format.ts +5 -2
  29. package/src/preview-highlight.ts +16 -0
  30. package/src/preview-pointer-host.ts +30 -0
  31. package/src/shell-resets.css +13 -0
  32. package/src/site-changes.ts +46 -0
  33. package/src/site-pointer.ts +39 -6
  34. package/src/site-widget.tsx +66 -23
@@ -1,8 +1,8 @@
1
1
  import { jsxs as s, jsx as t, Fragment as U } from "react/jsx-runtime";
2
- import { K as $, P as ue, Q as Zt, p as Rt, U as Qt, f as at, V as Fe, W as Jt, X as en, Y as tn, Z as nn, _ as rn, z as on, k as an, $ as sn, a0 as ln, a1 as cn, a2 as He, a3 as me, a4 as Ne, a5 as st, a6 as dn, a7 as un, T as hn, a8 as pn, a9 as gn, aa as mn, ab as fn, ac as bn, ad as xn, y as vn, ae as $n, N as kn, af as wn } from "./WorkspaceRoutes-Dzpaj8ov.js";
2
+ import { P as $, V as ue, W as Zt, p as Rt, X as Jt, f as at, Y as Fe, Z as Qt, _ as en, $ as tn, a0 as nn, a1 as rn, G as on, m as an, a2 as sn, a3 as ln, a4 as cn, a5 as He, a6 as me, a7 as Ne, a8 as st, a9 as dn, aa as un, T as hn, ab as pn, ac as gn, ad as mn, ae as fn, af as bn, ag as xn, F as vn, ah as $n, N as kn, ai as wn } from "./WorkspaceRoutes-CCDPtLla.js";
3
3
  import { useRef as k, useState as f, useLayoutEffect as te, useCallback as Ke, useEffect as z, useMemo as yn, useId as Ue } from "react";
4
4
  import { createPortal as Me } from "react-dom";
5
- import { L as Nn, a as lt } from "./dashboard-kWmpeuAP.js";
5
+ import { L as Nn, a as lt } from "./dashboard-Dw0zfTXg.js";
6
6
  function O({
7
7
  title: n,
8
8
  lede: r,
@@ -209,7 +209,7 @@ const w = {
209
209
  function ut(n, r, o, a = "en") {
210
210
  if (!(n != null && n.trim())) return;
211
211
  const d = n.replace(/\/+$/, "");
212
- return !r || !o ? d : `${d}${Qt(o, r.type, r.slug, r.locale, a)}`;
212
+ return !r || !o ? d : `${d}${Jt(o, r.type, r.slug, r.locale, a)}`;
213
213
  }
214
214
  const he = "cubic-bezier(0.23, 1, 0.32, 1)", Oe = "cubic-bezier(0.55, 0, 1, 0.45)", In = "cubic-bezier(0.32, 0.72, 0, 1)", _n = 550, An = 300, Ln = 750, Bn = 360, It = "backmatter.devbar.mode";
215
215
  function Pn(n) {
@@ -365,7 +365,7 @@ const Zn = `
365
365
  opacity: 1;
366
366
  }
367
367
  }
368
- `, e = "backmatter-devbar", Qn = "/api/backmatter/preview", Jn = 10, er = 360;
368
+ `, e = "backmatter-devbar", Jn = "/api/backmatter/preview", Qn = 10, er = 360;
369
369
  function xt(n, r) {
370
370
  return `${n}:${r.trim().toLowerCase()}`;
371
371
  }
@@ -380,7 +380,7 @@ function tr({
380
380
  changeCount: u,
381
381
  lineDiff: p,
382
382
  activity: c = null,
383
- previewEntryPath: R = Qn,
383
+ previewEntryPath: R = Jn,
384
384
  siteMode: y = "preview",
385
385
  frame: D = !1,
386
386
  frameRadius: X,
@@ -396,7 +396,7 @@ function tr({
396
396
  onSignOut: j,
397
397
  onPublishAnchor: Y
398
398
  }) {
399
- const le = k(null), ce = k(null), Z = k(null), G = k(null), x = k(null), A = k(null), T = k(null), Q = k(null), [ne, pe] = f(null), re = Ke((i) => {
399
+ const le = k(null), ce = k(null), Z = k(null), G = k(null), x = k(null), A = k(null), T = k(null), J = k(null), [ne, pe] = f(null), re = Ke((i) => {
400
400
  if (le.current = i, !i) {
401
401
  pe(null);
402
402
  return;
@@ -413,7 +413,7 @@ function tr({
413
413
  openDashboard: () => !1,
414
414
  openShortcuts: () => {
415
415
  }
416
- }), Ze = k(!0), [Ie, Wt] = f("system"), [_e, Qe] = f(!0), [Je, et] = f(!0), [Ht, $e] = f("main"), [Dt, qt] = f(""), [Ae, Le] = f(null), [tt, jt] = f("en");
416
+ }), Ze = k(!0), [Ie, Wt] = f("system"), [_e, Je] = f(!0), [Qe, et] = f(!0), [Ht, $e] = f("main"), [Dt, qt] = f(""), [Ae, Le] = f(null), [tt, jt] = f("en");
417
417
  z(() => {
418
418
  const i = a == null ? void 0 : a.workspaceId;
419
419
  if (!i) {
@@ -438,7 +438,7 @@ function tr({
438
438
  z(() => {
439
439
  qt(location.host);
440
440
  const i = je(), l = qn(i);
441
- et(gt(i, pt, !0)), Wt(l), Qe(gt(i, ht, !0));
441
+ et(gt(i, pt, !0)), Wt(l), Je(gt(i, ht, !0));
442
442
  }, []), z(() => {
443
443
  if (kt(Ie), Ie !== "system" || typeof matchMedia != "function") return;
444
444
  const i = matchMedia("(prefers-color-scheme: dark)"), l = () => kt("system");
@@ -448,8 +448,8 @@ function tr({
448
448
  if (!i) return;
449
449
  const l = document.documentElement, v = `${e}-pointing`, H = () => i.classList.toggle(v, l.classList.contains("backmatter-pointing"));
450
450
  H();
451
- const J = new MutationObserver(H);
452
- return J.observe(l, { attributes: !0, attributeFilter: ["class"] }), () => J.disconnect();
451
+ const Q = new MutationObserver(H);
452
+ return Q.observe(l, { attributes: !0, attributeFilter: ["class"] }), () => Q.disconnect();
453
453
  }, []), z(() => {
454
454
  if (oe.current && oe.current !== y && !d) {
455
455
  oe.current = null, De(y), Ce(y);
@@ -504,7 +504,7 @@ function tr({
504
504
  W.current.onEscape();
505
505
  return;
506
506
  }
507
- Jt(l) === "chat" && L(null);
507
+ Qt(l) === "chat" && L(null);
508
508
  }
509
509
  }
510
510
  return document.addEventListener("keydown", i, !0), () => document.removeEventListener("keydown", i, !0);
@@ -536,19 +536,19 @@ function tr({
536
536
  Xe.current = !0;
537
537
  const H = i.getAnimations().some((ae) => ae.id === "w") ? i.offsetWidth : Ge.current;
538
538
  i.getAnimations().filter((ae) => ae.id === "w").forEach((ae) => ae.cancel());
539
- const J = i.offsetWidth;
540
- if (Ge.current = J, l) return;
539
+ const Q = i.offsetWidth;
540
+ if (Ge.current = Q, l) return;
541
541
  const B = G.current;
542
- if (B && (se() ? B.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 150, easing: "ease", fill: "backwards" }) : qe(B, { delay: 40, blur: !0 })), se() || !Wn(H, J)) return;
542
+ if (B && (se() ? B.animate([{ opacity: 0 }, { opacity: 1 }], { duration: 150, easing: "ease", fill: "backwards" }) : qe(B, { delay: 40, blur: !0 })), se() || !Wn(H, Q)) return;
543
543
  const Yt = i.animate(
544
- [{ width: `${H}px` }, { width: `${J}px` }],
544
+ [{ width: `${H}px` }, { width: `${Q}px` }],
545
545
  { duration: 380, easing: In }
546
546
  );
547
547
  Yt.id = "w";
548
548
  }, [ne, Te, I, y]);
549
549
  const ke = (c == null ? void 0 : c.type) === "published" ? c.sha : "";
550
550
  te(() => {
551
- const i = Q.current;
551
+ const i = J.current;
552
552
  !ke || !i || se() || i.animate(
553
553
  [
554
554
  { transform: "scale(0.5)", opacity: 0 },
@@ -592,11 +592,11 @@ function tr({
592
592
  B.id = "hide";
593
593
  return;
594
594
  }
595
- const J = l.animate(
595
+ const Q = l.animate(
596
596
  [{ transform: "translateY(100%)" }, { transform: "none" }],
597
597
  { duration: 460, easing: he, fill: "backwards" }
598
598
  );
599
- J.id = "rise", G.current && qe(G.current, { delay: 140 });
599
+ Q.id = "rise", G.current && qe(G.current, { delay: 140 });
600
600
  }
601
601
  W.current.openDashboard = () => N ? ((async () => {
602
602
  let i = Be ?? N;
@@ -626,7 +626,7 @@ function tr({
626
626
  function Vt() {
627
627
  d || (L(null), m && E(), g());
628
628
  }
629
- Ze.current = Je;
629
+ Ze.current = Qe;
630
630
  function Ut(i) {
631
631
  h && g(), $e(i), L((l) => l === "settings" && i === "main" ? null : "settings");
632
632
  }
@@ -661,7 +661,7 @@ function tr({
661
661
  ] }, `${i.label}:${l}`)) })
662
662
  ] }) : (c == null ? void 0 : c.type) === "published" ? ge = /* @__PURE__ */ s(U, { children: [
663
663
  we,
664
- /* @__PURE__ */ t("span", { ref: Q, className: `${e}-check`, "aria-hidden": !0, children: "✓" }),
664
+ /* @__PURE__ */ t("span", { ref: J, className: `${e}-check`, "aria-hidden": !0, children: "✓" }),
665
665
  /* @__PURE__ */ s("span", { className: `${e}-published`, children: [
666
666
  "Published ",
667
667
  /* @__PURE__ */ t("code", { className: `${e}-field`, children: c.sha }),
@@ -770,10 +770,10 @@ function tr({
770
770
  branch: r,
771
771
  bar: ie,
772
772
  highlightBlocks: _e,
773
- previewAgent: Je,
773
+ previewAgent: Qe,
774
774
  dashboardHref: Be,
775
775
  onHighlight: (i) => {
776
- Qe(i), mt(je(), ht, i);
776
+ Je(i), mt(je(), ht, i);
777
777
  },
778
778
  onPreviewAgent: (i) => {
779
779
  et(i), mt(je(), pt, i);
@@ -1138,21 +1138,21 @@ function br({
1138
1138
  const le = Ke(
1139
1139
  (x, A, T) => {
1140
1140
  if (!r) return;
1141
- const Q = ++j.current, ne = S.trim(), pe = xt(r.workspaceId, ne);
1141
+ const J = ++j.current, ne = S.trim(), pe = xt(r.workspaceId, ne);
1142
1142
  A ? I(!0) : T != null && T.silent || D(!0), tn(r.workspaceId, {
1143
1143
  q: ne || void 0,
1144
- limit: Jn,
1144
+ limit: Qn,
1145
1145
  offset: x,
1146
1146
  current: r
1147
1147
  }).then((re) => {
1148
- Q === j.current && (R(re.total), p((ie) => {
1148
+ J === j.current && (R(re.total), p((ie) => {
1149
1149
  const xe = A ? [...ie, ...re.items] : re.items;
1150
1150
  return Y.current.set(pe, { rows: xe, total: re.total }), xe;
1151
1151
  }), C(null));
1152
1152
  }).catch(() => {
1153
- Q === j.current && (A || Y.current.get(pe) || p([]), C("Couldn't load pages"));
1153
+ J === j.current && (A || Y.current.get(pe) || p([]), C("Couldn't load pages"));
1154
1154
  }).finally(() => {
1155
- Q === j.current && (D(!1), I(!1));
1155
+ J === j.current && (D(!1), I(!1));
1156
1156
  });
1157
1157
  },
1158
1158
  [r, S]
@@ -1161,11 +1161,11 @@ function br({
1161
1161
  if (!d || !r) return;
1162
1162
  const x = S.trim(), A = xt(r.workspaceId, x), T = Y.current.get(A);
1163
1163
  T && (p(T.rows), R(T.total), C(null));
1164
- const Q = window.setTimeout(
1164
+ const J = window.setTimeout(
1165
1165
  () => le(0, !1, { silent: !!T }),
1166
1166
  x ? 200 : 0
1167
1167
  );
1168
- return () => window.clearTimeout(Q);
1168
+ return () => window.clearTimeout(J);
1169
1169
  }, [d, r, S, le]);
1170
1170
  function ce() {
1171
1171
  const x = q.current;