@lexical/text 0.51.1-nightly.20260925.0 → 0.52.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{$getRoot as t,$isDecoratorNode as e,$isElementNode as n,$isParagraphNode as r,$isTextNode as i,TextNode as o,$createTextNode as l}from"lexical";function s(){return t().getTextContent()}function f(t,e=!0){if(t)return!1;let n=s();return e&&(n=n.trim()),""===n}function u(t,e){return()=>f(t,e)}function c(o){if(!f(o,!1))return!1;const l=t().getChildren(),s=l.length;if(s>1)return!1;for(let t=0;t<s;t++){const o=l[t];if(e(o))return!1;if(n(o)){if(!r(o))return!1;if(0!==o.__indent)return!1;const t=o.getChildren(),e=t.length;for(let n=0;n<e;n++){const e=t[n];if(!i(e))return!1}}}return!0}function g(t){return()=>c(t)}function a(t,e){let r=t.getFirstChild(),o=0;t:for(;null!==r;){if(n(r)){const t=r.getFirstChild();if(null!==t){r=t;continue}}else if(i(r)){const t=r.getTextContentSize();if(o+t>e)return{node:r,offset:e-o};o+=t}const t=r.getNextSibling();if(null!==t){r=t;continue}let l=r.getParent();for(;null!==l;){const t=l.getNextSibling();if(null!==t){r=t;continue t}l=l.getParent()}break}return null}function d(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);throw n.search=r.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 x(t,e,n,r){const s=t=>t instanceof n,f=t=>{const e=l(t.getTextContent()).setFormat(t.getFormat()).setStyle(t.getStyle()).setDetail(t.getDetail());t.replace(e)};return[t.registerNodeTransform(o,t=>{if(!t.isSimpleText())return;let n,o=t.getPreviousSibling(),l=t.getTextContent(),u=t;if(i(o)){const n=o.getTextContent(),r=e(n+l);if(s(o)){if(null===r||0!==(t=>t.getLatest().__mode)(o))return void f(o);{const e=r.end-n.length;if(e>0){const r=n+l.slice(0,e);if(o.select(),o.setTextContent(r),e===l.length)t.remove();else{const n=l.slice(e);t.setTextContent(n)}return}}}else if(null===r||r.start<n.length)return}let c=0;for(;;){const t=l;n=e(t);const g=null===n?"":t.slice(n.end);if(l=g,""===g){const r=u.getNextSibling();if(i(r)){const i=t+r.getTextContent(),o=e(i);if(null===o)return void(s(r)?f(r):r.markDirty());if(null===n||o.start!==n.start)return}}if(null===n)return;if(0===n.start&&i(o)&&o.isTextEntity()){c+=n.end;continue}let a;0===n.start?[a,u]=u.splitText(n.end):[,a,u]=u.splitText(n.start+c,n.end+c),void 0===a&&d(165,"nodeToReplace");const x=r(a);if(x.setFormat(a.getFormat()).setStyle(a.getStyle()).setDetail(a.getDetail()),a.replace(x),null==u)return;c=0,o=x}}),t.registerNodeTransform(n,t=>{const n=t.getTextContent(),r=e(n);if(null===r||0!==r.start)return void f(t);if(n.length>r.end)return void t.splitText(r.end);const o=t.getPreviousSibling();i(o)&&o.isTextEntity()&&(f(o),f(t));const l=t.getNextSibling();i(l)&&l.isTextEntity()&&(f(l),s(t)&&f(t))})]}export{c as $canShowPlaceholder,g as $canShowPlaceholderCurry,a as $findTextIntersectionFromCharacters,f as $isRootTextContentEmpty,u as $isRootTextContentEmptyCurry,s as $rootTextContent,x as registerLexicalTextEntity};
9
+ import{$getRoot as t,$isDecoratorNode as e,$isElementNode as n,$isParagraphNode as r,$isTextNode as i,TextNode as o,$createTextNode as l}from"lexical";function s(){return t().getTextContent()}function f(t,e=!0){if(t)return!1;let n=s();return e&&(n=n.trim()),""===n}function u(t,e){return()=>f(t,e)}function c(o){if(!f(o,!1))return!1;const l=t().getChildren(),s=l.length;if(s>1)return!1;for(let t=0;t<s;t++){const o=l[t];if(e(o))return!1;if(n(o)){if(!r(o))return!1;if(0!==o.__indent)return!1;const t=o.getChildren(),e=t.length;for(let n=0;n<e;n++){const e=t[n];if(!i(e))return!1}}}return!0}function g(t){return()=>c(t)}function a(t,e){let r=t.getFirstChild(),o=0;t:for(;null!==r;){if(n(r)){const t=r.getFirstChild();if(null!==t){r=t;continue}}else if(i(r)){const t=r.getTextContentSize();if(o+t>e)return{node:r,offset:e-o};o+=t}const t=r.getNextSibling();if(null!==t){r=t;continue}let l=r.getParent();for(;null!==l;){const t=l.getNextSibling();if(null!==t){r=t;continue t}l=l.getParent()}break}return null}function d(t,...e){throw function(t,...e){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",t);for(const t of e)r.append("v",t);return n.search=r.toString(),new 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.`)}(t,...e)}function x(t,e,n,r){const s=t=>t instanceof n,f=t=>{const e=l(t.getTextContent()).setFormat(t.getFormat()).setStyle(t.getStyle()).setDetail(t.getDetail());t.replace(e)};return[t.registerNodeTransform(o,t=>{if(!t.isSimpleText())return;let n,o=t.getPreviousSibling(),l=t.getTextContent(),u=t;if(i(o)){const n=o.getTextContent(),r=e(n+l);if(s(o)){if(null===r||0!==(t=>t.getLatest().__mode)(o))return void f(o);{const e=r.end-n.length;if(e>0){const r=n+l.slice(0,e);if(o.select(),o.setTextContent(r),e===l.length)t.remove();else{const n=l.slice(e);t.setTextContent(n)}return}}}else if(null===r||r.start<n.length)return}let c=0;for(;;){const t=l;n=e(t);const g=null===n?"":t.slice(n.end);if(l=g,""===g){const r=u.getNextSibling();if(i(r)){const i=t+r.getTextContent(),o=e(i);if(null===o)return void(s(r)?f(r):r.markDirty());if(null===n||o.start!==n.start)return}}if(null===n)return;if(0===n.start&&i(o)&&o.isTextEntity()){c+=n.end;continue}let a;0===n.start?[a,u]=u.splitText(n.end):[,a,u]=u.splitText(n.start+c,n.end+c),void 0===a&&d(165,"nodeToReplace");const x=r(a);if(x.setFormat(a.getFormat()).setStyle(a.getStyle()).setDetail(a.getDetail()),a.replace(x),null==u)return;c=0,o=x}}),t.registerNodeTransform(n,t=>{const n=t.getTextContent(),r=e(n);if(null===r||0!==r.start)return void f(t);if(n.length>r.end)return void t.splitText(r.end);const o=t.getPreviousSibling();i(o)&&o.isTextEntity()&&(f(o),f(t));const l=t.getNextSibling();i(l)&&l.isTextEntity()&&(f(l),s(t)&&f(t))})]}export{c as $canShowPlaceholder,g as $canShowPlaceholderCurry,a as $findTextIntersectionFromCharacters,f as $isRootTextContentEmpty,u as $isRootTextContentEmptyCurry,s as $rootTextContent,x as registerLexicalTextEntity};
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "text"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "0.51.1-nightly.20260925.0",
12
+ "version": "0.52.0",
13
13
  "main": "./dist/LexicalText.js",
14
14
  "types": "./dist/typescript-too-old.d.ts",
15
15
  "repository": {
@@ -30,8 +30,8 @@
30
30
  }
31
31
  },
32
32
  "dependencies": {
33
- "@lexical/internal": "0.51.1-nightly.20260925.0",
34
- "lexical": "0.51.1-nightly.20260925.0"
33
+ "@lexical/internal": "0.52.0",
34
+ "lexical": "0.52.0"
35
35
  },
36
36
  "files": [
37
37
  "dist",