@backmatter/studio 0.0.21 → 0.0.23

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-DW0sLdpJ.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-LYgvnqww.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-CMMcsaX4.js").then((e) => ({
1826
+ const Lr = ot(() => import("./UiKitApp-DNnsTU4S.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-DW0sLdpJ.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-LYgvnqww.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-By0P4Yny.js";
2
- import { G as t, H as f } from "./chunks/WorkspaceRoutes-DW0sLdpJ.js";
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";
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-DW0sLdpJ.js";
4
- import { X as kt } from "./chunks/WorkspaceRoutes-DW0sLdpJ.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-LYgvnqww.js";
4
+ import { X as kt } from "./chunks/WorkspaceRoutes-LYgvnqww.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
@@ -169,6 +169,10 @@
169
169
  border-radius: 999px;
170
170
  }
171
171
 
172
+ .x1pjcqnp {
173
+ border-radius: inherit;
174
+ }
175
+
172
176
  .xjdkmwh {
173
177
  border-radius: var(--x16ewcrl);
174
178
  }
@@ -221,6 +225,10 @@
221
225
  gap: 0;
222
226
  }
223
227
 
228
+ .x12mrbbr {
229
+ gap: 1px;
230
+ }
231
+
224
232
  .x195vfkc {
225
233
  gap: 2px;
226
234
  }
@@ -471,6 +479,10 @@
471
479
  padding-block: 0;
472
480
  }
473
481
 
482
+ .xt0b8zv:hover {
483
+ text-decoration: underline;
484
+ }
485
+
474
486
  .x1t8xw5s:focus {
475
487
  border-color: color-mix(in srgb,var(--xw4dauw) 45%,var(--xz3qvk5));
476
488
  }
@@ -573,10 +585,18 @@
573
585
  align-self: stretch;
574
586
  }
575
587
 
588
+ .xmmqq2k {
589
+ animation-delay: .15s;
590
+ }
591
+
576
592
  .x12l1aco {
577
593
  animation-duration: .12s;
578
594
  }
579
595
 
596
+ .xtsvl71 {
597
+ animation-duration: .15s;
598
+ }
599
+
580
600
  .x5hsz1j {
581
601
  animation-duration: .2s;
582
602
  }
@@ -593,6 +613,10 @@
593
613
  animation-fill-mode: backwards;
594
614
  }
595
615
 
616
+ .x1u6ievf {
617
+ animation-fill-mode: both;
618
+ }
619
+
596
620
  .xa4qsjk {
597
621
  animation-iteration-count: infinite;
598
622
  }
@@ -625,6 +649,10 @@
625
649
  animation-timing-function: ease-in-out;
626
650
  }
627
651
 
652
+ .xa3vuyk {
653
+ animation-timing-function: ease-out;
654
+ }
655
+
628
656
  .x1esw782 {
629
657
  animation-timing-function: linear;
630
658
  }
@@ -1049,6 +1077,10 @@
1049
1077
  column-gap: 48px;
1050
1078
  }
1051
1079
 
1080
+ .x1q3hsim {
1081
+ column-gap: var(--x1ft7ks7);
1082
+ }
1083
+
1052
1084
  .x16qrkmw {
1053
1085
  contain: paint;
1054
1086
  }
@@ -1117,6 +1149,10 @@
1117
1149
  flex-basis: 0%;
1118
1150
  }
1119
1151
 
1152
+ .x1l7klhg {
1153
+ flex-basis: 100%;
1154
+ }
1155
+
1120
1156
  .xdl72j9 {
1121
1157
  flex-basis: auto;
1122
1158
  }
@@ -1149,6 +1185,10 @@
1149
1185
  flex-shrink: 2;
1150
1186
  }
1151
1187
 
1188
+ .xo4cfa7 {
1189
+ flex-shrink: 3;
1190
+ }
1191
+
1152
1192
  .x1a02dak {
1153
1193
  flex-wrap: wrap;
1154
1194
  }
@@ -1922,6 +1962,10 @@
1922
1962
  opacity: .8;
1923
1963
  }
1924
1964
 
