iobroker.webui 1.34.2 → 1.35.0
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/README.md +4 -0
- package/io-package.json +14 -14
- package/package.json +5 -5
- package/www/dist/frontend/common/IobrokerHandler.d.ts +2 -2
- package/www/dist/frontend/common/IobrokerHandler.js +6 -1
- package/www/dist/frontend/config/IobrokerWebuiSolutionExplorer.js +4 -4
- package/www/dist/frontend/generated/Properties.json +4 -4
- package/www/dist/frontend/generated/ScriptCommands.json +2 -0
- package/www/dist/frontend/runtime/CustomControls.js +12 -0
- package/www/dist/frontend/runtime/ScreenViewer.js +2 -2
- package/www/index.html +1 -1
- package/www/node_modules/@node-projects/web-component-designer/dist/elements/helper/getBoxQuads.js +48 -19
- package/www/node_modules/@node-projects/web-component-designer/dist/elements/services/dragDropService/DragDropService.js +5 -2
- package/www/node_modules/@node-projects/web-component-designer-visualization-addons/dist/components/SimpleScriptEditor.js +4 -1
- package/www/node_modules/@node-projects/web-component-designer-visualization-addons/dist/helpers/BindingsHelper.js +38 -6
- package/www/node_modules/blockly/blockly_compressed.js +28 -27
- package/www/node_modules/blockly/msg/en.js +5 -6
- package/www/node_modules/dock-spawn-ts/lib/es5/dock-spawn-ts.js +1 -1
- package/www/node_modules/dock-spawn-ts/lib/js/BrowserDialogHelper.js +4 -1
- package/www/node_modules/dock-spawn-ts/lib/js/DockManager.js +8 -0
- package/www/node_modules/dock-spawn-ts/lib/js/PanelContainer.js +1 -1
package/README.md
CHANGED
|
@@ -133,6 +133,10 @@ runtime.html?screenName=screen2
|
|
|
133
133
|
Placeholder for next versions:
|
|
134
134
|
### __WORK IN PROGRESS__
|
|
135
135
|
-->
|
|
136
|
+
### 1.35.0 (2025-09-23)
|
|
137
|
+
- better nameing
|
|
138
|
+
- changed object notification
|
|
139
|
+
|
|
136
140
|
### 1.34.2 (2025-09-21)
|
|
137
141
|
- anaother small fix in signal handling
|
|
138
142
|
|
package/io-package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"common": {
|
|
3
3
|
"name": "webui",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.35.0",
|
|
5
5
|
"titleLang": {
|
|
6
6
|
"en": "webui",
|
|
7
7
|
"de": "webui",
|
|
@@ -29,6 +29,19 @@
|
|
|
29
29
|
"zh-cn": "使用万维网传送器的高锰用户接口"
|
|
30
30
|
},
|
|
31
31
|
"news": {
|
|
32
|
+
"1.35.0": {
|
|
33
|
+
"en": "better nameing\nchanged object notification",
|
|
34
|
+
"de": "besser benennen\nänderung der objektbenachrichtigung",
|
|
35
|
+
"ru": "лучшее название\nизменено уведомление об объекте",
|
|
36
|
+
"pt": "melhor nome\nnotificação de objeto alterada",
|
|
37
|
+
"nl": "betere naamgeving\nobjectnotificatie gewijzigd",
|
|
38
|
+
"fr": "mieux nommer\nnotification d'objet modifiée",
|
|
39
|
+
"it": "nome migliore\nnotifica dell'oggetto modificato",
|
|
40
|
+
"es": "mejor nombre\nnotificación de objeto cambiado",
|
|
41
|
+
"pl": "lepsze nazwanie\nzmienione powiadomienie obiektu",
|
|
42
|
+
"uk": "краще ім'я\nзмінено повідомлення про об’єкт",
|
|
43
|
+
"zh-cn": "更好的名称\n更改对象通知"
|
|
44
|
+
},
|
|
32
45
|
"1.34.2": {
|
|
33
46
|
"en": "anaother small fix in signal handling",
|
|
34
47
|
"de": "Weitere kleine Korrektur in der Signalerkennung.",
|
|
@@ -106,19 +119,6 @@
|
|
|
106
119
|
"pl": "Przetestuj jeszcze jedno wydanie",
|
|
107
120
|
"uk": "Тестувати ще один реліз",
|
|
108
121
|
"zh-cn": "再试一次"
|
|
109
|
-
},
|
|
110
|
-
"1.31.5": {
|
|
111
|
-
"en": "Fix setting Props with simple scripts",
|
|
112
|
-
"de": "Reparieren Sie Props mit einfachen Skripten",
|
|
113
|
-
"ru": "Исправить настройку Props с помощью простых скриптов",
|
|
114
|
-
"pt": "Corrigir a configuração Props com scripts simples",
|
|
115
|
-
"nl": "Het instellen van Props met eenvoudige scripts",
|
|
116
|
-
"fr": "Correction du réglage Props avec des scripts simples",
|
|
117
|
-
"it": "Fissare le impostazioni Props con semplici script",
|
|
118
|
-
"es": "Corregir Props con scripts simples",
|
|
119
|
-
"pl": "Napraw ustawienia Propów za pomocą prostych skryptów",
|
|
120
|
-
"uk": "Виправлення налаштування пропсів з простими скриптами",
|
|
121
|
-
"zh-cn": "以简单的脚本修正设置道具"
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
124
|
"icon": "logo.png",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iobroker.webui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.35.0",
|
|
4
4
|
"description": "ioBroker webui",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/backend/main.js",
|
|
@@ -60,22 +60,22 @@
|
|
|
60
60
|
"@node-projects/node-html-parser-esm": "^6.2.0",
|
|
61
61
|
"@node-projects/propertygrid.webcomponent": "^1.4.1",
|
|
62
62
|
"@node-projects/splitview.webcomponent": "^1.0.1",
|
|
63
|
-
"@node-projects/web-component-designer": "^0.1.
|
|
63
|
+
"@node-projects/web-component-designer": "^0.1.265",
|
|
64
64
|
"@node-projects/web-component-designer-codeview-monaco": "^0.1.33",
|
|
65
65
|
"@node-projects/web-component-designer-htmlparserservice-nodehtmlparser": "^0.1.11",
|
|
66
66
|
"@node-projects/web-component-designer-stylesheetservice-css-tools": "^0.1.11",
|
|
67
|
-
"@node-projects/web-component-designer-visualization-addons": "^0.1.
|
|
67
|
+
"@node-projects/web-component-designer-visualization-addons": "^0.1.133",
|
|
68
68
|
"@node-projects/web-component-designer-widgets-wunderbaum": "^0.1.33",
|
|
69
69
|
"@types/json-schema": "^7.0.15",
|
|
70
70
|
"@web/dev-server": "^0.4.6",
|
|
71
|
-
"blockly": "^12.3.
|
|
71
|
+
"blockly": "^12.3.1",
|
|
72
72
|
"chai": "^5.3.1",
|
|
73
73
|
"chai-as-promised": "^8.0.2",
|
|
74
74
|
"construct-style-sheets-polyfill": "^3.1.0",
|
|
75
75
|
"cross-env": "^10.0.0",
|
|
76
76
|
"dayjs": "^1.11.18",
|
|
77
77
|
"del": "^8.0.1",
|
|
78
|
-
"dock-spawn-ts": "^3.
|
|
78
|
+
"dock-spawn-ts": "^3.7.0",
|
|
79
79
|
"es-module-shims": "2.6.2",
|
|
80
80
|
"eslint": "^9.36.0",
|
|
81
81
|
"esprima-next": "^6.0.3",
|
|
@@ -30,7 +30,7 @@ export declare class IobrokerHandler implements VisualizationHandler {
|
|
|
30
30
|
fontDeclarationsStylesheet: CSSStyleSheet;
|
|
31
31
|
globalScriptInstance: IGlobalScript;
|
|
32
32
|
objectsChanged: TypedEvent<{
|
|
33
|
-
type:
|
|
33
|
+
type: "screen" | "control";
|
|
34
34
|
name: string;
|
|
35
35
|
}>;
|
|
36
36
|
imagesChanged: TypedEvent<void>;
|
|
@@ -92,7 +92,7 @@ export declare class IobrokerHandler implements VisualizationHandler {
|
|
|
92
92
|
private _saveObjectToFile;
|
|
93
93
|
private _saveBinaryToFile;
|
|
94
94
|
sendCommand(command: 'addNpm' | 'removeNpm' | 'updateNpm' | 'uiConnected' | 'uiChangedView', data?: string): Promise<void>;
|
|
95
|
-
handleCommand(command: "uiReloadPackages" | "uiReload" | "uiRefresh" | "uiChangeView" | "uiChangedView" | "uiOpenDialog" | "uiOpenedDialog" | "uiPlaySound" | "uiRunScript" | "uiAlert", data: string, clientId?: string): Promise<void>;
|
|
95
|
+
handleCommand(command: "uiReloadPackages" | "uiReload" | "uiRefresh" | "uiChangeView" | "uiChangedView" | "uiOpenDialog" | "uiOpenedDialog" | "uiPlaySound" | "uiRunScript" | "uiAlert" | "objectChanged", data: string, clientId?: string): Promise<void>;
|
|
96
96
|
getSignalInformation(signal: any): SignalInformation;
|
|
97
97
|
getHistoricData(id: string, config: any): Promise<{
|
|
98
98
|
values: ioBroker.GetHistoryResult;
|
|
@@ -201,7 +201,8 @@ export class IobrokerHandler {
|
|
|
201
201
|
this.#cache.get(type).set(name, data);
|
|
202
202
|
if (type == 'control')
|
|
203
203
|
this._controlNames = null;
|
|
204
|
-
this.objectsChanged.emit({ type, name });
|
|
204
|
+
//this.objectsChanged.emit({ type, name });
|
|
205
|
+
this.sendCommand("objectChanged", JSON.stringify({ type, name }));
|
|
205
206
|
}
|
|
206
207
|
async removeObject(type, name) {
|
|
207
208
|
await this.connection.deleteFile(this.namespaceFiles, "/" + this.configPath + type + "s/" + name + '.' + type);
|
|
@@ -486,6 +487,10 @@ export class IobrokerHandler {
|
|
|
486
487
|
case "uiAlert":
|
|
487
488
|
alert(data);
|
|
488
489
|
break;
|
|
490
|
+
case "objectChanged":
|
|
491
|
+
const d = JSON.parse(data);
|
|
492
|
+
this.objectsChanged.emit(d);
|
|
493
|
+
break;
|
|
489
494
|
}
|
|
490
495
|
}
|
|
491
496
|
}
|
|
@@ -295,20 +295,20 @@ export class IobrokerWebuiSolutionExplorer extends BaseCustomWebComponentConstru
|
|
|
295
295
|
}], event);
|
|
296
296
|
};
|
|
297
297
|
return {
|
|
298
|
-
title: 'Screens Style',
|
|
298
|
+
title: 'Global Screens/Control Style',
|
|
299
299
|
folder: false,
|
|
300
300
|
contextMenu: (e, data) => ctxMenu(e),
|
|
301
301
|
dblclick: (e, data) => {
|
|
302
|
-
window.appShell.openGlobalStyleEditor(iobrokerHandler.config.globalStyle ?? '', '
|
|
302
|
+
window.appShell.openGlobalStyleEditor(iobrokerHandler.config.globalStyle ?? '', 'Global Screens/Control style', 'globalStyle');
|
|
303
303
|
}
|
|
304
304
|
};
|
|
305
305
|
}
|
|
306
306
|
_createFontDeclarationsNode() {
|
|
307
307
|
return {
|
|
308
|
-
title: '
|
|
308
|
+
title: 'Root Style (for fonts...)',
|
|
309
309
|
folder: false,
|
|
310
310
|
dblclick: (e, data) => {
|
|
311
|
-
window.appShell.openGlobalStyleEditor(iobrokerHandler.config.fontDeclarations ?? '', '
|
|
311
|
+
window.appShell.openGlobalStyleEditor(iobrokerHandler.config.fontDeclarations ?? '', 'Root Style', 'fontDeclarations');
|
|
312
312
|
}
|
|
313
313
|
};
|
|
314
314
|
}
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
},
|
|
73
73
|
"IControlSettings": {
|
|
74
74
|
"properties": {
|
|
75
|
-
"
|
|
75
|
+
"adoptedStyles": {
|
|
76
76
|
"items": {
|
|
77
77
|
"type": "string"
|
|
78
78
|
},
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"width",
|
|
97
97
|
"height",
|
|
98
98
|
"useGlobalStyle",
|
|
99
|
-
"
|
|
99
|
+
"adoptedStyles",
|
|
100
100
|
"bindToSize"
|
|
101
101
|
],
|
|
102
102
|
"type": "object"
|
|
@@ -217,7 +217,7 @@
|
|
|
217
217
|
},
|
|
218
218
|
"IScreenSettings": {
|
|
219
219
|
"properties": {
|
|
220
|
-
"
|
|
220
|
+
"adoptedStyles": {
|
|
221
221
|
"items": {
|
|
222
222
|
"type": "string"
|
|
223
223
|
},
|
|
@@ -242,7 +242,7 @@
|
|
|
242
242
|
"propertyOrder": [
|
|
243
243
|
"width",
|
|
244
244
|
"height",
|
|
245
|
-
"
|
|
245
|
+
"adoptedStyles",
|
|
246
246
|
"stretch"
|
|
247
247
|
],
|
|
248
248
|
"type": "object"
|
|
@@ -10,6 +10,7 @@ export class BaseCustomControl extends BaseCustomWebComponentConstructorAppend {
|
|
|
10
10
|
#eventListeners = [];
|
|
11
11
|
#resizeObserver;
|
|
12
12
|
#specialValueHandler;
|
|
13
|
+
#controlChangedSubscription;
|
|
13
14
|
constructor() {
|
|
14
15
|
super();
|
|
15
16
|
this._bindingsParse(null, true);
|
|
@@ -52,6 +53,16 @@ export class BaseCustomControl extends BaseCustomWebComponentConstructorAppend {
|
|
|
52
53
|
this.addEventListener(e[0], e[1]);
|
|
53
54
|
}
|
|
54
55
|
this.#resizeObserver?.observe(this);
|
|
56
|
+
this.#controlChangedSubscription = iobrokerHandler.objectsChanged.on(d => {
|
|
57
|
+
const ctlName = this.constructor[webuiCustomControlSymbol].name;
|
|
58
|
+
if (d.type == 'control' && d.name === ctlName) {
|
|
59
|
+
this.disconnectedCallback();
|
|
60
|
+
this._rootDocumentFragment = this.constructor.template.content.cloneNode(true);
|
|
61
|
+
this.shadowRoot.innerHTML = '';
|
|
62
|
+
this.shadowRoot.appendChild(this._rootDocumentFragment);
|
|
63
|
+
this.connectedCallback();
|
|
64
|
+
}
|
|
65
|
+
});
|
|
55
66
|
}
|
|
56
67
|
disconnectedCallback() {
|
|
57
68
|
for (let e of this.#eventListeners) {
|
|
@@ -62,6 +73,7 @@ export class BaseCustomControl extends BaseCustomWebComponentConstructorAppend {
|
|
|
62
73
|
b();
|
|
63
74
|
this.#bindings = null;
|
|
64
75
|
this.#resizeObserver?.unobserve(this);
|
|
76
|
+
this.#controlChangedSubscription.dispose();
|
|
65
77
|
}
|
|
66
78
|
_assignEvent(event, callback) {
|
|
67
79
|
const arrayEl = [event, callback];
|
|
@@ -259,8 +259,8 @@ let ScreenViewer = class ScreenViewer extends BaseCustomWebComponentConstructorA
|
|
|
259
259
|
}
|
|
260
260
|
connectedCallback() {
|
|
261
261
|
this._refreshViewSubscription = iobrokerHandler.refreshView.on(() => this._loadScreen());
|
|
262
|
-
this._screensChangedSubscription = iobrokerHandler.objectsChanged.on(
|
|
263
|
-
if (this._screenName)
|
|
262
|
+
this._screensChangedSubscription = iobrokerHandler.objectsChanged.on(d => {
|
|
263
|
+
if (this._screenName && d.type == 'screen' && d.name === this._screenName)
|
|
264
264
|
this._loadScreen();
|
|
265
265
|
});
|
|
266
266
|
this._scriptObject?.connectedCallback?.(this, this._rootShadow);
|
package/www/index.html
CHANGED
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
</button>
|
|
219
219
|
<button data-command="save" title="save" disabled><img src="./node_modules/@node-projects/web-component-designer/assets/icons/save.svg"></button>
|
|
220
220
|
<div style="margin-left: 30px;">
|
|
221
|
-
webui - 1.
|
|
221
|
+
webui - 1.35.0 - 2c06ad5
|
|
222
222
|
</div>
|
|
223
223
|
<button style="margin-left: 30px;" data-command="paste" title="paste" disabled><img
|
|
224
224
|
src="./node_modules/@node-projects/web-component-designer/assets/icons/paste.svg"></button>
|
package/www/node_modules/@node-projects/web-component-designer/dist/elements/helper/getBoxQuads.js
CHANGED
|
@@ -30,6 +30,35 @@ export function addPolyfill(windowObj = window) {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
+
* @param {globalThis} windowObj?
|
|
34
|
+
*/
|
|
35
|
+
export function patchAdoptNode(windowObj = window) {
|
|
36
|
+
if (!windowObj.Node.prototype.getBoxQuads) {
|
|
37
|
+
//@ts-ignore
|
|
38
|
+
windowObj.Node.prototype.getBoxQuads = function (options) {
|
|
39
|
+
return getBoxQuads(this, options);
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (!windowObj.Node.prototype.convertQuadFromNode) {
|
|
43
|
+
//@ts-ignore
|
|
44
|
+
windowObj.Node.prototype.convertQuadFromNode = function (quad, from, options) {
|
|
45
|
+
return convertQuadFromNode(this, quad, from, options);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (!windowObj.Node.prototype.convertRectFromNode) {
|
|
49
|
+
//@ts-ignore
|
|
50
|
+
windowObj.Node.prototype.convertRectFromNode = function (rect, from, options) {
|
|
51
|
+
return convertRectFromNode(this, rect, from, options);
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if (!windowObj.Node.prototype.convertPointFromNode) {
|
|
55
|
+
//@ts-ignore
|
|
56
|
+
windowObj.Node.prototype.convertPointFromNode = function (point, from, options) {
|
|
57
|
+
return convertPointFromNode(this, point, from, options);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
33
62
|
* @param {Node} node
|
|
34
63
|
* @param {DOMQuadInit} quad
|
|
35
64
|
* @param {Element} from
|
|
@@ -43,7 +72,7 @@ export function convertQuadFromNode(node, quad, from, options) {
|
|
|
43
72
|
quad = new DOMQuad(transformPointBox(quad.p1, options.fromBox, (node.ownerDocument.defaultView ?? window).getComputedStyle(from), -1), transformPointBox(quad.p2, options.fromBox, (node.ownerDocument.defaultView ?? window).getComputedStyle(from), -1), transformPointBox(quad.p3, options.fromBox, (node.ownerDocument.defaultView ?? window).getComputedStyle(from), -1), transformPointBox(quad.p4, options.fromBox, (node.ownerDocument.defaultView ?? window).getComputedStyle(from), -1));
|
|
44
73
|
}
|
|
45
74
|
let res = new DOMQuad(m2.transformPoint(m1.transformPoint(quad.p1)), m2.transformPoint(m1.transformPoint(quad.p2)), m2.transformPoint(m1.transformPoint(quad.p3)), m2.transformPoint(m1.transformPoint(quad.p4)));
|
|
46
|
-
if (options?.toBox && options?.toBox !== 'border' && node instanceof (node.ownerDocument.defaultView ?? window).Element) {
|
|
75
|
+
if (options?.toBox && options?.toBox !== 'border' && (node instanceof Element || node instanceof (node.ownerDocument.defaultView ?? window).Element)) {
|
|
47
76
|
res = new DOMQuad(transformPointBox(res.p1, options.toBox, (node.ownerDocument.defaultView ?? window).getComputedStyle(node), -1), transformPointBox(res.p2, options.toBox, (node.ownerDocument.defaultView ?? window).getComputedStyle(node), -1), transformPointBox(res.p3, options.toBox, (node.ownerDocument.defaultView ?? window).getComputedStyle(node), -1), transformPointBox(res.p4, options.toBox, (node.ownerDocument.defaultView ?? window).getComputedStyle(node), -1));
|
|
48
77
|
}
|
|
49
78
|
return res;
|
|
@@ -63,7 +92,7 @@ export function convertRectFromNode(node, rect, from, options) {
|
|
|
63
92
|
rect = new DOMRect(p.x, p.y, rect.width, rect.height);
|
|
64
93
|
}
|
|
65
94
|
let res = new DOMQuad(m2.transformPoint(m1.transformPoint(new DOMPoint(rect.x, rect.y))), m2.transformPoint(m1.transformPoint(new DOMPoint(rect.x + rect.width, rect.y))), m2.transformPoint(m1.transformPoint(new DOMPoint(rect.x + rect.width, rect.y + rect.height))), m2.transformPoint(m1.transformPoint(new DOMPoint(rect.x, rect.y + rect.height))));
|
|
66
|
-
if (options?.toBox && options?.toBox !== 'border' && node instanceof (node.ownerDocument.defaultView ?? window).Element) {
|
|
95
|
+
if (options?.toBox && options?.toBox !== 'border' && (node instanceof Element || node instanceof (node.ownerDocument.defaultView ?? window).Element)) {
|
|
67
96
|
res = new DOMQuad(transformPointBox(res.p1, options.toBox, (node.ownerDocument.defaultView ?? window).getComputedStyle(node), -1), transformPointBox(res.p2, options.toBox, (node.ownerDocument.defaultView ?? window).getComputedStyle(node), -1), transformPointBox(res.p3, options.toBox, (node.ownerDocument.defaultView ?? window).getComputedStyle(node), -1), transformPointBox(res.p4, options.toBox, (node.ownerDocument.defaultView ?? window).getComputedStyle(node), -1));
|
|
68
97
|
}
|
|
69
98
|
return res;
|
|
@@ -82,7 +111,7 @@ export function convertPointFromNode(node, point, from, options) {
|
|
|
82
111
|
point = transformPointBox(point, options.fromBox, (node.ownerDocument.defaultView ?? window).getComputedStyle(from), 1);
|
|
83
112
|
}
|
|
84
113
|
let res = m2.transformPoint(m1.transformPoint(point));
|
|
85
|
-
if (options?.toBox && options?.toBox !== 'border' && node instanceof (node.ownerDocument.defaultView ?? window).Element) {
|
|
114
|
+
if (options?.toBox && options?.toBox !== 'border' && (node instanceof Element || node instanceof (node.ownerDocument.defaultView ?? window).Element)) {
|
|
86
115
|
res = transformPointBox(res, options.toBox, (node.ownerDocument.defaultView ?? window).getComputedStyle(node), -1);
|
|
87
116
|
}
|
|
88
117
|
return res;
|
|
@@ -151,7 +180,7 @@ export function getBoxQuads(node, options) {
|
|
|
151
180
|
const points = Array(4);
|
|
152
181
|
/** @type {{x: number, y:number}[] } */
|
|
153
182
|
let o = null;
|
|
154
|
-
if (node instanceof (node.ownerDocument.defaultView ?? window).Element) {
|
|
183
|
+
if ((node instanceof Element || node instanceof (node.ownerDocument.defaultView ?? window).Element)) {
|
|
155
184
|
if (options?.box === 'margin') {
|
|
156
185
|
const cs = (node.ownerDocument.defaultView ?? window).getComputedStyle(node);
|
|
157
186
|
o = [{ x: parseFloat(cs.marginLeft), y: parseFloat(cs.marginTop) }, { x: -parseFloat(cs.marginRight), y: parseFloat(cs.marginTop) }, { x: -parseFloat(cs.marginRight), y: -parseFloat(cs.marginBottom) }, { x: parseFloat(cs.marginLeft), y: -parseFloat(cs.marginBottom) }];
|
|
@@ -205,25 +234,25 @@ function as2DPoint(point) {
|
|
|
205
234
|
export function getElementSize(node, matrix) {
|
|
206
235
|
let width = 0;
|
|
207
236
|
let height = 0;
|
|
208
|
-
if (node instanceof (node.ownerDocument.defaultView ?? window).HTMLElement) {
|
|
237
|
+
if ((node instanceof HTMLElement || node instanceof (node.ownerDocument.defaultView ?? window).HTMLElement)) {
|
|
209
238
|
width = node.offsetWidth;
|
|
210
239
|
height = node.offsetHeight;
|
|
211
240
|
}
|
|
212
|
-
else if (node instanceof (node.ownerDocument.defaultView ?? window).SVGSVGElement) {
|
|
241
|
+
else if ((node instanceof SVGSVGElement || node instanceof (node.ownerDocument.defaultView ?? window).SVGSVGElement)) {
|
|
213
242
|
width = node.width.baseVal.value;
|
|
214
243
|
height = node.height.baseVal.value;
|
|
215
244
|
}
|
|
216
|
-
else if (node instanceof (node.ownerDocument.defaultView ?? window).SVGGraphicsElement) {
|
|
245
|
+
else if ((node instanceof SVGGraphicsElement || node instanceof (node.ownerDocument.defaultView ?? window).SVGGraphicsElement)) {
|
|
217
246
|
const bbox = node.getBBox();
|
|
218
247
|
width = bbox.width;
|
|
219
248
|
height = bbox.height;
|
|
220
249
|
}
|
|
221
|
-
else if (node instanceof (node.ownerDocument.defaultView ?? window).MathMLElement) {
|
|
250
|
+
else if ((node instanceof MathMLElement || node instanceof (node.ownerDocument.defaultView ?? window).MathMLElement)) {
|
|
222
251
|
const bbox = node.getBoundingClientRect();
|
|
223
252
|
width = bbox.width / (matrix?.a ?? 1);
|
|
224
253
|
height = bbox.height / (matrix?.d ?? 1);
|
|
225
254
|
}
|
|
226
|
-
else if (node instanceof (node.ownerDocument.defaultView ?? window).Text) {
|
|
255
|
+
else if ((node instanceof Text || node instanceof (node.ownerDocument.defaultView ?? window).Text)) {
|
|
227
256
|
const range = document.createRange();
|
|
228
257
|
range.selectNodeContents(node);
|
|
229
258
|
const targetRect = range.getBoundingClientRect();
|
|
@@ -238,10 +267,10 @@ export function getElementSize(node, matrix) {
|
|
|
238
267
|
* @param {HTMLIFrameElement[]} iframes
|
|
239
268
|
*/
|
|
240
269
|
function getElementOffsetsInContainer(node, includeScroll, iframes) {
|
|
241
|
-
if (node instanceof (node.ownerDocument.defaultView ?? window).HTMLElement) {
|
|
270
|
+
if ((node instanceof HTMLElement || node instanceof (node.ownerDocument.defaultView ?? window).HTMLElement)) {
|
|
242
271
|
return new DOMPoint(node.offsetLeft - (includeScroll ? node.scrollLeft : 0), node.offsetTop - (includeScroll ? node.scrollTop : 0));
|
|
243
272
|
}
|
|
244
|
-
else if (node instanceof (node.ownerDocument.defaultView ?? window).Text) {
|
|
273
|
+
else if ((node instanceof Text || node instanceof (node.ownerDocument.defaultView ?? window).Text)) {
|
|
245
274
|
const range = document.createRange();
|
|
246
275
|
range.selectNodeContents(node);
|
|
247
276
|
const r1 = range.getBoundingClientRect();
|
|
@@ -253,8 +282,8 @@ function getElementOffsetsInContainer(node, includeScroll, iframes) {
|
|
|
253
282
|
const zY = parent.offsetHeight / r2.height;
|
|
254
283
|
return new DOMPoint((r1.x - r2.x) * zX, (r1.y - r2.y) * zY);
|
|
255
284
|
}
|
|
256
|
-
else if (node instanceof (node.ownerDocument.defaultView ?? window).Element) {
|
|
257
|
-
if (node instanceof (node.ownerDocument.defaultView ?? window).SVGGraphicsElement && !(node instanceof (node.ownerDocument.defaultView ?? window).SVGSVGElement)) {
|
|
285
|
+
else if ((node instanceof Element || node instanceof (node.ownerDocument.defaultView ?? window).Element)) {
|
|
286
|
+
if ((node instanceof SVGGraphicsElement || node instanceof (node.ownerDocument.defaultView ?? window).SVGGraphicsElement) && !((node instanceof SVGSVGElement || node instanceof (node.ownerDocument.defaultView ?? window).SVGSVGElement))) {
|
|
258
287
|
const bb = node.getBBox();
|
|
259
288
|
return new DOMPoint(bb.x, bb.y);
|
|
260
289
|
}
|
|
@@ -315,8 +344,8 @@ export function getResultingTransformationBetweenElementAndAllAncestors(node, an
|
|
|
315
344
|
}
|
|
316
345
|
}
|
|
317
346
|
else {
|
|
318
|
-
if (actualElement instanceof (actualElement.ownerDocument.defaultView ?? window).HTMLElement) {
|
|
319
|
-
if (lastOffsetParent !== actualElement.offsetParent && !(actualElement instanceof (actualElement.ownerDocument.defaultView ?? window).HTMLSlotElement)) {
|
|
347
|
+
if ((actualElement instanceof HTMLElement || actualElement instanceof (actualElement.ownerDocument.defaultView ?? window).HTMLElement)) {
|
|
348
|
+
if (lastOffsetParent !== actualElement.offsetParent && !((actualElement instanceof HTMLSlotElement || actualElement instanceof (actualElement.ownerDocument.defaultView ?? window).HTMLSlotElement))) {
|
|
320
349
|
const offsets = getElementOffsetsInContainer(actualElement, actualElement !== node, iframes);
|
|
321
350
|
lastOffsetParent = actualElement.offsetParent;
|
|
322
351
|
const mvMat = new DOMMatrix().translate(offsets.x, offsets.y);
|
|
@@ -360,14 +389,14 @@ export function getResultingTransformationBetweenElementAndAllAncestors(node, an
|
|
|
360
389
|
* @returns {Element}
|
|
361
390
|
*/
|
|
362
391
|
function getParentElementIncludingSlots(node, iframes) {
|
|
363
|
-
if (node instanceof (node.ownerDocument.defaultView ?? window).Element && node.assignedSlot)
|
|
392
|
+
if ((node instanceof Element || node instanceof (node.ownerDocument.defaultView ?? window).Element) && node.assignedSlot)
|
|
364
393
|
return node.assignedSlot;
|
|
365
394
|
if (node.parentElement == null) {
|
|
366
|
-
if (node.parentNode instanceof (node.ownerDocument.defaultView ?? window).ShadowRoot) {
|
|
395
|
+
if ((node.parentNode instanceof ShadowRoot || node.parentNode instanceof (node.ownerDocument.defaultView ?? window).ShadowRoot)) {
|
|
367
396
|
return node.parentNode.host;
|
|
368
397
|
}
|
|
369
398
|
}
|
|
370
|
-
if (node instanceof (node.ownerDocument.defaultView ?? window).HTMLHtmlElement) {
|
|
399
|
+
if ((node instanceof HTMLHtmlElement || node instanceof (node.ownerDocument.defaultView ?? window).HTMLHtmlElement)) {
|
|
371
400
|
if (iframes) {
|
|
372
401
|
for (const f of iframes)
|
|
373
402
|
if (f?.contentDocument == node.ownerDocument)
|
|
@@ -381,7 +410,7 @@ function getParentElementIncludingSlots(node, iframes) {
|
|
|
381
410
|
* @param {HTMLIFrameElement[]=} iframes
|
|
382
411
|
*/
|
|
383
412
|
export function getElementCombinedTransform(element, iframes) {
|
|
384
|
-
if (element instanceof (element.ownerDocument.defaultView ?? window).Text)
|
|
413
|
+
if ((element instanceof Text || element instanceof (element.ownerDocument.defaultView ?? window).Text))
|
|
385
414
|
return new DOMMatrix;
|
|
386
415
|
//https://www.w3.org/TR/css-transforms-2/#ctm
|
|
387
416
|
let s = (element.ownerDocument.defaultView ?? window).getComputedStyle(element);
|
|
@@ -47,8 +47,11 @@ export class DragDropService {
|
|
|
47
47
|
const containerPos = designerCanvas.getNormalizedElementCoordinates(newContainer.element);
|
|
48
48
|
const evCoord = designerCanvas.getNormalizedEventCoordinates(event);
|
|
49
49
|
const pos = { x: evCoord.x - containerPos.x, y: evCoord.y - containerPos.y };
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
let offset = { x: 0, y: 0 };
|
|
51
|
+
if (elementDefinition.mouseOffset)
|
|
52
|
+
offset = elementDefinition.mouseOffset;
|
|
53
|
+
containerService.place(event, designerCanvas, newContainer, offset, { x: 0, y: 0 }, pos, [di]);
|
|
54
|
+
containerService.finishPlace(event, designerCanvas, newContainer, offset, { x: 0, y: 0 }, pos, [di]);
|
|
52
55
|
requestAnimationFrame(() => {
|
|
53
56
|
designerCanvas.instanceServiceContainer.selectionService.setSelectedElements([di], event);
|
|
54
57
|
grp.commit();
|
|
@@ -123,7 +123,10 @@ export class SimpleScriptEditor extends BaseCustomWebComponentConstructorAppend
|
|
|
123
123
|
if (!property.specialAllreadyAdded) {
|
|
124
124
|
//@ts-ignore
|
|
125
125
|
property.specialAllreadyAdded = true;
|
|
126
|
-
if (
|
|
126
|
+
if (property.format === 'collection') {
|
|
127
|
+
//TODO: create a collection edt. in property grid control used
|
|
128
|
+
}
|
|
129
|
+
else if ((typeof currentValue === 'object' && currentValue !== null) || property.format === 'complex') {
|
|
127
130
|
let rB = document.createElement('button');
|
|
128
131
|
rB.style.height = 'calc(100% - 6px)';
|
|
129
132
|
rB.style.position = 'relative';
|
|
@@ -897,37 +897,62 @@ export class BindingsHelper {
|
|
|
897
897
|
else {
|
|
898
898
|
const stringValue = (v != null ? v.toString() : v);
|
|
899
899
|
if (stringValue in binding[1].converter) {
|
|
900
|
-
|
|
900
|
+
const cvVal = binding[1].converter[stringValue];
|
|
901
|
+
if (typeof cvVal === 'string')
|
|
902
|
+
v = new Function(signalVarNames, 'return `' + binding[1].converter[stringValue] + '`')(...valuesObject);
|
|
903
|
+
else
|
|
904
|
+
v = cvVal;
|
|
901
905
|
}
|
|
902
906
|
else {
|
|
907
|
+
let endedWithBreak = false;
|
|
903
908
|
//@ts-ignore
|
|
904
909
|
const nr = parseFloat(v);
|
|
905
910
|
for (let c in binding[1].converter) {
|
|
906
911
|
if (c.length > 2 && c[0] === '>' && c[1] === '=') {
|
|
907
912
|
const wr = parseFloat(c.substring(2));
|
|
908
913
|
if (nr >= wr) {
|
|
909
|
-
|
|
914
|
+
const cvVal = binding[1].converter[c];
|
|
915
|
+
if (typeof cvVal === 'string')
|
|
916
|
+
v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
|
|
917
|
+
else
|
|
918
|
+
v = cvVal;
|
|
919
|
+
endedWithBreak = true;
|
|
910
920
|
break;
|
|
911
921
|
}
|
|
912
922
|
}
|
|
913
923
|
else if (c.length > 2 && c[0] === '<' && c[1] === '=') {
|
|
914
924
|
const wr = parseFloat(c.substring(2));
|
|
915
925
|
if (nr <= wr) {
|
|
916
|
-
|
|
926
|
+
const cvVal = binding[1].converter[c];
|
|
927
|
+
if (typeof cvVal === 'string')
|
|
928
|
+
v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
|
|
929
|
+
else
|
|
930
|
+
v = cvVal;
|
|
931
|
+
endedWithBreak = true;
|
|
917
932
|
break;
|
|
918
933
|
}
|
|
919
934
|
}
|
|
920
935
|
else if (c.length > 1 && c[0] === '>') {
|
|
921
936
|
const wr = parseFloat(c.substring(1));
|
|
922
937
|
if (nr > wr) {
|
|
923
|
-
|
|
938
|
+
const cvVal = binding[1].converter[c];
|
|
939
|
+
if (typeof cvVal === 'string')
|
|
940
|
+
v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
|
|
941
|
+
else
|
|
942
|
+
v = cvVal;
|
|
943
|
+
endedWithBreak = true;
|
|
924
944
|
break;
|
|
925
945
|
}
|
|
926
946
|
}
|
|
927
947
|
else if (c.length > 1 && c[0] === '<') {
|
|
928
948
|
const wr = parseFloat(c.substring(1));
|
|
929
949
|
if (nr < wr) {
|
|
930
|
-
|
|
950
|
+
const cvVal = binding[1].converter[c];
|
|
951
|
+
if (typeof cvVal === 'string')
|
|
952
|
+
v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
|
|
953
|
+
else
|
|
954
|
+
v = cvVal;
|
|
955
|
+
endedWithBreak = true;
|
|
931
956
|
break;
|
|
932
957
|
}
|
|
933
958
|
}
|
|
@@ -935,12 +960,19 @@ export class BindingsHelper {
|
|
|
935
960
|
const sp = c.split('-');
|
|
936
961
|
if (sp.length > 1) {
|
|
937
962
|
if ((sp[0] === '' || nr >= parseFloat(sp[0])) && (sp[1] === '' || parseFloat(sp[1]) >= nr)) {
|
|
938
|
-
|
|
963
|
+
const cvVal = binding[1].converter[c];
|
|
964
|
+
if (typeof cvVal === 'string')
|
|
965
|
+
v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
|
|
966
|
+
else
|
|
967
|
+
v = cvVal;
|
|
968
|
+
endedWithBreak = true;
|
|
939
969
|
break;
|
|
940
970
|
}
|
|
941
971
|
}
|
|
942
972
|
}
|
|
943
973
|
}
|
|
974
|
+
if (!endedWithBreak && binding[1].converterDefault !== undefined)
|
|
975
|
+
v = binding[1].converterDefault;
|
|
944
976
|
}
|
|
945
977
|
}
|
|
946
978
|
}
|