iobroker.webui 1.34.2 → 1.35.1

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 CHANGED
@@ -133,6 +133,13 @@ runtime.html?screenName=screen2
133
133
  Placeholder for next versions:
134
134
  ### __WORK IN PROGRESS__
135
135
  -->
136
+ ### 1.35.1 (2025-09-23)
137
+ - fix reload custom controls
138
+
139
+ ### 1.35.0 (2025-09-23)
140
+ - better nameing
141
+ - changed object notification
142
+
136
143
  ### 1.34.2 (2025-09-21)
137
144
  - anaother small fix in signal handling
138
145
 
package/io-package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "webui",
4
- "version": "1.34.2",
4
+ "version": "1.35.1",
5
5
  "titleLang": {
6
6
  "en": "webui",
7
7
  "de": "webui",
@@ -29,6 +29,32 @@
29
29
  "zh-cn": "使用万维网传送器的高锰用户接口"
30
30
  },
31
31
  "news": {
32
+ "1.35.1": {
33
+ "en": "fix reload custom controls",
34
+ "de": "reload benutzerdefinierte bedienelemente",
35
+ "ru": "исправить пользовательские элементы управления",
36
+ "pt": "corrigir recarga de controles personalizados",
37
+ "nl": "repareren herladen aangepaste controles",
38
+ "fr": "fixer les contrôles personnalisés de recharge",
39
+ "it": "correzione dei controlli personalizzati di ricarica",
40
+ "es": "recargar controles personalizados",
41
+ "pl": "naprawiać sterowanie niestandardowe",
42
+ "uk": "виправити перевантаження користувальницьких контрольів",
43
+ "zh-cn": "固定重装自定义控制"
44
+ },
45
+ "1.35.0": {
46
+ "en": "better nameing\nchanged object notification",
47
+ "de": "besser benennen\nänderung der objektbenachrichtigung",
48
+ "ru": "лучшее название\nизменено уведомление об объекте",
49
+ "pt": "melhor nome\nnotificação de objeto alterada",
50
+ "nl": "betere naamgeving\nobjectnotificatie gewijzigd",
51
+ "fr": "mieux nommer\nnotification d'objet modifiée",
52
+ "it": "nome migliore\nnotifica dell'oggetto modificato",
53
+ "es": "mejor nombre\nnotificación de objeto cambiado",
54
+ "pl": "lepsze nazwanie\nzmienione powiadomienie obiektu",
55
+ "uk": "краще ім'я\nзмінено повідомлення про об’єкт",
56
+ "zh-cn": "更好的名称\n更改对象通知"
57
+ },
32
58
  "1.34.2": {
33
59
  "en": "anaother small fix in signal handling",
34
60
  "de": "Weitere kleine Korrektur in der Signalerkennung.",
@@ -93,32 +119,6 @@
93
119
  "pl": "Support sugestie css prop",
94
120
  "uk": "Підтримка пропозицій css",
95
121
  "zh-cn": "支持 css 道具建议"
96
- },
97
- "1.31.6": {
98
- "en": "Test one more release",
99
- "de": "Testen Sie eine weitere Freigabe",
100
- "ru": "Проверить еще один выпуск",
101
- "pt": "Teste mais uma versão",
102
- "nl": "Test nog een keer",
103
- "fr": "Tester une dernière libération",
104
- "it": "Prova un'altra versione",
105
- "es": "Prueba una versión más",
106
- "pl": "Przetestuj jeszcze jedno wydanie",
107
- "uk": "Тестувати ще один реліз",
108
- "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.34.2",
3
+ "version": "1.35.1",
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.262",
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.132",
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.0",
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.6.1",
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: string;
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;
@@ -1,6 +1,7 @@
1
1
  import { Connection } from "@iobroker/socket-client";
2
2
  import { TypedEvent, cssFromString } from "@node-projects/base-custom-webcomponent";
3
3
  import { sleep } from "../helper/Helper.js";
4
+ import { generateCustomControl } from "../runtime/CustomControls.js";
4
5
  export class IobrokerHandler {
5
6
  static instance = new IobrokerHandler();
6
7
  host;
@@ -201,7 +202,8 @@ export class IobrokerHandler {
201
202
  this.#cache.get(type).set(name, data);
202
203
  if (type == 'control')
203
204
  this._controlNames = null;
204
- this.objectsChanged.emit({ type, name });
205
+ //this.objectsChanged.emit({ type, name });
206
+ this.sendCommand("objectChanged", JSON.stringify({ type, name }));
205
207
  }
206
208
  async removeObject(type, name) {
207
209
  await this.connection.deleteFile(this.namespaceFiles, "/" + this.configPath + type + "s/" + name + '.' + type);
@@ -486,6 +488,12 @@ export class IobrokerHandler {
486
488
  case "uiAlert":
487
489
  alert(data);
488
490
  break;
491
+ case "objectChanged":
492
+ const d = JSON.parse(data);
493
+ if (d.type == 'control' && d.name)
494
+ generateCustomControl(d.name, await iobrokerHandler.getWebuiObject(d.type, d.name));
495
+ this.objectsChanged.emit(d);
496
+ break;
489
497
  }
490
498
  }
491
499
  }
@@ -2,7 +2,7 @@ import { BaseCustomWebComponentConstructorAppend, LazyLoader, css, html } from "
2
2
  import { dragDropFormatNameBindingObject, dragDropFormatNameElementDefinition, ContextMenu, sleep, dragDropFormatNamePropertyGrid, PropertiesHelper, copyTextToClipboard, NamedTools } from "@node-projects/web-component-designer";
3
3
  import { iobrokerHandler } from "../common/IobrokerHandler.js";
4
4
  import { exportData, openFileDialog } from "../helper/Helper.js";
5
- import { generateCustomControl, getCustomControlName, webuiCustomControlPrefix } from "../runtime/CustomControls.js";
5
+ import { getCustomControlName, webuiCustomControlPrefix } from "../runtime/CustomControls.js";
6
6
  import { defaultOptions, defaultStyle } from "@node-projects/web-component-designer-widgets-wunderbaum";
7
7
  import { Wunderbaum } from 'wunderbaum';
8
8
  //@ts-ignore
@@ -51,8 +51,6 @@ export class IobrokerWebuiSolutionExplorer extends BaseCustomWebComponentConstru
51
51
  async initialize(serviceContainer) {
52
52
  this.serviceContainer = serviceContainer;
53
53
  iobrokerHandler.objectsChanged.on(async (x) => {
54
- if (x.type == 'control' && x.name)
55
- generateCustomControl(x.name, await iobrokerHandler.getWebuiObject(x.type, x.name));
56
54
  this._refreshNode(x.type, true);
57
55
  });
58
56
  iobrokerHandler.imagesChanged.on(() => this._refreshNode('images'));
@@ -295,20 +293,20 @@ export class IobrokerWebuiSolutionExplorer extends BaseCustomWebComponentConstru
295
293
  }], event);
