lexical 0.1.4 → 0.1.8

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.
Files changed (44) hide show
  1. package/AutoLinkNode.js +9 -1
  2. package/CodeHighlightNode.js +9 -3
  3. package/CodeNode.js +9 -5
  4. package/HashtagNode.js +9 -3
  5. package/HeadingNode.js +9 -3
  6. package/Lexical.dev.js +7638 -0
  7. package/Lexical.js +9 -143
  8. package/Lexical.prod.js +153 -0
  9. package/LexicalAutoLinkNode.dev.js +58 -0
  10. package/LexicalAutoLinkNode.prod.js +7 -0
  11. package/LexicalCodeHighlightNode.dev.js +100 -0
  12. package/LexicalCodeHighlightNode.prod.js +9 -0
  13. package/LexicalCodeNode.dev.js +173 -0
  14. package/LexicalCodeNode.prod.js +11 -0
  15. package/LexicalExtendedNode.js +9 -0
  16. package/LexicalExtendedNodes.dev.js +32 -0
  17. package/LexicalExtendedNodes.prod.js +8 -0
  18. package/LexicalHashtagNode.dev.js +111 -0
  19. package/LexicalHashtagNode.prod.js +9 -0
  20. package/LexicalHeadingNode.dev.js +100 -0
  21. package/LexicalHeadingNode.prod.js +9 -0
  22. package/LexicalLinkNode.dev.js +115 -0
  23. package/LexicalLinkNode.prod.js +9 -0
  24. package/LexicalOverflowNode.dev.js +67 -0
  25. package/LexicalOverflowNode.js +9 -0
  26. package/LexicalOverflowNode.prod.js +8 -0
  27. package/LexicalQuoteNode.dev.js +86 -0
  28. package/LexicalQuoteNode.prod.js +9 -0
  29. package/LexicalTableCellNode.dev.js +81 -0
  30. package/LexicalTableCellNode.prod.js +9 -0
  31. package/LexicalTableNode.dev.js +638 -0
  32. package/LexicalTableNode.prod.js +21 -0
  33. package/LexicalTableRowNode.dev.js +76 -0
  34. package/LexicalTableRowNode.prod.js +8 -0
  35. package/LinkNode.js +9 -3
  36. package/QuoteNode.js +9 -3
  37. package/README.md +102 -4
  38. package/TableCellNode.js +9 -3
  39. package/TableNode.js +9 -10
  40. package/TableRowNode.js +9 -2
  41. package/package.json +2 -2
  42. package/ListItemNode.js +0 -8
  43. package/ListNode.js +0 -5
  44. package/ParagraphNode.js +0 -3
