@lexical/text 0.24.1-nightly.20250214.0 → 0.24.1-nightly.20250217.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var t=require("lexical");function e(){return t.$getRoot().getTextContent()}function n(t,n=!0){if(t)return!1;let r=e();return n&&(r=r.trim()),""===r}function r(e){if(!n(e,!1))return!1;const r=t.$getRoot().getChildren(),o=r.length;if(o>1)return!1;for(let e=0;e<o;e++){const n=r[e];if(t.$isDecoratorNode(n))return!1;if(t.$isElementNode(n)){if(!t.$isParagraphNode(n))return!1;if(0!==n.__indent)return!1;const r=n.getChildren(),o=r.length;for(let n=0;n<o;n++){const n=r[e];if(!t.$isTextNode(n))return!1}}}return!0}function o(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var i=o((function(t){const e=new URLSearchParams;e.append("code",t);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));exports.$canShowPlaceholder=r,exports.$canShowPlaceholderCurry=function(t){return()=>r(t)},exports.$findTextIntersectionFromCharacters=function(e,n){let r=e.getFirstChild(),o=0;t:for(;null!==r;){if(t.$isElementNode(r)){const t=r.getFirstChild();if(null!==t){r=t;continue}}else if(t.$isTextNode(r)){const t=r.getTextContentSize();if(o+t>n)return{node:r,offset:n-o};o+=t}const e=r.getNextSibling();if(null!==e){r=e;continue}let i=r.getParent();for(;null!==i;){const t=i.getNextSibling();if(null!==t){r=t;continue t}i=i.getParent()}break}return null},exports.$isRootTextContentEmpty=n,exports.$isRootTextContentEmptyCurry=function(t,e){return()=>n(t,e)},exports.$rootTextContent=e,exports.registerLexicalTextEntity=function(e,n,r,o){const s=t=>t instanceof r,l=e=>{const n=t.$createTextNode(e.getTextContent());n.setFormat(e.getFormat()),e.replace(n)};return[e.registerNodeTransform(t.TextNode,(e=>{if(!e.isSimpleText())return;let r,u=e.getPreviousSibling(),c=e.getTextContent(),f=e;if(t.$isTextNode(u)){const t=u.getTextContent(),r=n(t+c);if(s(u)){if(null===r||0!==(t=>t.getLatest().__mode)(u))return void l(u);{const n=r.end-t.length;if(n>0){const r=t+c.slice(0,n);if(u.select(),u.setTextContent(r),n===c.length)e.remove();else{const t=c.slice(n);e.setTextContent(t)}return}}}else if(null===r||r.start<t.length)return}let a=0;for(;;){r=n(c);let e,d=null===r?"":c.slice(r.end);if(c=d,""===d){const e=f.getNextSibling();if(t.$isTextNode(e)){d=f.getTextContent()+e.getTextContent();const t=n(d);if(null===t)return void(s(e)?l(e):e.markDirty());if(0!==t.start)return}}if(null===r)return;if(0===r.start&&t.$isTextNode(u)&&u.isTextEntity()){a+=r.end;continue}0===r.start?[e,f]=f.splitText(r.end):[,e,f]=f.splitText(r.start+a,r.end+a),void 0===e&&i(165,"nodeToReplace");const x=o(e);if(x.setFormat(e.getFormat()),e.replace(x),null==f)return;a=0,u=x}})),e.registerNodeTransform(r,(e=>{const r=e.getTextContent(),o=n(r);if(null===o||0!==o.start)return void l(e);if(r.length>o.end)return void e.splitText(o.end);const i=e.getPreviousSibling();t.$isTextNode(i)&&i.isTextEntity()&&(l(i),l(e));const u=e.getNextSibling();t.$isTextNode(u)&&u.isTextEntity()&&(l(u),s(e)&&l(e))}))]};
9
+ "use strict";var t=require("lexical");function e(){return t.$getRoot().getTextContent()}function n(t,n=!0){if(t)return!1;let r=e();return n&&(r=r.trim()),""===r}function r(e){if(!n(e,!1))return!1;const r=t.$getRoot().getChildren(),o=r.length;if(o>1)return!1;for(let e=0;e<o;e++){const n=r[e];if(t.$isDecoratorNode(n))return!1;if(t.$isElementNode(n)){if(!t.$isParagraphNode(n))return!1;if(0!==n.__indent)return!1;const r=n.getChildren(),o=r.length;for(let n=0;n<o;n++){const n=r[e];if(!t.$isTextNode(n))return!1}}}return!0}function o(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var i=o((function(t){const e=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",t);for(let t=1;t<arguments.length;t++)n.append("v",arguments[t]);throw e.search=n.toString(),Error(`Minified Lexical error #${t}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));exports.$canShowPlaceholder=r,exports.$canShowPlaceholderCurry=function(t){return()=>r(t)},exports.$findTextIntersectionFromCharacters=function(e,n){let r=e.getFirstChild(),o=0;t:for(;null!==r;){if(t.$isElementNode(r)){const t=r.getFirstChild();if(null!==t){r=t;continue}}else if(t.$isTextNode(r)){const t=r.getTextContentSize();if(o+t>n)return{node:r,offset:n-o};o+=t}const e=r.getNextSibling();if(null!==e){r=e;continue}let i=r.getParent();for(;null!==i;){const t=i.getNextSibling();if(null!==t){r=t;continue t}i=i.getParent()}break}return null},exports.$isRootTextContentEmpty=n,exports.$isRootTextContentEmptyCurry=function(t,e){return()=>n(t,e)},exports.$rootTextContent=e,exports.registerLexicalTextEntity=function(e,n,r,o){const s=t=>t instanceof r,l=e=>{const n=t.$createTextNode(e.getTextContent());n.setFormat(e.getFormat()),e.replace(n)};return[e.registerNodeTransform(t.TextNode,(e=>{if(!e.isSimpleText())return;let r,u=e.getPreviousSibling(),c=e.getTextContent(),f=e;if(t.$isTextNode(u)){const t=u.getTextContent(),r=n(t+c);if(s(u)){if(null===r||0!==(t=>t.getLatest().__mode)(u))return void l(u);{const n=r.end-t.length;if(n>0){const r=t+c.slice(0,n);if(u.select(),u.setTextContent(r),n===c.length)e.remove();else{const t=c.slice(n);e.setTextContent(t)}return}}}else if(null===r||r.start<t.length)return}let a=0;for(;;){r=n(c);let e,d=null===r?"":c.slice(r.end);if(c=d,""===d){const e=f.getNextSibling();if(t.$isTextNode(e)){d=f.getTextContent()+e.getTextContent();const t=n(d);if(null===t)return void(s(e)?l(e):e.markDirty());if(0!==t.start)return}}if(null===r)return;if(0===r.start&&t.$isTextNode(u)&&u.isTextEntity()){a+=r.end;continue}0===r.start?[e,f]=f.splitText(r.end):[,e,f]=f.splitText(r.start+a,r.end+a),void 0===e&&i(165,"nodeToReplace");const g=o(e);if(g.setFormat(e.getFormat()),e.replace(g),null==f)return;a=0,u=g}})),e.registerNodeTransform(r,(e=>{const r=e.getTextContent(),o=n(r);if(null===o||0!==o.start)return void l(e);if(r.length>o.end)return void e.splitText(o.end);const i=e.getPreviousSibling();t.$isTextNode(i)&&i.isTextEntity()&&(l(i),l(e));const u=e.getNextSibling();t.$isTextNode(u)&&u.isTextEntity()&&(l(u),s(e)&&l(e))}))]};
@@ -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 u(t,e=!0){if(t)return!1;let n=s();return e&&(n=n.trim()),""===n}function f(t,e){return()=>u(t,e)}function c(o){if(!u(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 e=o.getChildren(),n=e.length;for(let r=0;r<n;r++){const n=e[t];if(!i(n))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){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var x=d((function(t){const e=new URLSearchParams;e.append("code",t);for(let t=1;t<arguments.length;t++)e.append("v",arguments[t]);throw Error(`Minified Lexical error #${t}; visit https://lexical.dev/docs/error?${e} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));function T(t,e,n,r){const s=t=>t instanceof n,u=t=>{const e=l(t.getTextContent());e.setFormat(t.getFormat()),t.replace(e)};return[t.registerNodeTransform(o,(t=>{if(!t.isSimpleText())return;let n,o=t.getPreviousSibling(),l=t.getTextContent(),f=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 u(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(;;){n=e(l);let t,g=null===n?"":l.slice(n.end);if(l=g,""===g){const t=f.getNextSibling();if(i(t)){g=f.getTextContent()+t.getTextContent();const n=e(g);if(null===n)return void(s(t)?u(t):t.markDirty());if(0!==n.start)return}}if(null===n)return;if(0===n.start&&i(o)&&o.isTextEntity()){c+=n.end;continue}0===n.start?[t,f]=f.splitText(n.end):[,t,f]=f.splitText(n.start+c,n.end+c),void 0===t&&x(165,"nodeToReplace");const a=r(t);if(a.setFormat(t.getFormat()),t.replace(a),null==f)return;c=0,o=a}})),t.registerNodeTransform(n,(t=>{const n=t.getTextContent(),r=e(n);if(null===r||0!==r.start)return void u(t);if(n.length>r.end)return void t.splitText(r.end);const o=t.getPreviousSibling();i(o)&&o.isTextEntity()&&(u(o),u(t));const l=t.getNextSibling();i(l)&&l.isTextEntity()&&(u(l),s(t)&&u(t))}))]}export{c as $canShowPlaceholder,g as $canShowPlaceholderCurry,a as $findTextIntersectionFromCharacters,u as $isRootTextContentEmpty,f as $isRootTextContentEmptyCurry,s as $rootTextContent,T 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 u(t,e=!0){if(t)return!1;let n=s();return e&&(n=n.trim()),""===n}function f(t,e){return()=>u(t,e)}function c(o){if(!u(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 e=o.getChildren(),n=e.length;for(let r=0;r<n;r++){const n=e[t];if(!i(n))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){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var x=d((function(t){const e=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",t);for(let t=1;t<arguments.length;t++)n.append("v",arguments[t]);throw e.search=n.toString(),Error(`Minified Lexical error #${t}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}));function T(t,e,n,r){const s=t=>t instanceof n,u=t=>{const e=l(t.getTextContent());e.setFormat(t.getFormat()),t.replace(e)};return[t.registerNodeTransform(o,(t=>{if(!t.isSimpleText())return;let n,o=t.getPreviousSibling(),l=t.getTextContent(),f=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 u(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(;;){n=e(l);let t,g=null===n?"":l.slice(n.end);if(l=g,""===g){const t=f.getNextSibling();if(i(t)){g=f.getTextContent()+t.getTextContent();const n=e(g);if(null===n)return void(s(t)?u(t):t.markDirty());if(0!==n.start)return}}if(null===n)return;if(0===n.start&&i(o)&&o.isTextEntity()){c+=n.end;continue}0===n.start?[t,f]=f.splitText(n.end):[,t,f]=f.splitText(n.start+c,n.end+c),void 0===t&&x(165,"nodeToReplace");const a=r(t);if(a.setFormat(t.getFormat()),t.replace(a),null==f)return;c=0,o=a}})),t.registerNodeTransform(n,(t=>{const n=t.getTextContent(),r=e(n);if(null===r||0!==r.start)return void u(t);if(n.length>r.end)return void t.splitText(r.end);const o=t.getPreviousSibling();i(o)&&o.isTextEntity()&&(u(o),u(t));const l=t.getNextSibling();i(l)&&l.isTextEntity()&&(u(l),s(t)&&u(t))}))]}export{c as $canShowPlaceholder,g as $canShowPlaceholderCurry,a as $findTextIntersectionFromCharacters,u as $isRootTextContentEmpty,f as $isRootTextContentEmptyCurry,s as $rootTextContent,T as registerLexicalTextEntity};
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "text"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "0.24.1-nightly.20250214.0",
12
+ "version": "0.24.1-nightly.20250217.0",
13
13
  "main": "LexicalText.js",
14
14
  "types": "index.d.ts",
15
15
  "repository": {
@@ -37,6 +37,6 @@
37
37
  }
38
38
  },
39
39
  "dependencies": {
40
- "lexical": "0.24.1-nightly.20250214.0"
40
+ "lexical": "0.24.1-nightly.20250217.0"
41
41
  }
42
42
  }