@ebay/nice-dag-react 1.0.16 → 1.0.18

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.
package/lib/index.cjs CHANGED
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var ke;function hr(){if(ke)return M;ke=1;var i=V.default,l=Symbol.for("react.element"),D=Symbol.for("react.fragment"),E=Object.prototype.hasOwnProperty,y=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,O={key:!0,ref:!0,__self:!0,__source:!0};function C(P,p,w){var g,s={},T=null,R=null;w!==void 0&&(T=""+w),p.key!==void 0&&(T=""+p.key),p.ref!==void 0&&(R=p.ref);for(g in p)E.call(p,g)&&!O.hasOwnProperty(g)&&(s[g]=p[g]);if(P&&P.defaultProps)for(g in p=P.defaultProps,p)s[g]===void 0&&(s[g]=p[g]);return{$$typeof:l,type:P,key:T,ref:R,props:s,_owner:y.current}}return M.Fragment=D,M.jsx=C,M.jsxs=C,M}var L={};/**
9
+ */var ke;function hr(){if(ke)return M;ke=1;var i=V.default,l=Symbol.for("react.element"),T=Symbol.for("react.fragment"),E=Object.prototype.hasOwnProperty,y=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,O={key:!0,ref:!0,__self:!0,__source:!0};function C(P,p,w){var g,s={},D=null,R=null;w!==void 0&&(D=""+w),p.key!==void 0&&(D=""+p.key),p.ref!==void 0&&(R=p.ref);for(g in p)E.call(p,g)&&!O.hasOwnProperty(g)&&(s[g]=p[g]);if(P&&P.defaultProps)for(g in p=P.defaultProps,p)s[g]===void 0&&(s[g]=p[g]);return{$$typeof:l,type:P,key:D,ref:R,props:s,_owner:y.current}}return M.Fragment=T,M.jsx=C,M.jsxs=C,M}var L={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,14 +14,14 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Fe;function mr(){return Fe||(Fe=1,process.env.NODE_ENV!=="production"&&function(){var i=V.default,l=Symbol.for("react.element"),D=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),C=Symbol.for("react.provider"),P=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),s=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),R=Symbol.for("react.offscreen"),S=Symbol.iterator,K="@@iterator";function U(e){if(e===null||typeof e!="object")return null;var r=S&&e[S]||e[K];return typeof r=="function"?r:null}var b=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function f(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];x("error",e,t)}}function x(e,r,t){{var n=b.ReactDebugCurrentFrame,u=n.getStackAddendum();u!==""&&(r+="%s",t=t.concat([u]));var c=t.map(function(o){return String(o)});c.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,c)}}var H=!1,$=!1,$e=!1,We=!1,Ye=!1,ce;ce=Symbol.for("react.module.reference");function Me(e){return!!(typeof e=="string"||typeof e=="function"||e===E||e===O||Ye||e===y||e===w||e===g||We||e===R||H||$||$e||typeof e=="object"&&e!==null&&(e.$$typeof===T||e.$$typeof===s||e.$$typeof===C||e.$$typeof===P||e.$$typeof===p||e.$$typeof===ce||e.getModuleId!==void 0))}function Le(e,r,t){var n=e.displayName;if(n)return n;var u=r.displayName||r.name||"";return u!==""?t+"("+u+")":t}function le(e){return e.displayName||"Context"}function j(e){if(e==null)return null;if(typeof e.tag=="number"&&f("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case D:return"Portal";case O:return"Profiler";case y:return"StrictMode";case w:return"Suspense";case g:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case P:var r=e;return le(r)+".Consumer";case C:var t=e;return le(t._context)+".Provider";case p:return Le(e,e.render,"ForwardRef");case s:var n=e.displayName||null;return n!==null?n:j(e.type)||"Memo";case T:{var u=e,c=u._payload,o=u._init;try{return j(o(c))}catch{return null}}}return null}var k=Object.assign,W=0,fe,de,ve,pe,ge,he,me;function Ee(){}Ee.__reactDisabledLog=!0;function Ve(){{if(W===0){fe=console.log,de=console.info,ve=console.warn,pe=console.error,ge=console.group,he=console.groupCollapsed,me=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ee,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}W++}}function Ue(){{if(W--,W===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:k({},e,{value:fe}),info:k({},e,{value:de}),warn:k({},e,{value:ve}),error:k({},e,{value:pe}),group:k({},e,{value:ge}),groupCollapsed:k({},e,{value:he}),groupEnd:k({},e,{value:me})})}W<0&&f("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var X=b.ReactCurrentDispatcher,Z;function q(e,r,t){{if(Z===void 0)try{throw Error()}catch(u){var n=u.stack.trim().match(/\n( *(at )?)/);Z=n&&n[1]||""}return`
17
+ */var Fe;function mr(){return Fe||(Fe=1,process.env.NODE_ENV!=="production"&&function(){var i=V.default,l=Symbol.for("react.element"),T=Symbol.for("react.portal"),E=Symbol.for("react.fragment"),y=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),C=Symbol.for("react.provider"),P=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),g=Symbol.for("react.suspense_list"),s=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),R=Symbol.for("react.offscreen"),S=Symbol.iterator,K="@@iterator";function U(e){if(e===null||typeof e!="object")return null;var r=S&&e[S]||e[K];return typeof r=="function"?r:null}var b=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function f(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];x("error",e,t)}}function x(e,r,t){{var n=b.ReactDebugCurrentFrame,u=n.getStackAddendum();u!==""&&(r+="%s",t=t.concat([u]));var c=t.map(function(o){return String(o)});c.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,c)}}var H=!1,$=!1,$e=!1,We=!1,Ye=!1,ce;ce=Symbol.for("react.module.reference");function Me(e){return!!(typeof e=="string"||typeof e=="function"||e===E||e===O||Ye||e===y||e===w||e===g||We||e===R||H||$||$e||typeof e=="object"&&e!==null&&(e.$$typeof===D||e.$$typeof===s||e.$$typeof===C||e.$$typeof===P||e.$$typeof===p||e.$$typeof===ce||e.getModuleId!==void 0))}function Le(e,r,t){var n=e.displayName;if(n)return n;var u=r.displayName||r.name||"";return u!==""?t+"("+u+")":t}function le(e){return e.displayName||"Context"}function j(e){if(e==null)return null;if(typeof e.tag=="number"&&f("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case E:return"Fragment";case T:return"Portal";case O:return"Profiler";case y:return"StrictMode";case w:return"Suspense";case g:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case P:var r=e;return le(r)+".Consumer";case C:var t=e;return le(t._context)+".Provider";case p:return Le(e,e.render,"ForwardRef");case s:var n=e.displayName||null;return n!==null?n:j(e.type)||"Memo";case D:{var u=e,c=u._payload,o=u._init;try{return j(o(c))}catch{return null}}}return null}var k=Object.assign,W=0,fe,de,ve,pe,ge,he,me;function Ee(){}Ee.__reactDisabledLog=!0;function Ve(){{if(W===0){fe=console.log,de=console.info,ve=console.warn,pe=console.error,ge=console.group,he=console.groupCollapsed,me=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ee,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}W++}}function Ue(){{if(W--,W===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:k({},e,{value:fe}),info:k({},e,{value:de}),warn:k({},e,{value:ve}),error:k({},e,{value:pe}),group:k({},e,{value:ge}),groupCollapsed:k({},e,{value:he}),groupEnd:k({},e,{value:me})})}W<0&&f("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var X=b.ReactCurrentDispatcher,Z;function q(e,r,t){{if(Z===void 0)try{throw Error()}catch(u){var n=u.stack.trim().match(/\n( *(at )?)/);Z=n&&n[1]||""}return`
18
18
  `+Z+e}}var Q=!1,B;{var qe=typeof WeakMap=="function"?WeakMap:Map;B=new qe}function be(e,r){if(!e||Q)return"";{var t=B.get(e);if(t!==void 0)return t}var n;Q=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var c;c=X.current,X.current=null,Ve();try{if(r){var o=function(){throw Error()};if(Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(N){n=N}Reflect.construct(e,[],o)}else{try{o.call()}catch(N){n=N}e.call(o.prototype)}}else{try{throw Error()}catch(N){n=N}e()}}catch(N){if(N&&n&&typeof N.stack=="string"){for(var a=N.stack.split(`
19
19
  `),h=n.stack.split(`
20
20
  `),d=a.length-1,v=h.length-1;d>=1&&v>=0&&a[d]!==h[v];)v--;for(;d>=1&&v>=0;d--,v--)if(a[d]!==h[v]){if(d!==1||v!==1)do if(d--,v--,v<0||a[d]!==h[v]){var _=`
21
- `+a[d].replace(" at new "," at ");return e.displayName&&_.includes("<anonymous>")&&(_=_.replace("<anonymous>",e.displayName)),typeof e=="function"&&B.set(e,_),_}while(d>=1&&v>=0);break}}}finally{Q=!1,X.current=c,Ue(),Error.prepareStackTrace=u}var A=e?e.displayName||e.name:"",Ne=A?q(A):"";return typeof e=="function"&&B.set(e,Ne),Ne}function Be(e,r,t){return be(e,!1)}function Je(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function J(e,r,t){if(e==null)return"";if(typeof e=="function")return be(e,Je(e));if(typeof e=="string")return q(e);switch(e){case w:return q("Suspense");case g:return q("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case p:return Be(e.render);case s:return J(e.type,r,t);case T:{var n=e,u=n._payload,c=n._init;try{return J(c(u),r,t)}catch{}}}return""}var G=Object.prototype.hasOwnProperty,Re={},_e=b.ReactDebugCurrentFrame;function z(e){if(e){var r=e._owner,t=J(e.type,e._source,r?r.type:null);_e.setExtraStackFrame(t)}else _e.setExtraStackFrame(null)}function Ge(e,r,t,n,u){{var c=Function.call.bind(G);for(var o in e)if(c(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var h=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(d){a=d}a&&!(a instanceof Error)&&(z(u),f("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,o,typeof a),z(null)),a instanceof Error&&!(a.message in Re)&&(Re[a.message]=!0,z(u),f("Failed %s type: %s",t,a.message),z(null))}}}var ze=Array.isArray;function ee(e){return ze(e)}function Ke(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function He(e){try{return ye(e),!1}catch{return!0}}function ye(e){return""+e}function Ce(e){if(He(e))return f("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ke(e)),ye(e)}var Y=b.ReactCurrentOwner,Xe={key:!0,ref:!0,__self:!0,__source:!0},Te,De,re;re={};function Ze(e){if(G.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Qe(e){if(G.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function er(e,r){if(typeof e.ref=="string"&&Y.current&&r&&Y.current.stateNode!==r){var t=j(Y.current.type);re[t]||(f('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',j(Y.current.type),e.ref),re[t]=!0)}}function rr(e,r){{var t=function(){Te||(Te=!0,f("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function tr(e,r){{var t=function(){De||(De=!0,f("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var nr=function(e,r,t,n,u,c,o){var a={$$typeof:l,type:e,key:r,ref:t,props:o,_owner:c};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:u}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function ar(e,r,t,n,u){{var c,o={},a=null,h=null;t!==void 0&&(Ce(t),a=""+t),Qe(r)&&(Ce(r.key),a=""+r.key),Ze(r)&&(h=r.ref,er(r,u));for(c in r)G.call(r,c)&&!Xe.hasOwnProperty(c)&&(o[c]=r[c]);if(e&&e.defaultProps){var d=e.defaultProps;for(c in d)o[c]===void 0&&(o[c]=d[c])}if(a||h){var v=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&rr(o,v),h&&tr(o,v)}return nr(e,a,h,u,n,Y.current,o)}}var te=b.ReactCurrentOwner,Oe=b.ReactDebugCurrentFrame;function F(e){if(e){var r=e._owner,t=J(e.type,e._source,r?r.type:null);Oe.setExtraStackFrame(t)}else Oe.setExtraStackFrame(null)}var ne;ne=!1;function ae(e){return typeof e=="object"&&e!==null&&e.$$typeof===l}function Pe(){{if(te.current){var e=j(te.current.type);if(e)return`
21
+ `+a[d].replace(" at new "," at ");return e.displayName&&_.includes("<anonymous>")&&(_=_.replace("<anonymous>",e.displayName)),typeof e=="function"&&B.set(e,_),_}while(d>=1&&v>=0);break}}}finally{Q=!1,X.current=c,Ue(),Error.prepareStackTrace=u}var A=e?e.displayName||e.name:"",Ne=A?q(A):"";return typeof e=="function"&&B.set(e,Ne),Ne}function Be(e,r,t){return be(e,!1)}function Je(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function J(e,r,t){if(e==null)return"";if(typeof e=="function")return be(e,Je(e));if(typeof e=="string")return q(e);switch(e){case w:return q("Suspense");case g:return q("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case p:return Be(e.render);case s:return J(e.type,r,t);case D:{var n=e,u=n._payload,c=n._init;try{return J(c(u),r,t)}catch{}}}return""}var G=Object.prototype.hasOwnProperty,Re={},_e=b.ReactDebugCurrentFrame;function z(e){if(e){var r=e._owner,t=J(e.type,e._source,r?r.type:null);_e.setExtraStackFrame(t)}else _e.setExtraStackFrame(null)}function Ge(e,r,t,n,u){{var c=Function.call.bind(G);for(var o in e)if(c(e,o)){var a=void 0;try{if(typeof e[o]!="function"){var h=Error((n||"React class")+": "+t+" type `"+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}a=e[o](r,o,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(d){a=d}a&&!(a instanceof Error)&&(z(u),f("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,o,typeof a),z(null)),a instanceof Error&&!(a.message in Re)&&(Re[a.message]=!0,z(u),f("Failed %s type: %s",t,a.message),z(null))}}}var ze=Array.isArray;function ee(e){return ze(e)}function Ke(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function He(e){try{return ye(e),!1}catch{return!0}}function ye(e){return""+e}function Ce(e){if(He(e))return f("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ke(e)),ye(e)}var Y=b.ReactCurrentOwner,Xe={key:!0,ref:!0,__self:!0,__source:!0},De,Te,re;re={};function Ze(e){if(G.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Qe(e){if(G.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function er(e,r){if(typeof e.ref=="string"&&Y.current&&r&&Y.current.stateNode!==r){var t=j(Y.current.type);re[t]||(f('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',j(Y.current.type),e.ref),re[t]=!0)}}function rr(e,r){{var t=function(){De||(De=!0,f("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function tr(e,r){{var t=function(){Te||(Te=!0,f("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var nr=function(e,r,t,n,u,c,o){var a={$$typeof:l,type:e,key:r,ref:t,props:o,_owner:c};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:u}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function ar(e,r,t,n,u){{var c,o={},a=null,h=null;t!==void 0&&(Ce(t),a=""+t),Qe(r)&&(Ce(r.key),a=""+r.key),Ze(r)&&(h=r.ref,er(r,u));for(c in r)G.call(r,c)&&!Xe.hasOwnProperty(c)&&(o[c]=r[c]);if(e&&e.defaultProps){var d=e.defaultProps;for(c in d)o[c]===void 0&&(o[c]=d[c])}if(a||h){var v=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&rr(o,v),h&&tr(o,v)}return nr(e,a,h,u,n,Y.current,o)}}var te=b.ReactCurrentOwner,Oe=b.ReactDebugCurrentFrame;function F(e){if(e){var r=e._owner,t=J(e.type,e._source,r?r.type:null);Oe.setExtraStackFrame(t)}else Oe.setExtraStackFrame(null)}var ne;ne=!1;function ae(e){return typeof e=="object"&&e!==null&&e.$$typeof===l}function Pe(){{if(te.current){var e=j(te.current.type);if(e)return`
22
22
 
23
23
  Check the render method of \``+e+"`."}return""}}function or(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return`
24
24
 
25
25
  Check your code at `+r+":"+t+"."}return""}}var we={};function ir(e){{var r=Pe();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
26
26
 
27
- Check the top-level render call using <`+t+">.")}return r}}function Se(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=ir(r);if(we[t])return;we[t]=!0;var n="";e&&e._owner&&e._owner!==te.current&&(n=" It was passed a child from "+j(e._owner.type)+"."),F(e),f('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),F(null)}}function xe(e,r){{if(typeof e!="object")return;if(ee(e))for(var t=0;t<e.length;t++){var n=e[t];ae(n)&&Se(n,r)}else if(ae(e))e._store&&(e._store.validated=!0);else if(e){var u=U(e);if(typeof u=="function"&&u!==e.entries)for(var c=u.call(e),o;!(o=c.next()).done;)ae(o.value)&&Se(o.value,r)}}}function ur(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===p||r.$$typeof===s))t=r.propTypes;else return;if(t){var n=j(r);Ge(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!ne){ne=!0;var u=j(r);f("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",u||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&f("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function sr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){F(e),f("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),F(null);break}}e.ref!==null&&(F(e),f("Invalid attribute `ref` supplied to `React.Fragment`."),F(null))}}function je(e,r,t,n,u,c){{var o=Me(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var h=or(u);h?a+=h:a+=Pe();var d;e===null?d="null":ee(e)?d="array":e!==void 0&&e.$$typeof===l?(d="<"+(j(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):d=typeof e,f("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",d,a)}var v=ar(e,r,t,u,c);if(v==null)return v;if(o){var _=r.children;if(_!==void 0)if(n)if(ee(_)){for(var A=0;A<_.length;A++)xe(_[A],e);Object.freeze&&Object.freeze(_)}else f("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else xe(_,e)}return e===E?sr(v):ur(v),v}}function cr(e,r,t){return je(e,r,t,!0)}function lr(e,r,t){return je(e,r,t,!1)}var fr=lr,dr=cr;L.Fragment=E,L.jsx=fr,L.jsxs=dr}()),L}(function(i){process.env.NODE_ENV==="production"?i.exports=hr():i.exports=mr()})(ue);const se=ue.exports.Fragment,I=ue.exports.jsx;class Ae extends V.default.Component{render(){if(this.props.niceDag&&this.props.node.ref){const l=this.props.niceDag.getElementByNodeId(this.props.node.id);if(l)return ie.default.createPortal(I(se,{children:this.props.render(this.props)}),l)}return null}}class Ie extends V.default.Component{render(){return this.props.niceDag&&this.props.edge.ref?ie.default.createPortal(I(se,{children:this.props.render(this.props)}),this.props.edge.ref):null}}class Er extends V.default.Component{render(){if(this.props.niceDag){const l=this.props.niceDag.getRootContentElement();return ie.default.createPortal(I(se,{children:this.props.render(this.props.niceDag)}),l)}return null}}function br(i){const l=m.useCallback(()=>{i.remove()},[i]),D=m.useCallback((E,y=40)=>{i.insertNodes(E,y)},[i]);return{onEdgeRemove:l,onNodeInsert:D}}function Rr({node:i,niceDag:l}){const D=m.useCallback(()=>{i.remove()},[i]),E=m.useCallback(O=>{l.startEdgeDragging(i,O)},[l,i]),y=m.useCallback(O=>{l.startNodeDragging(i,O)},[l,i]);return{onNodeRemove:D,startEdgeDragging:E,startNodeDragging:y}}function _r(i){const{initNodes:l}=i;if(!l)throw new Error("initNodes can't be undefined!")}function yr(i){_r(i);const{onMount:l,renderNode:D,renderRootView:E,renderEdge:y,scrollPosition:O,initNodes:C,minimapConfig:P,...p}=i,w=m.useRef(null),g=m.useRef(null),s=m.useRef(null),T=m.useRef(),[R,S]=m.useState(0),K=m.useCallback(()=>{s.current&&s.current.destory()},[S]),U=m.useMemo(()=>({onChange:()=>{S(R+1)}}),[S,R]);return m.useEffect(()=>{if(T.current!==C){if(!s.current){const b=gr.default.init({container:w.current,minimapContainer:g.current,minimapConfig:P,...p},i.editable);s.current=b}s.current.withNodes(C).render(),S(R+1),T.current=C,l&&l()}return s.current.addNiceDagChangeListener(U),()=>{s.current.removeNiceDagChangeListener(U)}},[C,S,R,l]),m.useEffect(()=>(s.current&&s.current.isDestoried&&(s.current.withNodes(C).render(),S(R+1)),()=>{s.current&&s.current.destory()}),[]),{niceDag:s.current,niceDagEl:w,minimapEl:g,render:()=>{if(s.current){const b=s.current.getAllNodes();let f=(b==null?void 0:b.length)>0?b.map(x=>I(Ae,{render:D,node:x,niceDag:s.current,patchVersion:R},x.id)):null;if(E&&(f=[...f,I(Er,{niceDag:s.current,render:E},"root-view")]),y){const x=s.current.getAllEdges(),H=(x==null?void 0:x.length)>0?x.map($=>I(Ie,{render:y,edge:$,patchVersion:R,niceDag:s.current},`edge-${$.source.id}-${$.target.id}`)):[];f=[...f,...H]}return f}return null},reset:K}}exports.NiceDagEdge=Ie;exports.NiceDagNode=Ae;exports.useNiceDag=yr;exports.useNiceDagEdge=br;exports.useNiceDagNode=Rr;
27
+ Check the top-level render call using <`+t+">.")}return r}}function Se(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=ir(r);if(we[t])return;we[t]=!0;var n="";e&&e._owner&&e._owner!==te.current&&(n=" It was passed a child from "+j(e._owner.type)+"."),F(e),f('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),F(null)}}function xe(e,r){{if(typeof e!="object")return;if(ee(e))for(var t=0;t<e.length;t++){var n=e[t];ae(n)&&Se(n,r)}else if(ae(e))e._store&&(e._store.validated=!0);else if(e){var u=U(e);if(typeof u=="function"&&u!==e.entries)for(var c=u.call(e),o;!(o=c.next()).done;)ae(o.value)&&Se(o.value,r)}}}function ur(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===p||r.$$typeof===s))t=r.propTypes;else return;if(t){var n=j(r);Ge(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!ne){ne=!0;var u=j(r);f("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",u||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&f("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function sr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){F(e),f("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),F(null);break}}e.ref!==null&&(F(e),f("Invalid attribute `ref` supplied to `React.Fragment`."),F(null))}}function je(e,r,t,n,u,c){{var o=Me(e);if(!o){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var h=or(u);h?a+=h:a+=Pe();var d;e===null?d="null":ee(e)?d="array":e!==void 0&&e.$$typeof===l?(d="<"+(j(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):d=typeof e,f("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",d,a)}var v=ar(e,r,t,u,c);if(v==null)return v;if(o){var _=r.children;if(_!==void 0)if(n)if(ee(_)){for(var A=0;A<_.length;A++)xe(_[A],e);Object.freeze&&Object.freeze(_)}else f("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else xe(_,e)}return e===E?sr(v):ur(v),v}}function cr(e,r,t){return je(e,r,t,!0)}function lr(e,r,t){return je(e,r,t,!1)}var fr=lr,dr=cr;L.Fragment=E,L.jsx=fr,L.jsxs=dr}()),L}(function(i){process.env.NODE_ENV==="production"?i.exports=hr():i.exports=mr()})(ue);const se=ue.exports.Fragment,I=ue.exports.jsx;class Ae extends V.default.Component{render(){if(this.props.niceDag&&this.props.node.ref){const l=this.props.niceDag.getElementByNodeId(this.props.node.id);if(l)return ie.default.createPortal(I(se,{children:this.props.render({node:this.props.node,niceDag:this.props.niceDag})}),l)}return null}}class Ie extends V.default.Component{render(){return this.props.niceDag&&this.props.edge.ref?ie.default.createPortal(I(se,{children:this.props.render({edge:this.props.edge,niceDag:this.props.niceDag})}),this.props.edge.ref):null}}class Er extends V.default.Component{render(){if(this.props.niceDag){const l=this.props.niceDag.getRootContentElement();return ie.default.createPortal(I(se,{children:this.props.render(this.props.niceDag)}),l)}return null}}function br(i){const l=m.useCallback(()=>{i.remove()},[i]),T=m.useCallback((E,y=40)=>{i.insertNodes(E,y)},[i]);return{onEdgeRemove:l,onNodeInsert:T}}function Rr({node:i,niceDag:l}){const T=m.useCallback(()=>{i.remove()},[i]),E=m.useCallback(O=>{l.startEdgeDragging(i,O)},[l,i]),y=m.useCallback(O=>{l.startNodeDragging(i,O)},[l,i]);return{onNodeRemove:T,startEdgeDragging:E,startNodeDragging:y}}function _r(i){const{initNodes:l}=i;if(!l)throw new Error("initNodes can't be undefined!")}function yr(i){_r(i);const{onMount:l,renderNode:T,renderRootView:E,renderEdge:y,scrollPosition:O,initNodes:C,minimapConfig:P,...p}=i,w=m.useRef(null),g=m.useRef(null),s=m.useRef(null),D=m.useRef(),[R,S]=m.useState(0),K=m.useCallback(()=>{s.current&&s.current.destory()},[S]),U=m.useMemo(()=>({onChange:()=>{S(R+1)}}),[S,R]);return m.useEffect(()=>{if(D.current!==C){if(!s.current){const b=gr.default.init({container:w.current,minimapContainer:g.current,minimapConfig:P,...p},i.editable);s.current=b}s.current.withNodes(C).render(),S(R+1),D.current=C,l&&l()}return s.current.addNiceDagChangeListener(U),()=>{s.current.removeNiceDagChangeListener(U)}},[C,S,R,l]),m.useEffect(()=>(s.current&&s.current.isDestoried&&(s.current.withNodes(C).render(),S(R+1)),()=>{s.current&&s.current.destory()}),[]),{niceDag:s.current,niceDagEl:w,minimapEl:g,render:()=>{if(s.current){const b=s.current.getAllNodes();let f=(b==null?void 0:b.length)>0?b.map(x=>I(Ae,{render:T,node:x,niceDag:s.current,patchVersion:R},x.id)):null;if(E&&(f=[...f,I(Er,{niceDag:s.current,render:E},"root-view")]),y){const x=s.current.getAllEdges(),H=(x==null?void 0:x.length)>0?x.map($=>I(Ie,{render:y,edge:$,patchVersion:R,niceDag:s.current},`edge-${$.source.id}-${$.target.id}`)):[];f=[...f,...H]}return f}return null},reset:K}}exports.NiceDagEdge=Ie;exports.NiceDagNode=Ae;exports.useNiceDag=yr;exports.useNiceDagEdge=br;exports.useNiceDagNode=Rr;
package/lib/index.d.ts CHANGED
@@ -1,8 +1,16 @@
1
1
  import React, { MutableRefObject } from 'react';
2
2
  import NiceDagTypes, { IEdge, MinimapConfig } from '@ebay/nice-dag-core/lib/types';
3
+ export declare type RenderNodeArgs = {
4
+ niceDag: NiceDagTypes.NiceDag;
5
+ node: NiceDagTypes.IViewNode;
6
+ };
7
+ export declare type RenderEdgeArgs = {
8
+ niceDag: NiceDagTypes.NiceDag;
9
+ edge: NiceDagTypes.IEdge;
10
+ };
3
11
  export declare type UseNiceDagArgs = Omit<NiceDagTypes.NiceDagInitArgs, 'container'> & {
4
- renderNode: (props: NiceDagNodeProps) => React.Component<any, any, any>;
5
- renderEdge?: (props: NiceDagEdgeProps) => React.Component<any, any, any>;
12
+ renderNode: (props: RenderNodeArgs) => React.Component<any, any, any>;
13
+ renderEdge?: (props: RenderEdgeArgs) => React.Component<any, any, any>;
6
14
  renderRootView?: (niceDag: NiceDagTypes.NiceDag) => React.Component<any, any, any>;
7
15
  scrollPosition?: NiceDagTypes.Point;
8
16
  initNodes?: NiceDagTypes.Node[];
@@ -19,13 +27,13 @@ export declare type UseNiceDagType = {
19
27
  render: () => JSX.Element[];
20
28
  reset: () => void;
21
29
  };
22
- export interface NiceDagNodeProps {
30
+ interface NiceDagNodeProps {
23
31
  node: NiceDagTypes.IViewNode;
24
32
  render?: RenderNodeType;
25
33
  niceDag?: NiceDagTypes.NiceDag;
26
34
  patchVersion?: number;
27
35
  }
28
- export interface NiceDagEdgeProps {
36
+ interface NiceDagEdgeProps {
29
37
  niceDag?: NiceDagTypes.NiceDag;
30
38
  edge: NiceDagTypes.IEdge;
31
39
  render?: RenderEdgeType;
package/lib/index.js CHANGED
@@ -16,16 +16,16 @@ function gr() {
16
16
  if (Fe)
17
17
  return V;
18
18
  Fe = 1;
19
- var s = M, l = Symbol.for("react.element"), T = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, y = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, w = { key: !0, ref: !0, __self: !0, __source: !0 };
20
- function _(P, p, O) {
19
+ var s = M, l = Symbol.for("react.element"), T = Symbol.for("react.fragment"), m = Object.prototype.hasOwnProperty, y = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, D = { key: !0, ref: !0, __self: !0, __source: !0 };
20
+ function _(w, p, P) {
21
21
  var g, u = {}, C = null, R = null;
22
- O !== void 0 && (C = "" + O), p.key !== void 0 && (C = "" + p.key), p.ref !== void 0 && (R = p.ref);
22
+ P !== void 0 && (C = "" + P), p.key !== void 0 && (C = "" + p.key), p.ref !== void 0 && (R = p.ref);
23
23
  for (g in p)
24
- m.call(p, g) && !w.hasOwnProperty(g) && (u[g] = p[g]);
25
- if (P && P.defaultProps)
26
- for (g in p = P.defaultProps, p)
24
+ m.call(p, g) && !D.hasOwnProperty(g) && (u[g] = p[g]);
25
+ if (w && w.defaultProps)
26
+ for (g in p = w.defaultProps, p)
27
27
  u[g] === void 0 && (u[g] = p[g]);
28
- return { $$typeof: l, type: P, key: C, ref: R, props: u, _owner: y.current };
28
+ return { $$typeof: l, type: w, key: C, ref: R, props: u, _owner: y.current };
29
29
  }
30
30
  return V.Fragment = T, V.jsx = _, V.jsxs = _, V;
31
31
  }
@@ -42,11 +42,11 @@ var L = {};
42
42
  var Ae;
43
43
  function hr() {
44
44
  return Ae || (Ae = 1, process.env.NODE_ENV !== "production" && function() {
45
- var s = M, l = Symbol.for("react.element"), T = Symbol.for("react.portal"), m = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), w = Symbol.for("react.profiler"), _ = Symbol.for("react.provider"), P = Symbol.for("react.context"), p = Symbol.for("react.forward_ref"), O = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), u = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), R = Symbol.for("react.offscreen"), D = Symbol.iterator, H = "@@iterator";
45
+ var s = M, l = Symbol.for("react.element"), T = Symbol.for("react.portal"), m = Symbol.for("react.fragment"), y = Symbol.for("react.strict_mode"), D = Symbol.for("react.profiler"), _ = Symbol.for("react.provider"), w = Symbol.for("react.context"), p = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), u = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), R = Symbol.for("react.offscreen"), O = Symbol.iterator, H = "@@iterator";
46
46
  function U(e) {
47
47
  if (e === null || typeof e != "object")
48
48
  return null;
49
- var r = D && e[D] || e[H];
49
+ var r = O && e[O] || e[H];
50
50
  return typeof r == "function" ? r : null;
51
51
  }
52
52
  var E = s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
@@ -70,7 +70,7 @@ function hr() {
70
70
  var X = !1, $ = !1, Ie = !1, $e = !1, We = !1, ce;
71
71
  ce = Symbol.for("react.module.reference");
72
72
  function Ye(e) {
73
- return !!(typeof e == "string" || typeof e == "function" || e === m || e === w || We || e === y || e === O || e === g || $e || e === R || X || $ || Ie || typeof e == "object" && e !== null && (e.$$typeof === C || e.$$typeof === u || e.$$typeof === _ || e.$$typeof === P || e.$$typeof === p || e.$$typeof === ce || e.getModuleId !== void 0));
73
+ return !!(typeof e == "string" || typeof e == "function" || e === m || e === D || We || e === y || e === P || e === g || $e || e === R || X || $ || Ie || typeof e == "object" && e !== null && (e.$$typeof === C || e.$$typeof === u || e.$$typeof === _ || e.$$typeof === w || e.$$typeof === p || e.$$typeof === ce || e.getModuleId !== void 0));
74
74
  }
75
75
  function Ve(e, r, t) {
76
76
  var n = e.displayName;
@@ -94,18 +94,18 @@ function hr() {
94
94
  return "Fragment";
95
95
  case T:
96
96
  return "Portal";
97
- case w:
97
+ case D:
98
98
  return "Profiler";
99
99
  case y:
100
100
  return "StrictMode";
101
- case O:
101
+ case P:
102
102
  return "Suspense";
103
103
  case g:
104
104
  return "SuspenseList";
105
105
  }
106
106
  if (typeof e == "object")
107
107
  switch (e.$$typeof) {
108
- case P:
108
+ case w:
109
109
  var r = e;
110
110
  return le(r) + ".Consumer";
111
111
  case _:
@@ -294,7 +294,7 @@ function hr() {
294
294
  if (typeof e == "string")
295
295
  return B(e);
296
296
  switch (e) {
297
- case O:
297
+ case P:
298
298
  return B("Suspense");
299
299
  case g:
300
300
  return B("SuspenseList");
@@ -371,7 +371,7 @@ function hr() {
371
371
  ref: !0,
372
372
  __self: !0,
373
373
  __source: !0
374
- }, Te, we, te;
374
+ }, Te, De, te;
375
375
  te = {};
376
376
  function Xe(e) {
377
377
  if (G.call(e, "ref")) {
@@ -409,7 +409,7 @@ function hr() {
409
409
  function rr(e, r) {
410
410
  {
411
411
  var t = function() {
412
- we || (we = !0, f("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
412
+ De || (De = !0, f("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
413
413
  };
414
414
  t.isReactWarning = !0, Object.defineProperty(e, "ref", {
415
415
  get: t,
@@ -461,20 +461,20 @@ function hr() {
461
461
  return tr(e, a, h, i, n, Y.current, o);
462
462
  }
463
463
  }
464
- var ne = E.ReactCurrentOwner, Pe = E.ReactDebugCurrentFrame;
464
+ var ne = E.ReactCurrentOwner, we = E.ReactDebugCurrentFrame;
465
465
  function N(e) {
466
466
  if (e) {
467
467
  var r = e._owner, t = J(e.type, e._source, r ? r.type : null);
468
- Pe.setExtraStackFrame(t);
468
+ we.setExtraStackFrame(t);
469
469
  } else
470
- Pe.setExtraStackFrame(null);
470
+ we.setExtraStackFrame(null);
471
471
  }
472
472
  var ae;
473
473
  ae = !1;
474
474
  function oe(e) {
475
475
  return typeof e == "object" && e !== null && e.$$typeof === l;
476
476
  }
477
- function Oe() {
477
+ function Pe() {
478
478
  {
479
479
  if (ne.current) {
480
480
  var e = x(ne.current.type);
@@ -497,10 +497,10 @@ Check your code at ` + r + ":" + t + ".";
497
497
  return "";
498
498
  }
499
499
  }
500
- var De = {};
500
+ var Oe = {};
501
501
  function or(e) {
502
502
  {
503
- var r = Oe();
503
+ var r = Pe();
504
504
  if (!r) {
505
505
  var t = typeof e == "string" ? e : e.displayName || e.name;
506
506
  t && (r = `
@@ -516,9 +516,9 @@ Check the top-level render call using <` + t + ">.");
516
516
  return;
517
517
  e._store.validated = !0;
518
518
  var t = or(r);
519
- if (De[t])
519
+ if (Oe[t])
520
520
  return;
521
- De[t] = !0;
521
+ Oe[t] = !0;
522
522
  var n = "";
523
523
  e && e._owner && e._owner !== ne.current && (n = " It was passed a child from " + x(e._owner.type) + "."), N(e), f('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', t, n), N(null);
524
524
  }
@@ -584,7 +584,7 @@ Check the top-level render call using <` + t + ">.");
584
584
  var a = "";
585
585
  (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
586
586
  var h = ar(i);
587
- h ? a += h : a += Oe();
587
+ h ? a += h : a += Pe();
588
588
  var d;
589
589
  e === null ? d = "null" : re(e) ? d = "array" : e !== void 0 && e.$$typeof === l ? (d = "<" + (x(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : d = typeof e, f("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", d, a);
590
590
  }
@@ -627,7 +627,10 @@ class mr extends M.Component {
627
627
  const l = this.props.niceDag.getElementByNodeId(this.props.node.id);
628
628
  if (l)
629
629
  return ie.createPortal(/* @__PURE__ */ I(se, {
630
- children: this.props.render(this.props)
630
+ children: this.props.render({
631
+ node: this.props.node,
632
+ niceDag: this.props.niceDag
633
+ })
631
634
  }), l);
632
635
  }
633
636
  return null;
@@ -636,7 +639,10 @@ class mr extends M.Component {
636
639
  class Er extends M.Component {
637
640
  render() {
638
641
  return this.props.niceDag && this.props.edge.ref ? ie.createPortal(/* @__PURE__ */ I(se, {
639
- children: this.props.render(this.props)
642
+ children: this.props.render({
643
+ edge: this.props.edge,
644
+ niceDag: this.props.niceDag
645
+ })
640
646
  }), this.props.edge.ref) : null;
641
647
  }
642
648
  }
@@ -662,16 +668,16 @@ function Tr(s) {
662
668
  onNodeInsert: T
663
669
  };
664
670
  }
665
- function wr({
671
+ function Dr({
666
672
  node: s,
667
673
  niceDag: l
668
674
  }) {
669
675
  const T = A(() => {
670
676
  s.remove();
671
- }, [s]), m = A((w) => {
672
- l.startEdgeDragging(s, w);
673
- }, [l, s]), y = A((w) => {
674
- l.startNodeDragging(s, w);
677
+ }, [s]), m = A((D) => {
678
+ l.startEdgeDragging(s, D);
679
+ }, [l, s]), y = A((D) => {
680
+ l.startNodeDragging(s, D);
675
681
  }, [l, s]);
676
682
  return {
677
683
  onNodeRemove: T,
@@ -686,45 +692,45 @@ function br(s) {
686
692
  if (!l)
687
693
  throw new Error("initNodes can't be undefined!");
688
694
  }
689
- function Pr(s) {
695
+ function wr(s) {
690
696
  br(s);
691
697
  const {
692
698
  onMount: l,
693
699
  renderNode: T,
694
700
  renderRootView: m,
695
701
  renderEdge: y,
696
- scrollPosition: w,
702
+ scrollPosition: D,
697
703
  initNodes: _,
698
- minimapConfig: P,
704
+ minimapConfig: w,
699
705
  ...p
700
- } = s, O = K(null), g = K(null), u = K(null), C = K(), [R, D] = dr(0), H = A(() => {
706
+ } = s, P = K(null), g = K(null), u = K(null), C = K(), [R, O] = dr(0), H = A(() => {
701
707
  u.current && u.current.destory();
702
- }, [D]), U = vr(() => ({
708
+ }, [O]), U = vr(() => ({
703
709
  onChange: () => {
704
- D(R + 1);
710
+ O(R + 1);
705
711
  }
706
- }), [D, R]);
712
+ }), [O, R]);
707
713
  return Ne(() => {
708
714
  if (C.current !== _) {
709
715
  if (!u.current) {
710
716
  const E = pr.init({
711
- container: O.current,
717
+ container: P.current,
712
718
  minimapContainer: g.current,
713
- minimapConfig: P,
719
+ minimapConfig: w,
714
720
  ...p
715
721
  }, s.editable);
716
722
  u.current = E;
717
723
  }
718
- u.current.withNodes(_).render(), D(R + 1), C.current = _, l && l();
724
+ u.current.withNodes(_).render(), O(R + 1), C.current = _, l && l();
719
725
  }
720
726
  return u.current.addNiceDagChangeListener(U), () => {
721
727
  u.current.removeNiceDagChangeListener(U);
722
728
  };
723
- }, [_, D, R, l]), Ne(() => (u.current && u.current.isDestoried && (u.current.withNodes(_).render(), D(R + 1)), () => {
729
+ }, [_, O, R, l]), Ne(() => (u.current && u.current.isDestoried && (u.current.withNodes(_).render(), O(R + 1)), () => {
724
730
  u.current && u.current.destory();
725
731
  }), []), {
726
732
  niceDag: u.current,
727
- niceDagEl: O,
733
+ niceDagEl: P,
728
734
  minimapEl: g,
729
735
  render: () => {
730
736
  if (u.current) {
@@ -757,7 +763,7 @@ function Pr(s) {
757
763
  export {
758
764
  Er as NiceDagEdge,
759
765
  mr as NiceDagNode,
760
- Pr as useNiceDag,
766
+ wr as useNiceDag,
761
767
  Tr as useNiceDagEdge,
762
- wr as useNiceDagNode
768
+ Dr as useNiceDagNode
763
769
  };
package/lib/index.umd.cjs CHANGED
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var fe;function Le(){if(fe)return Y;fe=1;var o=W.default,f=Symbol.for("react.element"),O=Symbol.for("react.fragment"),b=Object.prototype.hasOwnProperty,C=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,P={key:!0,ref:!0,__self:!0,__source:!0};function T(w,g,S){var h,s={},D=null,_=null;S!==void 0&&(D=""+S),g.key!==void 0&&(D=""+g.key),g.ref!==void 0&&(_=g.ref);for(h in g)b.call(g,h)&&!P.hasOwnProperty(h)&&(s[h]=g[h]);if(w&&w.defaultProps)for(h in g=w.defaultProps,g)s[h]===void 0&&(s[h]=g[h]);return{$$typeof:f,type:w,key:D,ref:_,props:s,_owner:C.current}}return Y.Fragment=O,Y.jsx=T,Y.jsxs=T,Y}var M={};/**
9
+ */var fe;function Le(){if(fe)return Y;fe=1;var o=W.default,f=Symbol.for("react.element"),O=Symbol.for("react.fragment"),b=Object.prototype.hasOwnProperty,C=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,P={key:!0,ref:!0,__self:!0,__source:!0};function D(w,g,S){var h,s={},T=null,_=null;S!==void 0&&(T=""+S),g.key!==void 0&&(T=""+g.key),g.ref!==void 0&&(_=g.ref);for(h in g)b.call(g,h)&&!P.hasOwnProperty(h)&&(s[h]=g[h]);if(w&&w.defaultProps)for(h in g=w.defaultProps,g)s[h]===void 0&&(s[h]=g[h]);return{$$typeof:f,type:w,key:T,ref:_,props:s,_owner:C.current}}return Y.Fragment=O,Y.jsx=D,Y.jsxs=D,Y}var M={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,14 +14,14 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var le;function Ve(){return le||(le=1,process.env.NODE_ENV!=="production"&&function(){var o=W.default,f=Symbol.for("react.element"),O=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),T=Symbol.for("react.provider"),w=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),s=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),_=Symbol.for("react.offscreen"),j=Symbol.iterator,ee="@@iterator";function q(e){if(e===null||typeof e!="object")return null;var r=j&&e[j]||e[ee];return typeof r=="function"?r:null}var y=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function l(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];x("error",e,t)}}function x(e,r,t){{var n=y.ReactDebugCurrentFrame,u=n.getStackAddendum();u!==""&&(r+="%s",t=t.concat([u]));var c=t.map(function(i){return String(i)});c.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,c)}}var re=!1,L=!1,ze=!1,Ke=!1,He=!1,pe;pe=Symbol.for("react.module.reference");function Xe(e){return!!(typeof e=="string"||typeof e=="function"||e===b||e===P||He||e===C||e===S||e===h||Ke||e===_||re||L||ze||typeof e=="object"&&e!==null&&(e.$$typeof===D||e.$$typeof===s||e.$$typeof===T||e.$$typeof===w||e.$$typeof===g||e.$$typeof===pe||e.getModuleId!==void 0))}function Ze(e,r,t){var n=e.displayName;if(n)return n;var u=r.displayName||r.name||"";return u!==""?t+"("+u+")":t}function ge(e){return e.displayName||"Context"}function N(e){if(e==null)return null;if(typeof e.tag=="number"&&l("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case b:return"Fragment";case O:return"Portal";case P:return"Profiler";case C:return"StrictMode";case S:return"Suspense";case h:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case w:var r=e;return ge(r)+".Consumer";case T:var t=e;return ge(t._context)+".Provider";case g:return Ze(e,e.render,"ForwardRef");case s:var n=e.displayName||null;return n!==null?n:N(e.type)||"Memo";case D:{var u=e,c=u._payload,i=u._init;try{return N(i(c))}catch{return null}}}return null}var F=Object.assign,V=0,he,me,Ee,be,ye,_e,Re;function Ce(){}Ce.__reactDisabledLog=!0;function Qe(){{if(V===0){he=console.log,me=console.info,Ee=console.warn,be=console.error,ye=console.group,_e=console.groupCollapsed,Re=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ce,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}V++}}function er(){{if(V--,V===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},e,{value:he}),info:F({},e,{value:me}),warn:F({},e,{value:Ee}),error:F({},e,{value:be}),group:F({},e,{value:ye}),groupCollapsed:F({},e,{value:_e}),groupEnd:F({},e,{value:Re})})}V<0&&l("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=y.ReactCurrentDispatcher,ne;function B(e,r,t){{if(ne===void 0)try{throw Error()}catch(u){var n=u.stack.trim().match(/\n( *(at )?)/);ne=n&&n[1]||""}return`
18
- `+ne+e}}var ae=!1,J;{var rr=typeof WeakMap=="function"?WeakMap:Map;J=new rr}function Te(e,r){if(!e||ae)return"";{var t=J.get(e);if(t!==void 0)return t}var n;ae=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var c;c=te.current,te.current=null,Qe();try{if(r){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(k){n=k}Reflect.construct(e,[],i)}else{try{i.call()}catch(k){n=k}e.call(i.prototype)}}else{try{throw Error()}catch(k){n=k}e()}}catch(k){if(k&&n&&typeof k.stack=="string"){for(var a=k.stack.split(`
17
+ */var le;function Ve(){return le||(le=1,process.env.NODE_ENV!=="production"&&function(){var o=W.default,f=Symbol.for("react.element"),O=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),P=Symbol.for("react.profiler"),D=Symbol.for("react.provider"),w=Symbol.for("react.context"),g=Symbol.for("react.forward_ref"),S=Symbol.for("react.suspense"),h=Symbol.for("react.suspense_list"),s=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),_=Symbol.for("react.offscreen"),j=Symbol.iterator,ee="@@iterator";function q(e){if(e===null||typeof e!="object")return null;var r=j&&e[j]||e[ee];return typeof r=="function"?r:null}var y=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function l(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];x("error",e,t)}}function x(e,r,t){{var n=y.ReactDebugCurrentFrame,u=n.getStackAddendum();u!==""&&(r+="%s",t=t.concat([u]));var c=t.map(function(i){return String(i)});c.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,c)}}var re=!1,L=!1,ze=!1,Ke=!1,He=!1,pe;pe=Symbol.for("react.module.reference");function Xe(e){return!!(typeof e=="string"||typeof e=="function"||e===b||e===P||He||e===C||e===S||e===h||Ke||e===_||re||L||ze||typeof e=="object"&&e!==null&&(e.$$typeof===T||e.$$typeof===s||e.$$typeof===D||e.$$typeof===w||e.$$typeof===g||e.$$typeof===pe||e.getModuleId!==void 0))}function Ze(e,r,t){var n=e.displayName;if(n)return n;var u=r.displayName||r.name||"";return u!==""?t+"("+u+")":t}function ge(e){return e.displayName||"Context"}function N(e){if(e==null)return null;if(typeof e.tag=="number"&&l("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case b:return"Fragment";case O:return"Portal";case P:return"Profiler";case C:return"StrictMode";case S:return"Suspense";case h:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case w:var r=e;return ge(r)+".Consumer";case D:var t=e;return ge(t._context)+".Provider";case g:return Ze(e,e.render,"ForwardRef");case s:var n=e.displayName||null;return n!==null?n:N(e.type)||"Memo";case T:{var u=e,c=u._payload,i=u._init;try{return N(i(c))}catch{return null}}}return null}var F=Object.assign,V=0,he,me,Ee,be,ye,_e,Re;function Ce(){}Ce.__reactDisabledLog=!0;function Qe(){{if(V===0){he=console.log,me=console.info,Ee=console.warn,be=console.error,ye=console.group,_e=console.groupCollapsed,Re=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Ce,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}V++}}function er(){{if(V--,V===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:F({},e,{value:he}),info:F({},e,{value:me}),warn:F({},e,{value:Ee}),error:F({},e,{value:be}),group:F({},e,{value:ye}),groupCollapsed:F({},e,{value:_e}),groupEnd:F({},e,{value:Re})})}V<0&&l("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=y.ReactCurrentDispatcher,ne;function B(e,r,t){{if(ne===void 0)try{throw Error()}catch(u){var n=u.stack.trim().match(/\n( *(at )?)/);ne=n&&n[1]||""}return`
18
+ `+ne+e}}var ae=!1,J;{var rr=typeof WeakMap=="function"?WeakMap:Map;J=new rr}function De(e,r){if(!e||ae)return"";{var t=J.get(e);if(t!==void 0)return t}var n;ae=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var c;c=te.current,te.current=null,Qe();try{if(r){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(k){n=k}Reflect.construct(e,[],i)}else{try{i.call()}catch(k){n=k}e.call(i.prototype)}}else{try{throw Error()}catch(k){n=k}e()}}catch(k){if(k&&n&&typeof k.stack=="string"){for(var a=k.stack.split(`
19
19
  `),m=n.stack.split(`
20
20
  `),d=a.length-1,v=m.length-1;d>=1&&v>=0&&a[d]!==m[v];)v--;for(;d>=1&&v>=0;d--,v--)if(a[d]!==m[v]){if(d!==1||v!==1)do if(d--,v--,v<0||a[d]!==m[v]){var R=`
21
- `+a[d].replace(" at new "," at ");return e.displayName&&R.includes("<anonymous>")&&(R=R.replace("<anonymous>",e.displayName)),typeof e=="function"&&J.set(e,R),R}while(d>=1&&v>=0);break}}}finally{ae=!1,te.current=c,er(),Error.prepareStackTrace=u}var $=e?e.displayName||e.name:"",$e=$?B($):"";return typeof e=="function"&&J.set(e,$e),$e}function tr(e,r,t){return Te(e,!1)}function nr(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function G(e,r,t){if(e==null)return"";if(typeof e=="function")return Te(e,nr(e));if(typeof e=="string")return B(e);switch(e){case S:return B("Suspense");case h:return B("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case g:return tr(e.render);case s:return G(e.type,r,t);case D:{var n=e,u=n._payload,c=n._init;try{return G(c(u),r,t)}catch{}}}return""}var z=Object.prototype.hasOwnProperty,De={},Oe=y.ReactDebugCurrentFrame;function K(e){if(e){var r=e._owner,t=G(e.type,e._source,r?r.type:null);Oe.setExtraStackFrame(t)}else Oe.setExtraStackFrame(null)}function ar(e,r,t,n,u){{var c=Function.call.bind(z);for(var i in e)if(c(e,i)){var a=void 0;try{if(typeof e[i]!="function"){var m=Error((n||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}a=e[i](r,i,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(d){a=d}a&&!(a instanceof Error)&&(K(u),l("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,i,typeof a),K(null)),a instanceof Error&&!(a.message in De)&&(De[a.message]=!0,K(u),l("Failed %s type: %s",t,a.message),K(null))}}}var ir=Array.isArray;function ie(e){return ir(e)}function or(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function ur(e){try{return Pe(e),!1}catch{return!0}}function Pe(e){return""+e}function we(e){if(ur(e))return l("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",or(e)),Pe(e)}var U=y.ReactCurrentOwner,sr={key:!0,ref:!0,__self:!0,__source:!0},Se,je,oe;oe={};function cr(e){if(z.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function fr(e){if(z.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function lr(e,r){if(typeof e.ref=="string"&&U.current&&r&&U.current.stateNode!==r){var t=N(U.current.type);oe[t]||(l('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',N(U.current.type),e.ref),oe[t]=!0)}}function dr(e,r){{var t=function(){Se||(Se=!0,l("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function vr(e,r){{var t=function(){je||(je=!0,l("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var pr=function(e,r,t,n,u,c,i){var a={$$typeof:f,type:e,key:r,ref:t,props:i,_owner:c};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:u}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function gr(e,r,t,n,u){{var c,i={},a=null,m=null;t!==void 0&&(we(t),a=""+t),fr(r)&&(we(r.key),a=""+r.key),cr(r)&&(m=r.ref,lr(r,u));for(c in r)z.call(r,c)&&!sr.hasOwnProperty(c)&&(i[c]=r[c]);if(e&&e.defaultProps){var d=e.defaultProps;for(c in d)i[c]===void 0&&(i[c]=d[c])}if(a||m){var v=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&dr(i,v),m&&vr(i,v)}return pr(e,a,m,u,n,U.current,i)}}var ue=y.ReactCurrentOwner,xe=y.ReactDebugCurrentFrame;function I(e){if(e){var r=e._owner,t=G(e.type,e._source,r?r.type:null);xe.setExtraStackFrame(t)}else xe.setExtraStackFrame(null)}var se;se=!1;function ce(e){return typeof e=="object"&&e!==null&&e.$$typeof===f}function Ne(){{if(ue.current){var e=N(ue.current.type);if(e)return`
21
+ `+a[d].replace(" at new "," at ");return e.displayName&&R.includes("<anonymous>")&&(R=R.replace("<anonymous>",e.displayName)),typeof e=="function"&&J.set(e,R),R}while(d>=1&&v>=0);break}}}finally{ae=!1,te.current=c,er(),Error.prepareStackTrace=u}var $=e?e.displayName||e.name:"",$e=$?B($):"";return typeof e=="function"&&J.set(e,$e),$e}function tr(e,r,t){return De(e,!1)}function nr(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function G(e,r,t){if(e==null)return"";if(typeof e=="function")return De(e,nr(e));if(typeof e=="string")return B(e);switch(e){case S:return B("Suspense");case h:return B("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case g:return tr(e.render);case s:return G(e.type,r,t);case T:{var n=e,u=n._payload,c=n._init;try{return G(c(u),r,t)}catch{}}}return""}var z=Object.prototype.hasOwnProperty,Te={},Oe=y.ReactDebugCurrentFrame;function K(e){if(e){var r=e._owner,t=G(e.type,e._source,r?r.type:null);Oe.setExtraStackFrame(t)}else Oe.setExtraStackFrame(null)}function ar(e,r,t,n,u){{var c=Function.call.bind(z);for(var i in e)if(c(e,i)){var a=void 0;try{if(typeof e[i]!="function"){var m=Error((n||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}a=e[i](r,i,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(d){a=d}a&&!(a instanceof Error)&&(K(u),l("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,i,typeof a),K(null)),a instanceof Error&&!(a.message in Te)&&(Te[a.message]=!0,K(u),l("Failed %s type: %s",t,a.message),K(null))}}}var ir=Array.isArray;function ie(e){return ir(e)}function or(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function ur(e){try{return Pe(e),!1}catch{return!0}}function Pe(e){return""+e}function we(e){if(ur(e))return l("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",or(e)),Pe(e)}var U=y.ReactCurrentOwner,sr={key:!0,ref:!0,__self:!0,__source:!0},Se,je,oe;oe={};function cr(e){if(z.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function fr(e){if(z.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function lr(e,r){if(typeof e.ref=="string"&&U.current&&r&&U.current.stateNode!==r){var t=N(U.current.type);oe[t]||(l('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',N(U.current.type),e.ref),oe[t]=!0)}}function dr(e,r){{var t=function(){Se||(Se=!0,l("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function vr(e,r){{var t=function(){je||(je=!0,l("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var pr=function(e,r,t,n,u,c,i){var a={$$typeof:f,type:e,key:r,ref:t,props:i,_owner:c};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:u}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function gr(e,r,t,n,u){{var c,i={},a=null,m=null;t!==void 0&&(we(t),a=""+t),fr(r)&&(we(r.key),a=""+r.key),cr(r)&&(m=r.ref,lr(r,u));for(c in r)z.call(r,c)&&!sr.hasOwnProperty(c)&&(i[c]=r[c]);if(e&&e.defaultProps){var d=e.defaultProps;for(c in d)i[c]===void 0&&(i[c]=d[c])}if(a||m){var v=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&dr(i,v),m&&vr(i,v)}return pr(e,a,m,u,n,U.current,i)}}var ue=y.ReactCurrentOwner,xe=y.ReactDebugCurrentFrame;function I(e){if(e){var r=e._owner,t=G(e.type,e._source,r?r.type:null);xe.setExtraStackFrame(t)}else xe.setExtraStackFrame(null)}var se;se=!1;function ce(e){return typeof e=="object"&&e!==null&&e.$$typeof===f}function Ne(){{if(ue.current){var e=N(ue.current.type);if(e)return`
22
22
 
23
23
  Check the render method of \``+e+"`."}return""}}function hr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return`
24
24
 
25
25
  Check your code at `+r+":"+t+"."}return""}}var ke={};function mr(e){{var r=Ne();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
26
26
 
27
- Check the top-level render call using <`+t+">.")}return r}}function Fe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=mr(r);if(ke[t])return;ke[t]=!0;var n="";e&&e._owner&&e._owner!==ue.current&&(n=" It was passed a child from "+N(e._owner.type)+"."),I(e),l('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),I(null)}}function Ae(e,r){{if(typeof e!="object")return;if(ie(e))for(var t=0;t<e.length;t++){var n=e[t];ce(n)&&Fe(n,r)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var u=q(e);if(typeof u=="function"&&u!==e.entries)for(var c=u.call(e),i;!(i=c.next()).done;)ce(i.value)&&Fe(i.value,r)}}}function Er(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===g||r.$$typeof===s))t=r.propTypes;else return;if(t){var n=N(r);ar(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!se){se=!0;var u=N(r);l("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",u||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&l("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function br(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){I(e),l("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),I(null);break}}e.ref!==null&&(I(e),l("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}}function Ie(e,r,t,n,u,c){{var i=Xe(e);if(!i){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var m=hr(u);m?a+=m:a+=Ne();var d;e===null?d="null":ie(e)?d="array":e!==void 0&&e.$$typeof===f?(d="<"+(N(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):d=typeof e,l("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",d,a)}var v=gr(e,r,t,u,c);if(v==null)return v;if(i){var R=r.children;if(R!==void 0)if(n)if(ie(R)){for(var $=0;$<R.length;$++)Ae(R[$],e);Object.freeze&&Object.freeze(R)}else l("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ae(R,e)}return e===b?br(v):Er(v),v}}function yr(e,r,t){return Ie(e,r,t,!0)}function _r(e,r,t){return Ie(e,r,t,!1)}var Rr=_r,Cr=yr;M.Fragment=b,M.jsx=Rr,M.jsxs=Cr}()),M}(function(o){process.env.NODE_ENV==="production"?o.exports=Le():o.exports=Ve()})(Z);const Q=Z.exports.Fragment,A=Z.exports.jsx;class de extends W.default.Component{render(){if(this.props.niceDag&&this.props.node.ref){const f=this.props.niceDag.getElementByNodeId(this.props.node.id);if(f)return X.default.createPortal(A(Q,{children:this.props.render(this.props)}),f)}return null}}class ve extends W.default.Component{render(){return this.props.niceDag&&this.props.edge.ref?X.default.createPortal(A(Q,{children:this.props.render(this.props)}),this.props.edge.ref):null}}class Ue extends W.default.Component{render(){if(this.props.niceDag){const f=this.props.niceDag.getRootContentElement();return X.default.createPortal(A(Q,{children:this.props.render(this.props.niceDag)}),f)}return null}}function qe(o){const f=p.useCallback(()=>{o.remove()},[o]),O=p.useCallback((b,C=40)=>{o.insertNodes(b,C)},[o]);return{onEdgeRemove:f,onNodeInsert:O}}function Be({node:o,niceDag:f}){const O=p.useCallback(()=>{o.remove()},[o]),b=p.useCallback(P=>{f.startEdgeDragging(o,P)},[f,o]),C=p.useCallback(P=>{f.startNodeDragging(o,P)},[f,o]);return{onNodeRemove:O,startEdgeDragging:b,startNodeDragging:C}}function Je(o){const{initNodes:f}=o;if(!f)throw new Error("initNodes can't be undefined!")}function Ge(o){Je(o);const{onMount:f,renderNode:O,renderRootView:b,renderEdge:C,scrollPosition:P,initNodes:T,minimapConfig:w,...g}=o,S=p.useRef(null),h=p.useRef(null),s=p.useRef(null),D=p.useRef(),[_,j]=p.useState(0),ee=p.useCallback(()=>{s.current&&s.current.destory()},[j]),q=p.useMemo(()=>({onChange:()=>{j(_+1)}}),[j,_]);return p.useEffect(()=>{if(D.current!==T){if(!s.current){const y=Me.default.init({container:S.current,minimapContainer:h.current,minimapConfig:w,...g},o.editable);s.current=y}s.current.withNodes(T).render(),j(_+1),D.current=T,f&&f()}return s.current.addNiceDagChangeListener(q),()=>{s.current.removeNiceDagChangeListener(q)}},[T,j,_,f]),p.useEffect(()=>(s.current&&s.current.isDestoried&&(s.current.withNodes(T).render(),j(_+1)),()=>{s.current&&s.current.destory()}),[]),{niceDag:s.current,niceDagEl:S,minimapEl:h,render:()=>{if(s.current){const y=s.current.getAllNodes();let l=(y==null?void 0:y.length)>0?y.map(x=>A(de,{render:O,node:x,niceDag:s.current,patchVersion:_},x.id)):null;if(b&&(l=[...l,A(Ue,{niceDag:s.current,render:b},"root-view")]),C){const x=s.current.getAllEdges(),re=(x==null?void 0:x.length)>0?x.map(L=>A(ve,{render:C,edge:L,patchVersion:_,niceDag:s.current},`edge-${L.source.id}-${L.target.id}`)):[];l=[...l,...re]}return l}return null},reset:ee}}E.NiceDagEdge=ve,E.NiceDagNode=de,E.useNiceDag=Ge,E.useNiceDagEdge=qe,E.useNiceDagNode=Be,Object.defineProperties(E,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
27
+ Check the top-level render call using <`+t+">.")}return r}}function Fe(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=mr(r);if(ke[t])return;ke[t]=!0;var n="";e&&e._owner&&e._owner!==ue.current&&(n=" It was passed a child from "+N(e._owner.type)+"."),I(e),l('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),I(null)}}function Ae(e,r){{if(typeof e!="object")return;if(ie(e))for(var t=0;t<e.length;t++){var n=e[t];ce(n)&&Fe(n,r)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var u=q(e);if(typeof u=="function"&&u!==e.entries)for(var c=u.call(e),i;!(i=c.next()).done;)ce(i.value)&&Fe(i.value,r)}}}function Er(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===g||r.$$typeof===s))t=r.propTypes;else return;if(t){var n=N(r);ar(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!se){se=!0;var u=N(r);l("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",u||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&l("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function br(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){I(e),l("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),I(null);break}}e.ref!==null&&(I(e),l("Invalid attribute `ref` supplied to `React.Fragment`."),I(null))}}function Ie(e,r,t,n,u,c){{var i=Xe(e);if(!i){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var m=hr(u);m?a+=m:a+=Ne();var d;e===null?d="null":ie(e)?d="array":e!==void 0&&e.$$typeof===f?(d="<"+(N(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):d=typeof e,l("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",d,a)}var v=gr(e,r,t,u,c);if(v==null)return v;if(i){var R=r.children;if(R!==void 0)if(n)if(ie(R)){for(var $=0;$<R.length;$++)Ae(R[$],e);Object.freeze&&Object.freeze(R)}else l("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ae(R,e)}return e===b?br(v):Er(v),v}}function yr(e,r,t){return Ie(e,r,t,!0)}function _r(e,r,t){return Ie(e,r,t,!1)}var Rr=_r,Cr=yr;M.Fragment=b,M.jsx=Rr,M.jsxs=Cr}()),M}(function(o){process.env.NODE_ENV==="production"?o.exports=Le():o.exports=Ve()})(Z);const Q=Z.exports.Fragment,A=Z.exports.jsx;class de extends W.default.Component{render(){if(this.props.niceDag&&this.props.node.ref){const f=this.props.niceDag.getElementByNodeId(this.props.node.id);if(f)return X.default.createPortal(A(Q,{children:this.props.render({node:this.props.node,niceDag:this.props.niceDag})}),f)}return null}}class ve extends W.default.Component{render(){return this.props.niceDag&&this.props.edge.ref?X.default.createPortal(A(Q,{children:this.props.render({edge:this.props.edge,niceDag:this.props.niceDag})}),this.props.edge.ref):null}}class Ue extends W.default.Component{render(){if(this.props.niceDag){const f=this.props.niceDag.getRootContentElement();return X.default.createPortal(A(Q,{children:this.props.render(this.props.niceDag)}),f)}return null}}function qe(o){const f=p.useCallback(()=>{o.remove()},[o]),O=p.useCallback((b,C=40)=>{o.insertNodes(b,C)},[o]);return{onEdgeRemove:f,onNodeInsert:O}}function Be({node:o,niceDag:f}){const O=p.useCallback(()=>{o.remove()},[o]),b=p.useCallback(P=>{f.startEdgeDragging(o,P)},[f,o]),C=p.useCallback(P=>{f.startNodeDragging(o,P)},[f,o]);return{onNodeRemove:O,startEdgeDragging:b,startNodeDragging:C}}function Je(o){const{initNodes:f}=o;if(!f)throw new Error("initNodes can't be undefined!")}function Ge(o){Je(o);const{onMount:f,renderNode:O,renderRootView:b,renderEdge:C,scrollPosition:P,initNodes:D,minimapConfig:w,...g}=o,S=p.useRef(null),h=p.useRef(null),s=p.useRef(null),T=p.useRef(),[_,j]=p.useState(0),ee=p.useCallback(()=>{s.current&&s.current.destory()},[j]),q=p.useMemo(()=>({onChange:()=>{j(_+1)}}),[j,_]);return p.useEffect(()=>{if(T.current!==D){if(!s.current){const y=Me.default.init({container:S.current,minimapContainer:h.current,minimapConfig:w,...g},o.editable);s.current=y}s.current.withNodes(D).render(),j(_+1),T.current=D,f&&f()}return s.current.addNiceDagChangeListener(q),()=>{s.current.removeNiceDagChangeListener(q)}},[D,j,_,f]),p.useEffect(()=>(s.current&&s.current.isDestoried&&(s.current.withNodes(D).render(),j(_+1)),()=>{s.current&&s.current.destory()}),[]),{niceDag:s.current,niceDagEl:S,minimapEl:h,render:()=>{if(s.current){const y=s.current.getAllNodes();let l=(y==null?void 0:y.length)>0?y.map(x=>A(de,{render:O,node:x,niceDag:s.current,patchVersion:_},x.id)):null;if(b&&(l=[...l,A(Ue,{niceDag:s.current,render:b},"root-view")]),C){const x=s.current.getAllEdges(),re=(x==null?void 0:x.length)>0?x.map(L=>A(ve,{render:C,edge:L,patchVersion:_,niceDag:s.current},`edge-${L.source.id}-${L.target.id}`)):[];l=[...l,...re]}return l}return null},reset:ee}}E.NiceDagEdge=ve,E.NiceDagNode=de,E.useNiceDag=Ge,E.useNiceDagEdge=qe,E.useNiceDagNode=Be,Object.defineProperties(E,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebay/nice-dag-react",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./lib/index.cjs",
@@ -88,7 +88,7 @@
88
88
  "vite-plugin-dts": "^1.6.6"
89
89
  },
90
90
  "dependencies": {
91
- "@ebay/nice-dag-core": "^1.0.15"
91
+ "@ebay/nice-dag-core": "^1.0.17"
92
92
  },
93
93
  "peerDependencies": {
94
94
  "react": ">16.8.0",