@node-projects/web-component-designer 0.0.115 → 0.0.117
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/dist/elements/services/instanceService/DefaultInstanceService.js +1 -1
- package/dist/elements/widgets/bindableObjectsBrowser/bindable-objects-browser.js +1 -1
- package/dist/elements/widgets/codeView/code-view-code-mirror.js +1 -1
- package/dist/elements/widgets/codeView/code-view-monaco.js +1 -1
- package/dist/elements/widgets/designerView/designerCanvas.js +3 -1
- package/dist/elements/widgets/designerView/extensions/ExtensionManager.d.ts +2 -0
- package/dist/elements/widgets/designerView/extensions/ExtensionManager.js +12 -0
- package/dist/elements/widgets/designerView/extensions/IExtensionManger.d.ts +1 -0
- package/dist/elements/widgets/designerView/extensions/MouseOverExtension.js +1 -0
- package/dist/elements/widgets/designerView/extensions/PathExtension.js +6 -4
- package/dist/elements/widgets/designerView/extensions/ResizeExtension.js +3 -2
- package/dist/elements/widgets/designerView/extensions/SelectionDefaultExtension.js +1 -0
- package/dist/elements/widgets/designerView/extensions/TransformOriginExtension.js +6 -4
- package/dist/elements/widgets/paletteView/paletteTreeView.js +2 -1
- package/dist/elements/widgets/propertyGrid/PropertyGridWithHeader.js +6 -1
- package/dist/elements/widgets/treeView/treeViewExtended.js +1 -1
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ export class DefaultInstanceService {
|
|
|
8
8
|
if (importUri[0] === '.')
|
|
9
9
|
importUri = (window.location.origin + window.location.pathname).split('/').slice(0, -1).join('/') + '/' + importUri;
|
|
10
10
|
//@ts-ignore
|
|
11
|
-
if (importShim) {
|
|
11
|
+
if (window.importShim) {
|
|
12
12
|
//@ts-ignore
|
|
13
13
|
importShim(importUri).then((x) => {
|
|
14
14
|
let ctor = customElements.get(definition.tag);
|
|
@@ -31,7 +31,7 @@ export class BindableObjectsBrowser extends BaseCustomWebComponentLazyAppend {
|
|
|
31
31
|
super();
|
|
32
32
|
this._restoreCachedInititalValues();
|
|
33
33
|
//@ts-ignore
|
|
34
|
-
if (importShim)
|
|
34
|
+
if (window.importShim)
|
|
35
35
|
//@ts-ignore
|
|
36
36
|
importShim("jquery.fancytree/dist/skin-win8/ui.fancytree.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
37
37
|
else
|
|
@@ -20,7 +20,7 @@ export class CodeViewCodeMirror extends BaseCustomWebComponentLazyAppend {
|
|
|
20
20
|
constructor() {
|
|
21
21
|
super();
|
|
22
22
|
//@ts-ignore
|
|
23
|
-
if (importShim)
|
|
23
|
+
if (window.importShim)
|
|
24
24
|
//@ts-ignore
|
|
25
25
|
importShim("./codemirror/lib/codemirror.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
26
26
|
else
|
|
@@ -55,7 +55,7 @@ export class CodeViewMonaco extends BaseCustomWebComponentLazyAppend {
|
|
|
55
55
|
async ready() {
|
|
56
56
|
let style;
|
|
57
57
|
//@ts-ignore
|
|
58
|
-
if (importShim)
|
|
58
|
+
if (window.importShim)
|
|
59
59
|
//@ts-ignore
|
|
60
60
|
style = await importShim("monaco-editor/min/vs/editor/editor.main.css", { assert: { type: 'css' } });
|
|
61
61
|
else
|
|
@@ -391,6 +391,7 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
391
391
|
this._updateTransform();
|
|
392
392
|
this._fillCalculationrects();
|
|
393
393
|
this.onZoomFactorChanged.emit(this._zoomFactor);
|
|
394
|
+
this.extensionManager.refreshAllAppliedExtentions();
|
|
394
395
|
}
|
|
395
396
|
_updateTransform() {
|
|
396
397
|
this._scaleFactor = this._zoomFactor;
|
|
@@ -405,7 +406,8 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
405
406
|
this.instanceServiceContainer.undoService.clear();
|
|
406
407
|
this.overlayLayer.removeAllOverlays();
|
|
407
408
|
DomHelper.removeAllChildnodes(this.overlayLayer);
|
|
408
|
-
this.rootDesignItem.
|
|
409
|
+
for (let i of this.rootDesignItem.children())
|
|
410
|
+
this.rootDesignItem._removeChildInternal(i);
|
|
409
411
|
this.addDesignItems(designItems);
|
|
410
412
|
this.instanceServiceContainer.contentService.onContentChanged.emit({ changeType: 'parsed' });
|
|
411
413
|
}
|
|
@@ -4,6 +4,7 @@ import { ExtensionType } from './ExtensionType';
|
|
|
4
4
|
import { IExtensionManager } from "./IExtensionManger";
|
|
5
5
|
export declare class ExtensionManager implements IExtensionManager {
|
|
6
6
|
designerCanvas: IDesignerCanvas;
|
|
7
|
+
designItemsWithExtentions: Set<IDesignItem>;
|
|
7
8
|
constructor(designerCanvas: IDesignerCanvas);
|
|
8
9
|
private _contentChanged;
|
|
9
10
|
private _selectedElementsChanged;
|
|
@@ -14,4 +15,5 @@ export declare class ExtensionManager implements IExtensionManager {
|
|
|
14
15
|
refreshExtension(designItem: IDesignItem, extensionType?: ExtensionType): void;
|
|
15
16
|
refreshExtensions(designItems: IDesignItem[], extensionType?: ExtensionType): void;
|
|
16
17
|
refreshAllExtensions(designItems: IDesignItem[]): void;
|
|
18
|
+
refreshAllAppliedExtentions(): void;
|
|
17
19
|
}
|
|
@@ -2,6 +2,7 @@ import { DesignItem } from "../../../item/DesignItem";
|
|
|
2
2
|
import { ExtensionType } from './ExtensionType';
|
|
3
3
|
export class ExtensionManager {
|
|
4
4
|
designerCanvas;
|
|
5
|
+
designItemsWithExtentions = new Set();
|
|
5
6
|
constructor(designerCanvas) {
|
|
6
7
|
this.designerCanvas = designerCanvas;
|
|
7
8
|
designerCanvas.instanceServiceContainer.selectionService.onSelectionChanged.on(this._selectedElementsChanged.bind(this));
|
|
@@ -60,6 +61,7 @@ export class ExtensionManager {
|
|
|
60
61
|
}
|
|
61
62
|
appE.push(ext);
|
|
62
63
|
designItem.appliedDesignerExtensions.set(extensionType, appE);
|
|
64
|
+
this.designItemsWithExtentions.add(designItem);
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
}
|
|
@@ -89,6 +91,7 @@ export class ExtensionManager {
|
|
|
89
91
|
}
|
|
90
92
|
appE.push(ext);
|
|
91
93
|
i.appliedDesignerExtensions.set(extensionType, appE);
|
|
94
|
+
this.designItemsWithExtentions.add(i);
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
97
|
}
|
|
@@ -114,6 +117,8 @@ export class ExtensionManager {
|
|
|
114
117
|
}
|
|
115
118
|
}
|
|
116
119
|
designItem.appliedDesignerExtensions.delete(extensionType);
|
|
120
|
+
if (!designItem.appliedDesignerExtensions.size)
|
|
121
|
+
this.designItemsWithExtentions.delete(designItem);
|
|
117
122
|
}
|
|
118
123
|
}
|
|
119
124
|
else {
|
|
@@ -128,6 +133,7 @@ export class ExtensionManager {
|
|
|
128
133
|
}
|
|
129
134
|
}
|
|
130
135
|
designItem.appliedDesignerExtensions.clear();
|
|
136
|
+
this.designItemsWithExtentions.delete(designItem);
|
|
131
137
|
}
|
|
132
138
|
}
|
|
133
139
|
}
|
|
@@ -146,6 +152,8 @@ export class ExtensionManager {
|
|
|
146
152
|
}
|
|
147
153
|
}
|
|
148
154
|
i.appliedDesignerExtensions.delete(extensionType);
|
|
155
|
+
if (!i.appliedDesignerExtensions.size)
|
|
156
|
+
this.designItemsWithExtentions.delete(i);
|
|
149
157
|
}
|
|
150
158
|
}
|
|
151
159
|
}
|
|
@@ -162,6 +170,7 @@ export class ExtensionManager {
|
|
|
162
170
|
}
|
|
163
171
|
}
|
|
164
172
|
i.appliedDesignerExtensions.clear();
|
|
173
|
+
this.designItemsWithExtentions.delete(i);
|
|
165
174
|
}
|
|
166
175
|
}
|
|
167
176
|
}
|
|
@@ -242,4 +251,7 @@ export class ExtensionManager {
|
|
|
242
251
|
this.refreshExtensions(designItems, ExtensionType.Doubleclick);
|
|
243
252
|
}
|
|
244
253
|
}
|
|
254
|
+
refreshAllAppliedExtentions() {
|
|
255
|
+
this.refreshAllExtensions([...this.designItemsWithExtentions]);
|
|
256
|
+
}
|
|
245
257
|
}
|
|
@@ -8,4 +8,5 @@ export interface IExtensionManager {
|
|
|
8
8
|
refreshExtension(designItem: IDesignItem, extensionType?: ExtensionType): any;
|
|
9
9
|
refreshExtensions(designItems: IDesignItem[], extensionType?: ExtensionType): any;
|
|
10
10
|
refreshAllExtensions(designItems: IDesignItem[]): any;
|
|
11
|
+
refreshAllAppliedExtentions(): any;
|
|
11
12
|
}
|
|
@@ -13,6 +13,7 @@ export class MouseOverExtension extends AbstractExtension {
|
|
|
13
13
|
const xOffset = itemRect.x - this.designerCanvas.containerBoundingRect.x;
|
|
14
14
|
const yOffset = itemRect.y - this.designerCanvas.containerBoundingRect.y;
|
|
15
15
|
this._rect = this._drawRect((xOffset - offset) / this.designerCanvas.scaleFactor, (yOffset - offset) / this.designerCanvas.scaleFactor, (itemRect.width + offset + offset) / this.designerCanvas.scaleFactor, (itemRect.height + offset + offset) / this.designerCanvas.scaleFactor, 'svg-hover', this._rect);
|
|
16
|
+
this._rect.style.strokeWidth = (2 / this.designerCanvas.zoomFactor).toString();
|
|
16
17
|
}
|
|
17
18
|
dispose() {
|
|
18
19
|
this._removeAllOverlays();
|
|
@@ -74,18 +74,19 @@ export class PathExtension extends AbstractExtension {
|
|
|
74
74
|
}
|
|
75
75
|
pointerEvent(event, circle, p, index) {
|
|
76
76
|
event.stopPropagation();
|
|
77
|
+
const cursorPos = this.designerCanvas.getNormalizedEventCoordinates(event);
|
|
77
78
|
switch (event.type) {
|
|
78
79
|
case EventNames.PointerDown:
|
|
79
80
|
event.target.setPointerCapture(event.pointerId);
|
|
80
|
-
this._startPos =
|
|
81
|
+
this._startPos = cursorPos;
|
|
81
82
|
this._circlePos = { x: parseFloat(circle.getAttribute("cx")), y: parseFloat(circle.getAttribute("cy")) };
|
|
82
83
|
this._originalPathPoint = { x: p.values[index], y: p.values[index + 1] };
|
|
83
84
|
break;
|
|
84
85
|
case EventNames.PointerMove:
|
|
85
86
|
if (this._startPos && event.buttons > 0) {
|
|
86
87
|
this._lastPos = { x: this._startPos.x, y: this._startPos.y };
|
|
87
|
-
const cx =
|
|
88
|
-
const cy =
|
|
88
|
+
const cx = cursorPos.x - this._lastPos.x + this._circlePos.x;
|
|
89
|
+
const cy = cursorPos.y - this._lastPos.y + this._circlePos.y;
|
|
89
90
|
const dx = cx - this._circlePos.x;
|
|
90
91
|
const dy = cy - this._circlePos.y;
|
|
91
92
|
if (event.shiftKey) {
|
|
@@ -121,7 +122,8 @@ export class PathExtension extends AbstractExtension {
|
|
|
121
122
|
}
|
|
122
123
|
}
|
|
123
124
|
_drawPathCircle(x, y, p, index) {
|
|
124
|
-
let circle = this._drawCircle((this._parentRect.x - this.designerCanvas.containerBoundingRect.x) / this.designerCanvas.scaleFactor + x, (this._parentRect.y - this.designerCanvas.containerBoundingRect.y) / this.designerCanvas.scaleFactor + y, 5, 'svg-path');
|
|
125
|
+
let circle = this._drawCircle((this._parentRect.x - this.designerCanvas.containerBoundingRect.x) / this.designerCanvas.scaleFactor + x, (this._parentRect.y - this.designerCanvas.containerBoundingRect.y) / this.designerCanvas.scaleFactor + y, 5 / this.designerCanvas.scaleFactor, 'svg-path');
|
|
126
|
+
circle.style.strokeWidth = (1 / this.designerCanvas.zoomFactor).toString();
|
|
125
127
|
let circlePos = { x: x, y: y };
|
|
126
128
|
const items = [];
|
|
127
129
|
const pidx = this._pathdata.indexOf(p);
|
|
@@ -50,13 +50,14 @@ export class ResizeExtension extends AbstractExtension {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
_drawResizerOverlay(x, y, cursor, oldCircle) {
|
|
53
|
-
let circle = this._drawCircle(x, y, 3, 'svg-primary-resizer', oldCircle);
|
|
53
|
+
let circle = this._drawCircle(x, y, 3 / this.designerCanvas.zoomFactor, 'svg-primary-resizer', oldCircle);
|
|
54
|
+
circle.style.strokeWidth = (1 / this.designerCanvas.zoomFactor).toString();
|
|
54
55
|
if (!oldCircle) {
|
|
55
56
|
circle.addEventListener(EventNames.PointerDown, event => this._pointerActionTypeResize(circle, event, cursor));
|
|
56
57
|
circle.addEventListener(EventNames.PointerMove, event => this._pointerActionTypeResize(circle, event, cursor));
|
|
57
58
|
circle.addEventListener(EventNames.PointerUp, event => this._pointerActionTypeResize(circle, event, cursor));
|
|
58
59
|
}
|
|
59
|
-
circle.
|
|
60
|
+
circle.style.cursor = cursor;
|
|
60
61
|
return circle;
|
|
61
62
|
}
|
|
62
63
|
_pointerActionTypeResize(circle, event, actionMode = 'se-resize') {
|
|
@@ -15,6 +15,7 @@ export class SelectionDefaultExtension extends AbstractExtension {
|
|
|
15
15
|
const right = Number.parseFloat(computedStyle.marginRight.replace('px', ''));
|
|
16
16
|
const bottom = Number.parseFloat(computedStyle.marginBottom.replace('px', ''));
|
|
17
17
|
this._rect = this._drawRect(itemRect.x - left, itemRect.y - top, left + itemRect.width + right, top + itemRect.height + bottom, 'svg-selection', this._rect);
|
|
18
|
+
this._rect.style.strokeWidth = (2 / this.designerCanvas.zoomFactor).toString();
|
|
18
19
|
}
|
|
19
20
|
dispose() {
|
|
20
21
|
this._removeAllOverlays();
|
|
@@ -11,10 +11,12 @@ export class TransformOriginExtension extends AbstractExtension {
|
|
|
11
11
|
const rect = this.extendedItem.element.getBoundingClientRect();
|
|
12
12
|
const computed = getComputedStyle(this.extendedItem.element);
|
|
13
13
|
const to = computed.transformOrigin.split(' ');
|
|
14
|
-
this._circle = this._drawCircle((rect.x - this.designerCanvas.containerBoundingRect.x) / this.designerCanvas.scaleFactor + Number.parseFloat(to[0].replace('px', '')), (rect.y - this.designerCanvas.containerBoundingRect.y) / this.designerCanvas.scaleFactor + Number.parseFloat(to[1].replace('px', '')), 5, 'svg-transform-origin');
|
|
15
|
-
this._circle.
|
|
16
|
-
this.
|
|
17
|
-
this._circle2.
|
|
14
|
+
this._circle = this._drawCircle((rect.x - this.designerCanvas.containerBoundingRect.x) / this.designerCanvas.scaleFactor + Number.parseFloat(to[0].replace('px', '')), (rect.y - this.designerCanvas.containerBoundingRect.y) / this.designerCanvas.scaleFactor + Number.parseFloat(to[1].replace('px', '')), 5 / this.designerCanvas.scaleFactor, 'svg-transform-origin');
|
|
15
|
+
this._circle.style.strokeWidth = (1 / this.designerCanvas.zoomFactor).toString();
|
|
16
|
+
this._circle.style.cursor = 'pointer';
|
|
17
|
+
this._circle2 = this._drawCircle((rect.x - this.designerCanvas.containerBoundingRect.x) / this.designerCanvas.scaleFactor + Number.parseFloat(to[0].replace('px', '')), (rect.y - this.designerCanvas.containerBoundingRect.y) / this.designerCanvas.scaleFactor + Number.parseFloat(to[1].replace('px', '')), 1 / this.designerCanvas.scaleFactor, 'svg-transform-origin');
|
|
18
|
+
this._circle2.style.strokeWidth = (1 / this.designerCanvas.zoomFactor).toString();
|
|
19
|
+
this._circle2.style.pointerEvents = 'none';
|
|
18
20
|
this._circle.addEventListener(EventNames.PointerDown, event => this.pointerEvent(event));
|
|
19
21
|
this._circle.addEventListener(EventNames.PointerMove, event => this.pointerEvent(event));
|
|
20
22
|
this._circle.addEventListener(EventNames.PointerUp, event => this.pointerEvent(event)); //TODO: -> assign to window
|
|
@@ -57,7 +57,7 @@ export class PaletteTreeView extends BaseCustomWebComponentConstructorAppend {
|
|
|
57
57
|
super();
|
|
58
58
|
this._restoreCachedInititalValues();
|
|
59
59
|
//@ts-ignore
|
|
60
|
-
if (importShim)
|
|
60
|
+
if (window.importShim)
|
|
61
61
|
//@ts-ignore
|
|
62
62
|
importShim("jquery.fancytree/dist/skin-win8/ui.fancytree.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
63
63
|
else
|
|
@@ -77,6 +77,7 @@ export class PaletteTreeView extends BaseCustomWebComponentConstructorAppend {
|
|
|
77
77
|
extensions: ['childcounter', 'dnd5', 'filter'],
|
|
78
78
|
quicksearch: true,
|
|
79
79
|
source: [],
|
|
80
|
+
tooltip: true,
|
|
80
81
|
filter: {
|
|
81
82
|
autoExpand: true,
|
|
82
83
|
mode: 'hide',
|
|
@@ -78,6 +78,7 @@ export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
|
|
|
78
78
|
let di = DesignItem.GetOrCreateDesignItem(t, this._instanceServiceContainer.selectionService.primarySelection.serviceContainer, this._instanceServiceContainer);
|
|
79
79
|
this._instanceServiceContainer.selectionService.primarySelection.insertAdjacentElement(di, 'afterbegin');
|
|
80
80
|
grp.commit();
|
|
81
|
+
this._content.title = this._content.value;
|
|
81
82
|
}
|
|
82
83
|
else if (e.key == 'Escape') {
|
|
83
84
|
this._content.value = this._instanceServiceContainer.selectionService.primarySelection?.element?.textContent ?? '';
|
|
@@ -104,7 +105,11 @@ export class PropertyGridWithHeader extends BaseCustomWebComponentLazyAppend {
|
|
|
104
105
|
await sleep(20); // delay assignment a little bit, so onblur above could still set the value.
|
|
105
106
|
this._type.innerText = this._instanceServiceContainer.selectionService.primarySelection?.name ?? '';
|
|
106
107
|
this._id.value = this._instanceServiceContainer.selectionService.primarySelection?.id ?? '';
|
|
107
|
-
|
|
108
|
+
if (this._instanceServiceContainer.selectionService.primarySelection?.element?.children?.length <= 0)
|
|
109
|
+
this._content.value = this._instanceServiceContainer.selectionService.primarySelection?.element?.textContent ?? '';
|
|
110
|
+
else
|
|
111
|
+
this._content.value = '';
|
|
112
|
+
this._content.title = this._content.value;
|
|
108
113
|
});
|
|
109
114
|
}
|
|
110
115
|
}
|
|
@@ -96,7 +96,7 @@ export class TreeViewExtended extends BaseCustomWebComponentConstructorAppend {
|
|
|
96
96
|
super();
|
|
97
97
|
this._restoreCachedInititalValues();
|
|
98
98
|
//@ts-ignore
|
|
99
|
-
if (importShim)
|
|
99
|
+
if (window.importShim)
|
|
100
100
|
//@ts-ignore
|
|
101
101
|
importShim("jquery.fancytree/dist/skin-win8/ui.fancytree.css", { assert: { type: 'css' } }).then(x => this.shadowRoot.adoptedStyleSheets = [x.default, this.constructor.style]);
|
|
102
102
|
else
|