Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@lexical/table

Package Overview
Dependencies
Maintainers
5
Versions
199
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lexical/table - npm Package Compare versions

Comparing version 0.17.2-nightly.20240912.0 to 0.17.2-nightly.20240913.0

10

LexicalTable.prod.js

@@ -22,5 +22,5 @@ /**

function ha(a){a=h.$findMatchingParent(a,b=>I(b));if(I(a))return a;throw Error("Expected table cell to be inside of table row.");}function ia(a){a=h.$findMatchingParent(a,b=>M(b));if(M(a))return a;throw Error("Expected table cell to be inside of table.");}function ja(a,b){let c=ia(a),{x:d,y:e}=c.getCordsFromCellNode(a,b);return{above:c.getCellNodeFromCords(d,e-1,b),below:c.getCellNodeFromCords(d,e+1,b),left:c.getCellNodeFromCords(d-1,e,b),right:c.getCellNodeFromCords(d+1,e,b)}}
let ka=(a,b)=>a===x.BOTH||a===b?b:x.NO_STATUS;function N(a){let b=a.getFirstDescendant();null==b?a.selectStart():b.getParentOrThrow().selectStart()}function la(a,b){let c=a.getFirstChild();null!==c?c.insertBefore(b):a.append(b)}function O(a,b,c){let [d,e,f]=ma(a,b,c);null===e&&J(207);null===f&&J(208);return[d,e,f]}
function ma(a,b,c){function d(q){let p=e[q];void 0===p&&(e[q]=p=[]);return p}let e=[],f=null,g=null;a=a.getChildren();for(let q=0;q<a.length;q++){var n=a[q];I(n)||J(209);for(let p=n.getFirstChild(),u=0;null!=p;p=p.getNextSibling()){C(p)||J(147);for(n=d(q);void 0!==n[u];)u++;n={cell:p,startColumn:u,startRow:q};let {__rowSpan:k,__colSpan:l}=p;for(let m=0;m<k&&!(q+m>=a.length);m++){let t=d(q+m);for(let r=0;r<l;r++)t[u+r]=n}null!==b&&null===f&&b.is(p)&&(f=n);null!==c&&null===g&&c.is(p)&&(g=n)}}return[e,
f,g]}function P(a){a instanceof y||("__type"in a?(a=h.$findMatchingParent(a,C),C(a)||J(148)):(a=h.$findMatchingParent(a.getNode(),C),C(a)||J(148)));let b=a.getParent();I(b)||J(149);let c=b.getParent();M(c)||J(210);return[a,b,c]}
let ka=(a,b)=>a===x.BOTH||a===b?b:x.NO_STATUS;function N(a){let b=a.getFirstDescendant();null==b?a.selectStart():b.getParentOrThrow().selectStart()}function la(a,b){let c=a.getFirstChild();null!==c?c.insertBefore(b):a.append(b)}function O(a,b,c){let [d,e,f]=ma(a,b,c);null===e&&J(206);null===f&&J(207);return[d,e,f]}
function ma(a,b,c){function d(q){let p=e[q];void 0===p&&(e[q]=p=[]);return p}let e=[],f=null,g=null;a=a.getChildren();for(let q=0;q<a.length;q++){var n=a[q];I(n)||J(208);for(let p=n.getFirstChild(),u=0;null!=p;p=p.getNextSibling()){C(p)||J(147);for(n=d(q);void 0!==n[u];)u++;n={cell:p,startColumn:u,startRow:q};let {__rowSpan:k,__colSpan:l}=p;for(let m=0;m<k&&!(q+m>=a.length);m++){let t=d(q+m);for(let r=0;r<l;r++)t[u+r]=n}null!==b&&null===f&&b.is(p)&&(f=n);null!==c&&null===g&&c.is(p)&&(g=n)}}return[e,
f,g]}function P(a){a instanceof y||("__type"in a?(a=h.$findMatchingParent(a,C),C(a)||J(148)):(a=h.$findMatchingParent(a.getNode(),C),C(a)||J(148)));let b=a.getParent();I(b)||J(149);let c=b.getParent();M(c)||J(209);return[a,b,c]}
function oa(a){let [b,,c]=P(a);a=c.getChildren();let d=a.length;var e=a[0].getChildren().length;let f=Array(d);for(var g=0;g<d;g++)f[g]=Array(e);for(e=0;e<d;e++){g=a[e].getChildren();let n=0;for(let q=0;q<g.length;q++){for(;f[e][n];)n++;let p=g[q],u=p.__rowSpan||1,k=p.__colSpan||1;for(let l=0;l<u;l++)for(let m=0;m<k;m++)f[e+l][n+m]=p;if(b===p)return{colSpan:k,columnIndex:n,rowIndex:e,rowSpan:u};n+=k}}return null}

@@ -43,3 +43,3 @@ class pa{constructor(a,b,c){this.anchor=b;this.focus=c;b._selection=this;c._selection=this;this._cachedNodes=null;this.dirty=!1;this.tableKey=a}getStartEndPoints(){return[this.anchor,this.focus]}isBackward(){return this.focus.isBefore(this.anchor)}getCachedNodes(){return this._cachedNodes}setCachedNodes(a){this._cachedNodes=a}is(a){return Q(a)?this.tableKey===a.tableKey&&this.anchor.is(a.anchor)&&this.focus.is(a.focus):!1}set(a,b,c){this.dirty=!0;this.tableKey=a;this.anchor.key=b;this.focus.key=c;

"element"),c.formatText(a))});w.$setSelection(b);this.editor.dispatchCommand(w.SELECTION_CHANGE_COMMAND,void 0)})}clearText(){let a=this.editor;a.update(()=>{let b=w.$getNodeByKey(this.tableNodeKey);if(!M(b))throw Error("Expected TableNode.");var c=w.$getSelection();Q(c)||J(11);c=c.getNodes().filter(C);c.length===this.table.columns*this.table.rows?(b.selectPrevious(),b.remove(),w.$getRoot().selectStart()):(c.forEach(d=>{if(w.$isElementNode(d)){let e=w.$createParagraphNode(),f=w.$createTextNode();
e.append(f);d.append(e);d.getChildren().forEach(g=>{g!==e&&g.remove()})}}),S(a,this.table,null),w.$setSelection(null),a.dispatchCommand(w.SELECTION_CHANGE_COMMAND,void 0))})}}function ta(a,b){null!==ua(a)&&J(205);a.__lexicalTableSelection=b}function ua(a){return a.__lexicalTableSelection||null}function va(a){for(;null!=a;){let b=a.nodeName;if("TD"===b||"TH"===b){a=a._cell;if(void 0===a)break;return a}a=a.parentNode}return null}
e.append(f);d.append(e);d.getChildren().forEach(g=>{g!==e&&g.remove()})}}),S(a,this.table,null),w.$setSelection(null),a.dispatchCommand(w.SELECTION_CHANGE_COMMAND,void 0))})}}function ta(a,b){null!==ua(a)&&J(210);a.__lexicalTableSelection=b}function ua(a){return a.__lexicalTableSelection||null}function va(a){for(;null!=a;){let b=a.nodeName;if("TD"===b||"TH"===b){a=a._cell;if(void 0===a)break;return a}a=a.parentNode}return null}
function R(a){let b=[],c={columns:0,domRows:b,rows:0};var d=a.firstChild;let e=a=0;for(b.length=0;null!=d;){var f=d.nodeName;if("TD"===f||"TH"===f){f=d;f={elem:f,hasBackgroundColor:""!==f.style.backgroundColor,highlighted:!1,x:a,y:e};d._cell=f;let g=b[e];void 0===g&&(g=b[e]=[]);g[a]=f}else if(f=d.firstChild,null!=f){d=f;continue}f=d.nextSibling;if(null!=f)a++,d=f;else if(f=d.parentNode,null!=f){d=f.nextSibling;if(null==d)break;e++;a=0}}c.columns=a+1;c.rows=e+1;return c}

@@ -75,3 +75,3 @@ function S(a,b,c){let d=new Set(c?c.getNodes():[]);wa(b,(e,f)=>{let g=e.elem;d.has(f)?(e.highlighted=!0,xa(a,e)):(e.highlighted=!1,ya(a,e),g.getAttribute("style")||g.removeAttribute("style"))})}function wa(a,b){({domRows:a}=a);for(let c=0;c<a.length;c++){let d=a[c];if(d)for(let e=0;e<d.length;e++){let f=d[e];if(!f)continue;let g=w.$getNearestNodeFromDOMNode(f.elem);null!==g&&b(f,g,{x:e,y:c})}}}function za(a,b){b.disableHighlightStyle();wa(b.table,c=>{c.highlighted=!0;xa(a,c)})}

exports.$deleteTableRow__EXPERIMENTAL=function(){var a=w.$getSelection();w.$isRangeSelection(a)||Q(a)||J(188);var b=a.anchor.getNode();a=a.focus.getNode();let [c,,d]=P(b);[a]=P(a);let [e,f,g]=O(d,c,a);({startRow:b}=f);var {startRow:n}=g;a=n+a.__rowSpan-1;if(e.length===a-b+1)d.remove();else{n=e[0].length;var q=e[a+1],p=d.getChildAtIndex(a+1);for(let k=a;k>=b;k--){for(var u=n-1;0<=u;u--){let {cell:l,startRow:m,startColumn:t}=e[k][u];if(t===u&&(k===b&&m<b&&l.setRowSpan(l.__rowSpan-(m-b)),m>=b&&m+l.__rowSpan-
1>a))if(l.setRowSpan(l.__rowSpan-(a-m+1)),null===p&&J(122),0===u)la(p,l);else{let {cell:r}=q[u-1];r.insertAfter(l)}}u=d.getChildAtIndex(k);I(u)||J(206,String(k));u.remove()}void 0!==q?({cell:b}=q[0],N(b)):({cell:b}=e[b-1][0],N(b))}};exports.$findCellNode=X;exports.$findTableNode=T;exports.$getElementForTableNode=function(a,b){a=a.getElementByKey(b.getKey());if(null==a)throw Error("Table Element Not Found");return R(a)};exports.$getNodeTriplet=P;
1>a))if(l.setRowSpan(l.__rowSpan-(a-m+1)),null===p&&J(122),0===u)la(p,l);else{let {cell:r}=q[u-1];r.insertAfter(l)}}u=d.getChildAtIndex(k);I(u)||J(205,String(k));u.remove()}void 0!==q?({cell:b}=q[0],N(b)):({cell:b}=e[b-1][0],N(b))}};exports.$findCellNode=X;exports.$findTableNode=T;exports.$getElementForTableNode=function(a,b){a=a.getElementByKey(b.getKey());if(null==a)throw Error("Table Element Not Found");return R(a)};exports.$getNodeTriplet=P;
exports.$getTableCellNodeFromLexicalNode=function(a){a=h.$findMatchingParent(a,b=>C(b));return C(a)?a:null};exports.$getTableCellNodeRect=oa;exports.$getTableColumnIndexFromTableCellNode=function(a){return ha(a).getChildren().findIndex(b=>b.is(a))};exports.$getTableNodeFromLexicalNodeOrThrow=ia;exports.$getTableRowIndexFromTableCellNode=function(a){let b=ha(a);return ia(b).getChildren().findIndex(c=>c.is(b))};exports.$getTableRowNodeFromTableCellNodeOrThrow=ha;

@@ -78,0 +78,0 @@ exports.$insertTableColumn=function(a,b,c=!0,d,e){let f=a.getChildren(),g=[];for(let p=0;p<f.length;p++){let u=f[p];if(I(u))for(let k=0;k<d;k++){var n=u.getChildren();if(b>=n.length||0>b)throw Error("Table column target index out of range");n=n[b];C(n)||J(12);let {left:l,right:m}=ja(n,e);var q=x.NO_STATUS;if(l&&l.hasHeaderState(x.ROW)||m&&m.hasHeaderState(x.ROW))q|=x.ROW;q=B(q);q.append(w.$createParagraphNode());g.push({newTableCell:q,targetCell:n})}}g.forEach(({newTableCell:p,targetCell:u})=>{c?

@@ -11,9 +11,9 @@ {

"license": "MIT",
"version": "0.17.2-nightly.20240912.0",
"version": "0.17.2-nightly.20240913.0",
"main": "LexicalTable.js",
"types": "index.d.ts",
"dependencies": {
"@lexical/clipboard": "0.17.2-nightly.20240912.0",
"@lexical/utils": "0.17.2-nightly.20240912.0",
"lexical": "0.17.2-nightly.20240912.0"
"@lexical/clipboard": "0.17.2-nightly.20240913.0",
"@lexical/utils": "0.17.2-nightly.20240913.0",
"lexical": "0.17.2-nightly.20240913.0"
},

@@ -20,0 +20,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc