@node-projects/web-component-designer 0.0.192 → 0.0.193
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/helper/contextMenu/ContextMenu.d.ts +0 -3
- package/dist/elements/helper/contextMenu/ContextMenu.js +11 -15
- package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService.js +1 -0
- package/dist/elements/services/propertiesService/services/CssPropertiesService.js +1 -0
- package/dist/elements/widgets/designerView/designerCanvas.js +4 -5
- package/package.json +1 -1
|
@@ -11,9 +11,6 @@ export declare class ContextMenu {
|
|
|
11
11
|
menu: IContextMenuItem[];
|
|
12
12
|
options: IContextMenuOptions;
|
|
13
13
|
private num;
|
|
14
|
-
private _windowDownBound;
|
|
15
|
-
private _windowKeyUpBound;
|
|
16
|
-
private _windowResizeBound;
|
|
17
14
|
private _menuElement;
|
|
18
15
|
constructor(menu: IContextMenuItem[], options?: IContextMenuOptions);
|
|
19
16
|
reload(): void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { css } from "@node-projects/base-custom-webcomponent";
|
|
2
|
-
import { sleep } from '../Helper.js';
|
|
3
2
|
export class ContextMenu {
|
|
4
3
|
static _contextMenuCss = css `
|
|
5
4
|
.context_menu {
|
|
@@ -114,18 +113,15 @@ export class ContextMenu {
|
|
|
114
113
|
menu;
|
|
115
114
|
options;
|
|
116
115
|
num;
|
|
117
|
-
_windowDownBound;
|
|
118
|
-
_windowKeyUpBound;
|
|
119
|
-
_windowResizeBound;
|
|
120
116
|
_menuElement;
|
|
121
117
|
constructor(menu, options) {
|
|
122
118
|
this.num = ContextMenu.count++;
|
|
123
119
|
this.menu = menu;
|
|
124
120
|
this.options = options;
|
|
125
121
|
this.reload();
|
|
126
|
-
this.
|
|
127
|
-
this.
|
|
128
|
-
this.
|
|
122
|
+
this._windowDown = this._windowDown.bind(this);
|
|
123
|
+
this._windowKeyUp = this._windowKeyUp.bind(this);
|
|
124
|
+
this._windowResize = this._windowResize.bind(this);
|
|
129
125
|
}
|
|
130
126
|
reload() {
|
|
131
127
|
let shadowRoot = this.options?.shadowRoot ?? document;
|
|
@@ -241,10 +237,10 @@ export class ContextMenu {
|
|
|
241
237
|
}
|
|
242
238
|
menu.classList.add("context_menu_display");
|
|
243
239
|
event.preventDefault();
|
|
244
|
-
window.addEventListener("keyup", this.
|
|
245
|
-
window.addEventListener("mousedown", this.
|
|
246
|
-
window.addEventListener("resize", this.
|
|
247
|
-
|
|
240
|
+
window.addEventListener("keyup", this._windowKeyUp);
|
|
241
|
+
window.addEventListener("mousedown", this._windowDown);
|
|
242
|
+
window.addEventListener("resize", this._windowResize);
|
|
243
|
+
setTimeout(() => window.addEventListener("contextmenu", this._windowDown), 100);
|
|
248
244
|
}
|
|
249
245
|
_windowResize() {
|
|
250
246
|
this.close();
|
|
@@ -266,10 +262,10 @@ export class ContextMenu {
|
|
|
266
262
|
}
|
|
267
263
|
close() {
|
|
268
264
|
this._menuElement.remove();
|
|
269
|
-
window.removeEventListener("keyup", this.
|
|
270
|
-
window.removeEventListener("mousedown", this.
|
|
271
|
-
window.removeEventListener("contextmenu", this.
|
|
272
|
-
window.removeEventListener("resize", this.
|
|
265
|
+
window.removeEventListener("keyup", this._windowKeyUp);
|
|
266
|
+
window.removeEventListener("mousedown", this._windowDown);
|
|
267
|
+
window.removeEventListener("contextmenu", this._windowDown);
|
|
268
|
+
window.removeEventListener("resize", this._windowResize);
|
|
273
269
|
}
|
|
274
270
|
}
|
|
275
271
|
class ContextUtil {
|
|
@@ -3,6 +3,7 @@ import { RefreshMode } from '../IPropertiesService.js';
|
|
|
3
3
|
import { CommonPropertiesService } from './CommonPropertiesService.js';
|
|
4
4
|
import { ValueType } from '../ValueType.js';
|
|
5
5
|
import { NodeType } from '../../../item/NodeType.js';
|
|
6
|
+
//TODO: remove this code when import asserts are supported
|
|
6
7
|
let cssProperties;
|
|
7
8
|
//@ts-ignore
|
|
8
9
|
if (window.importShim) {
|
|
@@ -3,6 +3,7 @@ import { PropertyType } from '../PropertyType.js';
|
|
|
3
3
|
import { CommonPropertiesService } from './CommonPropertiesService.js';
|
|
4
4
|
import { RefreshMode } from '../IPropertiesService.js';
|
|
5
5
|
import { PropertiesHelper } from './PropertiesHelper.js';
|
|
6
|
+
//TODO: remove this code when import asserts are supported
|
|
6
7
|
let cssProperties;
|
|
7
8
|
//@ts-ignore
|
|
8
9
|
if (window.importShim) {
|
|
@@ -1007,17 +1007,16 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
1007
1007
|
return style;
|
|
1008
1008
|
}
|
|
1009
1009
|
traverseAndCollectRules(ruleContainer) {
|
|
1010
|
-
let
|
|
1010
|
+
let t = '';
|
|
1011
1011
|
for (let rule of ruleContainer.cssRules) {
|
|
1012
1012
|
if ((rule instanceof CSSContainerRule
|
|
1013
1013
|
|| rule instanceof CSSSupportsRule
|
|
1014
1014
|
|| rule instanceof CSSMediaRule)
|
|
1015
1015
|
&& rule.cssRules) {
|
|
1016
|
-
|
|
1016
|
+
t += rule.cssText.split(rule.conditionText)[0] + rule.conditionText + " { " + this.traverseAndCollectRules(rule) + " }";
|
|
1017
1017
|
}
|
|
1018
1018
|
if (rule instanceof CSSStyleRule) {
|
|
1019
1019
|
let parts = rule.selectorText.split(',');
|
|
1020
|
-
let t = '';
|
|
1021
1020
|
for (let p of parts) {
|
|
1022
1021
|
if (p.includes(this.cssprefixConstant)) {
|
|
1023
1022
|
t += p;
|
|
@@ -1036,10 +1035,10 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
1036
1035
|
cssText += e[0] + ':' + e[1].toString() + ';';
|
|
1037
1036
|
}
|
|
1038
1037
|
}
|
|
1039
|
-
|
|
1038
|
+
t += '{' + cssText + '}';
|
|
1040
1039
|
}
|
|
1041
1040
|
}
|
|
1042
|
-
return
|
|
1041
|
+
return t;
|
|
1043
1042
|
}
|
|
1044
1043
|
}
|
|
1045
1044
|
customElements.define('node-projects-designer-canvas', DesignerCanvas);
|