@book.dev/ui 1.65.0 → 1.66.0

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.
@@ -1,4 +1,4 @@
1
- import { Nt as e, U as t, i as n, n as r, t as i } from "./lucideIcons-DvomlmkS.js";
1
+ import { Nt as e, U as t, i as n, n as r, t as i } from "./lucideIcons-hxipmfOS.js";
2
2
  import { t as a } from "./emoji-Bmft6RPl.js";
3
3
  import { useMemo as o, useRef as s, useState as c } from "react";
4
4
  import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
@@ -1,4 +1,4 @@
1
- import { At as e, B as t, Nt as n, V as r, a as i, g as a, p as o, r as s, tt as c } from "./lucideIcons-DvomlmkS.js";
1
+ import { At as e, B as t, Nt as n, V as r, a as i, g as a, p as o, r as s, tt as c } from "./lucideIcons-hxipmfOS.js";
2
2
  import { i as l } from "./pageIcon-BWTy7hAh.js";
3
3
  import { t as u } from "./exportBlocks-33D7P_8Q.js";
4
4
  import * as d from "react";
@@ -35,7 +35,7 @@ function A({ value: e, fallback: t = "📄", className: r }) {
35
35
  }
36
36
  //#endregion
37
37
  //#region src/components/ui/icon-button.tsx
