@lexical/utils 0.44.1-nightly.20260519.0 → 0.45.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.
@@ -25,43 +25,6 @@ function formatDevErrorMessage(message) {
25
25
  throw new Error(message);
26
26
  }
27
27
 
28
- /**
29
- * Copyright (c) Meta Platforms, Inc. and affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- *
34
- */
35
-
36
- const CAN_USE_DOM$1 = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
37
-
38
- /**
39
- * Copyright (c) Meta Platforms, Inc. and affiliates.
40
- *
41
- * This source code is licensed under the MIT license found in the
42
- * LICENSE file in the root directory of this source tree.
43
- *
44
- */
45
-
46
- const documentMode = CAN_USE_DOM$1 && 'documentMode' in document ? document.documentMode : null;
47
- const IS_APPLE$1 = CAN_USE_DOM$1 && /Mac|iPod|iPhone|iPad/.test(navigator.platform);
48
- const IS_FIREFOX$1 = CAN_USE_DOM$1 && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);
49
- const CAN_USE_BEFORE_INPUT$1 = CAN_USE_DOM$1 && 'InputEvent' in window && !documentMode ? 'getTargetRanges' in new window.InputEvent('input') : false;
50
- const IS_IOS$1 = CAN_USE_DOM$1 && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
51
- const IS_ANDROID$1 = CAN_USE_DOM$1 && /Android/.test(navigator.userAgent);
52
-
53
- // Exclude Android — Android WebView's UA contains "Version/X.X ... Safari/537.36"
54
- // which falsely matches the Safari regex, activating wrong composition code paths.
55
- const IS_SAFARI$1 = CAN_USE_DOM$1 && /Version\/[\d.]+.*Safari/.test(navigator.userAgent) && !IS_ANDROID$1;
56
-
57
- // Keep these in case we need to use them in the future.
58
- // export const IS_WINDOWS: boolean = CAN_USE_DOM && /Win/.test(navigator.platform);
59
- const IS_CHROME$1 = CAN_USE_DOM$1 && /^(?=.*Chrome).*/i.test(navigator.userAgent);
60
- // export const canUseTextInputEvent: boolean = CAN_USE_DOM && 'TextEvent' in window && !documentMode;
61
-
62
- const IS_ANDROID_CHROME$1 = CAN_USE_DOM$1 && IS_ANDROID$1 && IS_CHROME$1;
63
- const IS_APPLE_WEBKIT$1 = CAN_USE_DOM$1 && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && IS_APPLE$1 && !IS_CHROME$1;
64
-
65
28
  /**
66
29
  * Copyright (c) Meta Platforms, Inc. and affiliates.
67
30
  *
@@ -224,10 +187,10 @@ function $getOrderedSelectionPoints(selection) {
224
187
  }
225
188
  function $rangeTargetFromPoint(editor, point, node, dom) {
226
189
  if (point.type === 'text' || !lexical.$isElementNode(node)) {
227
- const textDOM = lexical.getDOMTextNode(dom) || dom;
190
+ const textDOM = (lexical.$isTextNode(node) ? lexical.$getDOMTextNode(node, dom, editor) : lexical.getDOMTextNode(dom)) || dom;
228
191
  return [textDOM, point.offset];
229
192
  } else {
230
- const slot = lexical.$getEditorDOMRenderConfig(editor).$getDOMSlot(node, dom, editor);
193
+ const slot = lexical.$getDOMSlot(node, dom, editor);
231
194
  return [slot.element, slot.getFirstChildOffset() + point.offset];
232
195
  }
233
196
  }
@@ -310,6 +273,11 @@ function markSelection(editor, onReposition = defaultOnReposition) {
310
273
  previousFocusNode = currentEndNode;
311
274
  previousFocusNodeDOM = currentEndNodeDOM;
312
275
  previousFocusOffset = currentEndOffset;
276
+ // Pass {editor} so the active editor is set: $rangeTargetFromPoint reads
277
+ // the slot (getFirstChildOffset), which consults the active editor to
278
+ // skip the block cursor.
279
+ }, {
280
+ editor
313
281
  });
314
282
  }
315
283
  compute(editor.getEditorState());
@@ -361,18 +329,6 @@ function selectionAlwaysOnDisplay(editor, onReposition) {
361
329
  });
362
330
  }
363
331
 
364
- // Hotfix to export these with inlined types #5918
365
- const CAN_USE_BEFORE_INPUT = CAN_USE_BEFORE_INPUT$1;
366
- const CAN_USE_DOM = CAN_USE_DOM$1;
367
- const IS_ANDROID = IS_ANDROID$1;
368
- const IS_ANDROID_CHROME = IS_ANDROID_CHROME$1;
369
- const IS_APPLE = IS_APPLE$1;
370
- const IS_APPLE_WEBKIT = IS_APPLE_WEBKIT$1;
371
- const IS_CHROME = IS_CHROME$1;
372
- const IS_FIREFOX = IS_FIREFOX$1;
373
- const IS_IOS = IS_IOS$1;
374
- const IS_SAFARI = IS_SAFARI$1;
375
-
376
332
  /**
377
333
  * Returns true if the file type matches the types passed within the acceptableMimeTypes array, false otherwise.
378
334
  * The types passed must be strings and are CASE-SENSITIVE.
@@ -667,7 +623,6 @@ function registerNestedElementResolver(editor, targetNode, cloneNode, handleOver
667
623
  * @param editorState - The editor's state
668
624
  */