package/AutoLinkNode.js CHANGED
@@ -1 +1,9 @@
1
- 'use strict';var b=require("lexical/LinkNode"),c=require("lexical");class e extends b.LinkNode{static getType(){return"autolink"}static clone(a){return new e(a.__url,a.__key)}insertNewAfter(a){a=this.getParentOrThrow().insertNewAfter(a);if(c.$isElementNode(a)){const d=f(this.__url);a.append(d);return d}return null}canInsertTextAfter(){return!0}}function f(a){return new e(a)}exports.$createAutoLinkNode=f;exports.$isAutoLinkNode=function(a){return a instanceof e};exports.AutoLinkNode=e;
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ 'use strict'
8
+ const LexicalAutoLinkNode = process.env.NODE_ENV === 'development' ? require('./LexicalAutoLinkNode.dev.js') : require('./LexicalAutoLinkNode.prod.js')
9
+ module.exports = LexicalAutoLinkNode;
@@ -1,3 +1,9 @@
1
- 'use strict';var d=require("lexical");function e(a,...b){b.forEach(c=>{null!=c&&"string"===typeof c&&a.classList.add(...c.split(" "))})}function f(a,...b){b.forEach(c=>{a.classList.remove(...c.split(" "))})}
2
- class g extends d.TextNode{constructor(a,b,c){super(a,c);this.__highlightType=b}static getType(){return"code-highlight"}static clone(a){return new g(a.__text,a.__highlightType||void 0,a.__key)}createDOM(a){const b=super.createDOM(a);a=h(a.theme,this.__highlightType);e(b,a);return b}updateDOM(a,b,c){const k=super.updateDOM(a,b,c);a=h(c.theme,a.__highlightType);c=h(c.theme,this.__highlightType);a!==c&&(a&&f(b,a),c&&e(b,c));return k}setFormat(){return this.getWritable()}}
3
- function h(a,b){return b&&a&&a.codeHighlight&&a.codeHighlight[b]}exports.$createCodeHighlightNode=function(a,b){return new g(a,b)};exports.$isCodeHighlightNode=function(a){return a instanceof g};exports.CodeHighlightNode=g;
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ 'use strict'
8
+ const LexicalCodeHighlightNode = process.env.NODE_ENV === 'development' ? require('./LexicalCodeHighlightNode.dev.js') : require('./LexicalCodeHighlightNode.prod.js')
9
+ module.exports = LexicalCodeHighlightNode;
package/CodeNode.js CHANGED
@@ -1,5 +1,9 @@
1
- 'use strict';var e=require("lexical"),f=require("lexical/ParagraphNode"),g=require("lexical/CodeHighlightNode");function h(a,...c){c.forEach(b=>{null!=b&&"string"===typeof b&&a.classList.add(...b.split(" "))})}
2
- class k extends e.ElementNode{static getType(){return"code"}static clone(a){return new k(a.__language,a.__key)}constructor(a,c){super(c);this.__language=a}createDOM(a){const c=document.createElement("code");h(c,a.theme.code);c.setAttribute("spellcheck","false");return c}updateDOM(){return!1}insertNewAfter(a){var c=this.getChildren(),b=c.length;if(2<=b&&"\n"===c[b-1].getTextContent()&&"\n"===c[b-2].getTextContent()&&a.isCollapsed()&&a.anchor.key===this.__key&&a.anchor.offset===b)return c[b-1].remove(),
3
- c[b-2].remove(),a=f.$createParagraphNode(),this.insertAfter(a),a;c=a.anchor.getNode();var d=l(c);if(null!=d){b=0;for(d=d.getTextContent();b<d.length&&/[\t ]/.test(d[b]);)b+=1;if(0<b)return b=d.substring(0,b),b=g.$createCodeHighlightNode(b),c.insertAfter(b),a.insertNodes([e.$createLineBreakNode()]),b.select(),b}return null}canInsertTab(){return!0}collapseAtStart(){const a=f.$createParagraphNode();this.getChildren().forEach(c=>a.append(c));this.replace(a);return!0}setLanguage(a){this.getWritable().__language=
4
- a}getLanguage(){return this.getLatest().__language}}function l(a){let c=null;const b=a.getPreviousSiblings();for(b.push(a);0<b.length&&(a=b.pop(),g.$isCodeHighlightNode(a)&&(c=a),!e.$isLineBreakNode(a)););return c}exports.$createCodeNode=function(a){return new k(a)};exports.$isCodeNode=function(a){return a instanceof k};exports.CodeNode=k;exports.getFirstCodeHighlightNodeOfLine=l;
5
- exports.getLastCodeHighlightNodeOfLine=function(a){let c=null;const b=a.getNextSiblings();for(b.unshift(a);0<b.length&&(a=b.shift(),g.$isCodeHighlightNode(a)&&(c=a),!e.$isLineBreakNode(a)););return c};
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ 'use strict'
8
+ const LexicalCodeNode = process.env.NODE_ENV === 'development' ? require('./LexicalCodeNode.dev.js') : require('./LexicalCodeNode.prod.js')
9
+ module.exports = LexicalCodeNode;
package/HashtagNode.js CHANGED
@@ -1,3 +1,9 @@
1
- 'use strict';var c=require("lexical");function d(b,...a){a.forEach(f=>{null!=f&&"string"===typeof f&&b.classList.add(...f.split(" "))})}
2
- class e extends c.TextNode{static getType(){return"hashtag"}static clone(b){return new e(b.__text,b.__key)}constructor(b,a){super(b,a)}createDOM(b){const a=super.createDOM(b);d(a,b.theme.hashtag);return a}setTextContent(b){let a=super.setTextContent(b);return null===a.getParent()||a.isComposing()?this:(b=b.indexOf("#"),-1===b||"#"===a.getTextContent()?a=g(a):0<b&&([a]=a.splitText(b),a=g(a)),c.$isTextNode(a)&&a.isAttached()&&(b=a.getTextContent().slice(1).search(/[\s.,\\\/#!$%\^&\*;:{}=\-`~()@]/),
3
- 0===b?a=g(a):0<b&&([a]=a.splitText(b+1),a=g(a))),a)}canInsertTextBefore(){return!1}canInsertTextAfter(){return!0}}function g(b){var a=b.getTextContent();a=h(b)?c.$createTextNode(a):k(a);b.replace(a);return a}function k(b=""){return new e(b)}function h(b){return b instanceof e}exports.$createHashtagNode=k;exports.$isHashtagNode=h;exports.$toggleHashtag=g;exports.HashtagNode=e;
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ 'use strict'
8
+ const LexicalHashtagNode = process.env.NODE_ENV === 'development' ? require('./LexicalHashtagNode.dev.js') : require('./LexicalHashtagNode.prod.js')
9
+ module.exports = LexicalHashtagNode;
package/HeadingNode.js CHANGED
@@ -1,3 +1,9 @@
1
- 'use strict';var d=require("lexical"),e=require("lexical/ParagraphNode");function f(a,...b){b.forEach(c=>{null!=c&&"string"===typeof c&&a.classList.add(...c.split(" "))})}
2
- class g extends d.ElementNode{static getType(){return"heading"}static clone(a){return new g(a.__tag,a.__key)}constructor(a,b){super(b);this.__tag=a}getTag(){return this.__tag}createDOM(a){const b=this.__tag,c=document.createElement(b);a=a.theme.heading;void 0!==a&&f(c,a[b]);return c}updateDOM(){return!1}insertNewAfter(){const a=e.$createParagraphNode(),b=this.getDirection();a.setDirection(b);this.insertAfter(a);return a}collapseAtStart(){const a=e.$createParagraphNode();this.getChildren().forEach(b=>
3
- a.append(b));this.replace(a);return!0}}exports.$createHeadingNode=function(a){return new g(a)};exports.$isHeadingNode=function(a){return a instanceof g};exports.HeadingNode=g;
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ 'use strict'
8
+ const LexicalHeadingNode = process.env.NODE_ENV === 'development' ? require('./LexicalHeadingNode.dev.js') : require('./LexicalHeadingNode.prod.js')
9
+ module.exports = LexicalHeadingNode;