1965
+ .xtbifol:checked {
1966
+ background-color: var(--x11n7hvk);
1967
+ }
1968
+
1925
1969
  .x8w64xv:hover {
1926
1970
  background-color: var(--xeg52a);
1927
1971
  }
@@ -2067,6 +2111,10 @@
2067
2111
  background-color: #e4e4e7;
2068
2112
  }
2069
2113
 
2114
+ .xkfsa8o.xkfsa8o:hover {
2115
+ background-color: color-mix(in srgb,var(--xeg52a) 50%,transparent);
2116
+ }
2117
+
2070
2118
  .x9ezvp6.x9ezvp6:hover {
2071
2119
  background-color: #18181b;
2072
2120
  }
@@ -2260,10 +2308,6 @@
2260
2308
  height: 1px;
2261
2309
  }
2262
2310
 
2263
- .x1l36t39 {
2264
- height: 1rem;
2265
- }
2266
-
2267
2311
  .x1qx5ct2 {
2268
2312
  height: 20px;
2269
2313
  }
@@ -2372,6 +2416,10 @@
2372
2416
  left: 0;
2373
2417
  }
2374
2418
 
2419
+ .xpnmzw7 {
2420
+ left: 12px;
2421
+ }
2422
+
2375
2423
  .x54rlcq {
2376
2424
  left: 2px;
2377
2425
  }
@@ -2544,6 +2592,10 @@
2544
2592
  max-height: min(var(--available-height),240px);
2545
2593
  }
2546
2594
 
2595
+ .xo54sje {
2596
+ max-height: min(var(--available-height),24rem);
2597
+ }
2598
+
2547
2599
  .xsj38sl {
2548
2600
  max-height: min(var(--available-height),420px);
2549
2601
  }
@@ -2632,6 +2684,10 @@
2632
2684
  max-width: calc(100vw - 32px);
2633
2685
  }
2634
2686
 
2687
+ .x4bfss {
2688
+ max-width: min(max(var(--anchor-width),24rem),var(--available-width));
2689
+ }
2690
+
2635
2691
  .x2lwn1j {
2636
2692
  min-height: 0;
2637
2693
  }
@@ -3008,10 +3064,6 @@
3008
3064
  width: 1px;
3009
3065
  }
3010
3066
 
3011
- .xcdlrvm {
3012
- width: 1rem;
3013
- }
3014
-
3015
3067
  .xvm51jw {
3016
3068
  width: 2.5rem;
3017
3069
  }
@@ -3104,6 +3156,10 @@
3104
3156
  width: 48px;
3105
3157
  }
3106
3158
 
3159
+ .xekueh {
3160
+ width: 4rem;
3161
+ }
3162
+
3107
3163
  .x15yg21f {
3108
3164
  width: 56px;
3109
3165
  }
@@ -3220,6 +3276,22 @@
3220
3276
  border-bottom-color: var(--x1nzi8h4);
3221
3277
  }
3222
3278
 
3279
+ .x18efcp4:first-child {
3280
+ border-top-left-radius: calc(var(--x83d9l2) - 1px);
3281
+ }
3282
+
3283
+ .xfra7d4:first-child {
3284
+ border-top-right-radius: calc(var(--x83d9l2) - 1px);
3285
+ }
3286
+
3287
+ .xpave9o:last-child {
3288
+ border-bottom-left-radius: calc(var(--x83d9l2) - 1px);
3289
+ }
3290
+
3291
+ .x1m3jluo:last-child {
3292
+ border-bottom-right-radius: calc(var(--x83d9l2) - 1px);
3293
+ }
3294
+
3223
3295
  .x1t1lzn6:last-child {
3224
3296
  border-bottom-width: 0;
3225
3297
  }
@@ -3277,6 +3349,10 @@
3277
3349
  .x1d0y9ls:after {
3278
3350
  background-position: 0;
3279
3351
  }
3352
+
3353
+ .x1n6dlnu:before {
3354
+ border-radius: 999px;
3355
+ }
3280
3356
  }
3281
3357
 
3282
3358
  @layer priority7 {
@@ -3296,6 +3372,10 @@
3296
3372
  animation-timing-function: linear;
3297
3373
  }
