@lexical/utils
Advanced tools
Comparing version 0.16.0 to 0.16.1-nightly.20240610.0
@@ -93,10 +93,17 @@ /** | ||
* updating) or the component it resides in unmounts. | ||
* Note the functions don't neccesarily need to be in an array as all arguements | ||
* Note the functions don't neccesarily need to be in an array as all arguments | ||
* are considered to be the func argument and spread from there. | ||
* @param func - An array of functions meant to be executed by the returned function. | ||
* @returns the function which executes all the passed register command functions. | ||
* The order of cleanup is the reverse of the argument order. Generally it is | ||
* expected that the first "acquire" will be "released" last (LIFO order), | ||
* because a later step may have some dependency on an earlier one. | ||
* @param func - An array of cleanup functions meant to be executed by the returned function. | ||
* @returns the function which executes all the passed cleanup functions. | ||
*/ | ||
function mergeRegister(...func) { | ||
return () => { | ||
func.forEach(f => f()); | ||
for (let i = func.length - 1; i >= 0; i--) { | ||
func[i](); | ||
} | ||
// Clean up the references and make future calls a no-op | ||
func.length = 0; | ||
}; | ||
@@ -103,0 +110,0 @@ } |
@@ -11,3 +11,3 @@ /** | ||
let E="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement,F=E&&"documentMode"in document?document.documentMode:null,G=E&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),H=E&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),I=E&&"InputEvent"in window&&!F?"getTargetRanges"in new window.InputEvent("input"):!1,J=E&&/Version\/[\d.]+.*Safari/.test(navigator.userAgent),K=E&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream, | ||
L=E&&/Android/.test(navigator.userAgent),M=E&&/^(?=.*Chrome).*/i.test(navigator.userAgent),N=E&&L&&M;function O(...a){let b=[];for(let c of a)if(c&&"string"===typeof c)for(let [e]of c.matchAll(/\S+/g))b.push(e);return b}function P(...a){return()=>{a.forEach(b=>b())}}let Q={attributes:!0,characterData:!0,childList:!0,subtree:!0}; | ||
L=E&&/Android/.test(navigator.userAgent),M=E&&/^(?=.*Chrome).*/i.test(navigator.userAgent),N=E&&L&&M;function O(...a){let b=[];for(let c of a)if(c&&"string"===typeof c)for(let [e]of c.matchAll(/\S+/g))b.push(e);return b}function P(...a){return()=>{for(let b=a.length-1;0<=b;b--)a[b]();a.length=0}}let Q={attributes:!0,characterData:!0,childList:!0,subtree:!0}; | ||
function R(a,b,c){function e(){null===h&&C(182);null===n&&C(183);let {left:p,top:A}=h.getBoundingClientRect();var q=n;let r=g.createRectsFromDOMRange(a,b);t.isConnected||q.append(t);q=!1;for(let y=0;y<r.length;y++){var w=r[y];let u=k[y]||document.createElement("div"),z=u.style;"absolute"!==z.position&&(z.position="absolute",q=!0);var l=`${w.left-p}px`;z.left!==l&&(z.left=l,q=!0);l=`${w.top-A}px`;z.top!==l&&(u.style.top=l,q=!0);l=`${w.width}px`;z.width!==l&&(u.style.width=l,q=!0);w=`${w.height}px`; | ||
@@ -14,0 +14,0 @@ z.height!==w&&(u.style.height=w,q=!0);u.parentNode!==t&&(t.append(u),q=!0);k[y]=u}for(;k.length>r.length;)k.pop();q&&c(k)}function d(){h=n=null;null!==m&&m.disconnect();m=null;t.remove();for(let p of k)p.remove();k=[]}function f(){let p=a.getRootElement();if(null===p)return d();let A=p.parentElement;if(!(A instanceof HTMLElement))return d();d();h=p;n=A;m=new MutationObserver(q=>{let r=a.getRootElement(),w=r&&r.parentElement;if(r!==h||w!==n)return f();for(let l of q)if(!t.contains(l.target))return e()}); |
@@ -26,8 +26,11 @@ /** | ||
* updating) or the component it resides in unmounts. | ||
* Note the functions don't neccesarily need to be in an array as all arguements | ||
* Note the functions don't neccesarily need to be in an array as all arguments | ||
* are considered to be the func argument and spread from there. | ||
* @param func - An array of functions meant to be executed by the returned function. | ||
* @returns the function which executes all the passed register command functions. | ||
* The order of cleanup is the reverse of the argument order. Generally it is | ||
* expected that the first "acquire" will be "released" last (LIFO order), | ||
* because a later step may have some dependency on an earlier one. | ||
* @param func - An array of cleanup functions meant to be executed by the returned function. | ||
* @returns the function which executes all the passed cleanup functions. | ||
*/ | ||
export default function mergeRegister(...func: Array<Func>): () => void; | ||
export {}; |
@@ -11,10 +11,10 @@ { | ||
"license": "MIT", | ||
"version": "0.16.0", | ||
"version": "0.16.1-nightly.20240610.0", | ||
"main": "LexicalUtils.js", | ||
"types": "index.d.ts", | ||
"dependencies": { | ||
"@lexical/list": "0.16.0", | ||
"@lexical/selection": "0.16.0", | ||
"@lexical/table": "0.16.0", | ||
"lexical": "0.16.0" | ||
"@lexical/list": "0.16.1-nightly.20240610.0", | ||
"@lexical/selection": "0.16.1-nightly.20240610.0", | ||
"@lexical/table": "0.16.1-nightly.20240610.0", | ||
"lexical": "0.16.1-nightly.20240610.0" | ||
}, | ||
@@ -21,0 +21,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
100321
2051
+ Added@lexical/list@0.16.1-nightly.20240610.0(transitive)
+ Added@lexical/selection@0.16.1-nightly.20240610.0(transitive)
+ Added@lexical/table@0.16.1-nightly.20240610.0(transitive)
+ Addedlexical@0.16.1-nightly.20240610.0(transitive)
- Removed@lexical/list@0.16.0(transitive)
- Removed@lexical/selection@0.16.0(transitive)
- Removed@lexical/table@0.16.0(transitive)
- Removedlexical@0.16.0(transitive)