669
625
  function $restoreEditorState(editor, editorState) {
670
- const FULL_RECONCILE = 2;
671
626
  const nodeMap = new Map();
672
627
  const activeEditorState = editor._pendingEditorState;
673
628
  for (const [key, node] of editorState._nodeMap) {
@@ -676,7 +631,7 @@ function $restoreEditorState(editor, editorState) {
676
631
  if (activeEditorState) {
677
632
  activeEditorState._nodeMap = nodeMap;
678
633
  }
679
- editor._dirtyType = FULL_RECONCILE;
634
+ lexical.$fullReconcile();
680
635
  const selection = editorState._selection;
681
636
  lexical.$setSelection(selection === null ? null : selection.clone());
682
637
  }
@@ -861,7 +816,7 @@ function $handleIndentAndOutdent(indentOrOutdent) {
861
816
  function $insertFirst(parent, node) {
862
817
  lexical.$getChildCaret(parent, 'next').insert(node);
863
818
  }
864
- let NEEDS_MANUAL_ZOOM = IS_FIREFOX || !CAN_USE_DOM ? false : undefined;
819
+ let NEEDS_MANUAL_ZOOM = lexical.IS_FIREFOX || !lexical.CAN_USE_DOM ? false : undefined;
865
820
  function needsManualZoom() {
866
821
  if (NEEDS_MANUAL_ZOOM === undefined) {
867
822
  // If the browser implements standardized CSS zoom, then the client rect
@@ -1060,6 +1015,16 @@ function makeStateWrapper(stateConfig) {
1060
1015
  exports.$findMatchingParent = lexical.$findMatchingParent;
1061
1016
  exports.$getAdjacentSiblingOrParentSiblingCaret = lexical.$getAdjacentSiblingOrParentSiblingCaret;
1062
1017
  exports.$splitNode = lexical.$splitNode;
1018
+ exports.CAN_USE_BEFORE_INPUT = lexical.CAN_USE_BEFORE_INPUT;
1019
+ exports.CAN_USE_DOM = lexical.CAN_USE_DOM;
1020
+ exports.IS_ANDROID = lexical.IS_ANDROID;
1021
+ exports.IS_ANDROID_CHROME = lexical.IS_ANDROID_CHROME;
1022
+ exports.IS_APPLE = lexical.IS_APPLE;
1023
+ exports.IS_APPLE_WEBKIT = lexical.IS_APPLE_WEBKIT;
1024
+ exports.IS_CHROME = lexical.IS_CHROME;
1025
+ exports.IS_FIREFOX = lexical.IS_FIREFOX;
1026
+ exports.IS_IOS = lexical.IS_IOS;
1027
+ exports.IS_SAFARI = lexical.IS_SAFARI;
1063
1028
  exports.addClassNamesToElement = lexical.addClassNamesToElement;
1064
1029
  exports.isBlockDomNode = lexical.isBlockDomNode;
1065
1030
  exports.isHTMLAnchorElement = lexical.isHTMLAnchorElement;
@@ -1091,16 +1056,6 @@ exports.$reverseDfsIterator = $reverseDfsIterator;
1091
1056
  exports.$unwrapAndFilterDescendants = $unwrapAndFilterDescendants;
1092
1057
  exports.$unwrapNode = $unwrapNode;
1093
1058
  exports.$wrapNodeInElement = $wrapNodeInElement;
1094
- exports.CAN_USE_BEFORE_INPUT = CAN_USE_BEFORE_INPUT;
1095
- exports.CAN_USE_DOM = CAN_USE_DOM;
1096
- exports.IS_ANDROID = IS_ANDROID;
1097
- exports.IS_ANDROID_CHROME = IS_ANDROID_CHROME;
1098
- exports.IS_APPLE = IS_APPLE;
1099
- exports.IS_APPLE_WEBKIT = IS_APPLE_WEBKIT;
1100
- exports.IS_CHROME = IS_CHROME;
1101
- exports.IS_FIREFOX = IS_FIREFOX;
1102
- exports.IS_IOS = IS_IOS;
1103
- exports.IS_SAFARI = IS_SAFARI;
1104
1059
  exports.calculateZoomLevel = calculateZoomLevel;
1105
1060
  exports.isMimeType = isMimeType;
1106
1061
  exports.makeStateWrapper = makeStateWrapper;
@@ -6,8 +6,8 @@
6
6
  *
7
7
  */
8
8
 
9
- import { isHTMLElement, mergeRegister, $getSelection, $isRangeSelection, $isElementNode, getDOMTextNode, $getEditorDOMRenderConfig, $getChildCaret, $findMatchingParent, $getChildCaretOrSelf, $getSiblingCaret, $getAdjacentSiblingOrParentSiblingCaret, $caretRangeFromSelection, $getCaretRangeInDirection, $removeTextFromCaretRange, $isTextPointCaret, $splitAtPointCaretNext, $setSelectionFromCaretRange, $getCaretRange, $getPreviousSelection, $caretFromPoint, $getRoot, $createParagraphNode, $getAdjacentChildCaret, $isChildCaret, $normalizeCaret, $getCollapsedCaretRange, $getCaretInDirection, $isSiblingCaret, $rewindSiblingCaret, $cloneWithProperties, $setSelection, makeStepwiseIterator, $getState, $setState } from 'lexical';
10
- export { $findMatchingParent, $getAdjacentSiblingOrParentSiblingCaret, $splitNode, addClassNamesToElement, isBlockDomNode, isHTMLAnchorElement, isHTMLElement, isInlineDomNode, mergeRegister, removeClassNamesFromElement } from 'lexical';
9
+ import { isHTMLElement, mergeRegister, $getSelection, $isRangeSelection, $isElementNode, $isTextNode, $getDOMTextNode, getDOMTextNode, $getDOMSlot, $getChildCaret, $findMatchingParent, $getChildCaretOrSelf, $getSiblingCaret, $getAdjacentSiblingOrParentSiblingCaret, $caretRangeFromSelection, $getCaretRangeInDirection, $removeTextFromCaretRange, $isTextPointCaret, $splitAtPointCaretNext, $setSelectionFromCaretRange, $getCaretRange, $getPreviousSelection, $caretFromPoint, $getRoot, $createParagraphNode, $getAdjacentChildCaret, $isChildCaret, $normalizeCaret, $getCollapsedCaretRange, $getCaretInDirection, $isSiblingCaret, $rewindSiblingCaret, $cloneWithProperties, $fullReconcile, $setSelection, makeStepwiseIterator, $getState, $setState, IS_FIREFOX, CAN_USE_DOM } from 'lexical';
10
+ export { $findMatchingParent, $getAdjacentSiblingOrParentSiblingCaret, $splitNode, CAN_USE_BEFORE_INPUT, CAN_USE_DOM, IS_ANDROID, IS_ANDROID_CHROME, IS_APPLE, IS_APPLE_WEBKIT, IS_CHROME, IS_FIREFOX, IS_IOS, IS_SAFARI, addClassNamesToElement, isBlockDomNode, isHTMLAnchorElement, isHTMLElement, isInlineDomNode, mergeRegister, removeClassNamesFromElement } from 'lexical';
11
11
  import { createRectsFromDOMRange } from '@lexical/selection';
12
12
 
13
13
  /**
@@ -24,43 +24,6 @@ function formatDevErrorMessage(message) {
24
24
  throw new Error(message);
25
25
  }
26
26
 
27
- /**
28
- * Copyright (c) Meta Platforms, Inc. and affiliates.
29
- *
30
- * This source code is licensed under the MIT license found in the
31
- * LICENSE file in the root directory of this source tree.
32
- *
33
- */
34
-
35
- const CAN_USE_DOM$1 = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined';
36
-
37
- /**
38
- * Copyright (c) Meta Platforms, Inc. and affiliates.
39
- *
40
- * This source code is licensed under the MIT license found in the
41
- * LICENSE file in the root directory of this source tree.
42
- *
43
- */
44
-
45
- const documentMode = CAN_USE_DOM$1 && 'documentMode' in document ? document.documentMode : null;
46
- const IS_APPLE$1 = CAN_USE_DOM$1 && /Mac|iPod|iPhone|iPad/.test(navigator.platform);
47
- const IS_FIREFOX$1 = CAN_USE_DOM$1 && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);
48
- const CAN_USE_BEFORE_INPUT$1 = CAN_USE_DOM$1 && 'InputEvent' in window && !documentMode ? 'getTargetRanges' in new window.InputEvent('input') : false;
49
- const IS_IOS$1 = CAN_USE_DOM$1 && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
50
- const IS_ANDROID$1 = CAN_USE_DOM$1 && /Android/.test(navigator.userAgent);
51
-
52
- // Exclude Android — Android WebView's UA contains "Version/X.X ... Safari/537.36"
53
- // which falsely matches the Safari regex, activating wrong composition code paths.
54
- const IS_SAFARI$1 = CAN_USE_DOM$1 && /Version\/[\d.]+.*Safari/.test(navigator.userAgent) && !IS_ANDROID$1;
55
-
56
- // Keep these in case we need to use them in the future.
57
- // export const IS_WINDOWS: boolean = CAN_USE_DOM && /Win/.test(navigator.platform);
58
- const IS_CHROME$1 = CAN_USE_DOM$1 && /^(?=.*Chrome).*/i.test(navigator.userAgent);
59
- // export const canUseTextInputEvent: boolean = CAN_USE_DOM && 'TextEvent' in window && !documentMode;
60
-
61
- const IS_ANDROID_CHROME$1 = CAN_USE_DOM$1 && IS_ANDROID$1 && IS_CHROME$1;
62
- const IS_APPLE_WEBKIT$1 = CAN_USE_DOM$1 && /AppleWebKit\/[\d.]+/.test(navigator.userAgent) && IS_APPLE$1 && !IS_CHROME$1;
63
-
64
27
  /**
65
28
  * Copyright (c) Meta Platforms, Inc. and affiliates.
66
29
  *
@@ -223,10 +186,10 @@ function $getOrderedSelectionPoints(selection) {
223
186
  }
224
187
  function $rangeTargetFromPoint(editor, point, node, dom) {
225
188
  if (point.type === 'text' || !$isElementNode(node)) {
226
- const textDOM = getDOMTextNode(dom) || dom;
189
+ const textDOM = ($isTextNode(node) ? $getDOMTextNode(node, dom, editor) : getDOMTextNode(dom)) || dom;
227
190
  return [textDOM, point.offset];
228
191
  } else {
229
- const slot = $getEditorDOMRenderConfig(editor).$getDOMSlot(node, dom, editor);
192
+ const slot = $getDOMSlot(node, dom, editor);
230
193
  return [slot.element, slot.getFirstChildOffset() + point.offset];
231
194
  }
232
195
  }
@@ -309,6 +272,11 @@ function markSelection(editor, onReposition = defaultOnReposition) {
309
272
  previousFocusNode = currentEndNode;
310
273
  previousFocusNodeDOM = currentEndNodeDOM;
311
274
  previousFocusOffset = currentEndOffset;
275
+ // Pass {editor} so the active editor is set: $rangeTargetFromPoint reads
276
+ // the slot (getFirstChildOffset), which consults the active editor to
277
+ // skip the block cursor.
278
+ }, {
279
+ editor
312
280
  });
313
281
  }
314
282
  compute(editor.getEditorState());
@@ -360,18 +328,6 @@ function selectionAlwaysOnDisplay(editor, onReposition) {
360
328
  });
361
329
  }
362
330
 
363
- // Hotfix to export these with inlined types #5918
364
- const CAN_USE_BEFORE_INPUT = CAN_USE_BEFORE_INPUT$1;
365
- const CAN_USE_DOM = CAN_USE_DOM$1;
366
- const IS_ANDROID = IS_ANDROID$1;
367
- const IS_ANDROID_CHROME = IS_ANDROID_CHROME$1;
368
- const IS_APPLE = IS_APPLE$1;
369
- const IS_APPLE_WEBKIT = IS_APPLE_WEBKIT$1;
370
- const IS_CHROME = IS_CHROME$1;
371
- const IS_FIREFOX = IS_FIREFOX$1;
372
- const IS_IOS = IS_IOS$1;
373
- const IS_SAFARI = IS_SAFARI$1;
374
-
375
331
  /**
376
332
  * Returns true if the file type matches the types passed within the acceptableMimeTypes array, false otherwise.
377
333
  * The types passed must be strings and are CASE-SENSITIVE.
@@ -666,7 +622,6 @@ function registerNestedElementResolver(editor, targetNode, cloneNode, handleOver
666
622
  * @param editorState - The editor's state
667
623
  */
668
624
  function $restoreEditorState(editor, editorState) {
669
- const FULL_RECONCILE = 2;
670
625
  const nodeMap = new Map();
671
626
  const activeEditorState = editor._pendingEditorState;
672
627
  for (const [key, node] of editorState._nodeMap) {
@@ -675,7 +630,7 @@ function $restoreEditorState(editor, editorState) {
675
630
  if (activeEditorState) {
676
631
  activeEditorState._nodeMap = nodeMap;
677
632
  }
678
- editor._dirtyType = FULL_RECONCILE;
633
+ $fullReconcile();
679
634
  const selection = editorState._selection;
680
635
  $setSelection(selection === null ? null : selection.clone());
681
636
  }
@@ -1056,4 +1011,4 @@ function makeStateWrapper(stateConfig) {
1056
1011
  };
1057
1012
  }
1058
1013
 
1059
- export { $descendantsMatching, $dfs, $dfsIterator, $filter, $firstToLastIterator, $getAdjacentCaret, $getDepth, $getNearestBlockElementAncestorOrThrow, $getNearestNodeOfType, $getNextRightPreorderNode, $getNextSiblingOrParentSibling, $handleIndentAndOutdent, $insertFirst, $insertNodeIntoLeaf, $insertNodeToNearestRoot, $insertNodeToNearestRootAtCaret, $isEditorIsNestedEditor, $lastToFirstIterator, $restoreEditorState, $reverseDfs, $reverseDfsIterator, $unwrapAndFilterDescendants, $unwrapNode, $wrapNodeInElement, CAN_USE_BEFORE_INPUT, CAN_USE_DOM, IS_ANDROID, IS_ANDROID_CHROME, IS_APPLE, IS_APPLE_WEBKIT, IS_CHROME, IS_FIREFOX, IS_IOS, IS_SAFARI, calculateZoomLevel, isMimeType, makeStateWrapper, markSelection, mediaFileReader, objectKlassEquals, mlcPositionNodeOnRange as positionNodeOnRange, registerNestedElementResolver, selectionAlwaysOnDisplay };
1014
+ export { $descendantsMatching, $dfs, $dfsIterator, $filter, $firstToLastIterator, $getAdjacentCaret, $getDepth, $getNearestBlockElementAncestorOrThrow, $getNearestNodeOfType, $getNextRightPreorderNode, $getNextSiblingOrParentSibling, $handleIndentAndOutdent, $insertFirst, $insertNodeIntoLeaf, $insertNodeToNearestRoot, $insertNodeToNearestRootAtCaret, $isEditorIsNestedEditor, $lastToFirstIterator, $restoreEditorState, $reverseDfs, $reverseDfsIterator, $unwrapAndFilterDescendants, $unwrapNode, $wrapNodeInElement, calculateZoomLevel, isMimeType, makeStateWrapper, markSelection, mediaFileReader, objectKlassEquals, mlcPositionNodeOnRange as positionNodeOnRange, registerNestedElementResolver, selectionAlwaysOnDisplay };
@@ -184,14 +184,14 @@ declare export function $getAdjacentSiblingOrParentSiblingCaret<
184
184
  ): null | [NodeCaret<D>, number];
185
185
 
186
186
  export type StateConfigWrapper<K extends string, V> = {
187
- +stateConfig: StateConfig<K, V>;
188
- +$get: <T extends LexicalNode>(node: T) => V;
189
- +$set: <T extends LexicalNode>(
187
+ readonly stateConfig: StateConfig<K, V>;
188
+ readonly $get: <T extends LexicalNode>(node: T) => V;
189
+ readonly $set: <T extends LexicalNode>(
190
190
  node: T,
191
191
  valueOrUpdater: ValueOrUpdater<V>,
192
192
  ) => T;
193
193
  /** `[$get, $set]` */
194
- +accessors: Readonly<[$get: StateConfigWrapper<K, V>['$get'], $set: StateConfigWrapper<K, V>['$set']]>;
194
+ readonly accessors: Readonly<[$get: StateConfigWrapper<K, V>['$get'], $set: StateConfigWrapper<K, V>['$set']]>;
195
195
  /**
196
196
  * `() => function () { return $get(this) }`
197
197
  *
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ "use strict";var e=require("lexical"),t=require("@lexical/selection");function n(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function r(e){return`${e}px`}const o={attributes:!0,characterData:!0,childList:!0,subtree:!0};function i(i,s,l){let a=null,c=null,u=null,g=[];const d=document.createElement("div");function f(){null===a&&n(182),null===c&&n(183);const{left:e,top:o}=c.getBoundingClientRect(),u=t.createRectsFromDOMRange(i,s);var f,p;d.isConnected||(p=d,(f=c).insertBefore(p,f.firstChild));let $=!1;for(let t=0;t<u.length;t++){const n=u[t],i=g[t]||document.createElement("div"),s=i.style;"absolute"!==s.position&&(s.position="absolute",$=!0);const l=r(n.left-e);s.left!==l&&(s.left=l,$=!0);const a=r(n.top-o);s.top!==a&&(i.style.top=a,$=!0);const c=r(n.width);s.width!==c&&(i.style.width=c,$=!0);const f=r(n.height);s.height!==f&&(i.style.height=f,$=!0),i.parentNode!==d&&(d.append(i),$=!0),g[t]=i}for(;g.length>u.length;)g.pop();$&&l(g)}function p(){c=null,a=null,null!==u&&u.disconnect(),u=null,d.remove();for(const e of g)e.remove();g=[]}d.style.position="relative";const $=i.registerRootListener(function t(){const n=i.getRootElement();if(null===n)return p();const r=n.parentElement;if(!e.isHTMLElement(r))return p();p(),a=n,c=r,u=new MutationObserver(e=>{const n=i.getRootElement(),r=n&&n.parentElement;if(n!==a||r!==c)return t();for(const t of e)if(!d.contains(t.target))return f()}),u.observe(r,o),f()});return()=>{$(),p()}}function s(t,n,r,o){if("text"!==n.type&&e.$isElementNode(r)){const i=e.$getDOMSlot(r,o,t);return[i.element,i.getFirstChildOffset()+n.offset]}return[(e.$isTextNode(r)?e.$getDOMTextNode(r,o,t):e.getDOMTextNode(o))||o,n.offset]}function l(e){for(const t of e){const e=t.style;"Highlight"!==e.background&&(e.background="Highlight"),"HighlightText"!==e.color&&(e.color="HighlightText"),e.marginTop!==r(-1.5)&&(e.marginTop=r(-1.5)),e.paddingTop!==r(4)&&(e.paddingTop=r(4)),e.paddingBottom!==r(0)&&(e.paddingBottom=r(0))}}function a(t,n=l){let r=null,o=null,a=null,c=null,u=null,g=null,d=()=>{};function f(l){l.read(()=>{const l=e.$getSelection();if(!e.$isRangeSelection(l))return r=null,a=null,c=null,g=null,d(),void(d=()=>{});const[f,p]=function(e){const t=e.getStartEndPoints();return e.isBackward()?[t[1],t[0]]:t}(l),$=f.getNode(),m=$.getKey(),S=f.offset,C=p.getNode(),x=C.getKey(),h=p.offset,E=t.getElementByKey(m),N=t.getElementByKey(x),R=null===r||E!==o||S!==a||m!==r.getKey(),I=null===c||N!==u||h!==g||x!==c.getKey();if((R||I)&&null!==E&&null!==N){const e=function(e,t,n,r,o,i,l){const a=(e._window?e._window.document:document).createRange();return a.setStart(...s(e,t,n,r)),a.setEnd(...s(e,o,i,l)),a}(t,f,$,E,p,C,N);d(),d=i(t,e,n)}r=$,o=E,a=S,c=C,u=N,g=h},{editor:t})}return f(t.getEditorState()),e.mergeRegister(t.registerUpdateListener(({editorState:e})=>f(e)),()=>{d()})}function c(e,t){for(const n of t)if(e.type.startsWith(n))return!0;return!1}function u(e,t){return d("next",e,t)}function g(t,n){const r=e.$getAdjacentSiblingOrParentSiblingCaret(e.$getSiblingCaret(t,n));return r&&r[0]}function d(t,n,r){const o=e.$getRoot(),i=n||o,s=e.$isElementNode(i)?e.$getChildCaret(i,t):e.$getSiblingCaret(i,t),l=f(i),a=r?e.$getAdjacentChildCaret(e.$getChildCaretOrSelf(e.$getSiblingCaret(r,t)))||g(r,t):g(i,t);let c=l;return e.makeStepwiseIterator({hasNext:e=>null!==e,initial:s,map:e=>({depth:c,node:e.origin}),step:t=>{if(t.isSameNodeCaret(a))return null;e.$isChildCaret(t)&&c++;const n=e.$getAdjacentSiblingOrParentSiblingCaret(t);return!n||n[0].isSameNodeCaret(a)?null:(c+=n[1],n[0])}})}function f(e){let t=-1;for(let n=e;null!==n;n=n.getParent())t++;return t}function p(e,t){return d("previous",e,t)}function $(t,r,o){let i=e.$getCaretInDirection(r,"next");e.$isTextPointCaret(i)&&(0===i.offset?i=e.$getSiblingCaret(i.origin,"previous").getFlipped():i.offset===i.origin.getTextContentSize()&&(i=e.$getSiblingCaret(i.origin,"next"))),i.origin.is(t)&&(e.$isSiblingCaret(i)||n(342,t.getKey(),t.getType()),i=e.$rewindSiblingCaret(i)),(t.is(i.getNodeAtCaret())||t.is(i.getFlipped().getNodeAtCaret()))&&t.remove(!0);for(let t=i;t;t=e.$splitAtPointCaretNext(t,o))i=t;return e.$isTextPointCaret(i)&&n(283),i.insert(t.isInline()?e.$createParagraphNode().append(t):t),e.$getCaretInDirection(e.$getSiblingCaret(t.getLatest(),"next"),r.direction)}let m=!(e.IS_FIREFOX||!e.CAN_USE_DOM)&&void 0;function S(t,n,r){let o=!1;for(const i of C(t))n(i)?null!==r&&r(i):(o=!0,e.$isElementNode(i)&&S(i,n,r||(e=>i.insertAfter(e))),i.remove());return o}function C(t){return x(e.$getChildCaret(t,"previous"))}function x(t){return e.makeStepwiseIterator({hasNext:e.$isSiblingCaret,initial:t.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}exports.$findMatchingParent=e.$findMatchingParent,exports.$getAdjacentSiblingOrParentSiblingCaret=e.$getAdjacentSiblingOrParentSiblingCaret,exports.$splitNode=e.$splitNode,exports.CAN_USE_BEFORE_INPUT=e.CAN_USE_BEFORE_INPUT,exports.CAN_USE_DOM=e.CAN_USE_DOM,exports.IS_ANDROID=e.IS_ANDROID,exports.IS_ANDROID_CHROME=e.IS_ANDROID_CHROME,exports.IS_APPLE=e.IS_APPLE,exports.IS_APPLE_WEBKIT=e.IS_APPLE_WEBKIT,exports.IS_CHROME=e.IS_CHROME,exports.IS_FIREFOX=e.IS_FIREFOX,exports.IS_IOS=e.IS_IOS,exports.IS_SAFARI=e.IS_SAFARI,exports.addClassNamesToElement=e.addClassNamesToElement,exports.isBlockDomNode=e.isBlockDomNode,exports.isHTMLAnchorElement=e.isHTMLAnchorElement,exports.isHTMLElement=e.isHTMLElement,exports.isInlineDomNode=e.isInlineDomNode,exports.mergeRegister=e.mergeRegister,exports.removeClassNamesFromElement=e.removeClassNamesFromElement,exports.$descendantsMatching=function(t,n){const r=[],o=Array.from(t).reverse();for(let t=o.pop();void 0!==t;t=o.pop())if(n(t))r.push(t);else if(e.$isElementNode(t))for(const e of C(t))o.push(e);return r},exports.$dfs=function(e,t){return Array.from(u(e,t))},exports.$dfsIterator=u,exports.$filter=function(e,t){const n=[];for(let r=0;r<e.length;r++){const o=t(e[r]);null!==o&&n.push(o)}return n},exports.$firstToLastIterator=function(t){return x(e.$getChildCaret(t,"next"))},exports.$getAdjacentCaret=function(e){return e?e.getAdjacentCaret():null},exports.$getDepth=f,exports.$getNearestBlockElementAncestorOrThrow=function(t){const r=e.$findMatchingParent(t,t=>e.$isElementNode(t)&&!t.isInline());return e.$isElementNode(r)||n(4,t.__key),r},exports.$getNearestNodeOfType=function(e,t){let n=e;for(;null!=n;){if(n instanceof t)return n;n=n.getParent()}return null},exports.$getNextRightPreorderNode=function(t){const n=e.$getChildCaretOrSelf(e.$getSiblingCaret(t,"previous")),r=e.$getAdjacentSiblingOrParentSiblingCaret(n,"root");return r&&r[0].origin},exports.$getNextSiblingOrParentSibling=function(t){const n=e.$getAdjacentSiblingOrParentSiblingCaret(e.$getSiblingCaret(t,"next"));return n&&[n[0].origin,n[1]]},exports.$handleIndentAndOutdent=function(t){const n=e.$getSelection();if(!e.$isRangeSelection(n))return!1;const r=new Set,o=n.getNodes();for(let n=0;n<o.length;n++){const i=o[n],s=i.getKey();if(r.has(s))continue;const l=e.$findMatchingParent(i,t=>e.$isElementNode(t)&&!t.isInline());if(null===l)continue;const a=l.getKey();l.canIndent()&&!r.has(a)&&(r.add(a),t(l))}return r.size>0},exports.$insertFirst=function(t,n){e.$getChildCaret(t,"next").insert(n)},exports.$insertNodeIntoLeaf=function(t){const n=e.$getSelection();if(!e.$isRangeSelection(n))return void(n&&n.insertNodes([t]));const r=e.$caretRangeFromSelection(n);let o=e.$getCaretRangeInDirection(e.$removeTextFromCaretRange(r),"next").anchor;if(e.$isTextPointCaret(o)){const t=e.$splitAtPointCaretNext(o);if(!t)return;o=t}const i=o.getFlipped();i.insert(t),e.$setSelectionFromCaretRange(e.$getCaretRange(i,i))},exports.$insertNodeToNearestRoot=function(t){const n=e.$getSelection()||e.$getPreviousSelection();let r;if(e.$isRangeSelection(n))r=e.$caretFromPoint(n.focus,"next");else{if(null!=n){const t=n.getNodes(),o=t[t.length-1];o&&(r=e.$getSiblingCaret(o,"next"))}r=r||e.$getChildCaret(e.$getRoot(),"previous").getFlipped().insert(e.$createParagraphNode())}const o=$(t,r),i=e.$getAdjacentChildCaret(o),s=e.$isChildCaret(i)?e.$normalizeCaret(i):o;return e.$setSelectionFromCaretRange(e.$getCollapsedCaretRange(s)),t.getLatest()},exports.$insertNodeToNearestRootAtCaret=$,exports.$isEditorIsNestedEditor=function(e){return null!==e._parentEditor},exports.$lastToFirstIterator=C,exports.$restoreEditorState=function(t,n){const r=new Map,o=t._pendingEditorState;for(const[t,o]of n._nodeMap)r.set(t,e.$cloneWithProperties(o));o&&(o._nodeMap=r),e.$fullReconcile();const i=n._selection;e.$setSelection(null===i?null:i.clone())},exports.$reverseDfs=function(e,t){return Array.from(p(e,t))},exports.$reverseDfsIterator=p,exports.$unwrapAndFilterDescendants=function(e,t){return S(e,t,null)},exports.$unwrapNode=function(t){e.$rewindSiblingCaret(e.$getSiblingCaret(t,"next")).splice(1,t.getChildren())},exports.$wrapNodeInElement=function(e,t){const n=t();return e.replace(n),n.append(e),n},exports.calculateZoomLevel=function(e,t=!1){let n=1;if(function(){if(void 0===m){const e=document.createElement("div");e.style.position="absolute",e.style.opacity="0",e.style.width="100px",e.style.left="-1000px",document.body.appendChild(e);const t=e.getBoundingClientRect();e.style.setProperty("zoom","2"),m=e.getBoundingClientRect().width===t.width,document.body.removeChild(e)}return m}()||t)for(;e;)n*=Number(window.getComputedStyle(e).getPropertyValue("zoom")),e=e.parentElement;return n},exports.isMimeType=c,exports.makeStateWrapper=function(t){const n=n=>e.$getState(n,t),r=(n,r)=>e.$setState(n,t,r);return{$get:n,$set:r,accessors:[n,r],makeGetterMethod:()=>function(){return n(this)},makeSetterMethod:()=>function(e){return r(this,e)},stateConfig:t}},exports.markSelection=a,exports.mediaFileReader=function(e,t){const n=e[Symbol.iterator]();return new Promise((e,r)=>{const o=[],i=()=>{const{done:s,value:l}=n.next();if(s)return e(o);const a=new FileReader;a.addEventListener("error",r),a.addEventListener("load",()=>{const e=a.result;"string"==typeof e&&o.push({file:l,result:e}),i()}),c(l,t)?a.readAsDataURL(l):i()};i()})},exports.objectKlassEquals=function(e,t){return null!==e&&Object.getPrototypeOf(e).constructor.name===t.name},exports.positionNodeOnRange=i,exports.registerNestedElementResolver=function(e,t,n,r){const o=e=>e instanceof t;return e.registerNodeTransform(t,e=>{const t=(e=>{const t=e.getChildren();for(let e=0;e<t.length;e++){const n=t[e];if(o(n))return null}let n=e,r=e;for(;null!==n;)if(r=n,n=n.getParent(),o(n))return{child:r,parent:n};return null})(e);if(null!==t){const{child:o,parent:i}=t;if(o.is(e)){r(i,e);const t=o.getNextSiblings(),s=t.length;if(i.insertAfter(o),0!==s){const e=n(i);o.insertAfter(e);for(let n=0;n<s;n++)e.append(t[n])}i.canBeEmpty()||0!==i.getChildrenSize()||i.remove()}}})},exports.selectionAlwaysOnDisplay=function(e,t){let n=null;const r=()=>{const r=getSelection(),o=r&&r.anchorNode,i=e.getRootElement();null!==o&&null!==i&&i.contains(o)?null!==n&&(n(),n=null):null===n&&(n=a(e,t))};return e.registerRootListener(e=>{if(e){const t=e.ownerDocument;return t.addEventListener("selectionchange",r),r(),()=>{null!==n&&n(),t.removeEventListener("selectionchange",r)}}})};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+
9
+ import{isHTMLElement as t,mergeRegister as e,$getSelection as n,$isRangeSelection as o,$isElementNode as r,$isTextNode as i,$getDOMTextNode as l,getDOMTextNode as s,$getDOMSlot as u,$getChildCaret as c,$findMatchingParent as f,$getChildCaretOrSelf as a,$getSiblingCaret as d,$getAdjacentSiblingOrParentSiblingCaret as g,$caretRangeFromSelection as p,$getCaretRangeInDirection as m,$removeTextFromCaretRange as h,$isTextPointCaret as y,$splitAtPointCaretNext as v,$setSelectionFromCaretRange as E,$getCaretRange as S,$getPreviousSelection as x,$caretFromPoint as C,$getRoot as N,$createParagraphNode as _,$getAdjacentChildCaret as w,$isChildCaret as A,$normalizeCaret as R,$getCollapsedCaretRange as I,$getCaretInDirection as L,$isSiblingCaret as b,$rewindSiblingCaret as P,$cloneWithProperties as O,$fullReconcile as T,$setSelection as B,makeStepwiseIterator as M,$getState as F,$setState as D,IS_FIREFOX as K,CAN_USE_DOM as H}from"lexical";export{$findMatchingParent,$getAdjacentSiblingOrParentSiblingCaret,$splitNode,CAN_USE_BEFORE_INPUT,CAN_USE_DOM,IS_ANDROID,IS_ANDROID_CHROME,IS_APPLE,IS_APPLE_WEBKIT,IS_CHROME,IS_FIREFOX,IS_IOS,IS_SAFARI,addClassNamesToElement,isBlockDomNode,isHTMLAnchorElement,isHTMLElement,isInlineDomNode,mergeRegister,removeClassNamesFromElement}from"lexical";import{createRectsFromDOMRange as $}from"@lexical/selection";function k(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function U(t){return`${t}px`}const j={attributes:!0,characterData:!0,childList:!0,subtree:!0};function z(e,n,o){let r=null,i=null,l=null,s=[];const u=document.createElement("div");function c(){null===r&&k(182),null===i&&k(183);const{left:t,top:l}=i.getBoundingClientRect(),c=$(e,n);var f,a;u.isConnected||(a=u,(f=i).insertBefore(a,f.firstChild));let d=!1;for(let e=0;e<c.length;e++){const n=c[e],o=s[e]||document.createElement("div"),r=o.style;"absolute"!==r.position&&(r.position="absolute",d=!0);const i=U(n.left-t);r.left!==i&&(r.left=i,d=!0);const f=U(n.top-l);r.top!==f&&(o.style.top=f,d=!0);const a=U(n.width);r.width!==a&&(o.style.width=a,d=!0);const g=U(n.height);r.height!==g&&(o.style.height=g,d=!0),o.parentNode!==u&&(u.append(o),d=!0),s[e]=o}for(;s.length>c.length;)s.pop();d&&o(s)}function f(){i=null,r=null,null!==l&&l.disconnect(),l=null,u.remove();for(const t of s)t.remove();s=[]}u.style.position="relative";const a=e.registerRootListener(function n(){const o=e.getRootElement();if(null===o)return f();const s=o.parentElement;if(!t(s))return f();f(),r=o,i=s,l=new MutationObserver(t=>{const o=e.getRootElement(),l=o&&o.parentElement;if(o!==r||l!==i)return n();for(const e of t)if(!u.contains(e.target))return c()}),l.observe(s,j),c()});return()=>{a(),f()}}function W(t,e,n,o){if("text"!==e.type&&r(n)){const r=u(n,o,t);return[r.element,r.getFirstChildOffset()+e.offset]}return[(i(n)?l(n,o,t):s(o))||o,e.offset]}function G(t){for(const e of t){const t=e.style;"Highlight"!==t.background&&(t.background="Highlight"),"HighlightText"!==t.color&&(t.color="HighlightText"),t.marginTop!==U(-1.5)&&(t.marginTop=U(-1.5)),t.paddingTop!==U(4)&&(t.paddingTop=U(4)),t.paddingBottom!==U(0)&&(t.paddingBottom=U(0))}}function V(t,r=G){let i=null,l=null,s=null,u=null,c=null,f=null,a=()=>{};function d(e){e.read(()=>{const e=n();if(!o(e))return i=null,s=null,u=null,f=null,a(),void(a=()=>{});const[d,g]=function(t){const e=t.getStartEndPoints();return t.isBackward()?[e[1],e[0]]:e}(e),p=d.getNode(),m=p.getKey(),h=d.offset,y=g.getNode(),v=y.getKey(),E=g.offset,S=t.getElementByKey(m),x=t.getElementByKey(v),C=null===i||S!==l||h!==s||m!==i.getKey(),N=null===u||x!==c||E!==f||v!==u.getKey();if((C||N)&&null!==S&&null!==x){const e=function(t,e,n,o,r,i,l){const s=(t._window?t._window.document:document).createRange();return s.setStart(...W(t,e,n,o)),s.setEnd(...W(t,r,i,l)),s}(t,d,p,S,g,y,x);a(),a=z(t,e,r)}i=p,l=S,s=h,u=y,c=x,f=E},{editor:t})}return d(t.getEditorState()),e(t.registerUpdateListener(({editorState:t})=>d(t)),()=>{a()})}function X(t,e){let n=null;const o=()=>{const o=getSelection(),r=o&&o.anchorNode,i=t.getRootElement();null!==r&&null!==i&&i.contains(r)?null!==n&&(n(),n=null):null===n&&(n=V(t,e))};return t.registerRootListener(t=>{if(t){const e=t.ownerDocument;return e.addEventListener("selectionchange",o),o(),()=>{null!==n&&n(),e.removeEventListener("selectionchange",o)}}})}function q(t,e){for(const n of e)if(t.type.startsWith(n))return!0;return!1}function J(t,e){const n=t[Symbol.iterator]();return new Promise((t,o)=>{const r=[],i=()=>{const{done:l,value:s}=n.next();if(l)return t(r);const u=new FileReader;u.addEventListener("error",o),u.addEventListener("load",()=>{const t=u.result;"string"==typeof t&&r.push({file:s,result:t}),i()}),q(s,e)?u.readAsDataURL(s):i()};i()})}function Q(t,e){return Array.from(tt(t,e))}function Y(t){return t?t.getAdjacentCaret():null}function Z(t,e){return Array.from(lt(t,e))}function tt(t,e){return nt("next",t,e)}function et(t,e){const n=g(d(t,e));return n&&n[0]}function nt(t,e,n){const o=N(),i=e||o,l=r(i)?c(i,t):d(i,t),s=rt(i),u=n?w(a(d(n,t)))||et(n,t):et(i,t);let f=s;return M({hasNext:t=>null!==t,initial:l,map:t=>({depth:f,node:t.origin}),step:t=>{if(t.isSameNodeCaret(u))return null;A(t)&&f++;const e=g(t);return!e||e[0].isSameNodeCaret(u)?null:(f+=e[1],e[0])}})}function ot(t){const e=g(d(t,"next"));return e&&[e[0].origin,e[1]]}function rt(t){let e=-1;for(let n=t;null!==n;n=n.getParent())e++;return e}function it(t){const e=a(d(t,"previous")),n=g(e,"root");return n&&n[0].origin}function lt(t,e){return nt("previous",t,e)}function st(t,e){let n=t;for(;null!=n;){if(n instanceof e)return n;n=n.getParent()}return null}function ut(t){const e=f(t,t=>r(t)&&!t.isInline());return r(e)||k(4,t.__key),e}function ct(t,e,n,o){const r=t=>t instanceof e;return t.registerNodeTransform(e,t=>{const e=(t=>{const e=t.getChildren();for(let t=0;t<e.length;t++){const n=e[t];if(r(n))return null}let n=t,o=t;for(;null!==n;)if(o=n,n=n.getParent(),r(n))return{child:o,parent:n};return null})(t);if(null!==e){const{child:r,parent:i}=e;if(r.is(t)){o(i,t);const e=r.getNextSiblings(),l=e.length;if(i.insertAfter(r),0!==l){const t=n(i);r.insertAfter(t);for(let n=0;n<l;n++)t.append(e[n])}i.canBeEmpty()||0!==i.getChildrenSize()||i.remove()}}})}function ft(t,e){const n=new Map,o=t._pendingEditorState;for(const[t,o]of e._nodeMap)n.set(t,O(o));o&&(o._nodeMap=n),T();const r=e._selection;B(null===r?null:r.clone())}function at(t){const e=n()||x();let r;if(o(e))r=C(e.focus,"next");else{if(null!=e){const t=e.getNodes(),n=t[t.length-1];n&&(r=d(n,"next"))}r=r||c(N(),"previous").getFlipped().insert(_())}const i=dt(t,r),l=w(i),s=A(l)?R(l):i;return E(I(s)),t.getLatest()}function dt(t,e,n){let o=L(e,"next");y(o)&&(0===o.offset?o=d(o.origin,"previous").getFlipped():o.offset===o.origin.getTextContentSize()&&(o=d(o.origin,"next"))),o.origin.is(t)&&(b(o)||k(342,t.getKey(),t.getType()),o=P(o)),(t.is(o.getNodeAtCaret())||t.is(o.getFlipped().getNodeAtCaret()))&&t.remove(!0);for(let t=o;t;t=v(t,n))o=t;return y(o)&&k(283),o.insert(t.isInline()?_().append(t):t),L(d(t.getLatest(),"next"),e.direction)}function gt(t){const e=n();if(!o(e))return void(e&&e.insertNodes([t]));const r=p(e);let i=m(h(r),"next").anchor;if(y(i)){const t=v(i);if(!t)return;i=t}const l=i.getFlipped();l.insert(t),E(S(l,l))}function pt(t,e){const n=e();return t.replace(n),n.append(t),n}function mt(t,e){return null!==t&&Object.getPrototypeOf(t).constructor.name===e.name}function ht(t,e){const n=[];for(let o=0;o<t.length;o++){const r=e(t[o]);null!==r&&n.push(r)}return n}function yt(t){const e=n();if(!o(e))return!1;const i=new Set,l=e.getNodes();for(let e=0;e<l.length;e++){const n=l[e],o=n.getKey();if(i.has(o))continue;const s=f(n,t=>r(t)&&!t.isInline());if(null===s)continue;const u=s.getKey();s.canIndent()&&!i.has(u)&&(i.add(u),t(s))}return i.size>0}function vt(t,e){c(t,"next").insert(e)}let Et=!(K||!H)&&void 0;function St(t,e=!1){let n=1;if(function(){if(void 0===Et){const t=document.createElement("div");t.style.position="absolute",t.style.opacity="0",t.style.width="100px",t.style.left="-1000px",document.body.appendChild(t);const e=t.getBoundingClientRect();t.style.setProperty("zoom","2"),Et=t.getBoundingClientRect().width===e.width,document.body.removeChild(t)}return Et}()||e)for(;t;)n*=Number(window.getComputedStyle(t).getPropertyValue("zoom")),t=t.parentElement;return n}function xt(t){return null!==t._parentEditor}function Ct(t,e){return Nt(t,e,null)}function Nt(t,e,n){let o=!1;for(const i of At(t))e(i)?null!==n&&n(i):(o=!0,r(i)&&Nt(i,e,n||(t=>i.insertAfter(t))),i.remove());return o}function _t(t,e){const n=[],o=Array.from(t).reverse();for(let t=o.pop();void 0!==t;t=o.pop())if(e(t))n.push(t);else if(r(t))for(const e of At(t))o.push(e);return n}function wt(t){return Rt(c(t,"next"))}function At(t){return Rt(c(t,"previous"))}function Rt(t){return M({hasNext:b,initial:t.getAdjacentCaret(),map:t=>t.origin.getLatest(),step:t=>t.getAdjacentCaret()})}function It(t){P(d(t,"next")).splice(1,t.getChildren())}function Lt(t){const e=e=>F(e,t),n=(e,n)=>D(e,t,n);return{$get:e,$set:n,accessors:[e,n],makeGetterMethod:()=>function(){return e(this)},makeSetterMethod:()=>function(t){return n(this,t)},stateConfig:t}}export{_t as $descendantsMatching,Q as $dfs,tt as $dfsIterator,ht as $filter,wt as $firstToLastIterator,Y as $getAdjacentCaret,rt as $getDepth,ut as $getNearestBlockElementAncestorOrThrow,st as $getNearestNodeOfType,it as $getNextRightPreorderNode,ot as $getNextSiblingOrParentSibling,yt as $handleIndentAndOutdent,vt as $insertFirst,gt as $insertNodeIntoLeaf,at as $insertNodeToNearestRoot,dt as $insertNodeToNearestRootAtCaret,xt as $isEditorIsNestedEditor,At as $lastToFirstIterator,ft as $restoreEditorState,Z as $reverseDfs,lt as $reverseDfsIterator,Ct as $unwrapAndFilterDescendants,It as $unwrapNode,pt as $wrapNodeInElement,St as calculateZoomLevel,q as isMimeType,Lt as makeStateWrapper,V as markSelection,J as mediaFileReader,mt as objectKlassEquals,z as positionNodeOnRange,ct as registerNestedElementResolver,X as selectionAlwaysOnDisplay};
@@ -5,21 +5,13 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
7
  */
8
+ import { CAN_USE_BEFORE_INPUT, CAN_USE_DOM, IS_ANDROID, IS_ANDROID_CHROME, IS_APPLE, IS_APPLE_WEBKIT, IS_CHROME, IS_FIREFOX, IS_IOS, IS_SAFARI } from 'lexical';
8
9
  import { type CaretDirection, type EditorState, ElementNode, type Klass, type LexicalEditor, type LexicalNode, type NodeCaret, PointCaret, type SiblingCaret, SplitAtPointCaretNextOptions, StateConfig, ValueOrUpdater } from 'lexical';
9
10
  export { default as markSelection } from './markSelection';
10
11
  export { default as positionNodeOnRange } from './positionNodeOnRange';
11
12
  export { default as selectionAlwaysOnDisplay } from './selectionAlwaysOnDisplay';
12
13
  export { $findMatchingParent, $getAdjacentSiblingOrParentSiblingCaret, $splitNode, addClassNamesToElement, isBlockDomNode, isHTMLAnchorElement, isHTMLElement, isInlineDomNode, mergeRegister, removeClassNamesFromElement, } from 'lexical';
13
- export declare const CAN_USE_BEFORE_INPUT: boolean;
14
- export declare const CAN_USE_DOM: boolean;
15
- export declare const IS_ANDROID: boolean;
16
- export declare const IS_ANDROID_CHROME: boolean;
17
- export declare const IS_APPLE: boolean;
18
- export declare const IS_APPLE_WEBKIT: boolean;
19
- export declare const IS_CHROME: boolean;
20
- export declare const IS_FIREFOX: boolean;
21
- export declare const IS_IOS: boolean;
22
- export declare const IS_SAFARI: boolean;
14
+ export { CAN_USE_BEFORE_INPUT, CAN_USE_DOM, IS_ANDROID, IS_ANDROID_CHROME, IS_APPLE, IS_APPLE_WEBKIT, IS_CHROME, IS_FIREFOX, IS_IOS, IS_SAFARI, };
23
15
  /**
24
16
  * Returns true if the file type matches the types passed within the acceptableMimeTypes array, false otherwise.
25
17
  * The types passed must be strings and are CASE-SENSITIVE.
package/package.json CHANGED
@@ -8,35 +8,50 @@
8
8
  "utils"
9
9
  ],
10
10
  "license": "MIT",
11
- "version": "0.44.1-nightly.20260519.0",
12
- "main": "LexicalUtils.js",
13
- "types": "index.d.ts",
11
+ "version": "0.45.0",
12
+ "main": "./dist/LexicalUtils.js",
13
+ "types": "./dist/index.d.ts",
14
14
  "dependencies": {
15
- "@lexical/selection": "0.44.1-nightly.20260519.0",
16
- "lexical": "0.44.1-nightly.20260519.0"
15
+ "@lexical/internal": "0.45.0",
16
+ "@lexical/selection": "0.45.0",
17
+ "lexical": "0.45.0"
17
18
  },
18
19
  "repository": {
19
20
  "type": "git",
20
21
  "url": "git+https://github.com/facebook/lexical.git",
21
22
  "directory": "packages/lexical-utils"
22
23
  },
23
- "module": "LexicalUtils.mjs",
24
+ "module": "./dist/LexicalUtils.mjs",
24
25
  "sideEffects": false,
25
26
  "exports": {
26
27
  ".": {
28
+ "source": "./src/index.ts",
27
29
  "import": {
28
- "types": "./index.d.ts",
29
- "development": "./LexicalUtils.dev.mjs",
30
- "production": "./LexicalUtils.prod.mjs",
31
- "node": "./LexicalUtils.node.mjs",
32
- "default": "./LexicalUtils.mjs"
30
+ "types": "./dist/index.d.ts",
31
+ "development": "./dist/LexicalUtils.dev.mjs",
32
+ "production": "./dist/LexicalUtils.prod.mjs",
33
+ "node": "./dist/LexicalUtils.node.mjs",
34
+ "default": "./dist/LexicalUtils.mjs"
33
35
  },
34
36
  "require": {
35
- "types": "./index.d.ts",
36
- "development": "./LexicalUtils.dev.js",
37
- "production": "./LexicalUtils.prod.js",
38
- "default": "./LexicalUtils.js"
37
+ "types": "./dist/index.d.ts",
38
+ "development": "./dist/LexicalUtils.dev.js",
39
+ "production": "./dist/LexicalUtils.prod.js",
40
+ "default": "./dist/LexicalUtils.js"
39
41
  }
40
42
  }
41
- }
43
+ },
44
+ "files": [
45
+ "dist",
46
+ "src",
47
+ "!src/__tests__",
48
+ "!src/__bench__",
49
+ "!src/__mocks__",
50
+ "!src/**/*.test.ts",
51
+ "!src/**/*.test.tsx",
52
+ "!src/**/*.bench.ts",
53
+ "!src/**/*.bench.tsx",
54
+ "README.md",
55
+ "LICENSE"
56
+ ]
42
57
  }