@node-projects/web-component-designer 0.1.281 → 0.1.282
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.
|
@@ -138,7 +138,7 @@ export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
|
|
|
138
138
|
set instanceServiceContainer(value) {
|
|
139
139
|
this._instanceServiceContainer = value;
|
|
140
140
|
this._selectionChangedHandler?.dispose();
|
|
141
|
-
if (this.
|
|
141
|
+
if (this._instanceServiceContainer) {
|
|
142
142
|
this._selectionChangedHandler = this._instanceServiceContainer.selectionService.onSelectionChanged.on(async (e) => {
|
|
143
143
|
this.propertyGrid.instanceServiceContainer = value;
|
|
144
144
|
await sleep(20); // delay assignment a little bit, so onblur above could still set the value.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyGridWithHeader.js","sourceRoot":"","sources":["../../../../src/elements/widgets/propertyGrid/PropertyGridWithHeader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gCAAgC,EAAE,GAAG,EAAc,IAAI,EAAE,MAAM,yCAAyC,CAAC;AAIlH,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM,4EAA4E,CAAC;AAG3H,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAEtE,MAAM,OAAO,sBAAuB,SAAQ,gCAAgC;IAE1E,MAAM,CAAmB,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsCjC,CAAC;IAEJ,MAAM,CAAmB,QAAQ,GAAG,IAAI,CAAA;;;;;;;;;;oHAU0E,CAAA;IAE3G,YAAY,CAAe;IAE1B,KAAK,CAAmB;IACxB,GAAG,CAAmB;IACt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EO,gBAAgB,CAAC,KAAiB,EAAE,WAA0B,EAAE,QAAmB;QACzF,IAAI,YAAgC,CAAC;QACrC,IAAI,IAAI,CAAC,YAAY,CAAC,2BAA2B;YAC/C,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC,2BAA2B,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAA;QACrF,IAAI,CAAC,YAAY;YACf,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;QACxE,WAAW,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;;AAGH,cAAc,CAAC,MAAM,CAAC,gEAAgE,EAAE,sBAAsB,CAAC,CAAC"}
|
package/dist/index-min.js
CHANGED
|
@@ -1243,7 +1243,7 @@ declare global {
|
|
|
1243
1243
|
<div title="textContent" id="contentRect" style="width: 7px; height: 7px; border: 1px solid white;"></div>
|
|
1244
1244
|
<span id="contentSpan" class="desc">Content:</span><input type="text" id="content">
|
|
1245
1245
|
</div>
|
|
1246
|
-
<node-projects-web-component-designer-property-grid id="pg"></node-projects-web-component-designer-property-grid>`;propertyGrid;_type;_id;_content;_selectionChangedHandler;_instanceServiceContainer;_idRect;_contentRect;_innerRect;_propertiesService;_configButton;constructor(){super(),this._restoreCachedInititalValues(),this._type=this._getDomElement("type"),this._id=this._getDomElement("id"),this._content=this._getDomElement("content"),this.propertyGrid=this._getDomElement("pg"),this._idRect=this._getDomElement("idRect"),this._contentRect=this._getDomElement("contentRect"),this._innerRect=this._getDomElement("innerRect"),this._configButton=this._getDomElement("config"),this._configButton.onclick=async()=>{let i=await(await this.serviceContainer?.getLastServiceWhereAsync("configUiService",async r=>await r.hasConfigUi(this._instanceServiceContainer.selectionService.primarySelection))).getConfigUi(this._instanceServiceContainer.selectionService.primarySelection);this.serviceContainer.globalContext.showConfigClicked.emit({designItem:this._instanceServiceContainer.selectionService.primarySelection,configUi:i})},this._propertiesService=new ro,this._idRect.oncontextmenu=t=>{t.preventDefault(),this._instanceServiceContainer.selectionService.primarySelection?.isRootItem||this._openContextMenu(t,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService.idProperty)},this._contentRect.oncontextmenu=t=>{t.preventDefault(),this._instanceServiceContainer.selectionService.primarySelection?.isRootItem||this._openContextMenu(t,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService.contentProperty)},this._innerRect.oncontextmenu=t=>{t.preventDefault(),this._instanceServiceContainer.selectionService.primarySelection?.isRootItem||this._openContextMenu(t,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService.innerHtmlProperty)},this._id.onkeydown=t=>{t.key=="Enter"?this._instanceServiceContainer.selectionService.primarySelection.id=this._id.value:t.key=="Escape"&&(this._id.value=this._instanceServiceContainer.selectionService.primarySelection?.id??"",t.preventDefault(),t.stopPropagation()),we.refreshIsSetElementAndEditorForDesignItems(this._idRect,this._propertiesService.idProperty,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService)},this._content.onkeydown=t=>{t.key=="Enter"?(this._instanceServiceContainer.selectionService.primarySelection.content=this._content.value,this._content.title=this._content.value):t.key=="Escape"&&(this._content.value=this._instanceServiceContainer.selectionService.primarySelection?.element?.textContent??"",t.preventDefault(),t.stopPropagation()),we.refreshIsSetElementAndEditorForDesignItems(this._contentRect,this._propertiesService.contentProperty,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService),we.refreshIsSetElementAndEditorForDesignItems(this._innerRect,this._propertiesService.innerHtmlProperty,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService)};let e;this._id.onfocus=t=>{e=this._instanceServiceContainer.selectionService.primarySelection},this._id.onblur=t=>{e&&(e.id=this._id.value),e=null,we.refreshIsSetElementAndEditorForDesignItems(this._idRect,this._propertiesService.idProperty,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService)}}set serviceContainer(e){this.propertyGrid.serviceContainer=e}set instanceServiceContainer(e){this._instanceServiceContainer=e,this._selectionChangedHandler?.dispose(),this.instanceServiceContainer?this._selectionChangedHandler=this._instanceServiceContainer.selectionService.onSelectionChanged.on(async t=>{this.propertyGrid.instanceServiceContainer=e,await at(20),this._instanceServiceContainer.selectionService?.primarySelection?.isRootItem?(this._configButton.style.display="none",this._id.value="",this._content.value="",this._id.disabled=!0,this._content.disabled=!0,this._idRect.style.background="",this._contentRect.style.background="",this._innerRect.style.background="",this._type.value=":host"):(this._id.disabled=!1,this._content.disabled=!1,await this.serviceContainer?.getLastServiceWhereAsync("configUiService",r=>r.hasConfigUi(this._instanceServiceContainer.selectionService.primarySelection))?this._configButton.style.display="block":this._configButton.style.display="none",this._instanceServiceContainer.selectionService.primarySelection?.nodeType==E.Element?this._type.value=this._instanceServiceContainer.selectionService.primarySelection?.name??"":this._type.value=this._instanceServiceContainer.selectionService.primarySelection?.node?.nodeName??"",this._type.title=this._type.value,this._id.blur(),this._id.value=this._instanceServiceContainer.selectionService.primarySelection?.id??"",this._instanceServiceContainer.selectionService.primarySelection?.element?.nodeType!=E.Element?this._content.value=this._instanceServiceContainer.selectionService.primarySelection?.content??"":this._instanceServiceContainer.selectionService.primarySelection?.element?.children?.length<=0?this._content.value=this._instanceServiceContainer.selectionService.primarySelection?.content??"":this._content.value="",this._content.title=this._content.value,we.refreshIsSetElementAndEditorForDesignItems(this._idRect,this._propertiesService.idProperty,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService),we.refreshIsSetElementAndEditorForDesignItems(this._contentRect,this._propertiesService.contentProperty,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService),we.refreshIsSetElementAndEditorForDesignItems(this._innerRect,this._propertiesService.innerHtmlProperty,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService))}):(this._configButton.style.display="none",this._id.value="",this._content.value="",this._id.disabled=!0,this._content.disabled=!0,this._idRect.style.background="",this._contentRect.style.background="",this._innerRect.style.background="",this._type.value=":host"),this.propertyGrid.instanceServiceContainer=e}_openContextMenu(e,t,i){let r;this.propertyGrid.propertyContextMenuProvider&&(r=this.propertyGrid.propertyContextMenuProvider(t,i)),r||(r=i.service.getContextMenu(t,i)),le.show(r,e)}};customElements.define("node-projects-web-component-designer-property-grid-with-header",zc);import{css as Em,DomHelper as Am,html as Pm,BaseCustomWebComponentConstructorAppend as km}from"@node-projects/base-custom-webcomponent";J();$();Z();Be();import{BaseCustomWebComponentLazyAppend as ym,css as vm,cssFromString as xm,DomHelper as Fc,html as _m,TypedEvent as td}from"@node-projects/base-custom-webcomponent";Y();var ut=I.Normal,co=class{snapOffset=5;_overlayLayerView;_containerItem;_positionsH=[];_positionsMiddleH=[];_positionsV=[];_positionsMiddleV=[];_outerRect;constructor(e){this._overlayLayerView=e}initialize(e){this._containerItem=e}clearSnaplines(){this._overlayLayerView.removeAllNodesWithClass&&this._overlayLayerView.removeAllNodesWithClass("svg-snapline"),this._positionsH=[],this._positionsMiddleH=[],this._positionsV=[],this._positionsMiddleV=[]}calculateSnaplines(e){this.clearSnaplines();let t=this._containerItem.serviceContainer.snaplinesProviderService.provideSnaplines(this._containerItem,e);this._outerRect=t.outerRect,this._positionsH=t.positionsH,this._positionsMiddleH=t.positionsMiddleH,this._positionsV=t.positionsV,this._positionsMiddleV=t.positionsMiddleV}snapToPosition(e,t,i){let r=this.snapOffset+1,n,o;for(let c=0;c<this._positionsH.length;c++){let h=Math.abs(this._positionsH[c][0]-e.x);(h<r||h===r&&n===void 0)&&(r=h,n=[],o=this._positionsH[c][0]);let d;t&&(d=Math.abs(e.x+t.width-this._positionsH[c][0]),(d<r||d===r&&n===void 0)&&(r=d,n=[],o=this._positionsH[c][0]-t.width)),h===r&&n.push(this._positionsH[c][1]),t&&d===r&&h!==r&&n.push(this._positionsH[c][1])}if(t)for(let c=0;c<this._positionsMiddleH.length;c++){let h=Math.abs(this._positionsMiddleH[c][0]-(e.x+t.width/2));(h<r||h===r&&n===void 0)&&(r=h,n=[],o=this._positionsMiddleH[c][0]-t.width/2),h===r&&n.push(this._positionsMiddleH[c][1])}r=this.snapOffset+1;let a,l;for(let c=0;c<this._positionsV.length;c++){let h=Math.abs(this._positionsV[c][0]-e.y);(h<r||h===r&&a===void 0)&&(r=h,a=[],l=this._positionsV[c][0]);let d;t&&(d=Math.abs(e.y+t.height-this._positionsV[c][0]),(d<r||d===r&&a===void 0)&&(r=d,a=[],l=this._positionsV[c][0]-t.height)),h===r&&a.push(this._positionsV[c][1]),t&&d===r&&h!==r&&a.push(this._positionsV[c][1])}if(t)for(let c=0;c<this._positionsMiddleV.length;c++){let h=Math.abs(this._positionsMiddleV[c][0]-(e.y+t.height/2));(h<r||h===r&&a===void 0)&&(r=h,a=[],l=this._positionsMiddleV[c][0]-t.height/2),h===r&&a.push(this._positionsMiddleV[c][1])}if(this._overlayLayerView.removeAllNodesWithClass("svg-snapline"),n!==void 0||a!==void 0){let c={x:n!==void 0?o:e.x,y:a!==void 0?l:e.y};return this.drawSnaplines(c,t,n,a),{x:n!==void 0?o:null,y:a!==void 0?l:null}}return{x:null,y:null}}drawSnaplines(e,t,i,r){if(i){let n=e.y,o=e.y;for(let a of i){let l=a.y-this._outerRect.top;n=n<l?n:l,o=o>l?o:l}for(let a of i){if(a.x-this._outerRect.left==e.x||t&&a.x-this._outerRect.left==e.x+t.width){let c=document.createElementNS("http://www.w3.org/2000/svg","line");c.setAttribute("x1",a.x-this._outerRect.x),c.setAttribute("x2",a.x-this._outerRect.x),c.setAttribute("y1",n),c.setAttribute("y2",o),c.setAttribute("class","svg-snapline"),this._overlayLayerView.addOverlay(this.constructor.name,c,ut)}if(a.x-this._outerRect.left+a.width==e.x||t&&a.x-this._outerRect.left+a.width==e.x+t.width){let c=document.createElementNS("http://www.w3.org/2000/svg","line");c.setAttribute("x1",a.x-this._outerRect.x+a.width),c.setAttribute("x2",a.x-this._outerRect.x+a.width),c.setAttribute("y1",n),c.setAttribute("y2",o),c.setAttribute("class","svg-snapline"),this._overlayLayerView.addOverlay(this.constructor.name,c,ut)}if(t&&a.x-this._outerRect.left+a.width/2==e.x+t.width/2){let c=document.createElementNS("http://www.w3.org/2000/svg","line");c.setAttribute("x1",a.x-this._outerRect.x+a.width/2),c.setAttribute("x2",a.x-this._outerRect.x+a.width/2),c.setAttribute("y1",n),c.setAttribute("y2",o),c.setAttribute("class","svg-snapline"),this._overlayLayerView.addOverlay(this.constructor.name,c,ut)}let l=document.createElementNS("http://www.w3.org/2000/svg","rect");l.setAttribute("x",a.x-this._outerRect.x),l.setAttribute("width",a.width),l.setAttribute("y",a.y-this._outerRect.y),l.setAttribute("height",a.height),l.setAttribute("class","svg-snapline"),this._overlayLayerView.addOverlay(this.constructor.name,l,ut)}}if(r){let n=e.x,o=e.x;for(let a of r){let l=a.x-this._outerRect.left;n=n<l?n:l,o=o>l?o:l}for(let a of r){if(a.y-this._outerRect.top==e.y||t&&a.y-this._outerRect.top==e.y+t.height){let c=document.createElementNS("http://www.w3.org/2000/svg","line");c.setAttribute("x1",n),c.setAttribute("x2",o),c.setAttribute("y1",a.y-this._outerRect.y),c.setAttribute("y2",a.y-this._outerRect.y),c.setAttribute("class","svg-snapline"),this._overlayLayerView.addOverlay(this.constructor.name,c,ut)}if(a.y-this._outerRect.top+a.height==e.y||t&&a.y-this._outerRect.top+a.height==e.y+t.height){let c=document.createElementNS("http://www.w3.org/2000/svg","line");c.setAttribute("x1",n),c.setAttribute("x2",o),c.setAttribute("y1",a.y-this._outerRect.y+a.height),c.setAttribute("y2",a.y-this._outerRect.y+a.height),c.setAttribute("class","svg-snapline"),this._overlayLayerView.addOverlay(this.constructor.name,c,ut)}if(t&&a.y-this._outerRect.top+a.height/2==e.y+t.height/2){let c=document.createElementNS("http://www.w3.org/2000/svg","line");c.setAttribute("x1",n),c.setAttribute("x2",o),c.setAttribute("y1",a.y-this._outerRect.y+a.height/2),c.setAttribute("y2",a.y-this._outerRect.y+a.height/2),c.setAttribute("class","svg-snapline"),this._overlayLayerView.addOverlay(this.constructor.name,c,ut)}let l=document.createElementNS("http://www.w3.org/2000/svg","rect");l.setAttribute("x",a.x-this._outerRect.x),l.setAttribute("width",a.width),l.setAttribute("y",a.y-this._outerRect.y),l.setAttribute("height",a.height),l.setAttribute("class","svg-snapline"),this._overlayLayerView.addOverlay(this.constructor.name,l,ut)}}}};qe();wi();ke();$();X();ke();At();function z(s,e){let t=e.get(s);return t||(t=new Map,e.set(s,t),t)}var ho=class s{designerCanvas;designItemsWithExtentions=new Set;_timeout;_appliedDesignerExtensions=new WeakMap;_shouldAppliedDesignerExtensions=new WeakMap;_lastApplyEventPerType=new WeakMap;_lastPrimarySelectionRefreshItem;constructor(e){xh(),this.designerCanvas=e,e.instanceServiceContainer.selectionService.onSelectionChanged.on(this._selectedElementsChanged.bind(this)),e.instanceServiceContainer.selectionService.onSelectionRefresh.on(this._selectedElementsRefresh.bind(this)),e.instanceServiceContainer.contentService.onContentChanged.on(this._contentChanged.bind(this)),e.serviceContainer.globalContext.onToolChanged.on(()=>{this.removeExtension(e.instanceServiceContainer.selectionService.primarySelection,S.PrimarySelectionRefreshed),this._lastPrimarySelectionRefreshItem=null})}connected(){this._timeout||(this._timeout=setTimeout(()=>this.refreshAllExtensionsTimeout(),20))}disconnected(){this._timeout&&clearTimeout(this._timeout),this._timeout=null}refreshAllExtensionsTimeout(){this.refreshAllAppliedExtentions(),this._timeout=setTimeout(()=>this.refreshAllExtensionsTimeout(),20)}_contentChanged(e){requestAnimationFrame(()=>{switch(e.changeType){case"added":this.applyExtensions(e.designItems,S.Permanent,null,!0);break;case"moved":this.refreshExtensions(e.designItems,S.Permanent);break;case"parsed":this.applyExtensions(Array.from(this.designerCanvas.rootDesignItem.children()),S.Permanent,null,!0);break;case"removed":this.removeExtensions(e.designItems,!0,S.Permanent);break}})}_selectedElementsChanged(e){if(this._lastPrimarySelectionRefreshItem=null,e.oldSelectedElements&&e.oldSelectedElements.length&&(this.removeExtension(e.oldSelectedElements[0],S.PrimarySelectionRefreshed),this.removeExtension(e.oldSelectedElements[0],S.PrimarySelection),this.removeExtension(e.oldSelectedElements[0],S.PrimarySelectionAndCanBeEntered),this.removeExtension(e.oldSelectedElements[0],S.OnlyOneItemSelected),this.removeExtensions(e.oldSelectedElements,!1,S.Selection),this.removeExtensions(e.oldSelectedElements,!1,S.MultipleItemsSelected),e.oldSelectedElements[0].parent)){let t=T.GetOrCreateDesignItem(e.oldSelectedElements[0].parent.element,e.oldSelectedElements[0].parent.element,this.designerCanvas.serviceContainer,this.designerCanvas.instanceServiceContainer);this.removeExtension(t,S.PrimarySelectionContainer),this.removeExtension(t,S.PrimarySelectionContainerAndCanBeEntered)}if(e.selectedElements&&e.selectedElements.length&&(this.applyExtensions(e.selectedElements,S.Selection,e.event),this.applyExtension(e.selectedElements[0],S.PrimarySelection,e.event),e.selectedElements.length===1?this.applyExtension(e.selectedElements[0],S.OnlyOneItemSelected,e.event):e.selectedElements.length>1&&this.applyExtension(e.selectedElements[0],S.MultipleItemsSelected,e.event),e.selectedElements[0].getPlacementService()?.isEnterableContainer(e.selectedElements[0])&&this.applyExtension(e.selectedElements[0],S.PrimarySelectionAndCanBeEntered,e.event),e.selectedElements[0].parent)){let t=T.GetOrCreateDesignItem(e.selectedElements[0].parent.element,e.selectedElements[0].parent.element,this.designerCanvas.serviceContainer,this.designerCanvas.instanceServiceContainer);this.applyExtension(t,S.PrimarySelectionContainer,e.event),t.getPlacementService()?.isEnterableContainer(t)&&this.applyExtension(t,S.PrimarySelectionContainerAndCanBeEntered,e.event)}}_selectedElementsRefresh(e){this.refreshAllAppliedExtentions(e.event),e.selectedElements&&e.selectedElements.length&&this._lastPrimarySelectionRefreshItem?.deref()===e.selectedElements[0]&&(this._appliedDesignerExtensions.get(e.selectedElements[0])?.get(S.PrimarySelectionRefreshed)||this.applyExtension(e.selectedElements[0],S.PrimarySelectionRefreshed,e.event)),this._lastPrimarySelectionRefreshItem=new WeakRef(e.selectedElements[0])}applyExtension(e,t,i,r=!1){if(e&&e.nodeType==E.Element){let n=this.designerCanvas.serviceContainer.designerExtensions.get(t),o=[];if(n){let a={};Et();for(let l of n){let c=z(e,this._shouldAppliedDesignerExtensions).get(t);if(c||(c=[]),c.push(l),z(e,this._shouldAppliedDesignerExtensions).set(t,c),l.shouldExtend(this,this.designerCanvas,e)){let h=z(e,this._appliedDesignerExtensions).get(t);h||(h=[]);let d=l.getExtension(this,this.designerCanvas,e);try{d.extend(a,i),o.push(d),i?z(e,this._lastApplyEventPerType).set(t,i):z(e,this._lastApplyEventPerType).delete(t)}catch(p){console.error(p)}h.push(d),z(e,this._appliedDesignerExtensions).set(t,h),this.designItemsWithExtentions.add(e)}}}if(r)for(let a of e.children())this.applyExtension(a,t,i,r);return o}return null}applyExtensions(e,t,i,r=!1){if(this.designerCanvas.overlayLayer.startBatch(),e){let n=this.designerCanvas.serviceContainer.designerExtensions.get(t);if(n){let o={};Et();for(let a of n)for(let l of e){let c=z(l,this._shouldAppliedDesignerExtensions).get(t);if(c||(c=[]),c.push(a),z(l,this._shouldAppliedDesignerExtensions).set(t,c),a.shouldExtend(this,this.designerCanvas,l)){let h=z(l,this._appliedDesignerExtensions).get(t);h||(h=[]);let d=a.getExtension(this,this.designerCanvas,l);try{d.extend(o,i),i?z(l,this._lastApplyEventPerType).set(t,i):z(l,this._lastApplyEventPerType).delete(t)}catch(p){console.error(p)}h.push(d),z(l,this._appliedDesignerExtensions).set(t,h),this.designItemsWithExtentions.add(l)}}}if(r)for(let o of e)this.applyExtensions(Array.from(o.children()),t,i,r)}this.designerCanvas.overlayLayer.endBatch()}applyExtensionInstance(e,t){let i=z(e,this._appliedDesignerExtensions).get(S.Directly);i||(i=[]);try{t.extend(null,null)}catch(r){console.error(r)}i.push(t),z(e,this._appliedDesignerExtensions).set(S.Directly,i),this.designItemsWithExtentions.add(e)}removeExtensionInstance(e,t){for(let i of z(e,this._appliedDesignerExtensions)){let r=i[1].indexOf(t);if(r>=0){try{t.dispose()}catch(n){console.error(n)}i[1].splice(r,1),i[1].length==0&&(z(e,this._appliedDesignerExtensions).delete(i[0]),z(e,this._shouldAppliedDesignerExtensions).delete(i[0])),z(e,this._appliedDesignerExtensions).size||this.designItemsWithExtentions.delete(e)}}}removeExtension(e,t){if(e)if(t){z(e,this._shouldAppliedDesignerExtensions).delete(t);let i=z(e,this._appliedDesignerExtensions).get(t);if(i){for(let r of i)try{r.dispose(),z(e,this._lastApplyEventPerType).delete(t)}catch(n){console.error(n)}z(e,this._appliedDesignerExtensions).delete(t),z(e,this._appliedDesignerExtensions).size||this.designItemsWithExtentions.delete(e)}}else{z(e,this._shouldAppliedDesignerExtensions).clear();for(let i of z(e,this._appliedDesignerExtensions))for(let r of i[1])try{r.dispose()}catch(n){console.error(n)}z(e,this._appliedDesignerExtensions).clear(),this.designItemsWithExtentions.delete(e)}}removeExtensions(e,t,i){if(e)if(i)for(let r of e){t&&r.hasChildren&&this.removeExtensions([...r.children()],!0,i),z(r,this._shouldAppliedDesignerExtensions).delete(i);let n=z(r,this._appliedDesignerExtensions).get(i);if(n){for(let o of n)try{o.dispose(),z(r,this._lastApplyEventPerType).delete(i)}catch(a){console.error(a)}z(r,this._appliedDesignerExtensions).delete(i),z(r,this._appliedDesignerExtensions).size||this.designItemsWithExtentions.delete(r)}}else for(let r of e){t&&r.hasChildren&&this.removeExtensions([...r.children()],!0,i),z(r,this._shouldAppliedDesignerExtensions).clear();for(let n of z(r,this._appliedDesignerExtensions))for(let o of n[1])try{o.dispose()}catch(a){console.error(a)}z(r,this._appliedDesignerExtensions).clear(),this.designItemsWithExtentions.delete(r)}}refreshExtension(e,t,i){if(!(this.designerCanvas.checkVisibility&&!this.designerCanvas.checkVisibility())&&e)if(t)if(!e.element.isConnected)this.removeExtension(e,t);else{let r=z(e,this._appliedDesignerExtensions).get(t);if(r){let n={};Et();for(let o of r)try{o.refresh(n,i),i&&z(e,this._lastApplyEventPerType).set(t,i)}catch(a){console.error(a)}}}else{let r={};Et();for(let n of z(e,this._appliedDesignerExtensions))for(let o of n[1])try{o.refresh(r,i)}catch(a){console.error(a)}}}refreshExtensions(e,t,i,r,n){if(this.designerCanvas.checkVisibility&&!this.designerCanvas.checkVisibility())return;this.designerCanvas.overlayLayer.startBatch();let o=performance.now();if(e)if(t){let a={};Et();e:for(let l of e)if(!l.element.isConnected)this.removeExtension(l,t);else{let c=z(l,this._appliedDesignerExtensions).get(t);if(c)for(let h of c)try{if(h!=r&&h.refresh(a,i),n&&performance.now()-o>n){console.warn("refreshExtensions() took too long, stopped refreshing");break e}}catch(d){console.error(d)}}}else{let a={};Et();e:for(let l of e)for(let c of z(l,this._appliedDesignerExtensions))for(let h of c[1])try{if(h!=r&&(h.refresh(a,i),i&&z(l,this._lastApplyEventPerType).set(t,i),n&&performance.now()-o>n)){console.warn("refreshExtensions() took too long, stopped refreshing");break e}}catch(d){console.error(d)}}this.designerCanvas.overlayLayer.endBatch()}refreshAllExtensions(e,t,i){this.designerCanvas.overlayLayer.startBatch(),e&&(this.refreshExtensions(e,S.Directly,i,t),this.refreshExtensions(e,S.Permanent,i,t),this.refreshExtensions(e,S.Selection,i,t),this.refreshExtensions(e,S.PrimarySelection,i,t),this.refreshExtensions(e,S.PrimarySelectionContainer,i,t),this.refreshExtensions(e,S.MouseOver,i,t),this.refreshExtensions(e,S.OnlyOneItemSelected,i,t),this.refreshExtensions(e,S.MultipleItemsSelected,i,t),this.refreshExtensions(e,S.ContainerDragOverAndCanBeEntered,i,t),this.refreshExtensions(e,S.ContainerDrag,i,t),this.refreshExtensions(e,S.Doubleclick,i,t),this.refreshExtensions(e,S.Placement,i,t),this.refreshExtensions(e,S.PrimarySelectionAndCanBeEntered,i,t),this.refreshExtensions(e,S.PrimarySelectionContainerAndCanBeEntered,i,t)),this.designerCanvas.overlayLayer.endBatch()}refreshAllAppliedExtentions(e){this.designerCanvas.fillCalculationrects(),this.refreshAllExtensions([...this.designItemsWithExtentions],null,e)}reapplyAllAppliedExtentions(e,t){this.designerCanvas.overlayLayer.startBatch();for(let i of s.getAllChildElements(this.designerCanvas.rootDesignItem))if(!e||e.includes(i)){let r=[...z(i,this._shouldAppliedDesignerExtensions).keys()];for(let n of r){let o=z(i,this._lastApplyEventPerType).get(n);this.removeExtension(i,n),(t==null||t.includes(n))&&this.applyExtension(i,n,o)}}this.designerCanvas.overlayLayer.endBatch()}static*getAllChildElements(e){if(e.nodeType==E.Element&&(yield e),e.hasChildren)for(let t of e.children())for(let i of s.getAllChildElements(t))yield i}};Ze();Ee();Y();import{css as um,html as fm,BaseCustomWebComponentConstructorAppend as gm}from"@node-projects/base-custom-webcomponent";var oi=class s extends gm{static template=fm`
|
|
1246
|
+
<node-projects-web-component-designer-property-grid id="pg"></node-projects-web-component-designer-property-grid>`;propertyGrid;_type;_id;_content;_selectionChangedHandler;_instanceServiceContainer;_idRect;_contentRect;_innerRect;_propertiesService;_configButton;constructor(){super(),this._restoreCachedInititalValues(),this._type=this._getDomElement("type"),this._id=this._getDomElement("id"),this._content=this._getDomElement("content"),this.propertyGrid=this._getDomElement("pg"),this._idRect=this._getDomElement("idRect"),this._contentRect=this._getDomElement("contentRect"),this._innerRect=this._getDomElement("innerRect"),this._configButton=this._getDomElement("config"),this._configButton.onclick=async()=>{let i=await(await this.serviceContainer?.getLastServiceWhereAsync("configUiService",async r=>await r.hasConfigUi(this._instanceServiceContainer.selectionService.primarySelection))).getConfigUi(this._instanceServiceContainer.selectionService.primarySelection);this.serviceContainer.globalContext.showConfigClicked.emit({designItem:this._instanceServiceContainer.selectionService.primarySelection,configUi:i})},this._propertiesService=new ro,this._idRect.oncontextmenu=t=>{t.preventDefault(),this._instanceServiceContainer.selectionService.primarySelection?.isRootItem||this._openContextMenu(t,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService.idProperty)},this._contentRect.oncontextmenu=t=>{t.preventDefault(),this._instanceServiceContainer.selectionService.primarySelection?.isRootItem||this._openContextMenu(t,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService.contentProperty)},this._innerRect.oncontextmenu=t=>{t.preventDefault(),this._instanceServiceContainer.selectionService.primarySelection?.isRootItem||this._openContextMenu(t,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService.innerHtmlProperty)},this._id.onkeydown=t=>{t.key=="Enter"?this._instanceServiceContainer.selectionService.primarySelection.id=this._id.value:t.key=="Escape"&&(this._id.value=this._instanceServiceContainer.selectionService.primarySelection?.id??"",t.preventDefault(),t.stopPropagation()),we.refreshIsSetElementAndEditorForDesignItems(this._idRect,this._propertiesService.idProperty,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService)},this._content.onkeydown=t=>{t.key=="Enter"?(this._instanceServiceContainer.selectionService.primarySelection.content=this._content.value,this._content.title=this._content.value):t.key=="Escape"&&(this._content.value=this._instanceServiceContainer.selectionService.primarySelection?.element?.textContent??"",t.preventDefault(),t.stopPropagation()),we.refreshIsSetElementAndEditorForDesignItems(this._contentRect,this._propertiesService.contentProperty,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService),we.refreshIsSetElementAndEditorForDesignItems(this._innerRect,this._propertiesService.innerHtmlProperty,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService)};let e;this._id.onfocus=t=>{e=this._instanceServiceContainer.selectionService.primarySelection},this._id.onblur=t=>{e&&(e.id=this._id.value),e=null,we.refreshIsSetElementAndEditorForDesignItems(this._idRect,this._propertiesService.idProperty,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService)}}set serviceContainer(e){this.propertyGrid.serviceContainer=e}set instanceServiceContainer(e){this._instanceServiceContainer=e,this._selectionChangedHandler?.dispose(),this._instanceServiceContainer?this._selectionChangedHandler=this._instanceServiceContainer.selectionService.onSelectionChanged.on(async t=>{this.propertyGrid.instanceServiceContainer=e,await at(20),this._instanceServiceContainer.selectionService?.primarySelection?.isRootItem?(this._configButton.style.display="none",this._id.value="",this._content.value="",this._id.disabled=!0,this._content.disabled=!0,this._idRect.style.background="",this._contentRect.style.background="",this._innerRect.style.background="",this._type.value=":host"):(this._id.disabled=!1,this._content.disabled=!1,await this.serviceContainer?.getLastServiceWhereAsync("configUiService",r=>r.hasConfigUi(this._instanceServiceContainer.selectionService.primarySelection))?this._configButton.style.display="block":this._configButton.style.display="none",this._instanceServiceContainer.selectionService.primarySelection?.nodeType==E.Element?this._type.value=this._instanceServiceContainer.selectionService.primarySelection?.name??"":this._type.value=this._instanceServiceContainer.selectionService.primarySelection?.node?.nodeName??"",this._type.title=this._type.value,this._id.blur(),this._id.value=this._instanceServiceContainer.selectionService.primarySelection?.id??"",this._instanceServiceContainer.selectionService.primarySelection?.element?.nodeType!=E.Element?this._content.value=this._instanceServiceContainer.selectionService.primarySelection?.content??"":this._instanceServiceContainer.selectionService.primarySelection?.element?.children?.length<=0?this._content.value=this._instanceServiceContainer.selectionService.primarySelection?.content??"":this._content.value="",this._content.title=this._content.value,we.refreshIsSetElementAndEditorForDesignItems(this._idRect,this._propertiesService.idProperty,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService),we.refreshIsSetElementAndEditorForDesignItems(this._contentRect,this._propertiesService.contentProperty,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService),we.refreshIsSetElementAndEditorForDesignItems(this._innerRect,this._propertiesService.innerHtmlProperty,this._instanceServiceContainer.selectionService.selectedElements,this._propertiesService))}):(this._configButton.style.display="none",this._id.value="",this._content.value="",this._id.disabled=!0,this._content.disabled=!0,this._idRect.style.background="",this._contentRect.style.background="",this._innerRect.style.background="",this._type.value=":host"),this.propertyGrid.instanceServiceContainer=e}_openContextMenu(e,t,i){let r;this.propertyGrid.propertyContextMenuProvider&&(r=this.propertyGrid.propertyContextMenuProvider(t,i)),r||(r=i.service.getContextMenu(t,i)),le.show(r,e)}};customElements.define("node-projects-web-component-designer-property-grid-with-header",zc);import{css as Em,DomHelper as Am,html as Pm,BaseCustomWebComponentConstructorAppend as km}from"@node-projects/base-custom-webcomponent";J();$();Z();Be();import{BaseCustomWebComponentLazyAppend as ym,css as vm,cssFromString as xm,DomHelper as Fc,html as _m,TypedEvent as td}from"@node-projects/base-custom-webcomponent";Y();var ut=I.Normal,co=class{snapOffset=5;_overlayLayerView;_containerItem;_positionsH=[];_positionsMiddleH=[];_positionsV=[];_positionsMiddleV=[];_outerRect;constructor(e){this._overlayLayerView=e}initialize(e){this._containerItem=e}clearSnaplines(){this._overlayLayerView.removeAllNodesWithClass&&this._overlayLayerView.removeAllNodesWithClass("svg-snapline"),this._positionsH=[],this._positionsMiddleH=[],this._positionsV=[],this._positionsMiddleV=[]}calculateSnaplines(e){this.clearSnaplines();let t=this._containerItem.serviceContainer.snaplinesProviderService.provideSnaplines(this._containerItem,e);this._outerRect=t.outerRect,this._positionsH=t.positionsH,this._positionsMiddleH=t.positionsMiddleH,this._positionsV=t.positionsV,this._positionsMiddleV=t.positionsMiddleV}snapToPosition(e,t,i){let r=this.snapOffset+1,n,o;for(let c=0;c<this._positionsH.length;c++){let h=Math.abs(this._positionsH[c][0]-e.x);(h<r||h===r&&n===void 0)&&(r=h,n=[],o=this._positionsH[c][0]);let d;t&&(d=Math.abs(e.x+t.width-this._positionsH[c][0]),(d<r||d===r&&n===void 0)&&(r=d,n=[],o=this._positionsH[c][0]-t.width)),h===r&&n.push(this._positionsH[c][1]),t&&d===r&&h!==r&&n.push(this._positionsH[c][1])}if(t)for(let c=0;c<this._positionsMiddleH.length;c++){let h=Math.abs(this._positionsMiddleH[c][0]-(e.x+t.width/2));(h<r||h===r&&n===void 0)&&(r=h,n=[],o=this._positionsMiddleH[c][0]-t.width/2),h===r&&n.push(this._positionsMiddleH[c][1])}r=this.snapOffset+1;let a,l;for(let c=0;c<this._positionsV.length;c++){let h=Math.abs(this._positionsV[c][0]-e.y);(h<r||h===r&&a===void 0)&&(r=h,a=[],l=this._positionsV[c][0]);let d;t&&(d=Math.abs(e.y+t.height-this._positionsV[c][0]),(d<r||d===r&&a===void 0)&&(r=d,a=[],l=this._positionsV[c][0]-t.height)),h===r&&a.push(this._positionsV[c][1]),t&&d===r&&h!==r&&a.push(this._positionsV[c][1])}if(t)for(let c=0;c<this._positionsMiddleV.length;c++){let h=Math.abs(this._positionsMiddleV[c][0]-(e.y+t.height/2));(h<r||h===r&&a===void 0)&&(r=h,a=[],l=this._positionsMiddleV[c][0]-t.height/2),h===r&&a.push(this._positionsMiddleV[c][1])}if(this._overlayLayerView.removeAllNodesWithClass("svg-snapline"),n!==void 0||a!==void 0){let c={x:n!==void 0?o:e.x,y:a!==void 0?l:e.y};return this.drawSnaplines(c,t,n,a),{x:n!==void 0?o:null,y:a!==void 0?l:null}}return{x:null,y:null}}drawSnaplines(e,t,i,r){if(i){let n=e.y,o=e.y;for(let a of i){let l=a.y-this._outerRect.top;n=n<l?n:l,o=o>l?o:l}for(let a of i){if(a.x-this._outerRect.left==e.x||t&&a.x-this._outerRect.left==e.x+t.width){let c=document.createElementNS("http://www.w3.org/2000/svg","line");c.setAttribute("x1",a.x-this._outerRect.x),c.setAttribute("x2",a.x-this._outerRect.x),c.setAttribute("y1",n),c.setAttribute("y2",o),c.setAttribute("class","svg-snapline"),this._overlayLayerView.addOverlay(this.constructor.name,c,ut)}if(a.x-this._outerRect.left+a.width==e.x||t&&a.x-this._outerRect.left+a.width==e.x+t.width){let c=document.createElementNS("http://www.w3.org/2000/svg","line");c.setAttribute("x1",a.x-this._outerRect.x+a.width),c.setAttribute("x2",a.x-this._outerRect.x+a.width),c.setAttribute("y1",n),c.setAttribute("y2",o),c.setAttribute("class","svg-snapline"),this._overlayLayerView.addOverlay(this.constructor.name,c,ut)}if(t&&a.x-this._outerRect.left+a.width/2==e.x+t.width/2){let c=document.createElementNS("http://www.w3.org/2000/svg","line");c.setAttribute("x1",a.x-this._outerRect.x+a.width/2),c.setAttribute("x2",a.x-this._outerRect.x+a.width/2),c.setAttribute("y1",n),c.setAttribute("y2",o),c.setAttribute("class","svg-snapline"),this._overlayLayerView.addOverlay(this.constructor.name,c,ut)}let l=document.createElementNS("http://www.w3.org/2000/svg","rect");l.setAttribute("x",a.x-this._outerRect.x),l.setAttribute("width",a.width),l.setAttribute("y",a.y-this._outerRect.y),l.setAttribute("height",a.height),l.setAttribute("class","svg-snapline"),this._overlayLayerView.addOverlay(this.constructor.name,l,ut)}}if(r){let n=e.x,o=e.x;for(let a of r){let l=a.x-this._outerRect.left;n=n<l?n:l,o=o>l?o:l}for(let a of r){if(a.y-this._outerRect.top==e.y||t&&a.y-this._outerRect.top==e.y+t.height){let c=document.createElementNS("http://www.w3.org/2000/svg","line");c.setAttribute("x1",n),c.setAttribute("x2",o),c.setAttribute("y1",a.y-this._outerRect.y),c.setAttribute("y2",a.y-this._outerRect.y),c.setAttribute("class","svg-snapline"),this._overlayLayerView.addOverlay(this.constructor.name,c,ut)}if(a.y-this._outerRect.top+a.height==e.y||t&&a.y-this._outerRect.top+a.height==e.y+t.height){let c=document.createElementNS("http://www.w3.org/2000/svg","line");c.setAttribute("x1",n),c.setAttribute("x2",o),c.setAttribute("y1",a.y-this._outerRect.y+a.height),c.setAttribute("y2",a.y-this._outerRect.y+a.height),c.setAttribute("class","svg-snapline"),this._overlayLayerView.addOverlay(this.constructor.name,c,ut)}if(t&&a.y-this._outerRect.top+a.height/2==e.y+t.height/2){let c=document.createElementNS("http://www.w3.org/2000/svg","line");c.setAttribute("x1",n),c.setAttribute("x2",o),c.setAttribute("y1",a.y-this._outerRect.y+a.height/2),c.setAttribute("y2",a.y-this._outerRect.y+a.height/2),c.setAttribute("class","svg-snapline"),this._overlayLayerView.addOverlay(this.constructor.name,c,ut)}let l=document.createElementNS("http://www.w3.org/2000/svg","rect");l.setAttribute("x",a.x-this._outerRect.x),l.setAttribute("width",a.width),l.setAttribute("y",a.y-this._outerRect.y),l.setAttribute("height",a.height),l.setAttribute("class","svg-snapline"),this._overlayLayerView.addOverlay(this.constructor.name,l,ut)}}}};qe();wi();ke();$();X();ke();At();function z(s,e){let t=e.get(s);return t||(t=new Map,e.set(s,t),t)}var ho=class s{designerCanvas;designItemsWithExtentions=new Set;_timeout;_appliedDesignerExtensions=new WeakMap;_shouldAppliedDesignerExtensions=new WeakMap;_lastApplyEventPerType=new WeakMap;_lastPrimarySelectionRefreshItem;constructor(e){xh(),this.designerCanvas=e,e.instanceServiceContainer.selectionService.onSelectionChanged.on(this._selectedElementsChanged.bind(this)),e.instanceServiceContainer.selectionService.onSelectionRefresh.on(this._selectedElementsRefresh.bind(this)),e.instanceServiceContainer.contentService.onContentChanged.on(this._contentChanged.bind(this)),e.serviceContainer.globalContext.onToolChanged.on(()=>{this.removeExtension(e.instanceServiceContainer.selectionService.primarySelection,S.PrimarySelectionRefreshed),this._lastPrimarySelectionRefreshItem=null})}connected(){this._timeout||(this._timeout=setTimeout(()=>this.refreshAllExtensionsTimeout(),20))}disconnected(){this._timeout&&clearTimeout(this._timeout),this._timeout=null}refreshAllExtensionsTimeout(){this.refreshAllAppliedExtentions(),this._timeout=setTimeout(()=>this.refreshAllExtensionsTimeout(),20)}_contentChanged(e){requestAnimationFrame(()=>{switch(e.changeType){case"added":this.applyExtensions(e.designItems,S.Permanent,null,!0);break;case"moved":this.refreshExtensions(e.designItems,S.Permanent);break;case"parsed":this.applyExtensions(Array.from(this.designerCanvas.rootDesignItem.children()),S.Permanent,null,!0);break;case"removed":this.removeExtensions(e.designItems,!0,S.Permanent);break}})}_selectedElementsChanged(e){if(this._lastPrimarySelectionRefreshItem=null,e.oldSelectedElements&&e.oldSelectedElements.length&&(this.removeExtension(e.oldSelectedElements[0],S.PrimarySelectionRefreshed),this.removeExtension(e.oldSelectedElements[0],S.PrimarySelection),this.removeExtension(e.oldSelectedElements[0],S.PrimarySelectionAndCanBeEntered),this.removeExtension(e.oldSelectedElements[0],S.OnlyOneItemSelected),this.removeExtensions(e.oldSelectedElements,!1,S.Selection),this.removeExtensions(e.oldSelectedElements,!1,S.MultipleItemsSelected),e.oldSelectedElements[0].parent)){let t=T.GetOrCreateDesignItem(e.oldSelectedElements[0].parent.element,e.oldSelectedElements[0].parent.element,this.designerCanvas.serviceContainer,this.designerCanvas.instanceServiceContainer);this.removeExtension(t,S.PrimarySelectionContainer),this.removeExtension(t,S.PrimarySelectionContainerAndCanBeEntered)}if(e.selectedElements&&e.selectedElements.length&&(this.applyExtensions(e.selectedElements,S.Selection,e.event),this.applyExtension(e.selectedElements[0],S.PrimarySelection,e.event),e.selectedElements.length===1?this.applyExtension(e.selectedElements[0],S.OnlyOneItemSelected,e.event):e.selectedElements.length>1&&this.applyExtension(e.selectedElements[0],S.MultipleItemsSelected,e.event),e.selectedElements[0].getPlacementService()?.isEnterableContainer(e.selectedElements[0])&&this.applyExtension(e.selectedElements[0],S.PrimarySelectionAndCanBeEntered,e.event),e.selectedElements[0].parent)){let t=T.GetOrCreateDesignItem(e.selectedElements[0].parent.element,e.selectedElements[0].parent.element,this.designerCanvas.serviceContainer,this.designerCanvas.instanceServiceContainer);this.applyExtension(t,S.PrimarySelectionContainer,e.event),t.getPlacementService()?.isEnterableContainer(t)&&this.applyExtension(t,S.PrimarySelectionContainerAndCanBeEntered,e.event)}}_selectedElementsRefresh(e){this.refreshAllAppliedExtentions(e.event),e.selectedElements&&e.selectedElements.length&&this._lastPrimarySelectionRefreshItem?.deref()===e.selectedElements[0]&&(this._appliedDesignerExtensions.get(e.selectedElements[0])?.get(S.PrimarySelectionRefreshed)||this.applyExtension(e.selectedElements[0],S.PrimarySelectionRefreshed,e.event)),this._lastPrimarySelectionRefreshItem=new WeakRef(e.selectedElements[0])}applyExtension(e,t,i,r=!1){if(e&&e.nodeType==E.Element){let n=this.designerCanvas.serviceContainer.designerExtensions.get(t),o=[];if(n){let a={};Et();for(let l of n){let c=z(e,this._shouldAppliedDesignerExtensions).get(t);if(c||(c=[]),c.push(l),z(e,this._shouldAppliedDesignerExtensions).set(t,c),l.shouldExtend(this,this.designerCanvas,e)){let h=z(e,this._appliedDesignerExtensions).get(t);h||(h=[]);let d=l.getExtension(this,this.designerCanvas,e);try{d.extend(a,i),o.push(d),i?z(e,this._lastApplyEventPerType).set(t,i):z(e,this._lastApplyEventPerType).delete(t)}catch(p){console.error(p)}h.push(d),z(e,this._appliedDesignerExtensions).set(t,h),this.designItemsWithExtentions.add(e)}}}if(r)for(let a of e.children())this.applyExtension(a,t,i,r);return o}return null}applyExtensions(e,t,i,r=!1){if(this.designerCanvas.overlayLayer.startBatch(),e){let n=this.designerCanvas.serviceContainer.designerExtensions.get(t);if(n){let o={};Et();for(let a of n)for(let l of e){let c=z(l,this._shouldAppliedDesignerExtensions).get(t);if(c||(c=[]),c.push(a),z(l,this._shouldAppliedDesignerExtensions).set(t,c),a.shouldExtend(this,this.designerCanvas,l)){let h=z(l,this._appliedDesignerExtensions).get(t);h||(h=[]);let d=a.getExtension(this,this.designerCanvas,l);try{d.extend(o,i),i?z(l,this._lastApplyEventPerType).set(t,i):z(l,this._lastApplyEventPerType).delete(t)}catch(p){console.error(p)}h.push(d),z(l,this._appliedDesignerExtensions).set(t,h),this.designItemsWithExtentions.add(l)}}}if(r)for(let o of e)this.applyExtensions(Array.from(o.children()),t,i,r)}this.designerCanvas.overlayLayer.endBatch()}applyExtensionInstance(e,t){let i=z(e,this._appliedDesignerExtensions).get(S.Directly);i||(i=[]);try{t.extend(null,null)}catch(r){console.error(r)}i.push(t),z(e,this._appliedDesignerExtensions).set(S.Directly,i),this.designItemsWithExtentions.add(e)}removeExtensionInstance(e,t){for(let i of z(e,this._appliedDesignerExtensions)){let r=i[1].indexOf(t);if(r>=0){try{t.dispose()}catch(n){console.error(n)}i[1].splice(r,1),i[1].length==0&&(z(e,this._appliedDesignerExtensions).delete(i[0]),z(e,this._shouldAppliedDesignerExtensions).delete(i[0])),z(e,this._appliedDesignerExtensions).size||this.designItemsWithExtentions.delete(e)}}}removeExtension(e,t){if(e)if(t){z(e,this._shouldAppliedDesignerExtensions).delete(t);let i=z(e,this._appliedDesignerExtensions).get(t);if(i){for(let r of i)try{r.dispose(),z(e,this._lastApplyEventPerType).delete(t)}catch(n){console.error(n)}z(e,this._appliedDesignerExtensions).delete(t),z(e,this._appliedDesignerExtensions).size||this.designItemsWithExtentions.delete(e)}}else{z(e,this._shouldAppliedDesignerExtensions).clear();for(let i of z(e,this._appliedDesignerExtensions))for(let r of i[1])try{r.dispose()}catch(n){console.error(n)}z(e,this._appliedDesignerExtensions).clear(),this.designItemsWithExtentions.delete(e)}}removeExtensions(e,t,i){if(e)if(i)for(let r of e){t&&r.hasChildren&&this.removeExtensions([...r.children()],!0,i),z(r,this._shouldAppliedDesignerExtensions).delete(i);let n=z(r,this._appliedDesignerExtensions).get(i);if(n){for(let o of n)try{o.dispose(),z(r,this._lastApplyEventPerType).delete(i)}catch(a){console.error(a)}z(r,this._appliedDesignerExtensions).delete(i),z(r,this._appliedDesignerExtensions).size||this.designItemsWithExtentions.delete(r)}}else for(let r of e){t&&r.hasChildren&&this.removeExtensions([...r.children()],!0,i),z(r,this._shouldAppliedDesignerExtensions).clear();for(let n of z(r,this._appliedDesignerExtensions))for(let o of n[1])try{o.dispose()}catch(a){console.error(a)}z(r,this._appliedDesignerExtensions).clear(),this.designItemsWithExtentions.delete(r)}}refreshExtension(e,t,i){if(!(this.designerCanvas.checkVisibility&&!this.designerCanvas.checkVisibility())&&e)if(t)if(!e.element.isConnected)this.removeExtension(e,t);else{let r=z(e,this._appliedDesignerExtensions).get(t);if(r){let n={};Et();for(let o of r)try{o.refresh(n,i),i&&z(e,this._lastApplyEventPerType).set(t,i)}catch(a){console.error(a)}}}else{let r={};Et();for(let n of z(e,this._appliedDesignerExtensions))for(let o of n[1])try{o.refresh(r,i)}catch(a){console.error(a)}}}refreshExtensions(e,t,i,r,n){if(this.designerCanvas.checkVisibility&&!this.designerCanvas.checkVisibility())return;this.designerCanvas.overlayLayer.startBatch();let o=performance.now();if(e)if(t){let a={};Et();e:for(let l of e)if(!l.element.isConnected)this.removeExtension(l,t);else{let c=z(l,this._appliedDesignerExtensions).get(t);if(c)for(let h of c)try{if(h!=r&&h.refresh(a,i),n&&performance.now()-o>n){console.warn("refreshExtensions() took too long, stopped refreshing");break e}}catch(d){console.error(d)}}}else{let a={};Et();e:for(let l of e)for(let c of z(l,this._appliedDesignerExtensions))for(let h of c[1])try{if(h!=r&&(h.refresh(a,i),i&&z(l,this._lastApplyEventPerType).set(t,i),n&&performance.now()-o>n)){console.warn("refreshExtensions() took too long, stopped refreshing");break e}}catch(d){console.error(d)}}this.designerCanvas.overlayLayer.endBatch()}refreshAllExtensions(e,t,i){this.designerCanvas.overlayLayer.startBatch(),e&&(this.refreshExtensions(e,S.Directly,i,t),this.refreshExtensions(e,S.Permanent,i,t),this.refreshExtensions(e,S.Selection,i,t),this.refreshExtensions(e,S.PrimarySelection,i,t),this.refreshExtensions(e,S.PrimarySelectionContainer,i,t),this.refreshExtensions(e,S.MouseOver,i,t),this.refreshExtensions(e,S.OnlyOneItemSelected,i,t),this.refreshExtensions(e,S.MultipleItemsSelected,i,t),this.refreshExtensions(e,S.ContainerDragOverAndCanBeEntered,i,t),this.refreshExtensions(e,S.ContainerDrag,i,t),this.refreshExtensions(e,S.Doubleclick,i,t),this.refreshExtensions(e,S.Placement,i,t),this.refreshExtensions(e,S.PrimarySelectionAndCanBeEntered,i,t),this.refreshExtensions(e,S.PrimarySelectionContainerAndCanBeEntered,i,t)),this.designerCanvas.overlayLayer.endBatch()}refreshAllAppliedExtentions(e){this.designerCanvas.fillCalculationrects(),this.refreshAllExtensions([...this.designItemsWithExtentions],null,e)}reapplyAllAppliedExtentions(e,t){this.designerCanvas.overlayLayer.startBatch();for(let i of s.getAllChildElements(this.designerCanvas.rootDesignItem))if(!e||e.includes(i)){let r=[...z(i,this._shouldAppliedDesignerExtensions).keys()];for(let n of r){let o=z(i,this._lastApplyEventPerType).get(n);this.removeExtension(i,n),(t==null||t.includes(n))&&this.applyExtension(i,n,o)}}this.designerCanvas.overlayLayer.endBatch()}static*getAllChildElements(e){if(e.nodeType==E.Element&&(yield e),e.hasChildren)for(let t of e.children())for(let i of s.getAllChildElements(t))yield i}};Ze();Ee();Y();import{css as um,html as fm,BaseCustomWebComponentConstructorAppend as gm}from"@node-projects/base-custom-webcomponent";var oi=class s extends gm{static template=fm`
|
|
1247
1247
|
<svg id="svg" style="pointer-events: none;">
|
|
1248
1248
|
<defs id="defs"></defs>
|
|
1249
1249
|
<g id="background"></g>
|
package/package.json
CHANGED