Socket
Socket
Sign inDemoInstall

@lexical/utils

Package Overview
Dependencies
Maintainers
3
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lexical/utils - npm Package Compare versions

Comparing version 0.1.16 to 0.1.17

LexicalUtils.d.ts

18

LexicalUtils.dev.js

@@ -111,21 +111,13 @@ /**

}
function $areSiblingsNullOrSpace(node) {
return $isPreviousSiblingNullOrSpace(node) && $isNextSiblingNullOrSpace(node);
function mergeRegister(...func) {
return () => {
func.forEach(f => f());
};
}
function $isPreviousSiblingNullOrSpace(node) {
const previousSibling = node.getPreviousSibling();
return previousSibling === null || lexical.$isLineBreakNode(previousSibling) || lexical.$isTextNode(previousSibling) && previousSibling.isSimpleText() && previousSibling.getTextContent().endsWith(' ');
}
function $isNextSiblingNullOrSpace(node) {
const nextSibling = node.getNextSibling();
return nextSibling === null || lexical.$isLineBreakNode(nextSibling) || lexical.$isTextNode(nextSibling) && nextSibling.isSimpleText() && nextSibling.getTextContent().startsWith(' ');
}
exports.$areSiblingsNullOrSpace = $areSiblingsNullOrSpace;
exports.$dfs = $dfs;
exports.$findMatchingParent = $findMatchingParent;
exports.$getNearestNodeOfType = $getNearestNodeOfType;
exports.$isNextSiblingNullOrSpace = $isNextSiblingNullOrSpace;
exports.$isPreviousSiblingNullOrSpace = $isPreviousSiblingNullOrSpace;
exports.addClassNamesToElement = addClassNamesToElement;
exports.mergeRegister = mergeRegister;
exports.removeClassNamesFromElement = removeClassNamesFromElement;

@@ -7,4 +7,3 @@ /**

*/
var d=require("lexical");function g(a){a=a.getPreviousSibling();return null===a||d.$isLineBreakNode(a)||d.$isTextNode(a)&&a.isSimpleText()&&a.getTextContent().endsWith(" ")}function h(a){a=a.getNextSibling();return null===a||d.$isLineBreakNode(a)||d.$isTextNode(a)&&a.isSimpleText()&&a.getTextContent().startsWith(" ")}exports.$areSiblingsNullOrSpace=function(a){return g(a)&&h(a)};
exports.$dfs=function(a,b){const c=[];a=(a||d.$getRoot()).getLatest();b=b||(d.$isElementNode(a)?a.getLastDescendant():a);for(var e=a,f=0;null!==(e=e.getParent());)f++;for(e=f;null!==a&&!a.is(b);)if(c.push({depth:e,node:a}),d.$isElementNode(a)&&0<a.getChildrenSize())a=a.getFirstChild(),e++;else for(f=null;null===f&&null!==a;)f=a.getNextSibling(),null===f?(a=a.getParent(),e--):a=f;null!==a&&a.is(b)&&c.push({depth:e,node:a});return c};
exports.$findMatchingParent=function(a,b){for(;a!==d.$getRoot()&&null!=a;){if(b(a))return a;a=a.getParent()}return null};exports.$getNearestNodeOfType=function(a,b){for(;null!=a&&!(a instanceof b);)a=a.getParent();return a};exports.$isNextSiblingNullOrSpace=h;exports.$isPreviousSiblingNullOrSpace=g;exports.addClassNamesToElement=function(a,...b){b.forEach(c=>{null!=c&&"string"===typeof c&&a.classList.add(...c.split(" "))})};exports.removeClassNamesFromElement=function(a,...b){b.forEach(c=>{a.classList.remove(...c.split(" "))})};
var f=require("lexical");exports.$dfs=function(a,b){const c=[];a=(a||f.$getRoot()).getLatest();b=b||(f.$isElementNode(a)?a.getLastDescendant():a);for(var d=a,e=0;null!==(d=d.getParent());)e++;for(d=e;null!==a&&!a.is(b);)if(c.push({depth:d,node:a}),f.$isElementNode(a)&&0<a.getChildrenSize())a=a.getFirstChild(),d++;else for(e=null;null===e&&null!==a;)e=a.getNextSibling(),null===e?(a=a.getParent(),d--):a=e;null!==a&&a.is(b)&&c.push({depth:d,node:a});return c};
exports.$findMatchingParent=function(a,b){for(;a!==f.$getRoot()&&null!=a;){if(b(a))return a;a=a.getParent()}return null};exports.$getNearestNodeOfType=function(a,b){for(;null!=a&&!(a instanceof b);)a=a.getParent();return a};exports.addClassNamesToElement=function(a,...b){b.forEach(c=>{null!=c&&"string"===typeof c&&a.classList.add(...c.split(" "))})};exports.mergeRegister=function(...a){return()=>{a.forEach(b=>b())}};exports.removeClassNamesFromElement=function(a,...b){b.forEach(c=>{a.classList.remove(...c.split(" "))})};
{
"name": "@lexical/utils",
"author": {
"name": "Dominic Gannaway",
"email": "dg@domgan.com"
},
"description": "This package contains misc utilities for Lexical.",

@@ -15,10 +11,10 @@ "keywords": [

"license": "MIT",
"version": "0.1.16",
"version": "0.1.17",
"main": "LexicalUtils.js",
"peerDependencies": {
"lexical": "0.1.16"
"lexical": "0.1.17"
},
"dependencies": {
"@lexical/list": "0.1.16",
"@lexical/table": "0.1.16"
"@lexical/list": "0.1.17",
"@lexical/table": "0.1.17"
},

@@ -25,0 +21,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