laif-ds 0.2.85 → 0.2.87

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.
Files changed (113) hide show
  1. package/README.md +11 -81
  2. package/dist/CHANGELOG.md +13 -0
  3. package/dist/_virtual/index6.js +2 -2
  4. package/dist/_virtual/index7.js +2 -2
  5. package/dist/agent-docs/adoption-report.json +2 -2
  6. package/dist/agent-docs/manifest.json +3 -3
  7. package/dist/components/editor/editor-hooks/use-update-toolbar.js +6 -6
  8. package/dist/components/editor/editor-ui/content-editable.js +1 -1
  9. package/dist/components/editor/nodes/mention-node.js +2 -2
  10. package/dist/components/editor/plugins/actions/clear-editor-plugin.js +2 -2
  11. package/dist/components/editor/plugins/actions/counter-character-plugin.js +2 -2
  12. package/dist/components/editor/plugins/mention-plugin.js +21 -21
  13. package/dist/components/editor/plugins/toolbar/block-format/format-bulleted-list.js +10 -10
  14. package/dist/components/editor/plugins/toolbar/block-format/format-check-list.js +5 -5
  15. package/dist/components/editor/plugins/toolbar/block-format/format-heading.js +5 -5
  16. package/dist/components/editor/plugins/toolbar/block-format/format-numbered-list.js +5 -5
  17. package/dist/components/editor/plugins/toolbar/block-format/format-paragraph.js +9 -9
  18. package/dist/components/editor/plugins/toolbar/block-format/format-quote.js +3 -3
  19. package/dist/components/editor/plugins/toolbar/block-format-toolbar-plugin.js +13 -13
  20. package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +2 -2
  21. package/dist/components/editor/plugins/toolbar/history-toolbar-plugin.js +18 -19
  22. package/dist/components/editor/plugins/toolbar/mention-insert-toolbar-plugin.js +1 -1
  23. package/dist/components/editor/plugins/toolbar/toolbar-plugin.js +3 -3
  24. package/dist/components/ui/app-editor.js +51 -51
  25. package/dist/components/ui/markdown-renderer.js +33 -32
  26. package/dist/lib/utils.js +35 -34
  27. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +1 -1
  28. package/dist/node_modules/@floating-ui/{utils → core/node_modules/@floating-ui/utils}/dist/floating-ui.utils.js +33 -39
  29. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +20 -19
  30. package/dist/node_modules/@floating-ui/dom/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +12 -0
  31. package/dist/node_modules/@lexical/clipboard/dist/LexicalClipboard.prod.js +354 -0
  32. package/dist/node_modules/@lexical/code-core/dist/LexicalCodeCore.prod.js +298 -0
  33. package/dist/node_modules/@lexical/dragon/dist/LexicalDragon.prod.js +89 -0
  34. package/dist/node_modules/@lexical/extension/dist/LexicalExtension.prod.js +611 -0
  35. package/dist/node_modules/@lexical/history/dist/LexicalHistory.prod.js +96 -0
  36. package/dist/node_modules/@lexical/html/dist/LexicalHtml.prod.js +604 -0
  37. package/dist/node_modules/@lexical/link/dist/LexicalLink.prod.js +201 -0
  38. package/dist/node_modules/@lexical/list/dist/LexicalList.prod.js +843 -0
  39. package/dist/node_modules/@lexical/markdown/dist/LexicalMarkdown.prod.js +555 -0
  40. package/dist/node_modules/@lexical/react/dist/LexicalCheckListPlugin.prod.js +11 -0
  41. package/dist/node_modules/@lexical/react/dist/LexicalClearEditorPlugin.prod.js +13 -0
  42. package/dist/node_modules/@lexical/react/dist/LexicalComposer.prod.js +45 -0
  43. package/dist/node_modules/@lexical/react/{LexicalComposerContext.prod.js → dist/LexicalComposerContext.prod.js} +1 -1
  44. package/dist/node_modules/@lexical/react/dist/LexicalContentEditable.prod.js +53 -0
  45. package/dist/node_modules/@lexical/react/dist/LexicalErrorBoundary.prod.js +21 -0
  46. package/dist/node_modules/@lexical/react/{LexicalHistoryPlugin.prod.js → dist/LexicalHistoryPlugin.prod.js} +3 -3
  47. package/dist/node_modules/@lexical/react/dist/LexicalListPlugin.prod.js +17 -0
  48. package/dist/node_modules/@lexical/react/dist/LexicalOnChangePlugin.prod.js +16 -0
  49. package/dist/node_modules/@lexical/react/dist/LexicalReactProviderExtension.prod.js +6 -0
  50. package/dist/node_modules/@lexical/react/dist/LexicalRichTextPlugin.prod.js +77 -0
  51. package/dist/node_modules/@lexical/react/dist/LexicalTypeaheadMenuPlugin.prod.js +245 -0
  52. package/dist/node_modules/@lexical/react/dist/useLexicalEditable.prod.js +22 -0
  53. package/dist/node_modules/@lexical/rich-text/dist/LexicalRichText.prod.js +567 -0
  54. package/dist/node_modules/@lexical/selection/dist/LexicalSelection.prod.js +123 -0
  55. package/dist/node_modules/@lexical/table/dist/LexicalTable.prod.js +929 -0
  56. package/dist/node_modules/@lexical/text/{LexicalText.prod.js → dist/LexicalText.prod.js} +6 -6
  57. package/dist/node_modules/@lexical/utils/dist/LexicalUtils.prod.js +111 -0
  58. package/dist/node_modules/eventemitter3/index2.js +1 -1
  59. package/dist/node_modules/lexical/dist/Lexical.prod.js +6731 -0
  60. package/dist/node_modules/style-to-object/cjs/index.js +1 -1
  61. package/package.json +17 -15
  62. package/dist/_virtual/prism-cpp.js +0 -3
  63. package/dist/_virtual/prism-cpp2.js +0 -5
  64. package/dist/_virtual/prism-java.js +0 -3
  65. package/dist/_virtual/prism-java2.js +0 -5
  66. package/dist/_virtual/prism-python.js +0 -3
  67. package/dist/_virtual/prism-python2.js +0 -5
  68. package/dist/_virtual/prism-rust.js +0 -3
  69. package/dist/_virtual/prism-rust2.js +0 -5
  70. package/dist/_virtual/prism-typescript.js +0 -3
  71. package/dist/_virtual/prism-typescript2.js +0 -5
  72. package/dist/_virtual/prism.js +0 -3
  73. package/dist/_virtual/prism2.js +0 -5
  74. package/dist/node_modules/@lexical/clipboard/LexicalClipboard.prod.js +0 -159
  75. package/dist/node_modules/@lexical/code/LexicalCode.prod.js +0 -236
  76. package/dist/node_modules/@lexical/dragon/LexicalDragon.prod.js +0 -46
  77. package/dist/node_modules/@lexical/history/LexicalHistory.prod.js +0 -89
  78. package/dist/node_modules/@lexical/html/LexicalHtml.prod.js +0 -108
  79. package/dist/node_modules/@lexical/link/LexicalLink.prod.js +0 -187
  80. package/dist/node_modules/@lexical/list/LexicalList.prod.js +0 -729
  81. package/dist/node_modules/@lexical/markdown/LexicalMarkdown.prod.js +0 -367
  82. package/dist/node_modules/@lexical/react/LexicalCheckListPlugin.prod.js +0 -11
  83. package/dist/node_modules/@lexical/react/LexicalClearEditorPlugin.prod.js +0 -17
  84. package/dist/node_modules/@lexical/react/LexicalComposer.prod.js +0 -45
  85. package/dist/node_modules/@lexical/react/LexicalContentEditable.prod.js +0 -55
  86. package/dist/node_modules/@lexical/react/LexicalErrorBoundary.prod.js +0 -49
  87. package/dist/node_modules/@lexical/react/LexicalListPlugin.prod.js +0 -17
  88. package/dist/node_modules/@lexical/react/LexicalOnChangePlugin.prod.js +0 -16
  89. package/dist/node_modules/@lexical/react/LexicalRichTextPlugin.prod.js +0 -56
  90. package/dist/node_modules/@lexical/react/LexicalTypeaheadMenuPlugin.prod.js +0 -220
  91. package/dist/node_modules/@lexical/react/useLexicalEditable.prod.js +0 -21
  92. package/dist/node_modules/@lexical/rich-text/LexicalRichText.prod.js +0 -376
  93. package/dist/node_modules/@lexical/selection/LexicalSelection.prod.js +0 -107
  94. package/dist/node_modules/@lexical/table/LexicalTable.prod.js +0 -661
  95. package/dist/node_modules/@lexical/utils/LexicalUtils.prod.js +0 -102
  96. package/dist/node_modules/lexical/Lexical.prod.js +0 -4912
  97. package/dist/node_modules/prismjs/components/prism-c.js +0 -77
  98. package/dist/node_modules/prismjs/components/prism-clike.js +0 -32
  99. package/dist/node_modules/prismjs/components/prism-cpp.js +0 -93
  100. package/dist/node_modules/prismjs/components/prism-css.js +0 -56
  101. package/dist/node_modules/prismjs/components/prism-java.js +0 -122
  102. package/dist/node_modules/prismjs/components/prism-javascript.js +0 -138
  103. package/dist/node_modules/prismjs/components/prism-markdown.js +0 -301
  104. package/dist/node_modules/prismjs/components/prism-markup.js +0 -174
  105. package/dist/node_modules/prismjs/components/prism-objectivec.js +0 -11
  106. package/dist/node_modules/prismjs/components/prism-powershell.js +0 -56
  107. package/dist/node_modules/prismjs/components/prism-python.js +0 -69
  108. package/dist/node_modules/prismjs/components/prism-rust.js +0 -124
  109. package/dist/node_modules/prismjs/components/prism-sql.js +0 -34
  110. package/dist/node_modules/prismjs/components/prism-swift.js +0 -114
  111. package/dist/node_modules/prismjs/components/prism-typescript.js +0 -53
  112. package/dist/node_modules/prismjs/prism.js +0 -1165
  113. /package/dist/node_modules/@floating-ui/{utils → dom/node_modules/@floating-ui/utils}/dist/floating-ui.utils.dom.js +0 -0