296
294
  };
297
295
  return {
298
- title: 'Screens Style',
296
+ title: 'Global Screens/Control Style',
299
297
  folder: false,
300
298
  contextMenu: (e, data) => ctxMenu(e),
301
299
  dblclick: (e, data) => {
302
- window.appShell.openGlobalStyleEditor(iobrokerHandler.config.globalStyle ?? '', 'screens style', 'globalStyle');
300
+ window.appShell.openGlobalStyleEditor(iobrokerHandler.config.globalStyle ?? '', 'Global Screens/Control style', 'globalStyle');
303
301
  }
304
302
  };
305
303
  }
306
304
  _createFontDeclarationsNode() {
307
305
  return {
308
- title: 'Global Style',
306
+ title: 'Root Style (for fonts...)',
309
307
  folder: false,
310
308
  dblclick: (e, data) => {
311
- window.appShell.openGlobalStyleEditor(iobrokerHandler.config.fontDeclarations ?? '', 'global style', 'fontDeclarations');
309
+ window.appShell.openGlobalStyleEditor(iobrokerHandler.config.fontDeclarations ?? '', 'Root Style', 'fontDeclarations');
312
310
  }
313
311
  };
314
312
  }
@@ -72,7 +72,7 @@
72
72
  },
73
73
  "IControlSettings": {
74
74
  "properties": {
75
- "addoptedStyles": {
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
- "addoptedStyles",
99
+ "adoptedStyles",
100
100
  "bindToSize"
101
101
  ],
102
102
  "type": "object"
@@ -217,7 +217,7 @@
217
217
  },
218
218
  "IScreenSettings": {
219
219
  "properties": {
220
- "addoptedStyles": {
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
- "addoptedStyles",
245
+ "adoptedStyles",
246
246
  "stretch"
247
247
  ],
248
248
  "type": "object"
@@ -1003,6 +1003,8 @@
1003
1003
  "type": "string"
1004
1004
  },
1005
1005
  "valueList": {
1006
+ "description": "List of values wich can be toggled through",
1007
+ "format": "collection",
1006
1008
  "items": {
1007
1009
  "type": [
1008
1010
  "string",
@@ -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.34.2 - 40551f4
221
+ webui - 1.35.1 - d7d2637
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>
@@ -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
- containerService.place(event, designerCanvas, newContainer, { x: 0, y: 0 }, { x: 0, y: 0 }, pos, [di]);
51
- containerService.finishPlace(event, designerCanvas, newContainer, { x: 0, y: 0 }, { x: 0, y: 0 }, pos, [di]);
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 ((typeof currentValue === 'object' && currentValue !== null) || property.format === 'complex') {
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
- v = new Function(signalVarNames, 'return `' + binding[1].converter[stringValue] + '`')(...valuesObject);
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
- v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
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
- v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
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
- v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
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
- v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
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
- v = new Function(signalVarNames, 'return `' + binding[1].converter[c] + '`')(...valuesObject);
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
  }