@plurid/plurid-react 0.0.0-30 → 0.0.0-31
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.
|
@@ -534,7 +534,7 @@
|
|
|
534
534
|
::after {
|
|
535
535
|
content: "${({devisible:e,suffix:t})=>e?"":t||"'"}";
|
|
536
536
|
}
|
|
537
|
-
`,Xn=o.connect((e=>({stateTree:Ot.space.getTree(e),stateLastClosedPlane:Ot.space.getLastClosedPlane(e),stateGeneralTheme:Ot.themes.getGeneralTheme(e),stateConfiguration:Ot.configuration.getConfiguration(e),stateViewSize:Ot.space.getViewSize(e)})),(e=>({dispatch:e,dispatchSetTree:t=>e(qe.space.setTree(t)),dispatchSetSpaceField:t=>e(qe.space.setSpaceField(t)),dispatchUpdateSpaceLinkCoordinates:t=>e(qe.space.updateSpaceLinkCoordinates(t))})),null,{context:Ge})((e=>{const n=r.useContext(He);if(!n)return x.default.createElement(x.default.Fragment,null,e.children);const{hostname:o,planesRegistrar:i,defaultPubSub:s}=n,c=ie(i);if(!c)return x.default.createElement(x.default.Fragment,null,e.children);const{children:d,route:f,devisible:p,suffix:m,atClick:g,style:h,className:T,preview:E,previewComponent:v,previewFadeIn:S,previewFadeOut:P,previewOffsetX:b,previewOffsetY:R,stateTree:I,stateLastClosedPlane:C,stateGeneralTheme:w,stateConfiguration:O,stateViewSize:y,dispatch:_,dispatchSetTree:L,dispatchSetSpaceField:A,dispatchUpdateSpaceLinkCoordinates:U}=e,D=O.elements.plane.controls.show,N=S||t.PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_IN,M=P||t.PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_OUT,k=me(f),F=pe(k,O.network.protocol,o||O.network.host),B=null!=m?m:t.PLURID_DEFAULT_CONFIGURATION_LINK_SUFFIX,Y=null!=p&&p,$=r.useRef(null),X=r.useRef(null),V=r.useRef(null),
|
|
537
|
+
`,Xn=o.connect((e=>({stateTree:Ot.space.getTree(e),stateLastClosedPlane:Ot.space.getLastClosedPlane(e),stateGeneralTheme:Ot.themes.getGeneralTheme(e),stateConfiguration:Ot.configuration.getConfiguration(e),stateViewSize:Ot.space.getViewSize(e)})),(e=>({dispatch:e,dispatchSetTree:t=>e(qe.space.setTree(t)),dispatchSetSpaceField:t=>e(qe.space.setSpaceField(t)),dispatchUpdateSpaceLinkCoordinates:t=>e(qe.space.updateSpaceLinkCoordinates(t))})),null,{context:Ge})((e=>{const n=r.useContext(He);if(!n)return x.default.createElement(x.default.Fragment,null,e.children);const{hostname:o,planesRegistrar:i,defaultPubSub:s}=n,c=ie(i);if(!c)return x.default.createElement(x.default.Fragment,null,e.children);const{children:d,route:f,devisible:p,suffix:m,atClick:g,style:h,className:T,preview:E,previewComponent:v,previewFadeIn:S,previewFadeOut:P,previewOffsetX:b,previewOffsetY:R,stateTree:I,stateLastClosedPlane:C,stateGeneralTheme:w,stateConfiguration:O,stateViewSize:y,dispatch:_,dispatchSetTree:L,dispatchSetSpaceField:A,dispatchUpdateSpaceLinkCoordinates:U}=e,D=O.elements.plane.controls.show,N=S||t.PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_IN,M=P||t.PLURID_DEFAULT_CONFIGURATION_LINK_PREVIEW_FADE_OUT,k=me(f),F=pe(k,O.network.protocol,o||O.network.host),B=null!=m?m:t.PLURID_DEFAULT_CONFIGURATION_LINK_SUFFIX,Y=null!=p&&p,$=r.useRef(null),X=r.useRef(null),V=r.useRef(null),z=r.useRef(),[K,Z]=r.useState(!1),[j,G]=r.useState(!1),[W,H]=r.useState(!1),[q,J]=r.useState(""),[Q,ee]=r.useState(le($.current)),[te,ae]=r.useState(kn),ne=()=>{const e=$.current;if(!e)return Object.assign({},kn);let t=0,a=0,n=!1,r=e,o=!0,i=0,l=0;for(;o;)if("static"!==window.getComputedStyle(r).position||n||(t+=r.offsetTop,a+=r.offsetLeft,n=!0),"relative"===window.getComputedStyle(r).position&&(i+=t,l+=a,t=0,a=0,n=!1),r.scrollLeft&&(l+=-r.scrollLeft),r.scrollTop&&(i+=-r.scrollTop),r.parentElement){"PluridPlane"===r.parentElement.dataset.pluridEntity&&(o=!1),r=r.parentElement}else o=!1;const s=D?56:0;return{x:l+e.offsetWidth,y:i+s}},re=u.useDebouncedCallback((()=>{(()=>{const e=ne();U({planeID:q,linkCoordinates:e});const t=a.space.tree.logic.updatePlaneLocation(l.objects.clone(I),Q,q,l.objects.clone(e));L(t)})()}),t.PLURID_DEFAULT_RESIZE_DEBOUNCE_TIME),oe=e=>{const{updatedTree:t,updatedPlane:n}=a.space.tree.logic.togglePlaneFromTree(l.objects.clone(I),q,e);return L(t),H((e=>!e)),G(!1),{updatedPlane:n}},se=(e,t)=>{t&&(W||(A({field:"isolatePlane",value:""}),Et(_,t,e)))},ce=e=>{if(e.altKey&&W&&q){const t=a.space.tree.logic.getTreePlaneByID(I,q);Et(_,t,e)}else W||q?(e=>{const{updatedPlane:t}=oe();se(e,t)})(e):(e=>{if(!Q||!F)return;const{route:t}=F,n=ne(),{pluridPlaneID:r,updatedTree:i,updatedTreePlane:s}=a.space.tree.logic.updateTreeWithNewPlane(t,Q,n,l.objects.clone(I),c.getAll(),O,o);r&&(se(e,s),L(i),H(!0),J(r))})(e)},ue=()=>{$.current&&$.current.blur()},de=r.useCallback((e=>{e.preventDefault(),void 0!==g&&g(e),ce(e),ue()}),[Q,JSON.stringify(I),$.current]);return r.useEffect((()=>{const e=le($.current);ee(e);const t=ne();ae(t);((e,t)=>{if(e&&e.children)for(const a of e.children)a.linkCoordinates&&(a.linkCoordinates.x!==t.x&&a.linkCoordinates.y!==t.y||(H(!0),J(a.planeID)))})(a.space.tree.logic.getTreePlaneByID(I,e),t)}),[]),r.useEffect((()=>{W&&re()}),[W,JSON.stringify(y),JSON.stringify(I)]),r.useEffect((()=>{if(E)return K&&V.current&&(X.current=setTimeout((()=>{G(!0)}),N),clearTimeout(V.current)),K||(V.current=setTimeout((()=>{G(!1),X.current&&clearTimeout(X.current)}),M)),()=>{V.current&&clearTimeout(V.current),X.current&&clearTimeout(X.current)}}),[E,K]),r.useEffect((()=>{}),[]),r.useEffect((()=>{const e=s.subscribe({topic:t.PLURID_PUBSUB_TOPIC.OPEN_CLOSED_PLANE,callback:()=>{C===q&&(oe(),A({field:"lastClosedPlane",value:""}))}});return()=>{s.unsubscribe(e)}}),[W,q,JSON.stringify(I)]),r.useEffect((()=>{const e=s.subscribe({topic:t.PLURID_PUBSUB_TOPIC.CLOSE_PLANE,callback:e=>{const{id:t}=e;if(t===q&&W){oe(!1),A({field:"lastClosedPlane",value:t})}}});return()=>{s.unsubscribe(e)}}),[W,q,JSON.stringify(I)]),r.useEffect((()=>{const e=a.space.tree.logic.getTreePlaneByID(I,q);return z.current=e,()=>{setTimeout((()=>{var e;W&&null===$.current&&!1===(null===(e=z.current)||void 0===e?void 0:e.show)&&(()=>{const e=a.space.tree.logic.removePlaneFromTree(l.objects.clone(I),q);L(e),H((e=>!e)),G(!1)})()}),10)}}),[W,j,q,Q,JSON.stringify(I)]),x.default.createElement($n,{ref:$,onClick:e=>de(e),onMouseEnter:()=>Z(!0),onMouseLeave:()=>Z(!1),onKeyUp:e=>(e=>{if("Enter"===e.code)return de(e),void ue()})(e),theme:w,suffix:B,devisible:Y,style:Object.assign({},h),className:T,"data-plurid-entity":t.PLURID_ENTITY_LINK,tabIndex:0},d,j&&!W&&x.default.createElement(Fn,{elementID:`preview-${Q}`,rootID:Q},x.default.createElement(Yn,{planeRoute:k,linkCoordinates:te,previewComponent:v,previewOffsetX:b,previewOffsetY:R})))})),Vn=c.css`
|
|
538
538
|
color: ${({theme:e})=>e.colorTertiary};
|
|
539
539
|
|
|
540
540
|
@media (hover:hover) {
|