@lexical/list
Advanced tools
Comparing version 0.21.1-nightly.20241223.0 to 0.22.0
@@ -653,5 +653,3 @@ /** | ||
checked: this.getChecked(), | ||
type: 'listitem', | ||
value: this.getValue(), | ||
version: 1 | ||
value: this.getValue() | ||
}; | ||
@@ -1083,5 +1081,3 @@ } | ||
start: this.getStart(), | ||
tag: this.getTag(), | ||
type: 'list', | ||
version: 1 | ||
tag: this.getTag() | ||
}; | ||
@@ -1088,0 +1084,0 @@ } |
@@ -22,10 +22,9 @@ /** | ||
class H extends h.ElementNode{static getType(){return"listitem"}static clone(a){return new H(a.__value,a.__checked,a.__key)}constructor(a,b,c){super(c);this.__value=void 0===a?1:a;this.__checked=b}createDOM(a){let b=document.createElement("li"),c=this.getParent();r(c)&&"check"===c.getListType()&&L(b,this,null);b.value=this.__value;M(b,a.theme,this);return b}updateDOM(a,b,c){let d=this.getParent();r(d)&&"check"===d.getListType()&&L(b,this,a);b.value=this.__value;M(b,c.theme,this);return!1}static transform(){return a=> | ||
{q(a)||l(144);if(null!=a.__checked){var b=a.getParent();r(b)&&"check"!==b.getListType()&&null!=a.getChecked()&&a.setChecked(void 0)}}}static importDOM(){return{li:()=>({conversion:N,priority:0})}}static importJSON(a){let b=x();b.setChecked(a.checked);b.setValue(a.value);b.setFormat(a.format);b.setDirection(a.direction);return b}exportDOM(a){a=this.createDOM(a._config);a.style.textAlign=this.getFormatType();return{element:a}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),type:"listitem", | ||
value:this.getValue(),version:1}}append(...a){for(let b=0;b<a.length;b++){let c=a[b];if(h.$isElementNode(c)&&this.canMergeWith(c)){let d=c.getChildren();this.append(...d);c.remove()}else super.append(c)}return this}replace(a,b){if(q(a))return super.replace(a);this.setIndent(0);let c=this.getParentOrThrow();if(!r(c))return a;if(c.__first===this.getKey())c.insertBefore(a);else if(c.__last===this.getKey())c.insertAfter(a);else{let d=A(c.getListType()),e=this.getNextSibling();for(;e;){let f=e;e=e.getNextSibling(); | ||
d.append(f)}c.insertAfter(a);a.insertAfter(d)}b&&(h.$isElementNode(a)||l(139),this.getChildren().forEach(d=>{a.append(d)}));this.remove();0===c.getChildrenSize()&&c.remove();return a}insertAfter(a,b=!0){let c=this.getParentOrThrow();r(c)||l(39);if(q(a))return super.insertAfter(a,b);let d=this.getNextSiblings();c.insertAfter(a,b);if(0!==d.length){let e=A(c.getListType());d.forEach(f=>e.append(f));a.insertAfter(e,b)}return a}remove(a){let b=this.getPreviousSibling(),c=this.getNextSibling();super.remove(a); | ||
b&&c&&v(b)&&v(c)&&(F(b.getFirstChild(),c.getFirstChild()),c.remove())}insertNewAfter(a,b=!0){a=x(null==this.__checked?void 0:!1);this.insertAfter(a,b);return a}collapseAtStart(a){let b=h.$createParagraphNode();this.getChildren().forEach(f=>b.append(f));var c=this.getParentOrThrow(),d=c.getParentOrThrow();let e=q(d);1===c.getChildrenSize()?e?(c.remove(),d.select()):(c.insertBefore(b),c.remove(),c=a.anchor,a=a.focus,d=b.getKey(),"element"===c.type&&c.getNode().is(this)&&c.set(d,c.offset,"element"), | ||
"element"===a.type&&a.getNode().is(this)&&a.set(d,a.offset,"element")):(c.insertBefore(b),this.remove());return!0}getValue(){return this.getLatest().__value}setValue(a){this.getWritable().__value=a}getChecked(){let a=this.getLatest(),b,c=this.getParent();r(c)&&(b=c.getListType());return"check"===b?!!a.__checked:void 0}setChecked(a){this.getWritable().__checked=a}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){var a=this.getParent();if(null===a)return this.getLatest().__indent;a=a.getParentOrThrow(); | ||
let b=0;for(;q(a);)a=a.getParentOrThrow().getParentOrThrow(),b++;return b}setIndent(a){"number"!==typeof a&&l(117);a=Math.floor(a);0<=a||l(199);let b=this.getIndent();for(;b!==a;)if(b<a){var c=new Set;if(!v(this)&&!c.has(this.getKey())){var d=this.getParent(),e=this.getNextSibling(),f=this.getPreviousSibling();if(v(e)&&v(f))d=f.getFirstChild(),r(d)&&(d.append(this),f=e.getFirstChild(),r(f)&&(f=f.getChildren(),B(d,f),e.remove(),c.add(e.getKey())));else if(v(e))e=e.getFirstChild(),r(e)&&(e=e.getFirstChild(), | ||
null!==e&&e.insertBefore(this));else if(v(f))e=f.getFirstChild(),r(e)&&e.append(this);else if(r(d)){c=x();let k=A(d.getListType());c.append(k);k.append(this);f?f.insertAfter(c):e?e.insertBefore(c):d.append(c)}}b++}else I(this),b--;return this}canInsertAfter(a){return q(a)}canReplaceWith(a){return q(a)}canMergeWith(a){return q(a)||h.$isParagraphNode(a)}extractWithChild(a,b){if(!h.$isRangeSelection(b))return!1;a=b.anchor.getNode();let c=b.focus.getNode();return this.isParentOf(a)&&this.isParentOf(c)&& | ||
this.getTextContent().length===b.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return A("bullet")}canMergeWhenEmpty(){return!0}} | ||
{q(a)||l(144);if(null!=a.__checked){var b=a.getParent();r(b)&&"check"!==b.getListType()&&null!=a.getChecked()&&a.setChecked(void 0)}}}static importDOM(){return{li:()=>({conversion:N,priority:0})}}static importJSON(a){let b=x();b.setChecked(a.checked);b.setValue(a.value);b.setFormat(a.format);b.setDirection(a.direction);return b}exportDOM(a){a=this.createDOM(a._config);a.style.textAlign=this.getFormatType();return{element:a}}exportJSON(){return{...super.exportJSON(),checked:this.getChecked(),value:this.getValue()}}append(...a){for(let b= | ||
0;b<a.length;b++){let c=a[b];if(h.$isElementNode(c)&&this.canMergeWith(c)){let d=c.getChildren();this.append(...d);c.remove()}else super.append(c)}return this}replace(a,b){if(q(a))return super.replace(a);this.setIndent(0);let c=this.getParentOrThrow();if(!r(c))return a;if(c.__first===this.getKey())c.insertBefore(a);else if(c.__last===this.getKey())c.insertAfter(a);else{let d=A(c.getListType()),e=this.getNextSibling();for(;e;){let f=e;e=e.getNextSibling();d.append(f)}c.insertAfter(a);a.insertAfter(d)}b&& | ||
(h.$isElementNode(a)||l(139),this.getChildren().forEach(d=>{a.append(d)}));this.remove();0===c.getChildrenSize()&&c.remove();return a}insertAfter(a,b=!0){let c=this.getParentOrThrow();r(c)||l(39);if(q(a))return super.insertAfter(a,b);let d=this.getNextSiblings();c.insertAfter(a,b);if(0!==d.length){let e=A(c.getListType());d.forEach(f=>e.append(f));a.insertAfter(e,b)}return a}remove(a){let b=this.getPreviousSibling(),c=this.getNextSibling();super.remove(a);b&&c&&v(b)&&v(c)&&(F(b.getFirstChild(),c.getFirstChild()), | ||
c.remove())}insertNewAfter(a,b=!0){a=x(null==this.__checked?void 0:!1);this.insertAfter(a,b);return a}collapseAtStart(a){let b=h.$createParagraphNode();this.getChildren().forEach(f=>b.append(f));var c=this.getParentOrThrow(),d=c.getParentOrThrow();let e=q(d);1===c.getChildrenSize()?e?(c.remove(),d.select()):(c.insertBefore(b),c.remove(),c=a.anchor,a=a.focus,d=b.getKey(),"element"===c.type&&c.getNode().is(this)&&c.set(d,c.offset,"element"),"element"===a.type&&a.getNode().is(this)&&a.set(d,a.offset, | ||
"element")):(c.insertBefore(b),this.remove());return!0}getValue(){return this.getLatest().__value}setValue(a){this.getWritable().__value=a}getChecked(){let a=this.getLatest(),b,c=this.getParent();r(c)&&(b=c.getListType());return"check"===b?!!a.__checked:void 0}setChecked(a){this.getWritable().__checked=a}toggleChecked(){this.setChecked(!this.__checked)}getIndent(){var a=this.getParent();if(null===a)return this.getLatest().__indent;a=a.getParentOrThrow();let b=0;for(;q(a);)a=a.getParentOrThrow().getParentOrThrow(), | ||
b++;return b}setIndent(a){"number"!==typeof a&&l(117);a=Math.floor(a);0<=a||l(199);let b=this.getIndent();for(;b!==a;)if(b<a){var c=new Set;if(!v(this)&&!c.has(this.getKey())){var d=this.getParent(),e=this.getNextSibling(),f=this.getPreviousSibling();if(v(e)&&v(f))d=f.getFirstChild(),r(d)&&(d.append(this),f=e.getFirstChild(),r(f)&&(f=f.getChildren(),B(d,f),e.remove(),c.add(e.getKey())));else if(v(e))e=e.getFirstChild(),r(e)&&(e=e.getFirstChild(),null!==e&&e.insertBefore(this));else if(v(f))e=f.getFirstChild(), | ||
r(e)&&e.append(this);else if(r(d)){c=x();let k=A(d.getListType());c.append(k);k.append(this);f?f.insertAfter(c):e?e.insertBefore(c):d.append(c)}}b++}else I(this),b--;return this}canInsertAfter(a){return q(a)}canReplaceWith(a){return q(a)}canMergeWith(a){return q(a)||h.$isParagraphNode(a)}extractWithChild(a,b){if(!h.$isRangeSelection(b))return!1;a=b.anchor.getNode();let c=b.focus.getNode();return this.isParentOf(a)&&this.isParentOf(c)&&this.getTextContent().length===b.getTextContent().length}isParentRequired(){return!0}createParentElementNode(){return A("bullet")}canMergeWhenEmpty(){return!0}} | ||
function M(a,b,c){let d=[],e=[];var f=(b=b.list)?b.listitem:void 0;if(b&&b.nested)var k=b.nested.listitem;void 0!==f&&d.push(...K(f));if(b){f=c.getParent();f=r(f)&&"check"===f.getListType();let m=c.getChecked();f&&!m||e.push(b.listitemUnchecked);f&&m||e.push(b.listitemChecked);f&&d.push(m?b.listitemChecked:b.listitemUnchecked)}void 0!==k&&(k=K(k),c.getChildren().some(m=>r(m))?d.push(...k):e.push(...k));0<e.length&&g.removeClassNamesFromElement(a,...e);0<d.length&&g.addClassNamesToElement(a,...d)} | ||
@@ -37,3 +36,3 @@ function L(a,b,c){r(b.getFirstChild())?(a.removeAttribute("role"),a.removeAttribute("tabIndex"),a.removeAttribute("aria-checked")):(a.setAttribute("role","checkbox"),a.setAttribute("tabIndex","-1"),c&&b.__checked===c.__checked||a.setAttribute("aria-checked",b.getChecked()?"true":"false"))} | ||
({conversion:T,priority:0}),ul:()=>({conversion:T,priority:0})}}static importJSON(a){let b=A(a.listType,a.start);b.setFormat(a.format);b.setIndent(a.indent);b.setDirection(a.direction);return b}exportDOM(a){a=this.createDOM(a._config,a);g.isHTMLElement(a)&&(1!==this.__start&&a.setAttribute("start",String(this.__start)),"check"===this.__listType&&a.setAttribute("__lexicalListType","check"));return{element:a}}exportJSON(){return{...super.exportJSON(),listType:this.getListType(),start:this.getStart(), | ||
tag:this.getTag(),type:"list",version:1}}canBeEmpty(){return!1}canIndent(){return!1}append(...a){for(let c=0;c<a.length;c++){var b=a[c];if(q(b))super.append(b);else{let d=x();r(b)?d.append(b):h.$isElementNode(b)?b.isInline()?d.append(b):(b=h.$createTextNode(b.getTextContent()),d.append(b)):d.append(b);super.append(d)}}return this}extractWithChild(a){return q(a)}} | ||
tag:this.getTag()}}canBeEmpty(){return!1}canIndent(){return!1}append(...a){for(let c=0;c<a.length;c++){var b=a[c];if(q(b))super.append(b);else{let d=x();r(b)?d.append(b):h.$isElementNode(b)?b.isInline()?d.append(b):(b=h.$createTextNode(b.getTextContent()),d.append(b)):d.append(b);super.append(d)}}return this}extractWithChild(a){return q(a)}} | ||
function S(a,b,c){let d=[],e=[];var f=b.list;if(void 0!==f){let m=f[`${c.__tag}Depth`]||[];b=p(c)-1;let Q=b%m.length;var k=m[Q];let R=f[c.__tag],C,D=f.nested;f=f.checklist;void 0!==D&&D.list&&(C=D.list);void 0!==R&&d.push(R);void 0!==f&&"check"===c.__listType&&d.push(f);if(void 0!==k)for(d.push(...K(k)),k=0;k<m.length;k++)k!==Q&&e.push(c.__tag+k);void 0!==C&&(c=K(C),1<b?d.push(...c):e.push(...c))}0<e.length&&g.removeClassNamesFromElement(a,...e);0<d.length&&g.addClassNamesToElement(a,...d)} | ||
@@ -40,0 +39,0 @@ function U(a){let b=[];for(let d=0;d<a.length;d++){var c=a[d];q(c)?(b.push(c),c=c.getChildren(),1<c.length&&c.forEach(e=>{r(e)&&b.push(w(e))})):b.push(w(c))}return b} |
@@ -11,8 +11,8 @@ { | ||
"license": "MIT", | ||
"version": "0.21.1-nightly.20241223.0", | ||
"version": "0.22.0", | ||
"main": "LexicalList.js", | ||
"types": "index.d.ts", | ||
"dependencies": { | ||
"@lexical/utils": "0.21.1-nightly.20241223.0", | ||
"lexical": "0.21.1-nightly.20241223.0" | ||
"@lexical/utils": "0.22.0", | ||
"lexical": "0.22.0" | ||
}, | ||
@@ -19,0 +19,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
139735
2930
+ Added@lexical/clipboard@0.22.0(transitive)
+ Added@lexical/html@0.22.0(transitive)
+ Added@lexical/selection@0.22.0(transitive)
+ Added@lexical/table@0.22.0(transitive)
+ Added@lexical/utils@0.22.0(transitive)
+ Addedlexical@0.22.0(transitive)
- Removed@lexical/clipboard@0.21.1-nightly.20241223.0(transitive)
- Removed@lexical/html@0.21.1-nightly.20241223.0(transitive)
- Removed@lexical/selection@0.21.1-nightly.20241223.0(transitive)
- Removed@lexical/table@0.21.1-nightly.20241223.0(transitive)
- Removed@lexical/utils@0.21.1-nightly.20241223.0(transitive)
- Removedlexical@0.21.1-nightly.20241223.0(transitive)
Updated@lexical/utils@0.22.0
Updatedlexical@0.22.0