@@ -0,0 +1,53 @@
1
+ "use client";
2
+ import { useLexicalComposerContext as B } from "./LexicalComposerContext.prod.js";
3
+ import { forwardRef as h, useState as p, useLayoutEffect as L, useEffect as O, useCallback as U, useMemo as _ } from "react";
4
+ import { mergeRegister as F, CAN_USE_DOM as P } from "../../../lexical/dist/Lexical.prod.js";
5
+ import { jsxs as V, Fragment as $, jsx as f } from "react/jsx-runtime";
6
+ import { $canShowPlaceholderCurry as G } from "../../text/dist/LexicalText.prod.js";
7
+ const w = P ? L : O;
8
+ function H({ editor: e, ariaActiveDescendant: t, ariaAutoComplete: l, ariaControls: s, ariaDescribedBy: i, ariaErrorMessage: n, ariaExpanded: a, ariaInvalid: u, ariaLabel: m, ariaLabelledBy: d, ariaMultiline: b, ariaOwns: k, ariaRequired: D, autoCapitalize: A, className: M, id: R, role: E = "textbox", spellCheck: q = !0, style: z, tabIndex: I, "data-testid": N, ...S }, C) {
9
+ const [o, x] = p(e.isEditable()), v = U((r) => {
10
+ r && r.ownerDocument && r.ownerDocument.defaultView ? e.setRootElement(r) : e.setRootElement(null);
11
+ }, [e]), j = _(() => /* @__PURE__ */ (function(...r) {
12
+ return (y) => {
13
+ for (const c of r) typeof c == "function" ? c(y) : c != null && (c.current = y);
14
+ };
15
+ })(C, v), [v, C]);
16
+ return w(() => (x(e.isEditable()), e.registerEditableListener((r) => {
17
+ x(r);
18
+ })), [e]), /* @__PURE__ */ f("div", { "aria-activedescendant": o ? t : void 0, "aria-autocomplete": o ? l : "none", "aria-controls": o ? s : void 0, "aria-describedby": i, ...n != null ? { "aria-errormessage": n } : {}, "aria-expanded": o && E === "combobox" ? !!a : void 0, ...u != null ? { "aria-invalid": u } : {}, "aria-label": m, "aria-labelledby": d, "aria-multiline": b, "aria-owns": o ? k : void 0, "aria-readonly": !o || void 0, "aria-required": D, autoCapitalize: A, className: M, contentEditable: o, "data-testid": N, id: R, ref: j, role: E, spellCheck: q, style: z, tabIndex: I, ...S });
19
+ }
20
+ const J = /* @__PURE__ */ h(H);
21
+ function g(e) {
22
+ return e.read("latest", G(e.isComposing()));
23
+ }
24
+ const ee = /* @__PURE__ */ h(K);
25
+ function K(e, t) {
26
+ const { placeholder: l, ...s } = e, [i] = B();
27
+ return V($, { children: [/* @__PURE__ */ f(J, { editor: i, ...s, ref: t }), l != null && /* @__PURE__ */ f(Q, { editor: i, content: l })] });
28
+ }
29
+ function Q({ content: e, editor: t }) {
30
+ const l = (function(a) {
31
+ const [u, m] = p(() => g(a));
32
+ return w(() => {
33
+ function d() {
34
+ const b = g(a);
35
+ m(b);
36
+ }
37
+ return d(), F(a.registerUpdateListener(() => {
38
+ d();
39
+ }), a.registerEditableListener(() => {
40
+ d();
41
+ }));
42
+ }, [a]), u;
43
+ })(t), [s, i] = p(t.isEditable());
44
+ if (L(() => (i(t.isEditable()), t.registerEditableListener((a) => {
45
+ i(a);
46
+ })), [t]), !l) return null;
47
+ let n = null;
48
+ return typeof e == "function" ? n = e(s) : e !== null && (n = e), n === null ? null : /* @__PURE__ */ f("div", { "aria-hidden": !0, children: n });
49
+ }
50
+ export {
51
+ ee as ContentEditable,
52
+ J as ContentEditableElement
53
+ };
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { Component as n } from "react";
3
+ import { jsx as t } from "react/jsx-runtime";
4
+ class s extends n {
5
+ state = { hasError: !1 };
6
+ static getDerivedStateFromError() {
7
+ return { hasError: !0 };
8
+ }
9
+ componentDidCatch(r, o) {
10
+ this.props.onError(r instanceof Error ? r : new Error(String(r), { cause: r }), o);
11
+ }
12
+ render() {
13
+ return this.state.hasError ? this.props.fallback : this.props.children;
14
+ }
15
+ }
16
+ function c({ children: e, fallback: r, onError: o }) {
17
+ return t(s, { fallback: r === void 0 ? /* @__PURE__ */ t("div", { style: { border: "1px solid #f00", color: "#f00", padding: "8px" }, children: "An error was thrown." }) : r, onError: o, children: e });
18
+ }
19
+ export {
20
+ c as LexicalErrorBoundary
21
+ };
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import { useLexicalComposerContext as n } from "./LexicalComposerContext.prod.js";
3
- import { createEmptyHistoryState as m, registerHistory as l } from "../history/LexicalHistory.prod.js";
3
+ import { createEmptyHistoryState as m, registerHistory as l } from "../../history/dist/LexicalHistory.prod.js";
4
4
  import { useMemo as u, useEffect as c } from "react";
