@lexical/extension 0.51.0 → 0.51.1-nightly.20260921.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.
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- import{$isDecoratorNode as e,$isElementNode as t,registerEventListeners as n,stopLexicalPropagation as r,$getRoot as l,$createParagraphNode as i}from"lexical";import{namedSignals as o}from"@lexical/extension/namedSignals";import{effect as s}from"@lexical/extension/signals";function u(n){return!!e(n)||!(!t(n)||!n.isShadowRoot())}function a(e,t,n,r){return!!e.isEditable()&&(n.target===t&&e.read("latest",()=>{const t=l().getLastChild();if(null===t)return!1;const i=e.getElementByKey(t.getKey());return null!==i&&(!(n.clientY<=i.getBoundingClientRect().bottom)&&r(t))}))}const c={build:(e,t)=>o(t),config:{$shouldInsertAfter:u,disabled:!1},name:"@lexical/ClickAfterLastBlock",register:(e,t,o)=>s(()=>{const t=o.getOutput();if(!t.disabled.value)return e.registerRootListener(o=>{if(null===o)return;return n(o,{click:n=>{a(e,o,n,t.$shouldInsertAfter.peek())&&(n.preventDefault(),r(n),e.update(()=>{const e=l().getLastChild();if(null===e)return;if(!t.$shouldInsertAfter.peek()(e))return;const n=i();e.insertAfter(n),n.select()}))},mousedown:n=>{a(e,o,n,t.$shouldInsertAfter.peek())&&n.preventDefault()}},!0)})})};export{u as $defaultShouldInsertAfter,c as ClickAfterLastBlockExtension};
9
+ import{$isDecoratorNode as e,$isElementNode as t,registerEventListeners as n,stopLexicalPropagation as r,$getRoot as l,$createParagraphNode as i}from"lexical";import{namedSignals as o}from"@lexical/extension/namedSignals";import{effect as s}from"@lexical/extension/signals";function u(n){return!!e(n)||!(!t(n)||!n.isShadowRoot())}function a(e,t,n,r){return!!e.isEditable()&&n.target===t&&e.read("latest",()=>{const t=l().getLastChild();if(null===t)return!1;const i=e.getElementByKey(t.getKey());return null!==i&&!(n.clientY<=i.getBoundingClientRect().bottom)&&r(t)})}const c={build:(e,t)=>o(t),config:{$shouldInsertAfter:u,disabled:!1},name:"@lexical/ClickAfterLastBlock",register:(e,t,o)=>s(()=>{const t=o.getOutput();if(!t.disabled.value)return e.registerRootListener(o=>{if(null!==o)return n(o,{click:n=>{a(e,o,n,t.$shouldInsertAfter.peek())&&(n.preventDefault(),r(n),e.update(()=>{const e=l().getLastChild();if(null===e)return;if(!t.$shouldInsertAfter.peek()(e))return;const n=i();e.insertAfter(n),n.select()}))},mousedown:n=>{a(e,o,n,t.$shouldInsertAfter.peek())&&n.preventDefault()}},!0)})})};export{u as $defaultShouldInsertAfter,c as ClickAfterLastBlockExtension};
@@ -337,7 +337,7 @@ function deserializeEditorStateFamily(family, editor) {
337
337
  let node = null;
338
338
  try {
339
339
  node = $buildNodeVersion(version.json, editor);
340
- } catch (_unused) {
340
+ } catch {
341
341
  // A version that no longer rebuilds costs the states that reference
342
342
  // it, which the caller reports; the rest of the family is still good.
343
343
  versions.push(null);
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- import{$isElementNode as t,$parseSerializedNode as e,$getRoot as n,$createNodeSelection as o,$createRangeSelection as r,$isRangeSelection as s,$isNodeSelection as i,HISTORY_MERGE_TAG as l}from"lexical";import{EditorStateExtension as u}from"@lexical/extension/EditorStateExtension";import{getPeerDependencyFromEditor as a}from"@lexical/extension/getPeerDependencyFromEditor";import{LexicalBuilder as c}from"@lexical/extension/LexicalBuilder";import{RootElementExtension as f}from"@lexical/extension/RootElementExtension";import{signal as y,effect as p}from"@lexical/extension/signals";import{WatchEditableExtension as d}from"@lexical/extension/WatchEditableExtension";const m={root:{children:[],direction:null,format:"",indent:0,type:"root",version:1}};function _(e){const n=e.exportJSON();delete n.children,delete n.$slots;const o={json:n,key:e.__key,next:e.__next,parent:e.__parent,prev:e.__prev};t(e)&&(o.first=e.__first,o.last=e.__last,o.size=e.__size);const{__slotHost:r,__slots:s}=e;return null!=s&&(o.slots=Array.from(s)),null!=r&&(o.slotHost=r),o}function h(t){const e=new Map,n=[],o=t.map(t=>t.read(()=>{const o=[];for(const r of t._nodeMap.values()){let t=e.get(r);void 0===t&&(t=n.length,e.set(r,t),n.push(_(r))),o.push(t)}return{nodes:o,selection:(r=t._selection,s(r)?{anchor:{key:r.anchor.key,offset:r.anchor.offset,type:r.anchor.type},focus:{key:r.focus.key,offset:r.focus.offset,type:r.focus.type},format:r.format,style:r.style,type:"range"}:i(r)?{keys:Array.from(r._nodes),type:"node"}:null)};var r}));return{nodes:n,states:o}}function v(t){return null!=t&&"object"==typeof t}function g(t){return null==t||"string"==typeof t}function k(t){if(!v(t))return!1;const{first:e,json:n,key:o,last:r,next:s,parent:i,prev:l,size:u,slotHost:a,slots:c}=t;return v(n)&&"string"==typeof n.type&&"string"==typeof o&&g(i)&&g(l)&&g(s)&&g(e)&&g(r)&&(void 0===u||"number"==typeof u)&&g(a)&&(void 0===c||Array.isArray(c)&&c.every(t=>Array.isArray(t)&&2===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]))}function x(t){return v(t)&&"string"==typeof t.key&&"number"==typeof t.offset&&("text"===t.type||"element"===t.type)}function S(t){if(!v(t))return!1;const{nodes:e,states:n}=t;return Array.isArray(e)&&Array.isArray(n)&&e.every(k)&&n.every(t=>v(t)&&Array.isArray(t.nodes)&&t.nodes.every(t=>"number"==typeof t&&t>=0&&t<e.length)&&function(t){return null==t||!!v(t)&&("node"===t.type?Array.isArray(t.keys)&&t.keys.every(t=>"string"==typeof t):"range"===t.type&&x(t.anchor)&&x(t.focus)&&"number"==typeof t.format&&"string"==typeof t.style)}(t.selection))}function b(t,o){if("root"!==t.type)return e(t);let r;if(o.parseEditorState({root:t},()=>{r=n()}),void 0===r)throw new Error("editorStateFamily: the root version did not parse");return r}function E(e,n){const s=[],i=new Map;let l=!1,u=!1;const a=n.parseEditorState(m,()=>{for(const t of e.nodes){let e=null;try{e=b(t.json,n)}catch(t){s.push(null);continue}const o=i.get(t.key);void 0===o?i.set(t.key,e.__key):e.__key=o,s.push(e)}const o=t=>null===t?null:i.get(t)??null;for(const[n,r]of e.nodes.entries()){const e=s[n];if(null===e)continue;e.__parent=o(r.parent),e.__prev=o(r.prev),e.__next=o(r.next),t(e)&&(e.__first=o(r.first??null),e.__last=o(r.last??null),e.__size=r.size??0);const i=e;void 0!==r.slots&&(l=!0,i.__slots=new Map(r.slots.flatMap(([t,e])=>{const n=o(e);return null===n?[]:[[t,n]]}))),void 0!==r.slotHost&&(i.__slotHost=o(r.slotHost))}u=!0});return u?e.states.map(t=>{const e=new Map;for(const n of t.nodes){const t=s[n];if(null==t)return null;e.set(t.__key,t)}if(!e.has("root"))return null;const n=a.clone(function(t,e){if(null==t)return null;if("node"===t.type){const n=o();for(const o of t.keys){const t=e.get(o);if(void 0===t)return null;n._nodes.add(t)}return n}const n=e.get(t.anchor.key),s=e.get(t.focus.key);if(void 0===n||void 0===s)return null;const i=r();return i.anchor.key=n,i.anchor.offset=t.anchor.offset,i.anchor.type=t.anchor.type,i.focus.key=s,i.focus.offset=t.focus.offset,i.focus.type=t.focus.type,i.format=t.format,i.style=t.style,i}(t.selection,i));return n._nodeMap=e,n._slotsUsed=l,n._parsed=!1,n}):e.states.map(()=>null)}function A(t,e){return function(t,e){const n=`lexicalHMR:${encodeURIComponent(e)}`;return void 0!==t?`${n}:${encodeURIComponent(t)}`:n}(""===e?void 0:e,M(t)?t._config.namespace:"")}function M(t){const e=c.maybeFromEditor(t);if(!e)return!1;for(const n of e.extensionNameMap.values()){const{namespace:e}=n.extension;if(e&&e===t._config.namespace)return!0}return null!==t._parentEditor&&M(t._parentEditor)}function w(t,e){return t.data[e]}function H(t){if(null==t||"object"!=typeof t)return!1;const e=t,n=t=>Object.prototype.hasOwnProperty.call(e,t);return n("editable")&&n("editorState")&&"boolean"==typeof e.editable&&function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.toJSON&&"function"==typeof t.isEmpty}(e.editorState)}const j={afterRegistration(t,{hot:e,id:n},o){if(!e)return()=>{};const r=A(t,n),s=a(t,"@lexical/history/History");let i=!1;const c=w(e,r);if(H(c))try{t.setEditable(c.editable);const e="function"==typeof c.serialize?c.serialize():null;if(function(t){if(null==t||"object"!=typeof t)return!1;const{family:e,history:n}=t;if(!S(e))return!1;if(null==n)return!0;const o=t=>"number"==typeof t&&t>=0&&t<e.states.length,{current:r,redoStack:s,undoStack:i}=n;return(null===r||o(r))&&Array.isArray(s)&&s.every(o)&&Array.isArray(i)&&i.every(o)}(e)){const n=E(e.family,t),o=n[0];null==o||o.isEmpty()||(o._parsed=!0,t.setEditorState(o,{tag:l}),null!=e.history&&s&&(s.output.historyState.value=function(t,e,n){const o=t=>{const o=e[t];return null==o||o.isEmpty()?null:{editor:n,editorState:o}},r=t=>t.map(o).filter(t=>null!==t),s=null===t.current?null:o(t.current),i=r(t.undoStack);return{current:s,redoStack:r(t.redoStack),undoStack:i}}(e.history,n,t)),i=!0)}else;}catch(t){}i&&o.getInitResult().restoreCount.value++;const y=o.getDependency(u).output,m=o.getDependency(d).output,_=o.getDependency(f).output;let v=null;return p(()=>{const n=y.value,o=m.value,i=null!==_.value,l=w(e,r);if(null!==v&&v.editorState===n&&v.editable===o)return void(H(l)&&l.owner===t&&(l.mounted=i));v={editable:o,editorState:n};const u={...(n.isEmpty()&&H(l)?l:null)??{editorState:n,serialize:()=>function(t,e,n){const o=[e],r=e=>e.editor===t,s=t=>o.push(t.editorState)-1,i=t=>t.filter(r).map(s),l=n?{current:n.current&&r(n.current)?s(n.current):null,redoStack:i(n.redoStack),undoStack:i(n.undoStack)}:null;return{family:h(o),history:l}}(t,n,s?s.output.historyState.peek():null)},editable:o,mounted:i,owner:t};e.data[r]=u})},build:(t,e,n)=>n.getInitResult(),config:{hot:null},dependencies:[u,f,d],init:()=>({restoreCount:y(0)}),name:"@lexical/extension/HMR"};export{j as HMRExtension};
9
+ import{$isElementNode as t,$parseSerializedNode as e,$getRoot as n,$createNodeSelection as o,$createRangeSelection as r,$isRangeSelection as s,$isNodeSelection as i,HISTORY_MERGE_TAG as l}from"lexical";import{EditorStateExtension as u}from"@lexical/extension/EditorStateExtension";import{getPeerDependencyFromEditor as a}from"@lexical/extension/getPeerDependencyFromEditor";import{LexicalBuilder as c}from"@lexical/extension/LexicalBuilder";import{RootElementExtension as f}from"@lexical/extension/RootElementExtension";import{signal as y,effect as p}from"@lexical/extension/signals";import{WatchEditableExtension as d}from"@lexical/extension/WatchEditableExtension";const m={root:{children:[],direction:null,format:"",indent:0,type:"root",version:1}};function _(e){const n=e.exportJSON();delete n.children,delete n.$slots;const o={json:n,key:e.__key,next:e.__next,parent:e.__parent,prev:e.__prev};t(e)&&(o.first=e.__first,o.last=e.__last,o.size=e.__size);const{__slotHost:r,__slots:s}=e;return null!=s&&(o.slots=Array.from(s)),null!=r&&(o.slotHost=r),o}function h(t){const e=new Map,n=[],o=t.map(t=>t.read(()=>{const o=[];for(const r of t._nodeMap.values()){let t=e.get(r);void 0===t&&(t=n.length,e.set(r,t),n.push(_(r))),o.push(t)}return{nodes:o,selection:(r=t._selection,s(r)?{anchor:{key:r.anchor.key,offset:r.anchor.offset,type:r.anchor.type},focus:{key:r.focus.key,offset:r.focus.offset,type:r.focus.type},format:r.format,style:r.style,type:"range"}:i(r)?{keys:Array.from(r._nodes),type:"node"}:null)};var r}));return{nodes:n,states:o}}function v(t){return null!=t&&"object"==typeof t}function g(t){return null==t||"string"==typeof t}function k(t){if(!v(t))return!1;const{first:e,json:n,key:o,last:r,next:s,parent:i,prev:l,size:u,slotHost:a,slots:c}=t;return v(n)&&"string"==typeof n.type&&"string"==typeof o&&g(i)&&g(l)&&g(s)&&g(e)&&g(r)&&(void 0===u||"number"==typeof u)&&g(a)&&(void 0===c||Array.isArray(c)&&c.every(t=>Array.isArray(t)&&2===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]))}function x(t){return v(t)&&"string"==typeof t.key&&"number"==typeof t.offset&&("text"===t.type||"element"===t.type)}function S(t,o){if("root"!==t.type)return e(t);let r;if(o.parseEditorState({root:t},()=>{r=n()}),void 0===r)throw new Error("editorStateFamily: the root version did not parse");return r}function b(t,e){return function(t,e){const n=`lexicalHMR:${encodeURIComponent(e)}`;return void 0!==t?`${n}:${encodeURIComponent(t)}`:n}(""===e?void 0:e,E(t)?t._config.namespace:"")}function E(t){const e=c.maybeFromEditor(t);if(!e)return!1;for(const n of e.extensionNameMap.values()){const{namespace:e}=n.extension;if(e&&e===t._config.namespace)return!0}return null!==t._parentEditor&&E(t._parentEditor)}function A(t,e){return t.data[e]}function M(t){if(null==t||"object"!=typeof t)return!1;const e=t,n=t=>Object.prototype.hasOwnProperty.call(e,t);return n("editable")&&n("editorState")&&"boolean"==typeof e.editable&&function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.toJSON&&"function"==typeof t.isEmpty}(e.editorState)}const w={afterRegistration(e,{hot:n,id:s},i){if(!n)return()=>{};const c=b(e,s),y=a(e,"@lexical/history/History");let _=!1;const g=A(n,c);if(M(g))try{e.setEditable(g.editable);const n="function"==typeof g.serialize?g.serialize():null;if(function(t){if(null==t||"object"!=typeof t)return!1;const{family:e,history:n}=t;if(!function(t){if(!v(t))return!1;const{nodes:e,states:n}=t;return Array.isArray(e)&&Array.isArray(n)&&e.every(k)&&n.every(t=>v(t)&&Array.isArray(t.nodes)&&t.nodes.every(t=>"number"==typeof t&&t>=0&&t<e.length)&&function(t){return null==t||!!v(t)&&("node"===t.type?Array.isArray(t.keys)&&t.keys.every(t=>"string"==typeof t):"range"===t.type&&x(t.anchor)&&x(t.focus)&&"number"==typeof t.format&&"string"==typeof t.style)}(t.selection))}(e))return!1;if(null==n)return!0;const o=t=>"number"==typeof t&&t>=0&&t<e.states.length,{current:r,redoStack:s,undoStack:i}=n;return(null===r||o(r))&&Array.isArray(s)&&s.every(o)&&Array.isArray(i)&&i.every(o)}(n)){const s=function(e,n){const s=[],i=new Map;let l=!1,u=!1;const a=n.parseEditorState(m,()=>{for(const t of e.nodes){let e=null;try{e=S(t.json,n)}catch{s.push(null);continue}const o=i.get(t.key);void 0===o?i.set(t.key,e.__key):e.__key=o,s.push(e)}const o=t=>null===t?null:i.get(t)??null;for(const[n,r]of e.nodes.entries()){const e=s[n];if(null===e)continue;e.__parent=o(r.parent),e.__prev=o(r.prev),e.__next=o(r.next),t(e)&&(e.__first=o(r.first??null),e.__last=o(r.last??null),e.__size=r.size??0);const i=e;void 0!==r.slots&&(l=!0,i.__slots=new Map(r.slots.flatMap(([t,e])=>{const n=o(e);return null===n?[]:[[t,n]]}))),void 0!==r.slotHost&&(i.__slotHost=o(r.slotHost))}u=!0});return u?e.states.map(t=>{const e=new Map;for(const n of t.nodes){const t=s[n];if(null==t)return null;e.set(t.__key,t)}if(!e.has("root"))return null;const n=a.clone(function(t,e){if(null==t)return null;if("node"===t.type){const n=o();for(const o of t.keys){const t=e.get(o);if(void 0===t)return null;n._nodes.add(t)}return n}const n=e.get(t.anchor.key),s=e.get(t.focus.key);if(void 0===n||void 0===s)return null;const i=r();return i.anchor.key=n,i.anchor.offset=t.anchor.offset,i.anchor.type=t.anchor.type,i.focus.key=s,i.focus.offset=t.focus.offset,i.focus.type=t.focus.type,i.format=t.format,i.style=t.style,i}(t.selection,i));return n._nodeMap=e,n._slotsUsed=l,n._parsed=!1,n}):e.states.map(()=>null)}(n.family,e),i=s[0];null==i||i.isEmpty()||(i._parsed=!0,e.setEditorState(i,{tag:l}),null!=n.history&&y&&(y.output.historyState.value=function(t,e,n){const o=t=>{const o=e[t];return null==o||o.isEmpty()?null:{editor:n,editorState:o}},r=t=>t.map(o).filter(t=>null!==t),s=null===t.current?null:o(t.current),i=r(t.undoStack);return{current:s,redoStack:r(t.redoStack),undoStack:i}}(n.history,s,e)),_=!0)}}catch(t){}_&&i.getInitResult().restoreCount.value++;const E=i.getDependency(u).output,w=i.getDependency(d).output,H=i.getDependency(f).output;let j=null;return p(()=>{const t=E.value,o=w.value,r=null!==H.value,s=A(n,c);if(null!==j&&j.editorState===t&&j.editable===o)return void(M(s)&&s.owner===e&&(s.mounted=r));j={editable:o,editorState:t};const i={...(t.isEmpty()&&M(s)?s:null)??{editorState:t,serialize:()=>function(t,e,n){const o=[e],r=e=>e.editor===t,s=t=>o.push(t.editorState)-1,i=t=>t.filter(r).map(s),l=n?{current:n.current&&r(n.current)?s(n.current):null,redoStack:i(n.redoStack),undoStack:i(n.undoStack)}:null;return{family:h(o),history:l}}(e,t,y?y.output.historyState.peek():null)},editable:o,mounted:r,owner:e};n.data[c]=i})},build:(t,e,n)=>n.getInitResult(),config:{hot:null},dependencies:[u,f,d],init:()=>({restoreCount:y(0)}),name:"@lexical/extension/HMR"};export{w as HMRExtension};
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- import{$insertNodeToNearestRoot as e}from"@lexical/utils";import{createCommand as t,DecoratorNode as n,$getDocument as o,addClassNamesToElement as r,$create as i,mergeRegister as s,$getSelection as l,$isRangeSelection as c,COMMAND_PRIORITY_EDITOR as d,CLICK_COMMAND as u,isDOMNode as a,$getNodeFromDOMNode as f,COMMAND_PRIORITY_LOW as m,removeClassNamesFromElement as g,$isNodeSelection as x,$createNodeSelection as p,$setSelection as h}from"lexical";import{EditorStateExtension as S}from"@lexical/extension/EditorStateExtension";import{NodeSelectionExtension as N}from"@lexical/extension/NodeSelectionExtension";import{signal as y,batch as E,effect as M}from"@lexical/extension/signals";const v=/* @__PURE__ */t("INSERT_HORIZONTAL_RULE_COMMAND");class O extends n{$config(){return this.config("horizontalrule",{extends:n,importDOM:{hr:()=>({conversion:D,priority:0})}})}exportDOM(){return{element:o().createElement("hr")}}createDOM(e){const t=o().createElement("hr");return r(t,e.theme.hr),t}getTextContent(){return"\n"}isInline(){return!1}updateDOM(){return!1}}function D(){return{node:C()}}function C(){return i(O)}function K(e){return e instanceof O}const R={dependencies:[S,N],name:"@lexical/extension/HorizontalRule",nodes:()=>[O],register(t,n,o){const{watchNodeKey:i}=o.getDependency(N).output,S=y({nodeSelections:new Map}),D=t._config.theme.hrSelected??"selected";return s(t.registerCommand(v,t=>{const n=l();if(!c(n))return!1;if(null!==n.focus.getNode()){const t=C();e(t)}return!0},d),t.registerCommand(u,e=>{if(a(e.target)){const t=f(e.target);if(K(t))return function(e,t=!1){const n=l(),o=e.isSelected(),r=e.getKey();let i;t&&x(n)?i=n:(i=p(),h(i)),o?i.delete(r):i.add(r)}(t,e.shiftKey),!0}return!1},m),t.registerMutationListener(O,(e,n)=>{E(()=>{let n=!1;const{nodeSelections:o}=S.peek();for(const[r,s]of e.entries())if("destroyed"===s)o.delete(r),n=!0;else{const e=o.get(r),s=t.getElementByKey(r);e?e.domNode.value=s:(n=!0,o.set(r,{domNode:y(s),selectedSignal:i(r)}))}n&&(S.value={nodeSelections:o})})}),M(()=>{const e=[];for(const{domNode:t,selectedSignal:n}of S.value.nodeSelections.values())e.push(M(()=>{const e=t.value;if(e){n.value?r(e,D):g(e,D)}}));return s(...e)}))}};export{C as $createHorizontalRuleNode,K as $isHorizontalRuleNode,R as HorizontalRuleExtension,O as HorizontalRuleNode,v as INSERT_HORIZONTAL_RULE_COMMAND};
9
+ import{$insertNodeToNearestRoot as e}from"@lexical/utils";import{createCommand as t,DecoratorNode as n,$getDocument as o,addClassNamesToElement as r,$create as i,mergeRegister as s,$getSelection as l,$isRangeSelection as c,COMMAND_PRIORITY_EDITOR as d,CLICK_COMMAND as u,isDOMNode as a,$getNodeFromDOMNode as m,COMMAND_PRIORITY_LOW as f,removeClassNamesFromElement as g,$isNodeSelection as x,$createNodeSelection as p,$setSelection as h}from"lexical";import{EditorStateExtension as S}from"@lexical/extension/EditorStateExtension";import{NodeSelectionExtension as N}from"@lexical/extension/NodeSelectionExtension";import{signal as y,batch as E,effect as M}from"@lexical/extension/signals";const v=/* @__PURE__ */t("INSERT_HORIZONTAL_RULE_COMMAND");class O extends n{$config(){return this.config("horizontalrule",{extends:n,importDOM:{hr:()=>({conversion:D,priority:0})}})}exportDOM(){return{element:o().createElement("hr")}}createDOM(e){const t=o().createElement("hr");return r(t,e.theme.hr),t}getTextContent(){return"\n"}isInline(){return!1}updateDOM(){return!1}}function D(){return{node:C()}}function C(){return i(O)}function K(e){return e instanceof O}const R={dependencies:[S,N],name:"@lexical/extension/HorizontalRule",nodes:()=>[O],register(t,n,o){const{watchNodeKey:i}=o.getDependency(N).output,S=y({nodeSelections:new Map}),D=t._config.theme.hrSelected??"selected";return s(t.registerCommand(v,t=>{const n=l();if(!c(n))return!1;if(null!==n.focus.getNode()){const t=C();e(t)}return!0},d),t.registerCommand(u,e=>{if(a(e.target)){const t=m(e.target);if(K(t))return function(e,t=!1){const n=l(),o=e.isSelected(),r=e.getKey();let i;t&&x(n)?i=n:(i=p(),h(i)),o?i.delete(r):i.add(r)}(t,e.shiftKey),!0}return!1},f),t.registerMutationListener(O,(e,n)=>{E(()=>{let n=!1;const{nodeSelections:o}=S.peek();for(const[r,s]of e.entries())if("destroyed"===s)o.delete(r),n=!0;else{const e=o.get(r),s=t.getElementByKey(r);e?e.domNode.value=s:(n=!0,o.set(r,{domNode:y(s),selectedSignal:i(r)}))}n&&(S.value={nodeSelections:o})})}),M(()=>{const e=[];for(const{domNode:t,selectedSignal:n}of S.value.nodeSelections.values())e.push(M(()=>{const e=t.value;e&&(n.value?r(e,D):g(e,D))}));return s(...e)}))}};export{C as $createHorizontalRuleNode,K as $isHorizontalRuleNode,R as HorizontalRuleExtension,O as HorizontalRuleNode,v as INSERT_HORIZONTAL_RULE_COMMAND};
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- import{COMPOSITION_START_COMMAND as e,$getSelection as t,$isRangeSelection as n,COMMAND_PRIORITY_BEFORE_EDITOR as o,$getNodeByKey as r,$isTextNode as l,COMPOSITION_START_TAG as i,registerEventListener as s,mergeRegister as u}from"lexical";import{effect as a,signal as c}from"@lexical/extension/signals";const m={build:e=>({composingTextNode:c(null),compositionKey:c(null)}),name:"@lexical/extension/IME",register(c,m,d){const{compositionKey:g,composingTextNode:p}=d.getOutput(),x=c.registerCommand(e,()=>{const e=t();return n(e)&&(g.value=e.anchor.key),!1},o),v=a(()=>{const e=g.value;p.value=null!==e?c.read("latest",()=>{const t=r(e);return l(t)?t:null}):null}),f=c.registerUpdateListener(({tags:e,editorState:o})=>{e.has(i)&&o.read(()=>{const e=t();if(!n(e))return;const o=e.anchor.getNode();l(o)&&(p.value=o)})}),h=c.registerRootListener(e=>{if(null===e)return void(g.value=null);return s(e,"compositionend",()=>{g.value=null})});return u(x,v,f,h)}};export{m as IMEExtension};
9
+ import{COMPOSITION_START_COMMAND as e,$getSelection as t,$isRangeSelection as n,COMMAND_PRIORITY_BEFORE_EDITOR as o,$getNodeByKey as l,$isTextNode as r,COMPOSITION_START_TAG as i,registerEventListener as s,mergeRegister as u}from"lexical";import{effect as a,signal as c}from"@lexical/extension/signals";const m={build:e=>({composingTextNode:c(null),compositionKey:c(null)}),name:"@lexical/extension/IME",register(c,m,d){const{compositionKey:g,composingTextNode:p}=d.getOutput(),x=c.registerCommand(e,()=>{const e=t();return n(e)&&(g.value=e.anchor.key),!1},o),v=a(()=>{const e=g.value;p.value=null!==e?c.read("latest",()=>{const t=l(e);return r(t)?t:null}):null}),f=c.registerUpdateListener(({tags:e,editorState:o})=>{e.has(i)&&o.read(()=>{const e=t();if(!n(e))return;const o=e.anchor.getNode();r(o)&&(p.value=o)})}),h=c.registerRootListener(e=>{if(null!==e)return s(e,"compositionend",()=>{g.value=null});g.value=null});return u(x,v,f,h)}};export{m as IMEExtension};
@@ -33,9 +33,9 @@ function formatDevErrorMessage(message) {
33
33
  */
34
34
 
35
35
  /**
36
- * `"0.51.0+dev.esm"` is statically replaced with the build-specific
36
+ * `"0.51.1-nightly.20260921.0+dev.esm"` is statically replaced with the build-specific
37
37
  * version string in a Rollup build, and a consumer's bundler `define` can
38
- * inject it the same way — so the exact `"0.51.0+dev.esm"` member
38
+ * inject it the same way — so the exact `"0.51.1-nightly.20260921.0+dev.esm"` member
39
39
  * expression must be preserved for that substitution to match. Reading it
40
40
  * inside a try/catch lets the source be consumed directly (via the `source`
41
41
  * export condition) in a browser bundle, where `process` is undefined and
@@ -53,8 +53,8 @@ function formatDevErrorMessage(message) {
53
53
  function readLexicalVersion() {
54
54
  let envLexicalVersion;
55
55
  try {
56
- envLexicalVersion = "0.51.0+dev.esm";
57
- } catch (_unused) {
56
+ envLexicalVersion = "0.51.1-nightly.20260921.0+dev.esm";
57
+ } catch {
58
58
  // `process` is not defined in some browser bundles; use the fallback.
59
59
  }
60
60
  return envLexicalVersion ?? '"<unknown>+source"';
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- import{shallowMergeConfig as t,createEditor as e,mergeRegister as n}from"lexical";import{getNodeConfig as i}from"@lexical/extension/config";import{InitialStateExtension as s}from"@lexical/extension/InitialStateExtension";function o(t,...e){const n=new URL("https://lexical.dev/docs/error"),i=new URLSearchParams;i.append("code",t);for(const t of e)i.append("v",t);throw n.search=i.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 r(){let t;try{t="0.51.0+prod.esm"}catch(t){}return t??'"<unknown>+source"'}const a=/* @__PURE__ */r(),c=new Set(["__proto__","constructor","prototype"]);function d(t,e){if(t&&e&&!Array.isArray(e)&&"object"==typeof t&&"object"==typeof e){const n=t,i=e;for(const t in i)!c.has(t)&&Object.prototype.hasOwnProperty.call(i,t)&&(n[t]=d(n[t],i[t]));return t}return e}const g=0,h=1,f=2,u=3,p=4,l=5,m=6,x=7;function E(t){return t.id===g}function S(t){return t.id===f}function b(t){return function(t){return t.id===h}(t)||o(305,String(t.id),String(h)),Object.assign(t,{id:f})}const y=new Set;class R{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,e){this.builder=t,this.extension=e,this.configs=new Set,this.state={id:g}}mergeConfigs(){let e=this.extension.config||{};const n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):t;for(const t of this.configs)e=n(e,t);return e}init(t){const e=this.state;S(e)||o(306,String(e.id));const n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},i={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},s=function(t,e,n){return Object.assign(t,{config:e,id:u,registerState:n})}(e,this.mergeConfigs(),n);let r;this.state=s,this.extension.init&&(r=this.extension.init(t,s.config,n)),this.state=function(t,e,n){return Object.assign(t,{id:p,initResult:e,registerState:n})}(s,r,i)}build(t){const e=this.state;let n;e.id!==p&&o(307,String(e.id),String(l)),this.extension.build&&(n=this.extension.build(t,e.config,e.registerState));const i={...e.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(t,e,n){return Object.assign(t,{id:l,output:e,registerState:n})}(e,n,i)}register(t,e){this._signal=e;const n=this.state;n.id!==l&&o(308,String(n.id),String(l));const i=this.extension.register&&this.extension.register(t,n.config,n.registerState);return this.state=function(t){return Object.assign(t,{id:m})}(n),()=>{const t=this.state;t.id!==x&&o(309,String(n.id),String(x)),this.state=function(t){return Object.assign(t,{id:l})}(t),i&&i()}}afterRegistration(t){const e=this.state;let n;return e.id!==m&&o(310,String(e.id),String(m)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(t,e.config,e.registerState)),this.state=function(t){return Object.assign(t,{id:x})}(e),n}getSignal(){return void 0===this._signal&&o(311),this._signal}getInitResult(){void 0===this.extension.init&&o(312,this.extension.name);const t=this.state;return function(t){return t.id>=p}(t)||o(313,String(t.id),String(p)),t.initResult}getInitPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionInitDependency():void 0}getExtensionInitDependency(){const t=this.state;return function(t){return t.id>=u}(t)||o(314,String(t.id),String(u)),{config:t.config}}getPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionDependency():void 0}getInitDependency(t){const e=this.builder.getExtensionRep(t);return void 0===e&&o(315,this.extension.name,t.name),e.getExtensionInitDependency()}getDependency(t){const e=this.builder.getExtensionRep(t);return void 0===e&&o(315,this.extension.name,t.name),e.getExtensionDependency()}getState(){const t=this.state;return function(t){return t.id>=x}(t)||o(316,String(t.id),String(x)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||y}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([t])=>t)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){const t=this.state;(function(t){return t.id>=l})(t)||o(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}}const v=Symbol.for("@lexical/extension/LexicalBuilder");function N(...t){return O.fromExtensions(t).buildEditor()}function _(){}function w(t){throw t}function M(t){return Array.isArray(t)?t:[t]}const D=a;class O{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(t){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=D,this.roots=t;for(const e of t)this.addExtension(e)}static fromExtensions(t){const e=[M(s)];for(const n of t)e.push(M(n));return new O(e)}static maybeFromEditor(t){const e=t[v];return e&&(e.PACKAGE_VERSION!==D&&o(292,e.PACKAGE_VERSION,D),e instanceof O||o(293)),e}static fromEditor(t){const e=O.maybeFromEditor(t);return void 0===e&&o(294),e}constructEditor(){const{$initialEditorState:t,onError:n,onWarn:i,...s}=this.buildCreateEditorArgs(),o=Object.assign(e({...s,...n?{onError:t=>{n(t,o)}}:{},...i?{onWarn:t=>{i(t,o)}}:{}}),{[v]:this});for(const t of this.sortedExtensionReps())t.build(o);return o}buildEditor(){let t=_;function e(){try{t()}finally{t=_}}const i=Object.assign(this.constructEditor(),{dispose:e,[Symbol.dispose]:e});return t=n(this.registerEditor(i),()=>i.setRootElement(null)),i}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){const e=this.extensionNameMap.get(t.name);if(e)return e.extension!==t&&o(295,t.name),e}addEdge(t,e,n){const i=this.outgoingConfigEdges.get(t);if(i){const t=i.get(e);t?t.push(...n):i.set(e,n)}else this.outgoingConfigEdges.set(t,new Map([[e,n]]));const s=this.incomingEdges.get(e);s?s.add(t):this.incomingEdges.set(e,new Set([t]))}addExtension(t){void 0!==this._sortedExtensionReps&&o(296);const e=M(t),[n]=e;"string"!=typeof n.name&&o(297,typeof n.name);let i=this.extensionNameMap.get(n.name);if(void 0!==i&&i.extension!==n&&o(298,n.name),!i){i=new R(this,n),this.extensionNameMap.set(n.name,i);const t=this.conflicts.get(n.name);"string"==typeof t&&o(299,n.name,t);for(const t of n.conflictsWith||[])this.extensionNameMap.has(t)&&o(299,n.name,t),this.conflicts.set(t,n.name);for(const t of n.dependencies||[]){const e=M(t);this.addEdge(n.name,e[0].name,e.slice(1)),this.addExtension(e)}for(const[t,e]of n.peerDependencies||[])this.addEdge(n.name,t,e?[e]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const t=[],e=(n,i)=>{let s=n.state;if(S(s))return;const r=n.extension.name;var a;E(s)||o(300,r,i||"[unknown]"),E(a=s)||o(304,String(a.id),String(g)),s=Object.assign(a,{id:h}),n.state=s;const c=this.outgoingConfigEdges.get(r);if(c)for(const t of c.keys()){const n=this.extensionNameMap.get(t);n&&e(n,r)}s=b(s),n.state=s,t.push(n)};for(const t of this.extensionNameMap.values())E(t.state)&&e(t);for(const e of t)for(const[t,n]of this.outgoingConfigEdges.get(e.extension.name)||[])if(n.length>0){const e=this.extensionNameMap.get(t);if(e)for(const t of n)e.configs.add(t)}for(const[t,...e]of this.roots)if(e.length>0){const n=this.extensionNameMap.get(t.name);void 0===n&&o(301,t.name);for(const t of e)n.configs.add(t)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){const e=this.sortedExtensionReps(),i=new AbortController,s=[()=>i.abort()],o=i.signal;for(const n of e){const e=n.register(t,o);e&&s.push(e)}for(const n of e){const e=n.afterRegistration(t);e&&s.push(e)}return n(...s)}buildCreateEditorArgs(){const t={},e=new Set,n=new Map,s=new Map,r={},a={},c=this.sortedExtensionReps();for(const g of c){const{extension:c}=g;if(void 0!==c.onError&&(t.onError=c.onError),void 0!==c.onWarn&&(t.onWarn=c.onWarn),void 0!==c.disableEvents&&(t.disableEvents=c.disableEvents),void 0!==c.parentEditor&&(t.parentEditor=c.parentEditor),void 0!==c.editable&&(t.editable=c.editable),void 0!==c.namespace&&(t.namespace=c.namespace),void 0!==c.$initialEditorState&&(t.$initialEditorState=c.$initialEditorState),c.nodes)for(const t of i(c)){if("function"!=typeof t){const e=n.get(t.replace);e&&o(302,c.name,t.replace.name,e.extension.name),n.set(t.replace,g)}e.add(t)}if(c.html){if(c.html.export)for(const[t,e]of c.html.export.entries())s.set(t,e);c.html.import&&Object.assign(r,c.html.import)}c.theme&&d(a,c.theme)}Object.keys(a).length>0&&(t.theme=a),e.size&&(t.nodes=Array.from(e));const g=Object.keys(r).length>0,h=s.size>0;(g||h)&&(t.html={},g&&(t.html.import=r),h&&(t.html.export=s));for(const e of c)e.init(t);return t.onError||(t.onError=w),t}}export{O as LexicalBuilder,N as buildEditorFromExtensions,v as builderSymbol};
9
+ import{shallowMergeConfig as t,createEditor as e,mergeRegister as n}from"lexical";import{getNodeConfig as i}from"@lexical/extension/config";import{InitialStateExtension as s}from"@lexical/extension/InitialStateExtension";function o(t,...e){const n=new URL("https://lexical.dev/docs/error"),i=new URLSearchParams;i.append("code",t);for(const t of e)i.append("v",t);throw n.search=i.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 r(){let t;try{t="0.51.1-nightly.20260921.0+prod.esm"}catch{}return t??'"<unknown>+source"'}const a=/* @__PURE__ */r(),c=new Set(["__proto__","constructor","prototype"]);function d(t,e){if(t&&e&&!Array.isArray(e)&&"object"==typeof t&&"object"==typeof e){const n=t,i=e;for(const t in i)!c.has(t)&&Object.prototype.hasOwnProperty.call(i,t)&&(n[t]=d(n[t],i[t]));return t}return e}function g(t){return 0===t.id}function h(t){return 2===t.id}const f=new Set;class u{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,e){this.builder=t,this.extension=e,this.configs=new Set,this.state={id:0}}mergeConfigs(){let e=this.extension.config||{};const n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):t;for(const t of this.configs)e=n(e,t);return e}init(t){const e=this.state;h(e)||o(306,String(e.id));const n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},i={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},s=function(t,e,n){return Object.assign(t,{config:e,id:3,registerState:n})}(e,this.mergeConfigs(),n);let r;this.state=s,this.extension.init&&(r=this.extension.init(t,s.config,n)),this.state=function(t,e,n){return Object.assign(t,{id:4,initResult:e,registerState:n})}(s,r,i)}build(t){const e=this.state;let n;4!==e.id&&o(307,String(e.id),String(5)),this.extension.build&&(n=this.extension.build(t,e.config,e.registerState));const i={...e.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(t,e,n){return Object.assign(t,{id:5,output:e,registerState:n})}(e,n,i)}register(t,e){this._signal=e;const n=this.state;5!==n.id&&o(308,String(n.id),String(5));const i=this.extension.register&&this.extension.register(t,n.config,n.registerState);return this.state=function(t){return Object.assign(t,{id:6})}(n),()=>{const t=this.state;7!==t.id&&o(309,String(n.id),String(7)),this.state=function(t){return Object.assign(t,{id:5})}(t),i&&i()}}afterRegistration(t){const e=this.state;let n;return 6!==e.id&&o(310,String(e.id),String(6)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(t,e.config,e.registerState)),this.state=function(t){return Object.assign(t,{id:7})}(e),n}getSignal(){return void 0===this._signal&&o(311),this._signal}getInitResult(){void 0===this.extension.init&&o(312,this.extension.name);const t=this.state;return function(t){return t.id>=4}(t)||o(313,String(t.id),String(4)),t.initResult}getInitPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionInitDependency():void 0}getExtensionInitDependency(){const t=this.state;return function(t){return t.id>=3}(t)||o(314,String(t.id),String(3)),{config:t.config}}getPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionDependency():void 0}getInitDependency(t){const e=this.builder.getExtensionRep(t);return void 0===e&&o(315,this.extension.name,t.name),e.getExtensionInitDependency()}getDependency(t){const e=this.builder.getExtensionRep(t);return void 0===e&&o(315,this.extension.name,t.name),e.getExtensionDependency()}getState(){const t=this.state;return function(t){return t.id>=7}(t)||o(316,String(t.id),String(7)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||f}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([t])=>t)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){const t=this.state;(function(t){return t.id>=5})(t)||o(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}}const p=Symbol.for("@lexical/extension/LexicalBuilder");function l(...t){return b.fromExtensions(t).buildEditor()}function m(){}function x(t){throw t}function E(t){return Array.isArray(t)?t:[t]}const S=a;class b{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(t){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=S,this.roots=t;for(const e of t)this.addExtension(e)}static fromExtensions(t){const e=[E(s)];for(const n of t)e.push(E(n));return new b(e)}static maybeFromEditor(t){const e=t[p];return e&&(e.PACKAGE_VERSION!==S&&o(292,e.PACKAGE_VERSION,S),e instanceof b||o(293)),e}static fromEditor(t){const e=b.maybeFromEditor(t);return void 0===e&&o(294),e}constructEditor(){const{$initialEditorState:t,onError:n,onWarn:i,...s}=this.buildCreateEditorArgs(),o=Object.assign(e({...s,...n?{onError:t=>{n(t,o)}}:{},...i?{onWarn:t=>{i(t,o)}}:{}}),{[p]:this});for(const t of this.sortedExtensionReps())t.build(o);return o}buildEditor(){let t=m;function e(){try{t()}finally{t=m}}const i=Object.assign(this.constructEditor(),{dispose:e,[Symbol.dispose]:e});return t=n(this.registerEditor(i),()=>i.setRootElement(null)),i}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){const e=this.extensionNameMap.get(t.name);if(e)return e.extension!==t&&o(295,t.name),e}addEdge(t,e,n){const i=this.outgoingConfigEdges.get(t);if(i){const t=i.get(e);t?t.push(...n):i.set(e,n)}else this.outgoingConfigEdges.set(t,new Map([[e,n]]));const s=this.incomingEdges.get(e);s?s.add(t):this.incomingEdges.set(e,new Set([t]))}addExtension(t){void 0!==this._sortedExtensionReps&&o(296);const e=E(t),[n]=e;"string"!=typeof n.name&&o(297,typeof n.name);let i=this.extensionNameMap.get(n.name);if(void 0!==i&&i.extension!==n&&o(298,n.name),!i){i=new u(this,n),this.extensionNameMap.set(n.name,i);const t=this.conflicts.get(n.name);"string"==typeof t&&o(299,n.name,t);for(const t of n.conflictsWith||[])this.extensionNameMap.has(t)&&o(299,n.name,t),this.conflicts.set(t,n.name);for(const t of n.dependencies||[]){const e=E(t);this.addEdge(n.name,e[0].name,e.slice(1)),this.addExtension(e)}for(const[t,e]of n.peerDependencies||[])this.addEdge(n.name,t,e?[e]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const t=[],e=(n,i)=>{let s=n.state;if(h(s))return;const r=n.extension.name;var a;g(s)||o(300,r,i||"[unknown]"),g(a=s)||o(304,String(a.id),String(0)),s=Object.assign(a,{id:1}),n.state=s;const c=this.outgoingConfigEdges.get(r);if(c)for(const t of c.keys()){const n=this.extensionNameMap.get(t);n&&e(n,r)}s=function(t){return function(t){return 1===t.id}(t)||o(305,String(t.id),String(1)),Object.assign(t,{id:2})}(s),n.state=s,t.push(n)};for(const t of this.extensionNameMap.values())g(t.state)&&e(t);for(const e of t)for(const[t,n]of this.outgoingConfigEdges.get(e.extension.name)||[])if(n.length>0){const e=this.extensionNameMap.get(t);if(e)for(const t of n)e.configs.add(t)}for(const[t,...e]of this.roots)if(e.length>0){const n=this.extensionNameMap.get(t.name);void 0===n&&o(301,t.name);for(const t of e)n.configs.add(t)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){const e=this.sortedExtensionReps(),i=new AbortController,s=[()=>i.abort()],o=i.signal;for(const n of e){const e=n.register(t,o);e&&s.push(e)}for(const n of e){const e=n.afterRegistration(t);e&&s.push(e)}return n(...s)}buildCreateEditorArgs(){const t={},e=new Set,n=new Map,s=new Map,r={},a={},c=this.sortedExtensionReps();for(const g of c){const{extension:c}=g;if(void 0!==c.onError&&(t.onError=c.onError),void 0!==c.onWarn&&(t.onWarn=c.onWarn),void 0!==c.disableEvents&&(t.disableEvents=c.disableEvents),void 0!==c.parentEditor&&(t.parentEditor=c.parentEditor),void 0!==c.editable&&(t.editable=c.editable),void 0!==c.namespace&&(t.namespace=c.namespace),void 0!==c.$initialEditorState&&(t.$initialEditorState=c.$initialEditorState),c.nodes)for(const t of i(c)){if("function"!=typeof t){const e=n.get(t.replace);e&&o(302,c.name,t.replace.name,e.extension.name),n.set(t.replace,g)}e.add(t)}if(c.html){if(c.html.export)for(const[t,e]of c.html.export.entries())s.set(t,e);c.html.import&&Object.assign(r,c.html.import)}c.theme&&d(a,c.theme)}Object.keys(a).length>0&&(t.theme=a),e.size&&(t.nodes=Array.from(e));const g=Object.keys(r).length>0,h=s.size>0;(g||h)&&(t.html={},g&&(t.html.import=r),h&&(t.html.export=s));for(const e of c)e.init(t);return t.onError||(t.onError=x),t}}export{b as LexicalBuilder,l as buildEditorFromExtensions,p as builderSymbol};
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- import{$getSelection as e,$isRangeSelection as o,$getCaretRangeInDirection as i,$caretRangeFromSelection as n,$isTextPointCaret as t,$rewindSiblingCaret as r,$isSiblingCaret as s,$isLineBreakNode as l,$isChildCaret as c,$getSiblingCaret as a,$isElementNode as g,$normalizeCaret as u,$getChildCaret as f,$setSelectionFromCaretRange as d,$getCaretRange as m,$getEditor as p,getDOMSelection as x,$updateDOMSelection as h,$getPreviousSelection as w,mergeRegister as C,SELECTION_CHANGE_COMMAND as S,COMMAND_PRIORITY_BEFORE_CRITICAL as b,registerEventListeners as k,SKIP_SELECTION_FOCUS_TAG as v,SKIP_SCROLL_INTO_VIEW_TAG as F}from"lexical";import{namedSignals as N}from"@lexical/extension/namedSignals";import{effect as O}from"@lexical/extension/signals";const D=new Set([v,F]);const M={build:(e,o,i)=>N(o),config:{$fixFocusOverselection:function(){const C=e();if(o(C)&&!C.isCollapsed()){const e=i(n(C),"next");let o=e.focus;for(t(o)&&e.anchor.origin!==o.origin&&0===o.offset&&(o=r(o.getSiblingCaret())),s(o)&&e.anchor.origin!==o.origin&&l(o.origin)&&(o=r(o));c(o)&&e.anchor.origin!==o.origin;)o=r(a(o.origin,"next"));if(s(o)&&g(o.origin)&&(o=u(f(o.origin,"previous")).getFlipped()),o=u(o),!o.isSamePointCaret(e.focus)){const i=d(m(e.anchor,o)),n=p().getRootElement(),t=n&&x(n.ownerDocument.defaultView);t&&h(w(),i,p(),t,D,n)}}},dateNow:()=>Date.now(),disabled:!1,thresholdMsec:100},name:"@lexical/NormalizeTripleClickSelection",register:(e,o,i)=>O(()=>{const o=i.getOutput();if(!o.disabled.value)return e.registerRootListener(i=>{if(!i)return;let n=0;const t=e=>{if(e?e.detail>2:n>0){const i=o.dateNow.peek()();n=e&&"mousedown"===e.type||i-n<=o.thresholdMsec.peek()?i:0}return n};return C(e.registerCommand(S,()=>(t(null)&&(n=0,o.$fixFocusOverselection.peek()()),!1),b),k(i,{mousedown:t,mouseup:t},!0))})})};export{M as NormalizeTripleClickSelectionExtension};
9
+ import{$getSelection as e,$isRangeSelection as i,$getCaretRangeInDirection as o,$caretRangeFromSelection as n,$isTextPointCaret as t,$rewindSiblingCaret as r,$isSiblingCaret as s,$isLineBreakNode as l,$isChildCaret as c,$getSiblingCaret as a,$isElementNode as g,$normalizeCaret as u,$getChildCaret as f,$setSelectionFromCaretRange as d,$getCaretRange as m,$getEditor as p,getDOMSelection as x,$updateDOMSelection as h,$getPreviousSelection as w,mergeRegister as C,SELECTION_CHANGE_COMMAND as S,COMMAND_PRIORITY_BEFORE_CRITICAL as b,registerEventListeners as k,SKIP_SELECTION_FOCUS_TAG as v,SKIP_SCROLL_INTO_VIEW_TAG as F}from"lexical";import{namedSignals as N}from"@lexical/extension/namedSignals";import{effect as O}from"@lexical/extension/signals";const D=new Set([v,F]),M={build:(e,i,o)=>N(i),config:{$fixFocusOverselection:function(){const C=e();if(i(C)&&!C.isCollapsed()){const e=o(n(C),"next");let i=e.focus;for(t(i)&&e.anchor.origin!==i.origin&&0===i.offset&&(i=r(i.getSiblingCaret())),s(i)&&e.anchor.origin!==i.origin&&l(i.origin)&&(i=r(i));c(i)&&e.anchor.origin!==i.origin;)i=r(a(i.origin,"next"));if(s(i)&&g(i.origin)&&(i=u(f(i.origin,"previous")).getFlipped()),i=u(i),!i.isSamePointCaret(e.focus)){const o=d(m(e.anchor,i)),n=p().getRootElement(),t=n&&x(n.ownerDocument.defaultView);t&&h(w(),o,p(),t,D,n)}}},dateNow:()=>Date.now(),disabled:!1,thresholdMsec:100},name:"@lexical/NormalizeTripleClickSelection",register:(e,i,o)=>O(()=>{const i=o.getOutput();if(!i.disabled.value)return e.registerRootListener(o=>{if(!o)return;let n=0;const t=e=>{if(e?e.detail>2:n>0){const o=i.dateNow.peek()();n=e&&"mousedown"===e.type||o-n<=i.thresholdMsec.peek()?o:0}return n};return C(e.registerCommand(S,()=>(t(null)&&(n=0,i.$fixFocusOverselection.peek()()),!1),b),k(o,{mousedown:t,mouseup:t},!0))})})};export{M as NormalizeTripleClickSelectionExtension};
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- import{mergeRegister as e,SELECT_ALL_COMMAND as t,$getSelection as n,$isRangeSelection as l,$isBlockFullySelected as i,$getRoot as r,$selectAll as o,$isNodeSelection as s,$isRootNode as c,$isElementNode as a,$getSlotFrame as d,$getSlotHost as u,COMMAND_PRIORITY_LOW as g}from"lexical";import{namedSignals as m}from"@lexical/extension/namedSignals";import{PreventSelectAllExtension as f}from"@lexical/extension/PreventSelectAllExtension";import{effect as p}from"@lexical/extension/signals";const x={build:(e,t,n)=>m(t),config:{cascadeSelection:!1,disabled:!1},dependencies:[f],name:"@lexical/extension/SelectBlock",register:(m,x,v)=>{const S=v.getOutput(),b=v.getDependency(f).output;return e(p(()=>{b.disabled.value=S.disabled.value}),p(()=>{if(!S.disabled.value)return m.registerCommand(t,(e,t)=>{if(t!==m){if(!S.cascadeSelection.peek())return!1;return!!t.read("pending",()=>{const e=n();return l(e)&&i(r(),e)})&&(o(),!0)}const g=n();if(s(g)){const e=g.getNodes(),t=e[0];if(!t)return!1;const n=t.getTopLevelElement();return!n||c(n)||n.is(t)||e.length>1&&(f=n,!e.every(e=>f.is(e.getTopLevelElement())))?o():a(n)&&n.select(0,n.getChildrenSize()),!0}var f;if(!l(g))return!1;const p=g.anchor.getNode(),x=p.getTopLevelElement();if(x&&x.is(g.focus.getNode().getTopLevelElement())&&!i(x,g))return x.select(0,x.getChildrenSize()),!0;let v=d(p);for(;null!==v;){if(a(v)&&!i(v,g))return v.select(0,v.getChildrenSize()),!0;const e=u(v);v=null===e?null:d(e)}return i(r(),g)||o(),!0},g)}))}};export{x as SelectBlockExtension};
9
+ import{mergeRegister as e,SELECT_ALL_COMMAND as t,$getSelection as n,$isRangeSelection as l,$isBlockFullySelected as i,$getRoot as r,$selectAll as o,$isNodeSelection as s,$isRootNode as c,$isElementNode as a,$getSlotFrame as d,$getSlotHost as u,COMMAND_PRIORITY_LOW as g}from"lexical";import{namedSignals as m}from"@lexical/extension/namedSignals";import{PreventSelectAllExtension as p}from"@lexical/extension/PreventSelectAllExtension";import{effect as f}from"@lexical/extension/signals";const x={build:(e,t,n)=>m(t),config:{cascadeSelection:!1,disabled:!1},dependencies:[p],name:"@lexical/extension/SelectBlock",register:(m,x,v)=>{const S=v.getOutput(),b=v.getDependency(p).output;return e(f(()=>{b.disabled.value=S.disabled.value}),f(()=>{if(!S.disabled.value)return m.registerCommand(t,(e,t)=>{if(t!==m)return!!S.cascadeSelection.peek()&&(!!t.read("pending",()=>{const e=n();return l(e)&&i(r(),e)})&&(o(),!0));const g=n();if(s(g)){const e=g.getNodes(),t=e[0];if(!t)return!1;const n=t.getTopLevelElement();return!n||c(n)||n.is(t)||e.length>1&&(p=n,!e.every(e=>p.is(e.getTopLevelElement())))?o():a(n)&&n.select(0,n.getChildrenSize()),!0}var p;if(!l(g))return!1;const f=g.anchor.getNode(),x=f.getTopLevelElement();if(x&&x.is(g.focus.getNode().getTopLevelElement())&&!i(x,g))return x.select(0,x.getChildrenSize()),!0;let v=d(f);for(;null!==v;){if(a(v)&&!i(v,g))return v.select(0,v.getChildrenSize()),!0;const e=u(v);v=null===e?null:d(e)}return i(r(),g)||o(),!0},g)}))}};export{x as SelectBlockExtension};
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "extension",
7
7
  "plugin"
8
8
  ],
9
- "version": "0.51.0",
9
+ "version": "0.51.1-nightly.20260921.0",
10
10
  "license": "MIT",
11
11
  "repository": {
12
12
  "type": "git",
@@ -21,10 +21,10 @@
21
21
  "description": "This package provides the extension functionality for Lexical.",
22
22
  "sideEffects": false,
23
23
  "dependencies": {
24
- "@lexical/internal": "0.51.0",
25
- "@lexical/utils": "0.51.0",
24
+ "@lexical/internal": "0.51.1-nightly.20260921.0",
25
+ "@lexical/utils": "0.51.1-nightly.20260921.0",
26
26
  "@preact/signals-core": "^1.14.1",
27
- "lexical": "0.51.0"
27
+ "lexical": "0.51.1-nightly.20260921.0"
28
28
  },
29
29
  "exports": {
30
30
  "./AutoFocusExtension": {