@factorialco/f0-react 1.449.0 → 1.449.1
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/experimental.js
CHANGED
|
@@ -3,8 +3,8 @@ import { cx as Ld, cw as Fd, cJ as Td, cp as _d, cq as Ed, cT as Dd, cr as Od, c
|
|
|
3
3
|
import { jsx as e, jsxs as o, Fragment as U } from "react/jsx-runtime";
|
|
4
4
|
import * as De from "react";
|
|
5
5
|
import re, { forwardRef as E, useRef as G, useTransition as Il, useState as T, useLayoutEffect as za, useContext as Je, createContext as Ft, useCallback as Q, useMemo as q, useEffect as j, useId as kl, memo as Pa, Fragment as Sl, isValidElement as Al, cloneElement as Ra, Children as $a } from "react";
|
|
6
|
-
import { C as Ll, P as Fl, g as Ba, c as Tl, a as Wa, F as ft, f as _l, b as El, u as Ma, A as Dl, B as Ol, L as zl, d as Pl, V as Rl, e as $l, h as Mt, i as Bl, j as Wl } from "./index-
|
|
7
|
-
import { m as iu, n as ou, k as cu, v as du, o as uu, t as fu, E as mu, l as hu, y as pu, M as gu, I as bu, z as xu, p as vu, G as yu, H as wu, N as Nu, J as Cu, q as Iu, s as ku, R as Su, x as Au, K as Lu, S as Fu, T as Tu, r as _u, _ as Eu, D as Du, w as Ou } from "./index-
|
|
6
|
+
import { C as Ll, P as Fl, g as Ba, c as Tl, a as Wa, F as ft, f as _l, b as El, u as Ma, A as Dl, B as Ol, L as zl, d as Pl, V as Rl, e as $l, h as Mt, i as Bl, j as Wl } from "./index-BkJwEWAZ.js";
|
|
7
|
+
import { m as iu, n as ou, k as cu, v as du, o as uu, t as fu, E as mu, l as hu, y as pu, M as gu, I as bu, z as xu, p as vu, G as yu, H as wu, N as Nu, J as Cu, q as Iu, s as ku, R as Su, x as Au, K as Lu, S as Fu, T as Tu, r as _u, _ as Eu, D as Du, w as Ou } from "./index-BkJwEWAZ.js";
|
|
8
8
|
const Ml = zn("Search", [
|
|
9
9
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }],
|
|
10
10
|
["path", { d: "m21 21-4.3-4.3", key: "1qie3q" }]
|
package/dist/f0.js
CHANGED
|
@@ -6,8 +6,8 @@ import fe, { forwardRef as vt, useRef as Z, useImperativeHandle as nf, Children
|
|
|
6
6
|
import { g as of, h as af } from "./types-hferChl0.js";
|
|
7
7
|
import { A as F0, e as O0, F as I0, c as L0, d as M0, b as P0, a as z0, f as B0, o as V0, u as $0 } from "./types-hferChl0.js";
|
|
8
8
|
import { createPortal as Dl, unstable_batchedUpdates as Ar, flushSync as lf } from "react-dom";
|
|
9
|
-
import { C as cf, v as Tl, K as df, T as uf, S as Rl, y as qi, O as Ui, E as ff, $ as hf, Q as mf, U as pf, x as Al, k as gf, W as vf } from "./index-
|
|
10
|
-
import { m as H0, n as W0, o as q0, t as U0, F as Z0, M as G0, p as Q0, G as K0, H as X0, N as Y0, J as J0, q as e_, P as t_, s as n_, R as r_, r as s_, _ as i_, D as o_, w as a_, u as l_ } from "./index-
|
|
9
|
+
import { C as cf, v as Tl, K as df, T as uf, S as Rl, y as qi, O as Ui, E as ff, $ as hf, Q as mf, U as pf, x as Al, k as gf, W as vf } from "./index-BkJwEWAZ.js";
|
|
10
|
+
import { m as H0, n as W0, o as q0, t as U0, F as Z0, M as G0, p as Q0, G as K0, H as X0, N as Y0, J as J0, q as e_, P as t_, s as n_, R as r_, r as s_, _ as i_, D as o_, w as a_, u as l_ } from "./index-BkJwEWAZ.js";
|
|
11
11
|
import { defaultTranslations as d_ } from "./i18n-provider-defaults.js";
|
|
12
12
|
import './f0.css';const yf = {
|
|
13
13
|
xs: 1,
|
|
@@ -32681,100 +32681,90 @@ function cR(t, e, n, i) {
|
|
|
32681
32681
|
return t;
|
|
32682
32682
|
},
|
|
32683
32683
|
render: () => {
|
|
32684
|
-
let r = null, s = null, o = null;
|
|
32685
|
-
const
|
|
32686
|
-
const
|
|
32687
|
-
if (
|
|
32688
|
-
const
|
|
32689
|
-
if (
|
|
32690
|
-
const
|
|
32691
|
-
if (
|
|
32692
|
-
const
|
|
32693
|
-
return
|
|
32684
|
+
let r = null, s = null, o = null, a = null;
|
|
32685
|
+
const l = () => {
|
|
32686
|
+
const f = window.getSelection();
|
|
32687
|
+
if (f && f.rangeCount > 0) {
|
|
32688
|
+
const d = f.getRangeAt(0), { startContainer: c, startOffset: u } = d;
|
|
32689
|
+
if (c.nodeType === Node.TEXT_NODE) {
|
|
32690
|
+
const p = (c.textContent || "").lastIndexOf("@", u);
|
|
32691
|
+
if (p !== -1) {
|
|
32692
|
+
const m = document.createRange();
|
|
32693
|
+
return m.setStart(c, p), m.setEnd(c, p + 1), m.getBoundingClientRect();
|
|
32694
32694
|
}
|
|
32695
32695
|
}
|
|
32696
|
-
return
|
|
32696
|
+
return d.getBoundingClientRect();
|
|
32697
32697
|
}
|
|
32698
32698
|
return document.body.getBoundingClientRect();
|
|
32699
32699
|
};
|
|
32700
32700
|
return {
|
|
32701
|
-
onStart: (
|
|
32702
|
-
|
|
32703
|
-
|
|
32704
|
-
|
|
32705
|
-
const
|
|
32706
|
-
|
|
32707
|
-
const x = k[_];
|
|
32708
|
-
if (x === "@") {
|
|
32709
|
-
b = p - (w - _);
|
|
32710
|
-
break;
|
|
32711
|
-
}
|
|
32712
|
-
if (x === " " || x === `
|
|
32713
|
-
` || x === " ")
|
|
32714
|
-
break;
|
|
32715
|
-
}
|
|
32716
|
-
b !== -1 ? l.editor.chain().focus().deleteRange({ from: b, to: m }).run() : l.editor.chain().focus().deleteRange(l.range).run(), l.editor.chain().focus().insertContent([
|
|
32701
|
+
onStart: (f) => {
|
|
32702
|
+
a = f;
|
|
32703
|
+
const d = (h) => {
|
|
32704
|
+
if (!a) return;
|
|
32705
|
+
const { editor: p, range: m } = a;
|
|
32706
|
+
p.chain().focus().insertContentAt(m, [
|
|
32717
32707
|
{
|
|
32718
32708
|
type: "mention",
|
|
32719
32709
|
attrs: {
|
|
32720
|
-
id: String(
|
|
32721
|
-
label:
|
|
32722
|
-
image_url:
|
|
32723
|
-
href:
|
|
32710
|
+
id: String(h.id),
|
|
32711
|
+
label: h.label,
|
|
32712
|
+
image_url: h.image_url,
|
|
32713
|
+
href: h.href
|
|
32724
32714
|
}
|
|
32725
32715
|
},
|
|
32726
32716
|
{
|
|
32727
32717
|
type: "text",
|
|
32728
32718
|
text: " "
|
|
32729
32719
|
}
|
|
32730
|
-
]).run();
|
|
32720
|
+
]).run(), p.view.dom.ownerDocument.defaultView?.getSelection()?.collapseToEnd();
|
|
32731
32721
|
};
|
|
32732
32722
|
r = new gm(cx, {
|
|
32733
|
-
props: { items:
|
|
32734
|
-
editor:
|
|
32723
|
+
props: { items: f.items, command: d },
|
|
32724
|
+
editor: f.editor
|
|
32735
32725
|
});
|
|
32736
|
-
const
|
|
32737
|
-
if (
|
|
32738
|
-
const
|
|
32739
|
-
if (
|
|
32726
|
+
const u = (() => {
|
|
32727
|
+
if (f.clientRect) {
|
|
32728
|
+
const h = f.clientRect();
|
|
32729
|
+
if (h && h.width && h.height) return h;
|
|
32740
32730
|
}
|
|
32741
|
-
return
|
|
32731
|
+
return l();
|
|
32742
32732
|
})();
|
|
32743
32733
|
o = document.createElement("div"), document.body.appendChild(o), s = dx.createRoot(o), s.render(
|
|
32744
32734
|
/* @__PURE__ */ g(
|
|
32745
32735
|
$v,
|
|
32746
32736
|
{
|
|
32747
32737
|
content: r.element,
|
|
32748
|
-
anchorRect:
|
|
32749
|
-
editor:
|
|
32738
|
+
anchorRect: u,
|
|
32739
|
+
editor: f.editor
|
|
32750
32740
|
}
|
|
32751
32741
|
)
|
|
32752
|
-
),
|
|
32742
|
+
), f.editor?.commands.focus();
|
|
32753
32743
|
},
|
|
32754
|
-
onUpdate: (
|
|
32755
|
-
if (!r || !o || !s) return;
|
|
32756
|
-
r.updateProps({ items:
|
|
32757
|
-
const
|
|
32758
|
-
if (
|
|
32759
|
-
const
|
|
32760
|
-
if (
|
|
32744
|
+
onUpdate: (f) => {
|
|
32745
|
+
if (a = f, !r || !o || !s) return;
|
|
32746
|
+
r.updateProps({ items: f.items });
|
|
32747
|
+
const c = (() => {
|
|
32748
|
+
if (f.clientRect) {
|
|
32749
|
+
const u = f.clientRect();
|
|
32750
|
+
if (u && u.width && u.height) return u;
|
|
32761
32751
|
}
|
|
32762
|
-
return
|
|
32752
|
+
return l();
|
|
32763
32753
|
})();
|
|
32764
32754
|
s.render(
|
|
32765
32755
|
/* @__PURE__ */ g(
|
|
32766
32756
|
$v,
|
|
32767
32757
|
{
|
|
32768
32758
|
content: r.element,
|
|
32769
|
-
anchorRect:
|
|
32770
|
-
editor:
|
|
32759
|
+
anchorRect: c,
|
|
32760
|
+
editor: f.editor
|
|
32771
32761
|
}
|
|
32772
32762
|
)
|
|
32773
32763
|
);
|
|
32774
32764
|
},
|
|
32775
|
-
onKeyDown: (
|
|
32765
|
+
onKeyDown: (f) => r ? f.event.key === "ArrowUp" || f.event.key === "ArrowDown" ? r.ref?.onKeyDown(f) || !1 : f.event.key === "Escape" ? (a = null, s && o && (s.unmount(), o.remove()), !0) : r.ref?.onKeyDown(f) || !1 : !1,
|
|
32776
32766
|
onExit() {
|
|
32777
|
-
s && o && (s.unmount(), o.remove()), r?.destroy();
|
|
32767
|
+
a = null, s && o && (s.unmount(), o.remove()), r?.destroy();
|
|
32778
32768
|
}
|
|
32779
32769
|
};
|
|
32780
32770
|
}
|