@backmatter/studio 0.0.23 → 0.0.25

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.
@@ -3,7 +3,7 @@ var st = (e, t, n) => t in e ? rt(e, t, { enumerable: !0, configurable: !0, writ
3
3
  var $ = (e, t, n) => st(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { jsxs as w, jsx as i, Fragment as re } from "react/jsx-runtime";
5
5
  import { useRef as qe, useCallback as it, useSyncExternalStore as at, useState as E, useEffect as W, lazy as ot, Suspense as lt } from "react";
6
- import { X as Ie, V as R, k as ze, an as Be, ao as be, ap as ct, aq as ut, ar as Fe, as as Me, at as De, au as dt, av as ft, P as He, aw as ht, ax as ae, ah as K, Z as We, ay as xt, az as $e, ai as pt, ak as se, aa as Q, ab as Z, Y as oe, aA as gt, W as F, aB as mt, J as we, aC as ee, aj as yt, aD as vt, aE as bt, aF as wt, aG as kt, aH as St, f as Rt, aI as Et, a6 as _t, aJ as jt, aK as Tt, z as Pt, B as Ot, I as Lt, aL as Nt, aM as Ut, aN as At, K as Ct, aO as qt, R as It, L as zt, M as Bt, N as Ft, O as D, Q as Mt, U as Dt } from "./WorkspaceRoutes-LYgvnqww.js";
6
+ import { X as Ie, V as R, k as ze, an as Be, ao as be, ap as ct, aq as ut, ar as Fe, as as Me, at as De, au as dt, av as ft, P as He, aw as ht, ax as ae, ah as K, Z as We, ay as xt, az as $e, ai as pt, ak as se, aa as Q, ab as Z, Y as oe, aA as gt, W as F, aB as mt, J as we, aC as ee, aj as yt, aD as vt, aE as bt, aF as wt, aG as kt, aH as St, f as Rt, aI as Et, a6 as _t, aJ as jt, aK as Tt, z as Pt, B as Ot, I as Lt, aL as Nt, aM as Ut, aN as At, K as Ct, aO as qt, R as It, L as zt, M as Bt, N as Ft, O as D, Q as Mt, U as Dt } from "./WorkspaceRoutes-DuwT2y7A.js";
7
7
  const te = /* @__PURE__ */ Object.create(null), G = (e) => {
8
8
  var t, n;
9
9
  return ((t = globalThis.process) == null ? void 0 : t.env) || ((n = globalThis.Deno) == null ? void 0 : n.env.toObject()) || globalThis.__env__ || (e ? te : globalThis);
@@ -1823,7 +1823,7 @@ function Or(e) {
1823
1823
  const t = e.replace(/\/$/, "") || "/";
1824
1824
  return t === "/__ui" || /^\/__ui\/[^/]+$/.test(t);
1825
1825
  }
1826
- const Lr = ot(() => import("./UiKitApp-DNnsTU4S.js").then((e) => ({
1826
+ const Lr = ot(() => import("./UiKitApp-BW_SpUgQ.js").then((e) => ({
1827
1827
  default: e.UiKitApp
1828
1828
  })));
1829
1829
  function Ir() {
@@ -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 { 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-LYgvnqww.js";
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-DuwT2y7A.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-DGd2D7_c.js";
2
- import { G as t, H as f } from "./chunks/WorkspaceRoutes-LYgvnqww.js";
1
+ import { A as a, i as s } from "./chunks/dashboard-RFDdTeMV.js";
2
+ import { G as t, H as f } from "./chunks/WorkspaceRoutes-DuwT2y7A.js";
3
3
  export {
4
4
  a as DashboardApp,
5
5
  t as configureStudio,
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as t, jsxs as u, Fragment as he } from "react/jsx-runtime";
2
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-LYgvnqww.js";
4
- import { X as kt } from "./chunks/WorkspaceRoutes-LYgvnqww.js";
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-DuwT2y7A.js";
4
+ import { X as kt } from "./chunks/WorkspaceRoutes-DuwT2y7A.js";
5
5
  import { u as Ye, S as Ze } from "./chunks/define-studio-DlYjgrwr.js";
6
6
  import { d as zt } from "./chunks/define-studio-DlYjgrwr.js";
7
7
  const R = {
package/dist/studio.css CHANGED
@@ -31,6 +31,10 @@
31
31
  margin: 0;
32
32
  }
33
33
 
34
+ .x1bpp3o7 {
35
+ margin: auto;
36
+ }
37
+
34
38
  .x1717udv {
35
39
  padding: 0;
36
40
  }
@@ -463,7 +467,7 @@
463
467
  border-color: color-mix(in srgb,var(--xw4dauw) 45%,var(--xz3qvk5));
464
468
  }
465
469
 
466
- .x1gdl68u:focus-within {
470
+ .x1gdl68u:focus-within, .x1kayw1c:focus-visible {
467
471
  border-color: var(--x1nzi8h4);
468
472
  }
469
473
 
@@ -1281,6 +1285,10 @@
1281
1285
  font-weight: 700;
1282
1286
  }
1283
1287
 
1288
+ .x1th50cv {
1289
+ grid-template-columns: 11rem minmax(0, 1fr);
1290
+ }
1291
+
1284
1292
  .x1o61qjw {
1285
1293
  grid-template-columns: 1fr 1fr;
1286
1294
  }
@@ -1309,10 +1317,18 @@
1309
1317
  grid-template-columns: repeat(auto-fill, 72px);
1310
1318
  }
1311
1319
 
1320
+ .x1oqazeo {
1321
+ grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
1322
+ }
1323
+
1312
1324
  .x10vl0y4 {
1313
1325
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
1314
1326
  }
1315
1327
 
1328
+ .xrw2u2m {
1329
+ grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
1330
+ }
1331
+
1316
1332
  .xc8icb0 {
1317
1333
  isolation: isolate;
1318
1334
  }
@@ -1858,6 +1874,10 @@
1858
1874
  }
1859
1875
  }
1860
1876
 
1877
+ .x11exl2m:focus-visible {
1878
+ background-color: var(--xeg52a);
1879
+ }
1880
+
1861
1881
  .xjanfmb:focus-visible {
1862
1882
  background-size: 2px 100%;
1863
1883
  }
@@ -2046,6 +2066,12 @@
2046
2066
  }
2047
2067
  }
2048
2068
 
2069
+ @media (width <= 640px) {
2070
+ .xkaaz9w.xkaaz9w {
2071
+ display: none;
2072
+ }
2073
+ }
2074
+
2049
2075
  @media (prefers-reduced-motion: reduce) {
2050
2076
  .xkio4u3.xkio4u3 {
2051
2077
  display: none;
@@ -2076,6 +2102,12 @@
2076
2102
  }
2077
2103
  }
2078
2104
 
2105
+ @media (width <= 640px) {
2106
+ .x4jmfmw.x4jmfmw {
2107
+ grid-template-columns: minmax(0, 1fr);
2108
+ }
2109
+ }
2110
+
2079
2111
  @media (width <= 800px) {
2080
2112
  .x1kk4rku.x1kk4rku {
2081
2113
  grid-template-columns: repeat(2, minmax(0, 1fr));
@@ -2408,6 +2440,10 @@
2408
2440
  height: min(640px,calc(100vh - 68px - env(safe-area-inset-bottom, 0px)));
2409
2441
  }
2410
2442
 
2443
+ .x10ng2aq {
2444
+ height: min(760px, 100vh - 32px);
2445
+ }
2446
+
2411
2447
  .x6zskup {
2412
2448
  left: -4px;
2413
2449
  }
@@ -2636,6 +2672,10 @@
2636
2672
  max-width: 360px;
2637
2673
  }
2638
2674
 
2675
+ .xf2d64e {
2676
+ max-width: 40rem;
2677
+ }
2678
+
2639
2679
  .x1lr1uin {
2640
2680
  max-width: 420px;
2641
2681
  }
@@ -2648,6 +2688,10 @@
2648
2688
  max-width: 460px;
2649
2689
  }
2650
2690
 
2691
+ .xthy2uy {
2692
+ max-width: 50%;
2693
+ }
2694
+
2651
2695
  .xh9uqaf {
2652
2696
  max-width: 60%;
2653
2697
  }
@@ -3056,6 +3100,10 @@
3056
3100
  width: 16px;
3057
3101
  }
3058
3102
 
3103
+ .x1e67fm3 {
3104
+ width: 16rem;
3105
+ }
3106
+
3059
3107
  .x1xp8n7a {
3060
3108
  width: 18px;
3061
3109
  }
@@ -3212,6 +3260,10 @@
3212
3260
  width: calc(min(360px, 38vw) - 48px);
3213
3261
  }
3214
3262
 
3263
+ .x10br60o {
3264
+ width: min(1080px, 100vw - 32px);
3265
+ }
3266
+
3215
3267
  .x3bfboh {
3216
3268
  width: min(360px, 38vw);
3217
3269
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backmatter/studio",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
4
4
  "description": "The Backmatter editing surface: document editor, AI chat, publish. Mounted on your site or hosted on the dashboard.",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -56,7 +56,7 @@
56
56
  },
57
57
  "dependencies": {
58
58
  "@ai-sdk/react": "^4.0.100",
59
- "@backmatter/core": "^0.0.38",
59
+ "@backmatter/core": "^0.0.40",
60
60
  "@base-ui/react": "^1.6.0",
61
61
  "@central-icons-react/round-outlined-radius-2-stroke-1.5": "1.2.15",
62
62
  "@dnd-kit/abstract": "^0.5.0",
@@ -15,6 +15,7 @@ import { SettingsUsersPage } from "./pages/SettingsUsersPage";
15
15
  import { GithubConnectPage } from "./pages/GithubConnectPage";
16
16
  import { DocEditorPage } from "./pages/DocEditorPage";
17
17
  import { MediaGalleryPage } from "./pages/MediaGalleryPage";
18
+ import { BlocksLibraryPage } from "./pages/BlocksLibraryPage";
18
19
  import CodeSessionPage from "./pages/CodeSessionPage";
19
20
 
20
21
  /**
@@ -40,6 +41,7 @@ export function workspaceRoutes() {
40
41
  </Route>
41
42
  <Route path="content/:type/:docSlug" element={<DocEditorPage />} />
42
43
  <Route path="media" element={<MediaGalleryPage />} />
44
+ <Route path="blocks" element={<BlocksLibraryPage />} />
43
45
  </Route>
44
46
  );
45
47
  }
package/src/api.ts CHANGED
@@ -353,6 +353,9 @@ export function unbindGithub(workspaceId: string) {
353
353
  );
354
354
  }
355
355
 
356
+ /** "grouped" opens on block groups, "flat" lists every block, "auto" groups long catalogs. */
357
+ export type BlockPickerView = "auto" | "grouped" | "flat";
358
+
356
359
  export type SchemaField = {
357
360
  kind: string;
358
361
  multiple?: boolean;
@@ -369,6 +372,8 @@ export type SchemaField = {
369
372
  max?: number;
370
373
  step?: number;
371
374
  where?: Record<string, string | number | boolean>;
375
+ /** For blocks fields: layout of the "Add block" picker. */
376
+ picker?: BlockPickerView;
372
377
  /** Guidance from the site developer: what goes here. */
373
378
  description?: string;
374
379
  };
@@ -24,6 +24,8 @@ import {
24
24
  isWorkspaceCodePath,
25
25
  isWorkspaceEditorPath,
26
26
  isWorkspaceMediaPath,
27
+ isWorkspaceBlocksPath,
28
+ blocksPath,
27
29
  isWorkspaceSettingsPath,
28
30
  mediaPath,
29
31
  settingsPath,
@@ -47,6 +49,7 @@ import {
47
49
  ExplorerRailCodeIcon,
48
50
  ExplorerRailFilesIcon,
49
51
  ExplorerRailMediaIcon,
52
+ ExplorerRailBlocksIcon,
50
53
  ExplorerRailSearchIcon,
51
54
  ExplorerRailSettingsIcon,
52
55
  ExplorerTwistie,
@@ -345,6 +348,19 @@ export function ActivityRail({
345
348
  <ExplorerRailMediaIcon />
346
349
  </Link>
347
350
  </Tooltip>
351
+ <Tooltip label="Blocks" side="right">
352
+ <Link
353
+ to={blocksPath(workspaceSlug)}
354
+ aria-label="Blocks"
355
+ aria-current={isWorkspaceBlocksPath(location.pathname) ? "page" : undefined}
356
+ {...stylex.props(
357
+ styles.railBtn,
358
+ isWorkspaceBlocksPath(location.pathname) && styles.railBtnActive,
359
+ )}
360
+ >
361
+ <ExplorerRailBlocksIcon />
362
+ </Link>
363
+ </Tooltip>
348
364
  {codeHref ? (
349
365
  <Tooltip label="Code session" side="right">
350
366
  <Link
@@ -13,6 +13,7 @@ import {
13
13
  IconGit,
14
14
  IconHistory,
15
15
  IconImages1,
16
+ IconBlocks,
16
17
  IconListBullets,
17
18
  IconMagnifyingGlass,
18
19
  IconPageAdd,
@@ -71,6 +72,10 @@ export function ExplorerRailMediaIcon() {
71
72
  return <Central icon={IconImages1} size={RAIL} />;
72
73
  }
73
74
 
75
+ export function ExplorerRailBlocksIcon() {
76
+ return <Central icon={IconBlocks} size={RAIL} />;
77
+ }
78
+
74
79
  export function ExplorerRailCodeIcon() {
75
80
  return <Central icon={IconCode} size={RAIL} />;
76
81
  }
@@ -3,7 +3,10 @@
3
3
  // so custom inputs and block previews are ordinary React components. The
4
4
  // dashboard runs with an empty definition.
5
5
  import { createContext, useContext, type ComponentType, type ReactNode } from "react";
6
- import type { SchemaField } from "./api";
6
+ import type { BlockPickerView, SchemaField } from "./api";
7
+ import type { StudioBlockGroupConfig } from "./pages/block-groups";
8
+
9
+ export type { StudioBlockGroupConfig };
7
10
 
8
11
  export type StudioFieldInputProps = {
9
12
  /** Field name in the model or block. */
@@ -48,6 +51,14 @@ export type StudioDefinition = {
48
51
  fields?: Record<string, StudioFieldInput>;
49
52
  /** Per block name (as in `defineBlock({ name })`). */
50
53
  blocks?: Record<string, StudioBlockConfig>;
54
+ /**
55
+ * Default layout of the "Add block" picker. A blocks field overrides it with
56
+ * `field.blocks({ picker })`. Default "auto": grouped once there are more
57
+ * than 8 blocks in at least two groups.
58
+ */
59
+ blockPicker?: BlockPickerView;
60
+ /** Per block group name (as in `defineBlock({ group })`): label, cover image, order. */
61
+ blockGroups?: Record<string, StudioBlockGroupConfig>;
51
62
  /** Extra links in the Studio sidebar, e.g. back to the site. */
52
63
  menu?: StudioMenuItem[];
53
64
  };
package/src/index.ts CHANGED
@@ -4,6 +4,7 @@ export { SiteStudio, configureSiteStudio, bounceToEnter, type SiteStudioProps }
4
4
  export {
5
5
  defineStudio,
6
6
  type StudioBlockConfig,
7
+ type StudioBlockGroupConfig,
7
8
  type StudioBlockPreviewProps,
8
9
  type StudioDefinition,
9
10
  type StudioFieldInput,