3298
3374
 
3375
+ .x1trpwii:before {
3376
+ background-color: var(--x1dudhym);
3377
+ }
3378
+
3299
3379
  .x1ghgi56:after {
3300
3380
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 180 72' fill='none'%3E%3Cdefs%3E%3Cfilter id='b' x='-100%25' y='-100%25' width='300%25' height='300%25'%3E%3CfeGaussianBlur stdDeviation='6'/%3E%3C/filter%3E%3C/defs%3E%3Cg transform='rotate(-30 90 36)' filter='url(%23b)'%3E%3Crect x='72' y='18' width='36' height='36' fill='%2318181b' fill-opacity='.45'/%3E%3Crect x='84' y='16' width='12' height='40' fill='%2318181b'/%3E%3C/g%3E%3C/svg%3E");
3301
3381
  }
@@ -3308,11 +3388,15 @@
3308
3388
  background-size: 180px 72px;
3309
3389
  }
3310
3390
 
3391
+ .xuj3ll3:before {
3392
+ box-shadow: 0 1px 2px #0003;
3393
+ }
3394
+
3311
3395
  .x9ecp23::placeholder {
3312
3396
  color: var(--xw4dauw);
3313
3397
  }
3314
3398
 
3315
- .x1s928wv:after {
3399
+ .x1cpjm7i:before, .x1s928wv:after {
3316
3400
  content: "";
3317
3401
  }
3318
3402
 
@@ -3320,9 +3404,27 @@
3320
3404
  pointer-events: none;
3321
3405
  }
3322
3406
 
3323
- .x1j6awrg:after {
3407
+ .x1hmns74:before, .x1j6awrg:after {
3324
3408
  position: absolute;
3325
3409
  }
3410
+
3411
+ .xqfulrc:before {
3412
+ transition-duration: .12s;
3413
+ }
3414
+
3415
+ .x1hu8v7x:before {
3416
+ transition-property: transform;
3417
+ }
3418
+
3419
+ .xiop08k:checked:before {
3420
+ transform: translateX(12px);
3421
+ }
3422
+
3423
+ @media (prefers-reduced-motion: reduce) {
3424
+ .x13sdc92.x13sdc92:before {
3425
+ transition-duration: 0s;
3426
+ }
3427
+ }
3326
3428
  }
3327
3429
 
3328
3430
  @layer priority8 {
@@ -3330,14 +3432,30 @@
3330
3432
  height: 100%;
3331
3433
  }
3332
3434
 
3435
+ .xxt7thn:before {
3436
+ height: 12px;
3437
+ }
3438
+
3333
3439
  .x1oly944:after {
3334
3440
  left: -180px;
3335
3441
  }
3336
3442
 
3443
+ .x1tymlch:before {
3444
+ left: 2px;
3445
+ }
3446
+
3337
3447
  .x1m1drc7:after {
3338
3448
  top: 0;
3339
3449
  }
3340
3450
 
