@backmatter/studio 0.0.19 → 0.0.20
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-B1ANqCac.js → UiKitApp-C269OA8v.js} +2 -2
- package/dist/chunks/{WorkspaceRoutes-BHNGrf-j.js → WorkspaceRoutes-B4B5jjje.js} +8 -3
- package/dist/chunks/{dashboard-b-W6dGm5.js → dashboard-DeNgythd.js} +2 -2
- package/dist/chunks/{index-HYioDjux.js → index-7-TtXaMq.js} +1 -1
- package/dist/dashboard.js +2 -2
- package/dist/index.js +2 -2
- package/dist/studio.css +12 -0
- package/package.json +2 -2
- package/src/api.ts +7 -0
- package/src/pages/BlocksList.tsx +38 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as s, jsx as t, Fragment as U } from "react/jsx-runtime";
|
|
2
|
-
import { V as v, Y as he, Z as Zt, k as Rt, _ as Jt, f as ot, $ as Ve, a0 as Qt, a1 as en, a2 as tn, a3 as nn, a4 as rn, J as an, o as on, a5 as sn, a6 as ln, a7 as cn, a8 as He, a9 as fe, aa as ue, ab as st, ac as It, ad as dn, ae as un, T as hn, af as pn, ag as gn, ah as mn, ai as fn, aj as bn, ak as xn, I as vn, al as $n, P as kn, am as wn } from "./WorkspaceRoutes-
|
|
2
|
+
import { V as v, Y as he, Z as Zt, k as Rt, _ as Jt, f as ot, $ as Ve, a0 as Qt, a1 as en, a2 as tn, a3 as nn, a4 as rn, J as an, o as on, a5 as sn, a6 as ln, a7 as cn, a8 as He, a9 as fe, aa as ue, ab as st, ac as It, ad as dn, ae as un, T as hn, af as pn, ag as gn, ah as mn, ai as fn, aj as bn, ak as xn, I as vn, al as $n, P as kn, am as wn } from "./WorkspaceRoutes-B4B5jjje.js";
|
|
3
3
|
import { useRef as w, useState as b, useLayoutEffect as te, useCallback as Ke, useEffect as z, useMemo as yn, useId as Oe } from "react";
|
|
4
4
|
import { createPortal as Me } from "react-dom";
|
|
5
|
-
import { L as Nn, a as lt } from "./dashboard-
|
|
5
|
+
import { L as Nn, a as lt } from "./dashboard-DeNgythd.js";
|
|
6
6
|
function O({
|
|
7
7
|
title: n,
|
|
8
8
|
lede: r,
|
|
@@ -85418,7 +85418,7 @@ async function Wxt(e, t) {
|
|
|
85418
85418
|
}
|
|
85419
85419
|
let Mg = null;
|
|
85420
85420
|
function Gxt() {
|
|
85421
|
-
return import("./index-
|
|
85421
|
+
return import("./index-7-TtXaMq.js").then(({ remarkPlugins: e }) => e());
|
|
85422
85422
|
}
|
|
85423
85423
|
async function Zxt(e, t) {
|
|
85424
85424
|
if (!e.trim()) return { node: null, error: null };
|
|
@@ -91673,8 +91673,9 @@ function sbt({
|
|
|
91673
91673
|
/* @__PURE__ */ y("div", { className: "x78zum5 x2lah0s xpw8yq9", children: /* @__PURE__ */ y(Dt, { variant: "ghost", disabled: s, "aria-label": `Delete ${e.type}`, onClick: l, children: "Delete" }) })
|
|
91674
91674
|
] }),
|
|
91675
91675
|
a ? /* @__PURE__ */ L("div", { className: "x78zum5 xdt5ytf x1ndbd79 x1l8q8zy x1y1hw3e", children: [
|
|
91676
|
+
g != null && g.description ? /* @__PURE__ */ y(Be, { tone: "muted", size: "sm", children: g.description }) : null,
|
|
91676
91677
|
v ? /* @__PURE__ */ y("div", { className: "xb3r6kr xjdkmwh xmkeg23 x1y0btm7 x1j0qoeq", children: /* @__PURE__ */ y(v, { type: e.type, props: e.props }) }) : null,
|
|
91677
|
-
x.length === 0 ? /* @__PURE__ */ y(Be, { tone: "muted", size: "sm", children: g ? "This block has no fields." : `Unknown block type "${e.type}".` }) : x.map(([M, w]) => /* @__PURE__ */ y(sa, { label: obt(M, w), children: /* @__PURE__ */ y(Wh, { name: M, field: w, value: e.props[M], models: r, objects: i, documentLists: o, readOnly: s, onChange: (_) => u(cb(e.props, M, _)) }) }, M))
|
|
91678
|
+
x.length === 0 ? /* @__PURE__ */ y(Be, { tone: "muted", size: "sm", children: g ? "This block has no fields." : `Unknown block type "${e.type}".` }) : x.map(([M, w]) => /* @__PURE__ */ y(sa, { label: obt(M, w), hint: w.description ? /* @__PURE__ */ y("span", { className: "xnezs1t x1vrk1b5", children: w.description }) : void 0, children: /* @__PURE__ */ y(Wh, { name: M, field: w, value: e.props[M], models: r, objects: i, documentLists: o, readOnly: s, onChange: (_) => u(cb(e.props, M, _)) }) }, M))
|
|
91678
91679
|
] }) : null
|
|
91679
91680
|
] });
|
|
91680
91681
|
}
|
|
@@ -91719,13 +91720,17 @@ function x_({
|
|
|
91719
91720
|
}, onUpdateProps: (g) => s(tbt(e, h.id, g)) }, h.id)) }) }),
|
|
91720
91721
|
t.length === 0 ? /* @__PURE__ */ y(Be, { tone: "muted", size: "sm", children: "No blocks in the schema." }) : /* @__PURE__ */ L(Ys, { children: [
|
|
91721
91722
|
/* @__PURE__ */ y(el, { disabled: o, render: /* @__PURE__ */ y(Dt, { variant: "secondary", disabled: o, children: "Add block" }) }),
|
|
91722
|
-
/* @__PURE__ */ y(Qa, { children: /* @__PURE__ */ y(es, { side: "bottom", align: "start", sideOffset: 6, className: Ve(ze.positioner), children: /* @__PURE__ */ y(Ya, { "aria-label": "Add block", className: (h) => br(h, cbt.menu), children: t.map((h) => /* @__PURE__ */ y(_i, { label: h.name, onClick: () => d(h.name), className: (p) => Ve(ze.item, p.highlighted && ze.itemHighlighted), children:
|
|
91723
|
+
/* @__PURE__ */ y(Qa, { children: /* @__PURE__ */ y(es, { side: "bottom", align: "start", sideOffset: 6, className: Ve(ze.positioner), children: /* @__PURE__ */ y(Ya, { "aria-label": "Add block", className: (h) => br(h, cbt.menu), children: t.map((h) => /* @__PURE__ */ y(_i, { label: h.name, onClick: () => d(h.name), className: (p) => Ve(ze.item, p.highlighted && ze.itemHighlighted), children: /* @__PURE__ */ L("span", { className: "x78zum5 xdt5ytf x195vfkc xeuugli", children: [
|
|
91724
|
+
/* @__PURE__ */ y("span", { children: h.name }),
|
|
91725
|
+
h.description ? /* @__PURE__ */ y("span", { className: "x111yfic x1vrk1b5 x1xfvgam xeaf4i8", children: h.description }) : null
|
|
91726
|
+
] }) }, h.name)) }) }) })
|
|
91723
91727
|
] })
|
|
91724
91728
|
] });
|
|
91725
91729
|
}
|
|
91726
91730
|
const cbt = {
|
|
91727
91731
|
menu: {
|
|
91728
91732
|
k7Eaqz: "x12kinc7",
|
|
91733
|
+
ks0D6T: "xuv54rz",
|
|
91729
91734
|
$$css: !0
|
|
91730
91735
|
}
|
|
91731
91736
|
};
|
|
@@ -3,7 +3,7 @@ var Ye = (e, t, n) => t in e ? Xe(e, t, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var H = (e, t, n) => Ye(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { jsxs as k, jsx as o, Fragment as me } from "react/jsx-runtime";
|
|
5
5
|
import { useRef as Qe, useCallback as Ze, useSyncExternalStore as et, useState as S, useEffect as V, lazy as tt, Suspense as nt } from "react";
|
|
6
|
-
import { X as rt, an as be, ao as st, V as R, ap as it, k as at, aq as ot, ar as Ce, as as Ie, at as qe, au as lt, av as ct, P as ze, aw as ut, ax as ie, ah as J, Z as Be, ay as dt, az as Fe, ai as ft, ak as re, aa as Q, ab as Z, Y as ae, aA as ht, W as B, aB as pt, J as we, aC as ee, aj as gt, aD as mt, aE as xt, aF as yt, f as vt, aG as bt, a6 as wt, aH as kt, aI as St, z as Et, B as Rt, I as _t, aJ as Ot, aK as Tt, aL as Pt, K as jt, aM as Lt, R as At, L as Nt, M as Ut, N as Ct, O as F, Q as It, U as qt } from "./WorkspaceRoutes-
|
|
6
|
+
import { X as rt, an as be, ao as st, V as R, ap as it, k as at, aq as ot, ar as Ce, as as Ie, at as qe, au as lt, av as ct, P as ze, aw as ut, ax as ie, ah as J, Z as Be, ay as dt, az as Fe, ai as ft, ak as re, aa as Q, ab as Z, Y as ae, aA as ht, W as B, aB as pt, J as we, aC as ee, aj as gt, aD as mt, aE as xt, aF as yt, f as vt, aG as bt, a6 as wt, aH as kt, aI as St, z as Et, B as Rt, I as _t, aJ as Ot, aK as Tt, aL as Pt, K as jt, aM as Lt, R as At, L as Nt, M as Ut, N as Ct, O as F, Q as It, U as qt } from "./WorkspaceRoutes-B4B5jjje.js";
|
|
7
7
|
const te = /* @__PURE__ */ Object.create(null), W = (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);
|
|
@@ -1723,7 +1723,7 @@ function Sr(e) {
|
|
|
1723
1723
|
const t = e.replace(/\/$/, "") || "/";
|
|
1724
1724
|
return t === "/__ui" || /^\/__ui\/[^/]+$/.test(t);
|
|
1725
1725
|
}
|
|
1726
|
-
const Er = tt(() => import("./UiKitApp-
|
|
1726
|
+
const Er = tt(() => import("./UiKitApp-C269OA8v.js").then((e) => ({
|
|
1727
1727
|
default: e.UiKitApp
|
|
1728
1728
|
})));
|
|
1729
1729
|
function jr() {
|
|
@@ -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 { aN as Bt, aO as Bs, aP as a0, aQ as ct, aR as xt, aS as ea, aT as Gn, aU as Is, aV as Ls, aW as Ds, aX as La, aY as Ps, aZ as Os, a_ as Le, a$ as qs } from "./WorkspaceRoutes-
|
|
4
|
+
import { aN as Bt, aO as Bs, aP as a0, aQ as ct, aR as xt, aS as ea, aT as Gn, aU as Is, aV as Ls, aW as Ds, aX as La, aY as Ps, aZ as Os, a_ as Le, a$ as qs } from "./WorkspaceRoutes-B4B5jjje.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-DeNgythd.js";
|
|
2
|
+
import { G as t, H as f } from "./chunks/WorkspaceRoutes-B4B5jjje.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 } from "react/jsx-runtime";
|
|
2
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-
|
|
4
|
-
import { X as pt } from "./chunks/WorkspaceRoutes-
|
|
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-B4B5jjje.js";
|
|
4
|
+
import { X as pt } from "./chunks/WorkspaceRoutes-B4B5jjje.js";
|
|
5
5
|
import { u as He, S as We } from "./chunks/define-studio-DlYjgrwr.js";
|
|
6
6
|
import { d as bt } from "./chunks/define-studio-DlYjgrwr.js";
|
|
7
7
|
const R = {
|
package/dist/studio.css
CHANGED
|
@@ -1225,6 +1225,10 @@
|
|
|
1225
1225
|
line-height: 1.3;
|
|
1226
1226
|
}
|
|
1227
1227
|
|
|
1228
|
+
.x1xfvgam {
|
|
1229
|
+
line-height: 1.35;
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1228
1232
|
.x37zpob {
|
|
1229
1233
|
line-height: 1.4;
|
|
1230
1234
|
}
|
|
@@ -1608,6 +1612,10 @@
|
|
|
1608
1612
|
vertical-align: bottom;
|
|
1609
1613
|
}
|
|
1610
1614
|
|
|
1615
|
+
.xeaf4i8 {
|
|
1616
|
+
white-space: normal;
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1611
1619
|
.xuxw1ft {
|
|
1612
1620
|
white-space: nowrap;
|
|
1613
1621
|
}
|
|
@@ -2352,6 +2360,10 @@
|
|
|
2352
2360
|
max-width: 220px;
|
|
2353
2361
|
}
|
|
2354
2362
|
|
|
2363
|
+
.xuv54rz {
|
|
2364
|
+
max-width: 22rem;
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2355
2367
|
.x16em4ew {
|
|
2356
2368
|
max-width: 240px;
|
|
2357
2369
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backmatter/studio",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.20",
|
|
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.
|
|
59
|
+
"@backmatter/core": "^0.0.37",
|
|
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",
|
package/src/api.ts
CHANGED
|
@@ -369,11 +369,18 @@ export type SchemaField = {
|
|
|
369
369
|
max?: number;
|
|
370
370
|
step?: number;
|
|
371
371
|
where?: Record<string, string | number | boolean>;
|
|
372
|
+
/** Guidance from the site developer: what goes here. */
|
|
373
|
+
description?: string;
|
|
372
374
|
};
|
|
373
375
|
|
|
374
376
|
export type BlockSnapshot = {
|
|
375
377
|
name: string;
|
|
376
378
|
fields: Record<string, SchemaField>;
|
|
379
|
+
/** Guidance from the site developer: when to use this block. */
|
|
380
|
+
description?: string;
|
|
381
|
+
group?: string;
|
|
382
|
+
placement?: "first" | "last" | "any";
|
|
383
|
+
maxPerPage?: number;
|
|
377
384
|
};
|
|
378
385
|
|
|
379
386
|
export type SchemaPayload = {
|
package/src/pages/BlocksList.tsx
CHANGED
|
@@ -13,7 +13,7 @@ import { Button } from "../ui/Button";
|
|
|
13
13
|
import { Field } from "../ui/Field";
|
|
14
14
|
import { Text } from "../ui/Text";
|
|
15
15
|
import { cx, popup, popupClassName } from "../ui/popup";
|
|
16
|
-
import { colors, radius, space } from "../styles/tokens.stylex";
|
|
16
|
+
import { colors, radius, space, type } from "../styles/tokens.stylex";
|
|
17
17
|
import {
|
|
18
18
|
addBlock,
|
|
19
19
|
removeBlock,
|
|
@@ -148,6 +148,11 @@ function BlockItem({
|
|
|
148
148
|
</div>
|
|
149
149
|
{open ? (
|
|
150
150
|
<div {...stylex.props(styles.itemBody)}>
|
|
151
|
+
{def?.description ? (
|
|
152
|
+
<Text tone="muted" size="sm">
|
|
153
|
+
{def.description}
|
|
154
|
+
</Text>
|
|
155
|
+
) : null}
|
|
151
156
|
{Preview ? (
|
|
152
157
|
<div {...stylex.props(styles.preview)}>
|
|
153
158
|
<Preview type={block.type} props={block.props} />
|
|
@@ -161,7 +166,15 @@ function BlockItem({
|
|
|
161
166
|
</Text>
|
|
162
167
|
) : (
|
|
163
168
|
fieldEntries.map(([name, field]) => (
|
|
164
|
-
<Field
|
|
169
|
+
<Field
|
|
170
|
+
key={name}
|
|
171
|
+
label={fieldLabel(name, field)}
|
|
172
|
+
hint={
|
|
173
|
+
field.description ? (
|
|
174
|
+
<span {...stylex.props(styles.fieldGuidance)}>{field.description}</span>
|
|
175
|
+
) : undefined
|
|
176
|
+
}
|
|
177
|
+
>
|
|
165
178
|
<FieldControl
|
|
166
179
|
name={name}
|
|
167
180
|
field={field}
|
|
@@ -298,7 +311,12 @@ export function BlocksList({
|
|
|
298
311
|
cx(popup.item, state.highlighted && popup.itemHighlighted)
|
|
299
312
|
}
|
|
300
313
|
>
|
|
301
|
-
{
|
|
314
|
+
<span {...stylex.props(styles.menuEntry)}>
|
|
315
|
+
<span>{block.name}</span>
|
|
316
|
+
{block.description ? (
|
|
317
|
+
<span {...stylex.props(styles.menuDescription)}>{block.description}</span>
|
|
318
|
+
) : null}
|
|
319
|
+
</span>
|
|
302
320
|
</Menu.Item>
|
|
303
321
|
))}
|
|
304
322
|
</Menu.Popup>
|
|
@@ -421,5 +439,22 @@ const styles = stylex.create({
|
|
|
421
439
|
},
|
|
422
440
|
menu: {
|
|
423
441
|
minWidth: "12rem",
|
|
442
|
+
maxWidth: "22rem",
|
|
443
|
+
},
|
|
444
|
+
menuEntry: {
|
|
445
|
+
display: "flex",
|
|
446
|
+
flexDirection: "column",
|
|
447
|
+
gap: "2px",
|
|
448
|
+
minWidth: 0,
|
|
449
|
+
},
|
|
450
|
+
menuDescription: {
|
|
451
|
+
color: colors.textMuted,
|
|
452
|
+
fontSize: type.sm,
|
|
453
|
+
lineHeight: 1.35,
|
|
454
|
+
whiteSpace: "normal",
|
|
455
|
+
},
|
|
456
|
+
fieldGuidance: {
|
|
457
|
+
fontFamily: type.sans,
|
|
458
|
+
fontSize: type.sm,
|
|
424
459
|
},
|
|
425
460
|
});
|