5
5
  function H({ delay: s, externalHistoryState: i }) {
6
6
  const [a] = n();
7
7
  return (function(t, e, o = 1e3) {
8
- const r = u((() => e || m()), [e]);
9
- c((() => l(t, r, o)), [o, t, r]);
8
+ const r = u(() => e || m(), [e]);
9
+ c(() => l(t, r, o), [o, t, r]);
10
10
  })(a, i, s), null;
11
11
  }
12
12
  export {
@@ -0,0 +1,17 @@
1
+ "use client";
2
+ import { ListNode as n, ListItemNode as a, registerListStrictIndentTransform as m, registerList as i } from "../../list/dist/LexicalList.prod.js";
3
+ import { useLexicalComposerContext as u } from "./LexicalComposerContext.prod.js";
4
+ import { mergeRegister as f } from "../../../lexical/dist/Lexical.prod.js";
5
+ import { useEffect as t } from "react";
6
+ function L({ hasStrictIndent: r = !1, shouldPreserveNumbering: s = !1 }) {
7
+ const [e] = u();
8
+ return t(() => {
9
+ if (!e.hasNodes([n, a])) throw new Error("ListPlugin: ListNode and/or ListItemNode not registered on editor");
10
+ }, [e]), t(() => f(i(e, { restoreNumbering: s }), r ? m(e) : () => {
11
+ }), [e, r, s]), (function(o) {
12
+ t(() => i(o), [o]);
13
+ })(e), null;
14
+ }
15
+ export {
16
+ L as ListPlugin
17
+ };
@@ -0,0 +1,16 @@
1
+ "use client";
2
+ import { useLexicalComposerContext as f } from "./LexicalComposerContext.prod.js";
3
+ import { HISTORY_MERGE_TAG as g, CAN_USE_DOM as m } from "../../../lexical/dist/Lexical.prod.js";
4
+ import { useLayoutEffect as c, useEffect as l } from "react";
5
+ const p = m ? c : l;
6
+ function h({ ignoreHistoryMergeTagChange: r = !0, ignoreSelectionChange: n = !1, onChange: e }) {
7
+ const [t] = f();
8
+ return p(() => {
9
+ if (e) return t.registerUpdateListener(({ editorState: o, dirtyElements: a, dirtyLeaves: i, prevEditorState: u, tags: s }) => {
10
+ n && a.size === 0 && i.size === 0 || r && s.has(g) || u.isEmpty() || e(o, t, s);
11
+ });
12
+ }, [t, r, n, e]), null;
13
+ }
14
+ export {
15
+ h as OnChangePlugin
16
+ };
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ import { defineExtension as e } from "../../../lexical/dist/Lexical.prod.js";
3
+ const t = /* @__PURE__ */ e({ name: "@lexical/react/ReactProvider" });
4
+ export {
5
+ t as ReactProviderExtension
6
+ };
@@ -0,0 +1,77 @@
1
+ "use client";
2
+ import { useLexicalComposerContext as p } from "./LexicalComposerContext.prod.js";
3
+ import { useLexicalEditable as L } from "./useLexicalEditable.prod.js";
4
+ import { LexicalBuilder as B } from "../../extension/dist/LexicalExtension.prod.js";
5
+ import { ReactProviderExtension as S } from "./LexicalReactProviderExtension.prod.js";
6
+ import { useLayoutEffect as b, useEffect as h, useState as g, useMemo as v, Suspense as w } from "react";
7
+ import { flushSync as C, createPortal as R } from "react-dom";
8
+ import { mergeRegister as E, CAN_USE_DOM as D } from "../../../lexical/dist/Lexical.prod.js";
9
+ import { jsxs as P, Fragment as U, jsx as c } from "react/jsx-runtime";
10
+ import { $canShowPlaceholderCurry as $ } from "../../text/dist/LexicalText.prod.js";
11
+ import { registerDragonSupport as j } from "../../dragon/dist/LexicalDragon.prod.js";
12
+ import { registerRichText as k } from "../../rich-text/dist/LexicalRichText.prod.js";
13
+ function M(t, ...n) {
14
+ const r = new URL("https://lexical.dev/docs/error"), o = new URLSearchParams();
15
+ o.append("code", t);
16
+ for (const e of n) o.append("v", e);
17
+ throw r.search = o.toString(), Error(`Minified Lexical error #${t}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`);
18
+ }
19
+ const f = D ? b : h;
20
+ function N({ editor: t, ErrorBoundary: n }) {
21
+ return (function(r, o) {
22
+ const [e, u] = g(() => r.getDecorators());
23
+ return f(() => r.registerDecoratorListener((i) => {
24
+ C(() => {
25
+ u(i);
26
+ });
27
+ }), [r]), h(() => {
28
+ u(r.getDecorators());
29
+ }, [r]), v(() => {
30
+ const i = [], s = Object.keys(e);
31
+ for (let a = 0; a < s.length; a++) {
32
+ const l = s[a], x = /* @__PURE__ */ c(o, { onError: (y) => r._onError(y), children: /* @__PURE__ */ c(w, { fallback: null, children: e[l] }) }), m = r.getElementByKey(l);
33
+ m !== null && i.push(/* @__PURE__ */ R(x, m, l));
34
+ }
35
+ return i;
36
+ }, [o, e, r]);
37
+ })(t, n);
38
+ }
39
+ function _({ editor: t, ErrorBoundary: n }) {
40
+ return (function(r) {
41
+ const o = B.maybeFromEditor(r);
42
+ if (o && o.hasExtensionByName(S.name)) {
43
+ for (const e of ["@lexical/plain-text", "@lexical/rich-text"]) o.hasExtensionByName(e) && M(320, e);
44
+ return !0;
45
+ }
46
+ return !1;
47
+ })(t) ? null : /* @__PURE__ */ c(N, { editor: t, ErrorBoundary: n });
48
+ }
49
+ function d(t) {
50
+ return t.read("latest", $(t.isComposing()));
51
+ }
52
+ function V({ contentEditable: t, placeholder: n = null, ErrorBoundary: r }) {
53
+ const [o] = p();
54
+ return (function(e) {
55
+ f(() => E(k(e), j(e)), [e]);
56
+ })(o), /* @__PURE__ */ P(U, { children: [t, /* @__PURE__ */ c(F, { content: n }), /* @__PURE__ */ c(_, { editor: o, ErrorBoundary: r })] });
57
+ }
58
+ function F({ content: t }) {
59
+ const [n] = p(), r = (function(e) {
60
+ const [u, i] = g(() => d(e));
61
+ return f(() => {
62
+ function s() {
63
+ const a = d(e);
64
+ i(a);
65
+ }
66
+ return s(), E(e.registerUpdateListener(() => {
67
+ s();
68
+ }), e.registerEditableListener(() => {
69
+ s();
70
+ }));
71
+ }, [e]), u;
72
+ })(n), o = L();
73
+ return r ? typeof t == "function" ? t(o) : t : null;
74
+ }
75
+ export {
76
+ V as RichTextPlugin
77
+ };
@@ -0,0 +1,245 @@
1
+ "use client";
2
+ import { useLexicalComposerContext as H } from "./LexicalComposerContext.prod.js";
3
+ import { getScrollParent as q } from "../../utils/dist/LexicalUtils.prod.js";
4
+ import { $getSelection as $, $isRangeSelection as B, $isTextNode as z, getDOMSelection as G, getDOMSelectionPoints as J, COMMAND_PRIORITY_LOW as j, CAN_USE_DOM as Y, isDOMShadowRoot as Z, getRootOwnerDocument as ee, mergeRegister as W, createCommand as te, KEY_ENTER_COMMAND as ne, KEY_TAB_COMMAND as oe, KEY_ESCAPE_COMMAND as le, KEY_ARROW_UP_COMMAND as re, KEY_ARROW_DOWN_COMMAND as ie, getDOMShadowRoots as se, registerEventListener as F } from "../../../lexical/dist/Lexical.prod.js";
5
+ import { useCallback as P, useState as X, useEffect as v, startTransition as ue, useRef as ae, useLayoutEffect as ce, useMemo as de } from "react";
6
+ import me from "react-dom";
7
+ import { jsx as L, jsxs as fe } from "react/jsx-runtime";
8
+ const pe = Y ? ce : v;
9
+ class ve {
10
+ key;
11
+ ref;
12
+ icon;
13
+ title;
14
+ constructor(t) {
15
+ this.key = t, this.ref = { current: null }, this.setRefElement = this.setRefElement.bind(this);
16
+ }
17
+ setRefElement(t) {
18
+ this.ref = { current: t };
19
+ }
20
+ }
21
+ const K = (l) => {
22
+ const t = l.closest("#typeahead-menu");
23
+ if (!t) return;
24
+ const i = t.getBoundingClientRect();
25
+ i.top + i.height > window.innerHeight && t.scrollIntoView({ block: "center" }), i.top < 0 && t.scrollIntoView({ block: "center" }), l.scrollIntoView({ block: "nearest" });
26
+ };
27
+ function U(l, t) {
28
+ const i = l.getBoundingClientRect(), s = t.getBoundingClientRect();
29
+ return i.top >= s.top - 6 && i.top <= s.bottom + 6;
30
+ }
31
+ function ge(l, t, i, s) {
32
+ const [n] = H();
33
+ v(() => {
34
+ if (t != null && l != null) {
35
+ const c = n.getRootElement(), d = c != null ? q(c, !1) : document.body;
36
+ let h = !1, u = U(t, d);
37
+ const C = function() {
38
+ h || (window.requestAnimationFrame(function() {
39
+ i(), h = !1;
40
+ }), h = !0);
41
+ const e = U(t, d);
42
+ e !== u && (u = e, s?.(e));
43
+ }, x = new ResizeObserver(i), a = se(c ?? t);
44
+ return x.observe(t), W(F(window, "resize", i), F(document, "scroll", C, { capture: !0, passive: !0 }), ...a.map((e) => F(e, "scroll", C, { capture: !0, passive: !0 })), () => x.unobserve(t));
45
+ }
46
+ }, [t, n, s, i, l]);
47
+ }
48
+ const Q = /* @__PURE__ */ te("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");
49
+ function he({ index: l, isSelected: t, onClick: i, onMouseEnter: s, option: n }) {
50
+ let c = "item";
51
+ return t && (c += " selected"), /* @__PURE__ */ fe("li", { tabIndex: -1, className: c, ref: n.setRefElement, role: "option", "aria-selected": t, id: "typeahead-item-" + l, onMouseEnter: s, onClick: i, children: [n.icon, /* @__PURE__ */ L("span", { className: "text", children: n.title })] }, n.key);
52
+ }
53
+ function Re({ close: l, editor: t, anchorElementRef: i, resolution: s, options: n, menuRenderFn: c, onSelectOption: d, shouldSplitNodeWithQuery: h = !1, commandPriority: u = j, preselectFirstItem: C = !0 }) {
54
+ const [x, a] = X(null), e = x !== null ? Math.min(n.length - 1, x) : null, g = s.match && s.match.matchingString;
55
+ v(() => {
56
+ C && a(0);
57
+ }, [g, C]);
58
+ const R = P((o) => {
59
+ t.update(() => {
60
+ const r = s.match != null && h ? (function(p) {
61
+ const m = $();
62
+ if (!B(m) || !m.isCollapsed()) return null;
63
+ const O = m.anchor;
64
+ if (O.type !== "text") return null;
65
+ const y = O.getNode();
66
+ if (!y.isSimpleText()) return null;
67
+ const S = O.offset, _ = y.getTextContent().slice(0, S), b = p.replaceableString.length, w = S - (function(A, I, T) {
68
+ let k = T;
69
+ for (let D = k; D <= I.length; D++) A.slice(-D) === I.substring(0, D) && (k = D);
70
+ return k;
71
+ })(_, p.matchingString, b);
72
+ if (w < 0) return null;
73
+ let M;
74
+ return w === 0 ? [M] = y.splitText(S) : [, M] = y.splitText(w, S), M;
75
+ })(s.match) : null;
76
+ d(o, r, l, s.match ? s.match.matchingString : "");
77
+ });
78
+ }, [t, h, s.match, d, l]), f = P((o) => {
79
+ const r = t.getRootElement();
80
+ r !== null && (r.setAttribute("aria-activedescendant", "typeahead-item-" + o), a(o));
81
+ }, [t]), E = P(() => i.current && n.length ? /* @__PURE__ */ me.createPortal(/* @__PURE__ */ L("div", { className: "typeahead-popover mentions-menu", children: /* @__PURE__ */ L("ul", { children: n.map((o, r) => /* @__PURE__ */ L(he, { index: r, isSelected: e === r, onClick: () => {
82
+ a(r), R(o);
83
+ }, onMouseEnter: () => {
84
+ a(r);
85
+ }, option: o }, o.key)) }) }), i.current) : null, [i, n, e, R, a]);
86
+ v(() => () => {
87
+ const o = t.getRootElement();
88
+ o !== null && o.removeAttribute("aria-activedescendant");
89
+ }, [t]), pe(() => {
90
+ n === null ? a(null) : e === null && C && f(0);
91
+ }, [n, e, f, C]), v(() => W(t.registerCommand(Q, ({ option: o }) => !(!o.ref || o.ref.current == null) && (K(o.ref.current), !0), u)), [t, f, u]), v(() => W(t.registerCommand(ie, (o) => {
92
+ const r = o;
93
+ if (n !== null && n.length) {
94
+ const p = e === null ? 0 : e !== n.length - 1 ? e + 1 : 0;
95
+ f(p);
96
+ const m = n[p];
97
+ if (!m) return f(-1), r.preventDefault(), r.stopImmediatePropagation(), !0;
98
+ m.ref && m.ref.current && t.dispatchCommand(Q, { index: p, option: m }), r.preventDefault(), r.stopImmediatePropagation();
99
+ }
100
+ return !0;
101
+ }, u), t.registerCommand(re, (o) => {
102
+ const r = o;
103
+ if (n !== null && n.length) {
104
+ const p = e === null ? n.length - 1 : e !== 0 ? e - 1 : n.length - 1;
105
+ f(p);
106
+ const m = n[p];
107
+ if (!m) return f(-1), r.preventDefault(), r.stopImmediatePropagation(), !0;
108
+ m.ref && m.ref.current && K(m.ref.current), r.preventDefault(), r.stopImmediatePropagation();
109
+ }
110
+ return !0;
111
+ }, u), t.registerCommand(le, (o) => {
112
+ const r = o;
113
+ return r.preventDefault(), r.stopImmediatePropagation(), l(), !0;
114
+ }, u), t.registerCommand(oe, (o) => {
115
+ const r = o;
116
+ return n !== null && e !== null && n[e] != null && (r.preventDefault(), r.stopImmediatePropagation(), R(n[e]), !0);
117
+ }, u), t.registerCommand(ne, (o) => !(n === null || e === null || n[e] == null || o && o.shiftKey) && (o !== null && (o.preventDefault(), o.stopImmediatePropagation()), R(n[e]), !0), u)), [R, l, t, n, e, f, u]);
118
+ const N = de(() => ({ options: n, selectOptionAndCleanUp: R, selectedIndex: e, setHighlightedIndex: a }), [R, e, n]);
119
+ return c != null ? c(i, N, s.match ? s.match.matchingString : "") : E();
120
+ }
121
+ function V(l, t) {
122
+ t != null && (l.className = t), l.setAttribute("aria-label", "Typeahead menu"), l.setAttribute("role", "listbox"), l.style.display = "block", l.style.position = "absolute";
123
+ }
124
+ function Ce(l, t, i, s, n = !0) {
125
+ const [c] = H(), d = s ?? (function(a) {
126
+ if (!Y) return;
127
+ const e = a.getRootElement();
128
+ if (e !== null) {
129
+ const g = e.getRootNode();
130
+ return Z(g) ? g : e.ownerDocument.body;
131
+ }
132
+ return document.body;
133
+ })(c), h = Y ? ee(c.getRootElement()).createElement("div") : null, u = ae(h), C = P(() => {
134
+ if (u.current === null || d === void 0) return;
135
+ u.current.style.top = u.current.style.bottom;
136
+ const a = c.getRootElement(), e = u.current, g = e.firstChild;
137
+ if (a !== null && l !== null) {
138
+ const { left: R, top: f, width: E, height: N } = l.getRect(), o = u.current.offsetHeight;
139
+ if (e.style.top = `${f + o + 3 + (n ? window.pageYOffset : 0)}px`, e.style.left = `${R + window.pageXOffset}px`, e.style.height = `${N}px`, e.style.width = `${E}px`, g !== null) {
140
+ g.style.top = `${f}`;
141
+ const r = g.getBoundingClientRect(), p = r.height, m = r.width, O = a.getBoundingClientRect();
142
+ R + m > O.right && (e.style.left = `${O.right - m + window.pageXOffset}px`), (f + p > window.innerHeight || f + p > O.bottom) && f - O.top > p + N && (e.style.top = `${f - p - N + (n ? window.pageYOffset : 0)}px`);
143
+ }
144
+ e.isConnected || (V(e, i), d.append(e)), e.setAttribute("id", "typeahead-menu"), a.setAttribute("aria-controls", "typeahead-menu");
145
+ }
146
+ }, [c, l, n, i, d]);
147
+ v(() => {
148
+ const a = c.getRootElement();
149
+ return l !== null && C(), () => {
150
+ a !== null && a.removeAttribute("aria-controls");
151
+ const e = u.current;
152
+ e !== null && e.isConnected && (e.remove(), e.removeAttribute("id"));
153
+ };
154
+ }, [c, C, l]);
155
+ const x = P((a) => {
156
+ l !== null && (a || t(null));
157
+ }, [l, t]);
158
+ return ge(l, u.current, C, x), h != null && h === u.current && (V(h, i), d?.append(h)), u;
159
+ }
160
+ const Ee = `\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;
161
+ function Ne(l, { minLength: t = 1, maxLength: i = 75, punctuation: s = Ee, allowWhitespace: n = !1 }) {
162
+ return P((c) => {
163
+ const d = new RegExp("(^|\\s|\\()([" + l + "]((?:" + ("[^" + l + s + (n ? "" : "\\s") + "]") + "){0," + i + "}))$").exec(c);
164
+ if (d !== null) {
165
+ const h = d[1], u = d[3];
166
+ if (u.length >= t) return { leadOffset: d.index + h.length, matchingString: u, replaceableString: d[2] };
167
+ }
168
+ return null;
169
+ }, [n, l, s, i, t]);
170
+ }
171
+ function _e({ options: l, onQueryChange: t, onSelectOption: i, onOpen: s, onClose: n, menuRenderFn: c, triggerFn: d, anchorClassName: h, commandPriority: u = j, parent: C, preselectFirstItem: x = !0, ignoreEntityBoundary: a = !1 }) {
172
+ const [e] = H(), [g, R] = X(null), f = Ce(g, R, h, C), E = P(() => {
173
+ if (g === null) return;
174
+ const o = () => {
175
+ R(null);
176
+ };
177
+ let r;
178
+ try {
179
+ r = n && n();
180
+ } finally {
181
+ r ? r.then(o, o) : o();
182
+ }
183
+ }, [n, g]), N = P((o) => {
184
+ R(o), s != null && g === null && s(o);
185
+ }, [s, g]);
186
+ return v(() => {
187
+ const o = e.registerUpdateListener(() => {
188
+ e.read("latest", () => {
189
+ if (!e.isEditable()) return void E();
190
+ if (e.isComposing()) return;
191
+ const r = e._window || window, p = r.document.createRange(), m = $(), O = (function(S) {
192
+ let _ = null;
193
+ return S.read("latest", () => {
194
+ const b = $();
195
+ B(b) && (_ = (function(w) {
196
+ const M = w.anchor;
197
+ if (M.type !== "text") return null;
198
+ const A = M.getNode();
199
+ if (!A.isSimpleText()) return null;
200
+ const I = M.offset;
201
+ return A.getTextContent().slice(0, I);
202
+ })(b));
203
+ }), _;
204
+ })(e);
205
+ if (!B(m) || !m.isCollapsed() || O === null || p === null) return void E();
206
+ const y = d(O, e);
207
+ if (t(y ? y.matchingString : null), y !== null && (a || !(function(S, _) {
208
+ return _ === 0 && S.read("latest", () => {
209
+ const b = $();
210
+ if (B(b)) {
211
+ const w = b.anchor.getNode().getPreviousSibling();
212
+ return z(w) && w.isTextEntity();
213
+ }
214
+ return !1;
215
+ });
216
+ })(e, y.leadOffset)) && (function(_, b, w, M) {
217
+ const A = G(w);
218
+ if (A === null || !A.isCollapsed) return !1;
219
+ const I = J(A, M), T = I.anchorNode, k = _, D = I.anchorOffset;
220
+ if (T == null || D == null) return !1;
221
+ try {
222
+ b.setStart(T, k), b.setEnd(T, D);
223
+ } catch {
224
+ return !1;
225
+ }
226
+ return !0;
227
+ })(y.leadOffset, p, r, e.getRootElement()) !== null)
228
+ return void ue(() => N({ getRect: () => p.getBoundingClientRect(), match: y }));
229
+ E();
230
+ });
231
+ });
232
+ return () => {
233
+ o();
234
+ };
235
+ }, [e, d, t, g, E, N, a]), v(() => e.registerEditableListener((o) => {
236
+ o || E();
237
+ }), [e, E]), g === null || e === null || f.current === null ? null : /* @__PURE__ */ L(Re, { close: E, resolution: g, editor: e, anchorElementRef: f, options: l, menuRenderFn: c, shouldSplitNodeWithQuery: !0, onSelectOption: i, commandPriority: u, preselectFirstItem: x });
238
+ }
239
+ export {
240
+ _e as LexicalTypeaheadMenuPlugin,
241
+ ve as MenuOption,
242
+ Ee as PUNCTUATION,
243
+ Ne as useBasicTypeaheadTriggerMatch,
244
+ ge as useDynamicPositioning
245
+ };
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ import { useLexicalComposerContext as l } from "./LexicalComposerContext.prod.js";
3
+ import { useMemo as f, useState as m, useRef as b, useLayoutEffect as E, useEffect as p } from "react";
4
+ import { CAN_USE_DOM as x } from "../../../lexical/dist/Lexical.prod.js";
5
+ const L = x ? E : p;
6
+ function d(e) {
7
+ return { initialValueFn: () => e.isEditable(), subscribe: (t) => e.registerEditableListener(t) };
8
+ }
9
+ function M() {
10
+ return (function(e) {
11
+ const [t] = l(), i = f(() => e(t), [t, e]), [u, s] = m(() => i.initialValueFn()), n = b(u);
12
+ return L(() => {
13
+ const { initialValueFn: a, subscribe: c } = i, r = a();
14
+ return n.current !== r && (n.current = r, s(r)), c((o) => {
15
+ n.current = o, s(o);
16
+ });
17
+ }, [i, e]), u;
18
+ })(d);
19
+ }
20
+ export {
21
+ M as useLexicalEditable
22
+ };