@node-projects/web-component-designer 0.0.139 → 0.0.141

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.
@@ -6,7 +6,6 @@ export declare type DesignerTabControlIndexChangedEventArgs = {
6
6
  };
7
7
  export declare class DesignerTabControl extends BaseCustomWebComponentLazyAppend {
8
8
  private _selectedIndex;
9
- private _contentObserver;
10
9
  private _panels;
11
10
  private _headerDiv;
12
11
  private _moreDiv;
@@ -1,7 +1,7 @@
1
1
  import { BaseCustomWebComponentLazyAppend, css, TypedEvent, DomHelper } from '@node-projects/base-custom-webcomponent';
2
2
  export class DesignerTabControl extends BaseCustomWebComponentLazyAppend {
3
3
  _selectedIndex = -1;
4
- _contentObserver;
4
+ //private _contentObserver: MutationObserver;
5
5
  _panels;
6
6
  _headerDiv;
7
7
  _moreDiv;
@@ -97,15 +97,15 @@ export class DesignerTabControl extends BaseCustomWebComponentLazyAppend {
97
97
  `;
98
98
  constructor() {
99
99
  super();
100
- this._contentObserver = new MutationObserver((mut) => {
101
- let refresh = false;
102
- for (let m of mut) {
103
- if (m.type != 'attributes' || m.attributeName == 'style')
104
- refresh = true;
105
- }
106
- if (refresh)
107
- this.refreshItems();
108
- });
100
+ /*this._contentObserver = new MutationObserver((mut) => {
101
+ let refresh = false;
102
+ for (let m of mut) {
103
+ if (m.type != 'attributes' || m.attributeName == 'style')
104
+ refresh = true;
105
+ }
106
+ if (refresh)
107
+ this.refreshItems();
108
+ });*/
109
109
  let outerDiv = document.createElement("div");
110
110
  outerDiv.className = 'outer';
111
111
  this.shadowRoot.appendChild(outerDiv);
@@ -163,7 +163,7 @@ export class DesignerTabControl extends BaseCustomWebComponentLazyAppend {
163
163
  if (this._firstConnect) {
164
164
  this.refreshItems();
165
165
  this._firstConnect = false;
166
- this._contentObserver.observe(this, { childList: true, subtree: true, attributes: true });
166
+ //this._contentObserver.observe(this, { childList: true, subtree: true, attributes: true });
167
167
  let selectedIndexAttribute = this.getAttribute("selected-index");
168
168
  if (selectedIndexAttribute) {
169
169
  this.selectedIndex = parseInt(selectedIndexAttribute);
@@ -211,7 +211,8 @@ export class DesignerTabControl extends BaseCustomWebComponentLazyAppend {
211
211
  if (element.style.display != 'none') {
212
212
  index++;
213
213
  if (index == this._selectedIndex) {
214
- element.slot = "panels";
214
+ if (element.slot != "panels")
215
+ element.slot = "panels";
215
216
  const headerEl = this._elementMap.get(element);
216
217
  if (headerEl) {
217
218
  headerEl.classList.add('selected');
@@ -12,6 +12,7 @@ interface InstanceServiceNameMap {
12
12
  export declare class InstanceServiceContainer extends BaseServiceContainer<InstanceServiceNameMap> {
13
13
  designContext: IDesignContext;
14
14
  readonly designerCanvas: IDesignerCanvas;
15
+ designer: any;
15
16
  constructor(designerCanvas: IDesignerCanvas);
16
17
  get undoService(): IUndoService;
17
18
  get selectionService(): ISelectionService;
@@ -3,6 +3,7 @@ import { DesignContext } from '../widgets/designerView/DesignContext';
3
3
  export class InstanceServiceContainer extends BaseServiceContainer {
4
4
  designContext = new DesignContext();
5
5
  designerCanvas;
6
+ designer; //usable to assign designer from outside
6
7
  constructor(designerCanvas) {
7
8
  super();
8
9
  this.designerCanvas = designerCanvas;
@@ -465,8 +465,10 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
465
465
  this._updateTransform();
466
466
  this._fillCalculationrects();
467
467
  this.onZoomFactorChanged.emit(this._zoomFactor);
468
- if (refreshExtensions)
468
+ if (refreshExtensions) {
469
469
  this.extensionManager.refreshAllAppliedExtentions();
470
+ setTimeout(() => this.extensionManager.refreshAllAppliedExtentions(), 200);
471
+ }
470
472
  }
471
473
  _updateTransform() {
472
474
  this._scaleFactor = this._zoomFactor;
@@ -10,12 +10,7 @@ export class InvisibleDivExtension extends AbstractExtension {
10
10
  }
11
11
  refresh() {
12
12
  const itemRect = this.designerCanvas.getNormalizedElementCoordinates(this.extendedItem.element);
13
- const computedStyle = getComputedStyle(this.extendedItem.element);
14
- const left = Number.parseFloat(computedStyle.marginLeft.replace('px', ''));
15
- const top = Number.parseFloat(computedStyle.marginTop.replace('px', ''));
16
- const right = Number.parseFloat(computedStyle.marginRight.replace('px', ''));
17
- const bottom = Number.parseFloat(computedStyle.marginBottom.replace('px', ''));
18
- this._rect = this._drawRect(itemRect.x - left, itemRect.y - top, left + itemRect.width + right, top + itemRect.height + bottom, 'svg-invisible-div', this._rect, OverlayLayer.Background);
13
+ this._rect = this._drawRect(itemRect.x, itemRect.y, itemRect.width, itemRect.height, 'svg-invisible-div', this._rect, OverlayLayer.Background);
19
14
  }
20
15
  dispose() {
21
16
  this._removeAllOverlays();
@@ -75,6 +75,7 @@ export class PropertyGrid extends BaseCustomWebComponentLazyAppend {
75
75
  lst.createElements(items[0]);
76
76
  visibleDict.add(p.name);
77
77
  }
78
+ this._designerTabControl.refreshItems();
78
79
  if (this._designerTabControl.selectedIndex < 0)
79
80
  this._designerTabControl.selectedIndex = 0;
80
81
  for (let p of this._propertyGridPropertyLists) {
@@ -93,7 +93,7 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
93
93
  }
94
94
  }
95
95
  createElements(designItem) {
96
- if (this._propertiesService.listNeedsRefresh(designItem) || this._propertyMap.size == 0) {
96
+ if (this._propertiesService && (this._propertiesService.listNeedsRefresh(designItem)) || this._propertyMap.size == 0) {
97
97
  DomHelper.removeAllChildnodes(this._div);
98
98
  this._propertyMap.clear();
99
99
  if (this._propertiesService) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "A UI designer for Polymer apps",
3
3
  "name": "@node-projects/web-component-designer",
4
- "version": "0.0.139",
4
+ "version": "0.0.141",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "",