@node-projects/web-component-designer 0.1.171 → 0.1.173

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.
@@ -24,7 +24,7 @@ export declare class DesignItem implements IDesignItem {
24
24
  nodeReplaced: TypedEvent<void>;
25
25
  get window(): Window & typeof globalThis;
26
26
  get document(): Document;
27
- get usableContainer(): Element | ShadowRoot | Document;
27
+ get usableContainer(): Element | Document | ShadowRoot;
28
28
  clone(): Promise<IDesignItem>;
29
29
  allMatching(selectors: string): Generator<IDesignItem, void, undefined>;
30
30
  replaceNode(newNode: Node): void;
@@ -608,7 +608,9 @@ export class DesignItem {
608
608
  return [{ selector: null, declarations: localStyles, specificity: -1 }, ...rules];
609
609
  }
610
610
  }
611
- catch (err) { }
611
+ catch (err) {
612
+ console.warn('getAppliedRules', err);
613
+ }
612
614
  }
613
615
  styles = [{ selector: null, declarations: localStyles, specificity: -1 }];
614
616
  this._stylesCache = styles;
@@ -112,11 +112,14 @@ export class AbstractStylesheetService {
112
112
  if (designItem == null)
113
113
  return true;
114
114
  for (let selector of selectors) {
115
- /*if (selector == ':host') {
116
- selector = DesignerCanvas.cssprefixConstant;
117
- }*/
118
- if (designItem.element.matches(AbstractStylesheetService.patchStylesheetSelectorForDesigner(selector)))
119
- return true;
115
+ const patched = AbstractStylesheetService.patchStylesheetSelectorForDesigner(selector);
116
+ try {
117
+ if (designItem.element.matches(patched))
118
+ return true;
119
+ }
120
+ catch (err) {
121
+ console.warn("invalid selector: ", selector, "patched: " + patched);
122
+ }
120
123
  }
121
124
  return false;
122
125
  }
@@ -73,18 +73,16 @@ export class EditTextExtension extends AbstractExtension {
73
73
  this.extensionManager.removeExtensionInstance(this.extendedItem, this);
74
74
  };
75
75
  this._addOverlay(this._path, OverlayLayer.Background);
76
- let points = getDesignerCanvasNormalizedTransformedCornerDOMPoints(this.extendedItem.element, null, this.designerCanvas);
77
- let outsideRect = { width: this.designerCanvas.containerBoundingRect.width / this.designerCanvas.scaleFactor, height: this.designerCanvas.containerBoundingRect.height / this.designerCanvas.scaleFactor };
78
- let data = "M0 0 L" + outsideRect.width + " 0 L" + outsideRect.width + ' ' + outsideRect.height + " L0 " + outsideRect.height + " Z ";
79
- data += "M" + points[0].x + " " + points[0].y + " L" + points[1].x + " " + points[1].y + " L" + points[3].x + " " + points[3].y + " L" + points[2].x + " " + points[2].y + " Z";
80
- this._path.setAttribute("d", data);
76
+ this.refresh();
81
77
  }
82
78
  refresh() {
83
- let points = getDesignerCanvasNormalizedTransformedCornerDOMPoints(this.extendedItem.element, null, this.designerCanvas);
84
- let outsideRect = { width: this.designerCanvas.containerBoundingRect.width / this.designerCanvas.scaleFactor, height: this.designerCanvas.containerBoundingRect.height / this.designerCanvas.scaleFactor };
85
- let data = "M0 0 L" + outsideRect.width + " 0 L" + outsideRect.width + ' ' + outsideRect.height + " L0 " + outsideRect.height + " Z ";
86
- data += "M" + points[0].x + " " + points[0].y + " L" + points[1].x + " " + points[1].y + " L" + points[3].x + " " + points[3].y + " L" + points[2].x + " " + points[2].y + " Z";
87
- this._path.setAttribute("d", data);
79
+ let p = getDesignerCanvasNormalizedTransformedCornerDOMPoints(this.extendedItem.element, null, this.designerCanvas);
80
+ if (this._valuesHaveChanges(this.designerCanvas.containerBoundingRect.width, this.designerCanvas.containerBoundingRect.height, this.designerCanvas.scaleFactor, p[0].x, p[0].y, p[1].x, p[1].y, p[2].x, p[2].y, p[3].x, p[3].y)) {
81
+ let outsideRect = { width: this.designerCanvas.containerBoundingRect.width / this.designerCanvas.scaleFactor, height: this.designerCanvas.containerBoundingRect.height / this.designerCanvas.scaleFactor };
82
+ let data = "M0 0 L" + outsideRect.width + " 0 L" + outsideRect.width + ' ' + outsideRect.height + " L0 " + outsideRect.height + " Z ";
83
+ data += "M" + [p[0], p[1], p[3], p[2]].map(x => x.x + ',' + x.y).join(' ') + 'Z ';
84
+ this._path.setAttribute("d", data);
85
+ }
88
86
  }
89
87
  dispose() {
90
88
  this._selectionChangedListener.dispose();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "A WYSIWYG designer webcomponent for html components",
3
3
  "name": "@node-projects/web-component-designer",
4
- "version": "0.1.171",
4
+ "version": "0.1.173",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",