38
- var xe = he("inline-flex shrink-0 items-center justify-center rounded-md text-muted-foreground transition-[color,background-color,transform] active:scale-[0.94] hover:bg-hover hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 disabled:active:scale-100", {
38
+ var xe = he("inline-flex shrink-0 items-center justify-center rounded-md text-muted-foreground transition-[color,background-color,transform] active:scale-[0.94] hover:bg-hover hover:text-foreground focus-visible:outline-hidden focus-visible:shadow-[var(--ring-control)] disabled:pointer-events-none disabled:opacity-50 disabled:active:scale-100", {
39
39
  variants: { size: {
40
40
  sm: "p-1",
41
41
  md: "p-1.5"
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as e, A as t, At as n, B as r, C as i, Ct as a, D as o, Dt as s, E as c, Et as l, F as u, G as d, H as f, I as p, J as m, K as h, L as g, M as _, Mt as v, N as y, Nt as b, O as x, Ot as S, P as C, Q as w, R as T, S as E, St as D, T as O, Tt as ee, U as k, V as A, W as te, X as ne, Y as re, Z as ie, _ as ae, _t as oe, at as j, b as se, bt as ce, c as le, ct as ue, d as de, dt as fe, et as pe, f as me, ft as he, g as M, gt as ge, h as _e, ht as ve, it as ye, j as be, jt as xe, k as Se, kt as Ce, l as we, lt as Te, m as Ee, mt as De, nt as Oe, o as ke, ot as Ae, pt as je, q as Me, rt as Ne, s as Pe, st as Fe, tt as N, u as Ie, ut as Le, v as Re, vt as ze, w as Be, wt as Ve, x as He, xt as Ue, y as We, yt as Ge, z as Ke } from "./lucideIcons-DvomlmkS.js";
1
+ import { $ as e, A as t, At as n, B as r, C as i, Ct as a, D as o, Dt as s, E as c, Et as l, F as u, G as d, H as f, I as p, J as m, K as h, L as g, M as _, Mt as v, N as y, Nt as b, O as x, Ot as S, P as C, Q as w, R as T, S as E, St as D, T as O, Tt as ee, U as k, V as A, W as te, X as ne, Y as re, Z as ie, _ as ae, _t as oe, at as j, b as se, bt as ce, c as le, ct as ue, d as de, dt as fe, et as pe, f as me, ft as he, g as M, gt as ge, h as _e, ht as ve, it as ye, j as be, jt as xe, k as Se, kt as Ce, l as we, lt as Te, m as Ee, mt as De, nt as Oe, o as ke, ot as Ae, pt as je, q as Me, rt as Ne, s as Pe, st as Fe, tt as N, u as Ie, ut as Le, v as Re, vt as ze, w as Be, wt as Ve, x as He, xt as Ue, y as We, yt as Ge, z as Ke } from "./lucideIcons-hxipmfOS.js";
2
2
  import { c as qe, i as Je, l as Ye, n as Xe, o as Ze, r as Qe, s as $e } from "./pageIcon-BWTy7hAh.js";
3
- import { A as et, B as tt, C as nt, D as rt, E as it, F as at, I as ot, L as st, M as ct, N as lt, O as ut, P as dt, R as ft, S as pt, T as mt, _ as ht, a as gt, b as _t, c as vt, d as yt, f as bt, g as xt, h as St, i as Ct, j as wt, k as P, l as Tt, m as Et, n as Dt, o as Ot, p as kt, s as At, t as jt, u as Mt, v as Nt, w as Pt, x as Ft, y as It, z as Lt } from "./format-BXeG5xQH.js";
3
+ import { A as et, B as tt, C as nt, D as rt, E as it, F as at, I as ot, L as st, M as ct, N as lt, O as ut, P as dt, R as ft, S as pt, T as mt, _ as ht, a as gt, b as _t, c as vt, d as yt, f as bt, g as xt, h as St, i as Ct, j as wt, k as P, l as Tt, m as Et, n as Dt, o as Ot, p as kt, s as At, t as jt, u as Mt, v as Nt, w as Pt, x as Ft, y as It, z as Lt } from "./format-Bjlb4Y0K.js";
4
4
  import { A as Rt, C as zt, D as Bt, E as Vt, F as Ht, I as Ut, L as Wt, M as Gt, N as Kt, O as qt, P as Jt, R as Yt, S as Xt, T as Zt, _ as Qt, a as F, b as $t, c as en, d as tn, f as nn, g as rn, h as an, i as on, j as sn, k as cn, l as ln, m as un, n as dn, o as fn, p as pn, r as I, s as mn, t as hn, u as gn, v as _n, w as vn, x as yn, y as L, z as bn } from "./model-CBxw8JNb.js";
5
5
  import { C as xn, S as Sn, _ as Cn, a as wn, b as Tn, c as En, d as Dn, f as On, g as kn, h as An, i as jn, l as Mn, m as Nn, n as Pn, o as Fn, p as In, r as Ln, s as Rn, t as zn, u as Bn, v as Vn, y as Hn } from "./exportBlocks-33D7P_8Q.js";
6
6
  import { t as Un } from "./emoji-Bmft6RPl.js";
@@ -430,7 +430,7 @@ function uc({ pageId: e } = {}) {
430
430
  }
431
431
  //#endregion
432
432
  //#region src/components/ui/input.tsx
433
- var dc = vi("w-full rounded-md border border-input bg-transparent text-sm text-foreground transition-[color,border-color,box-shadow] file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50", {
433
+ var dc = vi("w-full rounded-md border border-input bg-transparent text-sm text-foreground transition-[color,border-color,box-shadow] file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:border-ring focus-visible:shadow-[var(--ring-field)] disabled:cursor-not-allowed disabled:opacity-50", {
434
434
  variants: { inputSize: {
435
435
  default: "flex h-9 px-3 py-1 shadow-xs",
436
436
  sm: "h-8 px-2.5 py-1"
@@ -5449,7 +5449,7 @@ var rd = ({ db: e, rowId: t, children: n }) => /* @__PURE__ */ q(pl, { children:
5449
5449
  d && re(e.key) && (t.preventDefault(), m(fd(e.key, null)));
5450
5450
  },
5451
5451
  onDrop: () => d && j(d, e.key),
5452
- className: b("flex shrink-0 items-center gap-1.5 rounded-md bg-muted/30 px-2 py-1.5 text-xs font-medium", t ? "w-11 justify-center" : "w-64", re(e.key) && "cursor-grab active:cursor-grabbing", p === fd(e.key, null) && "ring-1 ring-brand/40"),
5452
+ className: b("flex shrink-0 items-center gap-1.5 rounded-md bg-muted/30 px-2 py-1.5 text-xs font-medium", t ? "w-11 justify-center" : "w-64", re(e.key) && "cursor-grab active:cursor-grabbing", d === e.key && "opacity-40", p === fd(e.key, null) && "ring-1 ring-brand/40"),
5453
5453
  children: [
5454
5454
  e.color && /* @__PURE__ */ K("span", {
5455
5455
  className: "h-2.5 w-2.5 shrink-0 rounded-full",
@@ -5620,7 +5620,7 @@ var rd = ({ db: e, rowId: t, children: n }) => /* @__PURE__ */ q(pl, { children:
5620
5620
  onDragEnd: () => {
5621
5621
  f(null), m(null);
5622
5622
  },
5623
- className: b("flex items-center gap-1.5 px-1 text-xs font-medium", re(r.key) && "cursor-grab active:cursor-grabbing"),
5623
+ className: b("flex items-center gap-1.5 px-1 text-xs font-medium", re(r.key) && "cursor-grab active:cursor-grabbing", d === r.key && "opacity-40"),
5624
5624
  children: [
5625
5625
  r.color && /* @__PURE__ */ K("span", {
5626
5626
  className: "h-2.5 w-2.5 rounded-full",
@@ -16400,13 +16400,13 @@ var uy = ({ onSave: e, onLoad: t, title: r = "", onTitleChange: i, icon: a = "
16400
16400
  snapshot: t
16401
16401
  })), "text/markdown");
16402
16402
  else if (e === "pdf-paged" || e === "pdf-continuous" || e === "pdf-slides") {
16403
- let [{ toPdf: i, toPdfSlides: o }, { toHtml: s, toSlideDeck: c }] = await Promise.all([import("./toPdf-DGtKQSRA.js"), import("./toHtml-B6gQeUnu.js")]), l = e === "pdf-slides" ? await o(c(t, r, a)) : await i(s(t, r, a), e === "pdf-continuous" ? "continuous" : "paged");
16403
+ let [{ toPdf: i, toPdfSlides: o }, { toHtml: s, toSlideDeck: c }] = await Promise.all([import("./toPdf-DGtKQSRA.js"), import("./toHtml-Dv_ydwAi.js")]), l = e === "pdf-slides" ? await o(c(t, r, a)) : await i(s(t, r, a), e === "pdf-continuous" ? "continuous" : "paged");
16404
16404
  tu(`${n}${e === "pdf-slides" ? "-slides" : ""}.pdf`, l);
16405
16405
  } else if (e === "html-slides") {
16406
- let { toSlideDeck: e } = await import("./toHtml-B6gQeUnu.js");
16406
+ let { toSlideDeck: e } = await import("./toHtml-Dv_ydwAi.js");
16407
16407
  nu(`${n}-slides.html`, e(t, r, a), "text/html");
16408
16408
  } else {
16409
- let [{ toHtmlSite: e }, { gatherSite: i }] = await Promise.all([import("./toHtml-B6gQeUnu.js"), import("./exportSite-DlRm4u7W.js")]), o = d ? await i(h, d, {
16409
+ let [{ toHtmlSite: e }, { gatherSite: i }] = await Promise.all([import("./toHtml-Dv_ydwAi.js"), import("./exportSite-DlRm4u7W.js")]), o = d ? await i(h, d, {
16410
16410
  snapshot: t,
16411
16411
  title: r,
16412
16412
  icon: a
@@ -16517,24 +16517,30 @@ var uy = ({ onSave: e, onLoad: t, title: r = "", onTitleChange: i, icon: a = "
16517
16517
  children: ue
16518
16518
  }) : ue;
16519
16519
  }, dy = ({ pageId: e }) => {
16520
- let t = N(), r = ye(), { preferences: i } = n(), { t: a } = k(), { pages: o, deletePage: s, setPageHint: c, closePage: l } = M(), [u, d] = W(""), f = qe(e), [p, m] = W(void 0), [h, g] = W(void 0), _ = U(null), v = U(null), y = U(""), b = U(!1), x = U(0), S = B((t) => {
16521
- t.updatedAt <= y.current || (y.current = t.updatedAt, b.current || (d(t.name ?? ""), _.current = t.name ?? null, c(e, t.name)), g(t.hostedDatabaseId), Qe([{
16520
+ let t = N(), r = ye(), { preferences: i } = n(), { t: a } = k(), { pages: o, deletePage: s, setPageHint: c, closePage: l } = M(), [u, d] = W(""), f = qe(e), [p, m] = W(void 0), [h, g] = W(void 0), _ = U(null), v = U(null), y = U(!1), b = U(""), x = U(!1), S = U(0), C = B((t) => {
16521
+ t.updatedAt <= b.current || (b.current = t.updatedAt, !x.current && !y.current && (d(t.name ?? ""), _.current = t.name ?? null, c(e, t.name)), g(t.hostedDatabaseId), Qe([{
16522
16522
  id: t.id,
16523
16523
  icon: t.properties[Cr]
16524
- }]), x.current += 1, m({
16524
+ }]), S.current += 1, m({
16525
16525
  data: t.data,
16526
- version: x.current
16526
+ version: S.current
16527
16527
  }));
16528
- }, [e, c]), C = U(o);
16529
- C.current = o, V(() => {
16530
- let t = C.current.find((t) => t.id === e);
16531
- return d(t?.name ?? ""), _.current = t?.name ?? null, m(void 0), g(t ? t.hostedDatabaseId : void 0), y.current = t?.updatedAt ?? "", () => {
16528
+ }, [e, c]), w = U(o);
16529
+ w.current = o;
16530
+ let T = B(() => {
16531
+ v.current &&= (clearTimeout(v.current), null), y.current && t.renamePage(e, _.current).then((e) => {
16532
+ b.current = e.updatedAt, (e.name ?? null) === _.current && (y.current = !1);
16533
+ }).catch(() => void 0);
16534
+ }, [t, e]);
16535
+ V(() => {
16536
+ let t = w.current.find((t) => t.id === e);
16537
+ return d(t?.name ?? ""), _.current = t?.name ?? null, y.current = !1, m(void 0), g(t ? t.hostedDatabaseId : void 0), b.current = t?.updatedAt ?? "", () => {
16532
16538
  v.current && clearTimeout(v.current);
16533
16539
  };
16534
16540
  }, [e]);
16535
- let w = B(async () => {
16541
+ let E = B(async () => {
16536
16542
  let n = await t.getPage(e);
16537
- return _.current = n?.name ?? null, d(n?.name ?? ""), c(e, n?.name ?? null), n && (y.current = n.updatedAt, g(n.hostedDatabaseId), Qe([{
16543
+ return y.current || (_.current = n?.name ?? null, d(n?.name ?? ""), c(e, n?.name ?? null)), n && (b.current = n.updatedAt, g(n.hostedDatabaseId), Qe([{
16538
16544
  id: n.id,
16539
16545
  icon: n.properties[Cr]
16540
16546
  }])), n ? n.data : null;
@@ -16542,21 +16548,21 @@ var uy = ({ onSave: e, onLoad: t, title: r = "", onTitleChange: i, icon: a = "
16542
16548
  t,
16543
16549
  e,
16544
16550
  c
16545
- ]), T = B(async (n) => {
16546
- y.current = (await t.savePage({
16551
+ ]), D = B(async (n) => {
16552
+ b.current = (await t.savePage({
16547
16553
  id: e,
16548
16554
  name: _.current,
16549
16555
  data: n
16550
16556
  })).updatedAt;
16551
- }, [t, e]), E = B((n) => {
16552
- d(n), _.current = n.trim().length > 0 ? n : null, c(e, _.current), v.current && clearTimeout(v.current), v.current = setTimeout(() => {
16553
- t.renamePage(e, _.current).then((e) => {
16554
- y.current = e.updatedAt;
16555
- }).catch(() => void 0);
16556
- }, 600);
16557
- }, [t, e]), D = B((t) => {
16557
+ }, [t, e]), O = B((t) => {
16558
+ d(t), _.current = t.trim().length > 0 ? t : null, y.current = !0, c(e, _.current), v.current && clearTimeout(v.current), v.current = setTimeout(T, 600);
16559
+ }, [
16560
+ e,
16561
+ c,
16562
+ T
16563
+ ]), ee = B((t) => {
16558
16564
  Ye(e, t);
16559
- }, [e]), O = B(async () => {
16565
+ }, [e]), A = B(async () => {
16560
16566
  i.general.confirmOnTrash && !await r({
16561
16567
  title: a("confirm.trashTitle"),
16562
16568
  description: a("confirm.trashBody"),
@@ -16569,34 +16575,34 @@ var uy = ({ onSave: e, onLoad: t, title: r = "", onTitleChange: i, icon: a = "
16569
16575
  r,
16570
16576
  i.general.confirmOnTrash,
16571
16577
  a
16572
- ]), ee = B((e) => {
16573
- b.current = e;
16574
- }, []);
16578
+ ]), te = B((e) => {
16579
+ x.current = e, e || T();
16580
+ }, [T]);
16575
16581
  V(() => t.subscribePage(e, {
16576
- onPage: (e) => S(e),
16582
+ onPage: (e) => C(e),
16577
16583
  onDeleted: () => l(e)
16578
16584
  }), [
16579
16585
  t,
16580
16586
  e,
16581
- S,
16587
+ C,
16582
16588
  l
16583
16589
  ]);
16584
- let A = o.find((t) => t.id === e), te = A ? A.hostedDatabaseId : h;
16590
+ let ne = o.find((t) => t.id === e), re = ne ? ne.hostedDatabaseId : h;
16585
16591
  return /* @__PURE__ */ K(uy, {
16586
16592
  title: u,
16587
16593
  icon: f,
16588
16594
  incoming: p,
16589
- onTitleChange: E,
16590
- onTitleActiveChange: ee,
16591
- onIconChange: D,
16592
- onDelete: O,
16593
- onLoad: w,
16594
- onSave: T,
16595
+ onTitleChange: O,
16596
+ onTitleActiveChange: te,
16597
+ onIconChange: ee,
16598
+ onDelete: A,
16599
+ onLoad: E,
16600
+ onSave: D,
16595
16601
  pageId: e,
16596
- hasDatabase: !!te,
16602
+ hasDatabase: !!re,
16597
16603
  footer: /* @__PURE__ */ K(np, {
16598
16604
  pageId: e,
16599
- databaseIdHint: te
16605
+ databaseIdHint: re
16600
16606
  })
16601
16607
  }, e);
16602
16608
  }, fy = (e) => e && e.trim().length > 0 ? e : Ue("common.untitled");
@@ -17275,7 +17281,7 @@ function My() {
17275
17281
  //#endregion
17276
17282
  //#region src/components/ui/switch.tsx
17277
17283
  var Ny = R.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ K(Cs.Root, {
17278
- className: b("peer inline-flex h-[20px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-xs transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input", e),
17284
+ className: b("peer inline-flex h-[20px] w-[36px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-xs transition-colors focus-visible:outline-hidden focus-visible:shadow-[var(--ring-control)] disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input", e),
17279
17285
  ...t,
17280
17286
  ref: n,
17281
17287
  children: /* @__PURE__ */ K(Cs.Thumb, { className: b("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0") })
@@ -22061,7 +22067,7 @@ var Qx = () => {
22061
22067
  String(n % 60).padStart(2, "0")
22062
22068
  ]
22063
22069
  });
22064
- }, $x = qn(() => import("./EmojiGrid-BjFEmkhL.js"));
22070
+ }, $x = qn(() => import("./EmojiGrid-CyfYclJK.js"));
22065
22071
  function eS() {
22066
22072
  let { open: e, anchor: t, value: n, onPick: r } = $n(ll.subscribe, ll.getState, ll.getState);
22067
22073
  return /* @__PURE__ */ q(Wo.Root, {
@@ -4304,7 +4304,7 @@ var yi = i.forwardRef(({ className: e, children: t, ...n }, r) => /* @__PURE__ *
4304
4304
  className: q("relative grid w-full max-w-lg gap-4 border bg-background p-6 shadow-overlay duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg", e),
4305
4305
  ...n,
4306
4306
  children: [t, /* @__PURE__ */ m(D.Close, {
4307
- className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-hover data-[state=open]:text-muted-foreground",
4307
+ className: "absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus-visible:outline-hidden focus-visible:shadow-[var(--ring-control)] disabled:pointer-events-none data-[state=open]:bg-hover data-[state=open]:text-muted-foreground",
4308
4308
  children: [/* @__PURE__ */ p(_, { className: "h-4 w-4" }), /* @__PURE__ */ p("span", {
4309
4309
  className: "sr-only",
4310
4310
  children: "Close"
@@ -4337,13 +4337,13 @@ var Ci = i.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ p(D.Descrip
4337
4337
  Ci.displayName = D.Description.displayName;
4338
4338
  //#endregion
4339
4339
  //#region src/components/ui/button.tsx
4340
- var wi = k("inline-flex items-center justify-center rounded-md text-sm font-medium transition-[color,background-color,border-color,box-shadow,transform] active:scale-[0.97] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 disabled:active:scale-100", {
4340
+ var wi = k("inline-flex items-center justify-center rounded-md text-sm font-medium transition-[color,background-color,border-color,box-shadow,transform] active:scale-[0.97] focus-visible:outline-hidden focus-visible:shadow-[var(--ring-control)] disabled:pointer-events-none disabled:opacity-50 disabled:active:scale-100", {
4341
4341
  variants: {
4342
4342
  variant: {
4343
- default: "bg-primary text-primary-foreground shadow-sm hover:bg-primary/90",
4344
- destructive: "bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90",
4343
+ default: "bg-primary text-primary-foreground shadow-sm hover:bg-primary/90 active:bg-[color-mix(in_srgb,hsl(var(--primary)),var(--press-ink)_8%)]",
4344
+ destructive: "bg-destructive text-destructive-foreground shadow-xs hover:bg-destructive/90 active:bg-[color-mix(in_srgb,hsl(var(--destructive)),var(--press-ink)_8%)]",
4345
4345
  outline: "border border-input bg-transparent shadow-xs hover:bg-hover hover:text-accent-foreground",
4346
- secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
4346
+ secondary: "bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80 active:bg-[color-mix(in_srgb,hsl(var(--secondary)),var(--press-ink)_8%)]",
4347
4347
  ghost: "hover:bg-hover hover:text-accent-foreground",
4348
4348
  link: "text-primary underline-offset-4 hover:underline"
4349
4349
  },