3451
+ .xwwlq33:before {
3452
+ top: 2px;
3453
+ }
3454
+
3455
+ .x20nr4a:before {
3456
+ width: 12px;
3457
+ }
3458
+
3341
3459
  .x14wh5xp:after {
3342
3460
  width: calc(100% + 180px);
3343
3461
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backmatter/studio",
3
- "version": "0.0.21",
3
+ "version": "0.0.23",
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": {
@@ -237,6 +237,7 @@ function ObjectFieldEditor({
237
237
  onChange,
238
238
  }: SharedFieldProps) {
239
239
  const resolved = resolveObjectFields(field, objects);
240
+ const isSwitch = useIsSwitchField(models);
240
241
  if (!resolved) {
241
242
  return (
242
243
  <JsonField
@@ -255,7 +256,12 @@ function ObjectFieldEditor({
255
256
  const body = (
256
257
  <div {...stylex.props(styles.objectFields)}>
257
258
  {Object.entries(resolved).map(([fieldName, nestedField]) => (
258
- <NestedField key={fieldName} name={fieldName} field={nestedField}>
259
+ <NestedField
260
+ key={fieldName}
261
+ name={fieldName}
262
+ field={nestedField}
263
+ inline={isSwitch(nestedField)}
264
+ >
259
265
  <FieldControl
260
266
  name={`${name}.${fieldName}`}
261
267
  field={nestedField}
@@ -295,14 +301,24 @@ function ObjectFieldEditor({
295
301
  );
296
302
  }
297
303
 
304
+ /** Tells which fields show as a switch, so their row can set it beside the label. */
305
+ export function useIsSwitchField(
306
+ models: Array<{ type: string; external?: boolean }>,
307
+ ): (field: SchemaField) => boolean {
308
+ const definition = useStudioDefinition();
309
+ return (field) => chooseFieldInput(definition, field, models) === "boolean";
310
+ }
311
+
298
312
  /** Composite fields hold their own labeled inputs, so they get a group, not a `<label>`. */
299
313
  function NestedField({
300
314
  name,
301
315
  field,
316
+ inline,
302
317
  children,
303
318
  }: {
304
319
  name: string;
305
320
  field: SchemaField;
321
+ inline: boolean;
306
322
  children: ReactNode;
307
323
  }) {
308
324
  const label = fieldLabel(name, field);
@@ -317,7 +333,7 @@ function NestedField({
317
333
  );
318
334
  }
319
335
  return (
320
- <Field label={label} hint={hint}>
336
+ <Field label={label} hint={hint} inline={inline}>
321
337
  {children}
322
338
  </Field>
323
339
  );
@@ -802,9 +818,10 @@ export function FieldControl({
802
818
  return (
803
819
  <input
804
820
  type="checkbox"
821
+ role="switch"
805
822
  checked={value === true}
806
823
  disabled={readOnly}
807
- {...stylex.props(styles.check)}
824
+ {...stylex.props(styles.switch)}
808
825
  onChange={(event) => {
809
826
  if (readOnly) return;
810
827
  onChange(event.target.checked);
@@ -982,14 +999,55 @@ const styles = stylex.create({
982
999
  backgroundColor: "transparent",
983
1000
  cursor: "pointer",
984
1001
  },
985
- check: {
986
- width: "1rem",
987
- height: "1rem",
1002
+ switch: {
1003
+ appearance: "none",
1004
+ position: "relative",
1005
+ flexShrink: 0,
1006
+ width: "28px",
1007
+ height: "16px",
1008
+ margin: 0,
1009
+ borderRadius: "999px",
1010
+ backgroundColor: colors.border,
1011
+ cursor: "pointer",
1012
+ transitionProperty: "background-color",
1013
+ transitionDuration: "120ms",
1014
+ "::before": {
1015
+ content: '""',
1016
+ position: "absolute",
1017
+ top: "2px",
1018
+ left: "2px",
1019
+ width: "12px",
1020
+ height: "12px",
1021
+ borderRadius: "999px",
1022
+ backgroundColor: colors.bgSurface,
1023
+ boxShadow: "0 1px 2px rgba(0, 0, 0, 0.2)",
1024
+ transitionProperty: "transform",
1025
+ transitionDuration: "120ms",
1026
+ "@media (prefers-reduced-motion: reduce)": {
1027
+ transitionDuration: "0s",
1028
+ },
1029
+ },
1030
+ ":checked": {
1031
+ backgroundColor: colors.accent,
1032
+ },
1033
+ ":checked::before": {
1034
+ transform: "translateX(12px)",
1035
+ },
1036
+ ":disabled": {
1037
+ cursor: "default",
1038
+ opacity: 0.5,
1039
+ },
1040
+ ":focus-visible": {
1041
+ outlineWidth: 2,
1042
+ outlineStyle: "solid",
1043
+ outlineColor: colors.focus,
1044
+ outlineOffset: 2,
1045
+ },
988
1046
  },
989
1047
  objectFields: {
990
1048
  display: "flex",
991
1049
  flexDirection: "column",
992
- gap: space.md,
1050
+ gap: space.lg,
993
1051
  },
994
1052
  nest: {
995
1053
  display: "flex",