iobroker.webui 1.27.1 → 1.28.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.
Files changed (33) hide show
  1. package/README.md +3 -0
  2. package/io-package.json +14 -14
  3. package/package.json +12 -12
  4. package/www/dist/frontend/config/IobrokerWebuiAppShell.js +1 -1
  5. package/www/index.html +1 -1
  6. package/www/node_modules/@iobroker/socket-client/dist/esm/Connection.js +27 -4
  7. package/www/node_modules/@node-projects/base-custom-webcomponent/dist/BaseCustomWebComponent.js +5 -1
  8. package/www/node_modules/@node-projects/web-component-designer/dist/elements/helper/Helper.js +34 -0
  9. package/www/node_modules/@node-projects/web-component-designer/dist/elements/helper/getBoxQuads.js +18 -9
  10. package/www/node_modules/@node-projects/web-component-designer/dist/elements/item/DesignItem.js +11 -5
  11. package/www/node_modules/@node-projects/web-component-designer/dist/elements/services/DefaultServiceBootstrap.js +2 -0
  12. package/www/node_modules/@node-projects/web-component-designer/dist/elements/services/ServiceContainer.js +3 -0
  13. package/www/node_modules/@node-projects/web-component-designer/dist/elements/services/deletionService/DeletionService.js +7 -0
  14. package/www/node_modules/@node-projects/web-component-designer/dist/elements/services/deletionService/IDeletionService.js +2 -0
  15. package/www/node_modules/@node-projects/web-component-designer/dist/elements/services/placementService/AbsolutePlacementService.js +10 -4
  16. package/www/node_modules/@node-projects/web-component-designer/dist/elements/services/placementService/DefaultPlacementService.js +10 -4
  17. package/www/node_modules/@node-projects/web-component-designer/dist/elements/services/propertiesService/services/AbstractPolymerLikePropertiesService.js +13 -8
  18. package/www/node_modules/@node-projects/web-component-designer/dist/elements/services/undoService/transactionItems/PropertyChangeAction.js +32 -0
  19. package/www/node_modules/@node-projects/web-component-designer/dist/elements/widgets/designerView/designerCanvas.js +6 -2
  20. package/www/node_modules/@node-projects/web-component-designer/dist/elements/widgets/designerView/extensions/ResizeExtension.js +5 -0
  21. package/www/node_modules/@node-projects/web-component-designer/dist/elements/widgets/designerView/extensions/contextMenu/RectContextMenu.js +1 -2
  22. package/www/node_modules/@node-projects/web-component-designer/dist/elements/widgets/propertyGrid/PropertyGridPropertyList.js +1 -1
  23. package/www/node_modules/@node-projects/web-component-designer/dist/index.js +4 -0
  24. package/www/node_modules/@node-projects/web-component-designer-visualization-addons/dist/helpers/BindingsHelper.js +2 -2
  25. package/www/node_modules/dock-spawn-ts/lib/es5/dock-spawn-ts.js +1 -1
  26. package/www/node_modules/dock-spawn-ts/lib/js/DockManager.js +4 -4
  27. package/www/node_modules/dock-spawn-ts/lib/js/PanelContainer.js +8 -6
  28. package/www/node_modules/dock-spawn-ts/lib/js/TabHandle.js +5 -1
  29. package/www/node_modules/dock-spawn-ts/lib/js/UndockInitiator.js +4 -0
  30. package/www/node_modules/es-module-shims/dist/es-module-shims.js +690 -438
  31. package/www/node_modules/long/index.js +1 -1
  32. package/www/node_modules/long/umd/index.js +6 -6
  33. package/www/node_modules/@node-projects/web-component-designer-visualization-addons/dist/blockly/components/fields/FieldObjectId.js +0 -6
package/README.md CHANGED
@@ -133,6 +133,9 @@ runtime.html?screenName=screen2
133
133
  Placeholder for next versions:
134
134
  ### __WORK IN PROGRESS__
135
135
  -->
136
+ ### 1.28.0 (2025-05-03)
137
+ - update packages
138
+
136
139
  ### 1.27.1 (2025-03-30)
137
140
  - fix xml import
138
141
 
package/io-package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "webui",
4
- "version": "1.27.1",
4
+ "version": "1.28.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.28.0": {
33
+ "en": "update packages",
34
+ "de": "update-pakete",
35
+ "ru": "обновление пакетов",
36
+ "pt": "pacotes de atualização",
37
+ "nl": "pakketten bijwerken",
38
+ "fr": "mettre à jour les paquets",
39
+ "it": "pacchetti di aggiornamento",
40
+ "es": "actualizar paquetes",
41
+ "pl": "aktualizacja pakietów",
42
+ "uk": "оновлення пакетів",
43
+ "zh-cn": "更新软件包"
44
+ },
32
45
  "1.27.1": {
33
46
  "en": "fix xml import",
34
47
  "de": "xml importieren",
@@ -106,19 +119,6 @@
106
119
  "pl": "naprawić wiązania w niestandardowych kontrolach",
107
120
  "uk": "фіксувати прив'язки в користувацьких управліннях",
108
121
  "zh-cn": "定制控制中的固定绑定"
109
- },
110
- "1.24.4": {
111
- "en": "switch again to old module shims (error in new one)",
112
- "de": "wieder auf alte modul-shimmel wechseln (error in new one)",
113
- "ru": "переключение снова на старых модуле shims (ошибка в новом)",
114
- "pt": "mudar novamente para os antigos xeques do módulo (erro em novo)",
115
- "nl": "weer overschakelen naar oude module shims (fout in nieuwe)",
116
- "fr": "passer à nouveau à l'ancien module shims (erreur dans le nouveau)",
117
- "it": "passare di nuovo a shims vecchio modulo (error in uno nuovo)",
118
- "es": "cambiar de nuevo al viejo módulo shims (error nuevo)",
119
- "pl": "przełącz ponownie na stary moduł shims (błąd w nowym)",
120
- "uk": "повторно переключіть до старих модулів (error in new)",
121
- "zh-cn": "再次切换到旧模块shims( 错误在新模块中)"
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.27.1",
3
+ "version": "1.28.0",
4
4
  "description": "ioBroker webui",
5
5
  "type": "module",
6
6
  "main": "dist/backend/main.js",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@iobroker/adapter-core": "^3.2.3",
47
- "@types/node": "^22.13.14"
47
+ "@types/node": "^22.15.3"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@adobe/css-tools": "4.4.2",
@@ -52,19 +52,19 @@
52
52
  "@alcalzone/release-script-plugin-iobroker": "^3.7.2",
53
53
  "@alcalzone/release-script-plugin-license": "^3.7.0",
54
54
  "@blockly/zoom-to-fit": "^6.0.12",
55
- "@iobroker/socket-client": "^4.1.0",
55
+ "@iobroker/socket-client": "^4.1.3",
56
56
  "@iobroker/testing": "^5.0.4",
57
57
  "@iobroker/webcomponent-selectid-dialog": "^1.0.7",
58
- "@node-projects/base-custom-webcomponent": "0.29.0",
58
+ "@node-projects/base-custom-webcomponent": "0.30.0",
59
59
  "@node-projects/lean-he-esm": "^3.3.0",
60
60
  "@node-projects/node-html-parser-esm": "^6.2.0",
61
61
  "@node-projects/propertygrid.webcomponent": "^1.3.0",
62
62
  "@node-projects/splitview.webcomponent": "^1.0.1",
63
- "@node-projects/web-component-designer": "^0.1.247",
63
+ "@node-projects/web-component-designer": "^0.1.257",
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.10",
67
- "@node-projects/web-component-designer-visualization-addons": "^0.1.116",
67
+ "@node-projects/web-component-designer-visualization-addons": "^0.1.117",
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",
@@ -75,24 +75,24 @@
75
75
  "cross-env": "^7.0.3",
76
76
  "dayjs": "^1.11.13",
77
77
  "del": "^8.0.0",
78
- "dock-spawn-ts": "^3.3.0",
79
- "es-module-shims": "2.0.10",
80
- "eslint": "^9.23.0",
78
+ "dock-spawn-ts": "^3.5.0",
79
+ "es-module-shims": "2.4.1",
80
+ "eslint": "^9.26.0",
81
81
  "esprima-next": "^6.0.3",
82
82
  "glob-stream": "^8.0.2",
83
83
  "gulp": "^5.0.0",
84
84
  "gulp-git": "^2.11.0",
85
85
  "gulp-replace": "^1.1.4",
86
- "long": "^5.3.1",
86
+ "long": "^5.3.2",
87
87
  "mobile-drag-drop": "^3.0.0-rc.0",
88
- "mocha": "^11.1.0",
88
+ "mocha": "^11.2.2",
89
89
  "monaco-editor": "^0.50.0",
90
90
  "nyc": "^17.1.0",
91
91
  "sinon-chai": "^4.0.0",
92
92
  "toastify-js": "^1.12.0",
93
93
  "ts-node": "^10.9.2",
94
94
  "tslib": "^2.8.1",
95
- "typescript": "^5.8.2",
95
+ "typescript": "^5.8.3",
96
96
  "typescript-json-schema": "^0.65.1",
97
97
  "wunderbaum": "0.13.0"
98
98
  }
@@ -160,7 +160,7 @@ export class IobrokerWebuiAppShell extends BaseCustomWebComponentConstructorAppe
160
160
  this.serviceContainer = serviceContainer;
161
161
  new CommandHandling(this._dockManager, this, serviceContainer);
162
162
  this._dockManager.addLayoutListener({
163
- onActiveDocumentChange: (manager, panel, previousPanel) => {
163
+ onActiveDocumentChange: async (manager, panel, previousPanel) => {
164
164
  if (previousPanel) {
165
165
  let element = this._dock.getElementInSlot(previousPanel.elementContent);
166
166
  if (element?.deactivated)
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.27.1 - 88f34da
221
+ webui - 1.28.0 - a3c3349
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>
@@ -416,25 +416,31 @@ export class Connection {
416
416
  this.lastAccessToken = accessToken;
417
417
  this._socket.emit('updateTokenExpiration', accessToken, (err, success) => {
418
418
  if (err) {
419
- console.error(`Cannot update expiration time: ${err}`);
419
+ console.error(`[UPDATE/${new Date().toISOString()}] cannot say to server about new token: ${err}`);
420
420
  window.location.reload();
421
421
  }
422
422
  else if (!success) {
423
- console.error('Cannot update expiration time');
423
+ console.error(`[UPDATE/${new Date().toISOString()}] cannot say to server about new token`);
424
424
  window.location.reload();
425
425
  }
426
+ else {
427
+ console.log(`[UPDATE/${new Date().toISOString()}] server accepted new token: ${accessToken}`);
428
+ }
426
429
  });
427
430
  }
428
431
  this.checkAccessTokenExpire();
429
432
  }
430
433
  refreshTokens(tokenStructure, takeOwnership) {
431
434
  if (!tokenStructure) {
435
+ console.log(`[REFRESH/${new Date().toISOString()}] No token structure found => reloading the page`);
432
436
  // Refresh the page, as we cannot refresh the token
433
437
  setTimeout(() => window.location.reload(), 500);
434
438
  return;
435
439
  }
436
440
  if (takeOwnership || !tokenStructure.owner || tokenStructure.owner === this.connId) {
441
+ console.log(`[REFRESH/${new Date().toISOString()}] claim ownership of the token`);
437
442
  if (this.acquireTokenLock()) {
443
+ console.log(`[REFRESH/${new Date().toISOString()}] refreshing token`);
438
444
  // Access token will expire soon => Send authentication again
439
445
  fetch('./oauth/token', {
440
446
  method: 'POST',
@@ -451,6 +457,7 @@ export class Connection {
451
457
  })
452
458
  .then((data) => {
453
459
  if (data.access_token) {
460
+ console.log(`[REFRESH/${new Date().toISOString()}] received new token: ${data.access_token}`);
454
461
  this.saveTokens(data, tokenStructure.stayLoggedIn);
455
462
  this.releaseTokenLock();
456
463
  this.updateTokenExpiration(data.access_token);
@@ -460,6 +467,7 @@ export class Connection {
460
467
  }
461
468
  })
462
469
  .catch(err => {
470
+ console.warn(`[REFRESH/${new Date().toISOString()}] cannot refresh token: ${err}`);
463
471
  this.releaseTokenLock();
464
472
  this.deleteTokens(tokenStructure.stayLoggedIn);
465
473
  console.error(err);
@@ -467,6 +475,7 @@ export class Connection {
467
475
  });
468
476
  }
469
477
  else {
478
+ console.log(`[REFRESH/${new Date().toISOString()}] Someone else is updating the token, so wait for the next check`);
470
479
  // Someone else is updating the token, so wait for the next check
471
480
  this.checkAccessTokenExpire();
472
481
  }
@@ -533,35 +542,49 @@ export class Connection {
533
542
  // Check if the access token expires in the next 30 seconds
534
543
  if (accessExpireInUnixMs < Date.now() + 30_000) {
535
544
  const takeOwnership = accessExpireInUnixMs < Date.now() + 5_500;
545
+ console.log(`[TOKEN/${new Date().toISOString()}] Updating refresh token ${tokens.access_token}`);
536
546
  if (!tokens.refresh_token) {
547
+ console.log(`[TOKEN/${new Date().toISOString()}] We do not have a refresh token, so we need to reauthenticate`);
537
548
  // Refresh the page, as we cannot refresh the token
538
549
  setTimeout(() => window.location.reload(), Date.now() > accessExpireInUnixMs ? 500 : accessExpireInUnixMs - Date.now());
539
550
  }
540
551
  else if (tokens.owner === this.connId ||
541
552
  // We gave 25 seconds to the owner to update the token, and now we will do it and take the ownership
542
553
  takeOwnership) {
554
+ if (tokens.owner === this.connId) {
555
+ console.log(`[TOKEN/${new Date().toISOString()}] We are the owner of the token`);
556
+ }
557
+ else {
558
+ console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token, but we will take ownership`);
559
+ }
543
560
  // Handle token expiration if the connection is the owner of the token
544
561
  if (this.props.tokenTimeoutHandler) {
562
+ console.log(`[TOKEN/${new Date().toISOString()}] Asking GUI if we should prolong the token`);
545
563
  // Asc if the user wants to stay logged in
546
564
  void this.props.tokenTimeoutHandler(accessExpireInUnixMs).then(prolong => {
547
565
  if (prolong) {
566
+ console.log(`[TOKEN/${new Date().toISOString()}] Token will be prolonged`);
548
567
  this.refreshTokens(tokens, takeOwnership);
549
568
  }
550
569
  else {
570
+ console.log(`[TOKEN/${new Date().toISOString()}] Token will not be prolonged. Reloading the page`);
551
571
  // Refresh the page, as we cannot refresh the token
552
572
  setTimeout(() => window.location.reload(), Date.now() > accessExpireInUnixMs ? 500 : accessExpireInUnixMs - Date.now());
553
573
  }
554
574
  });
555
575
  }
556
576
  else {
577
+ console.log(`[TOKEN/${new Date().toISOString()}] No tokenTimeoutHandler defined. Prolonging the token`);
557
578
  this.refreshTokens(tokens, takeOwnership);
558
579
  }
559
580
  }
560
581
  else if (this.lastAccessToken !== tokens.access_token) {
582
+ console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token, but we will inform the server about new token`);
561
583
  // The connection is not the owner, so just check if access_token changed, so inform the server about it
562
584
  this.refreshTokens(tokens);
563
585
  }
564
586
  else {
587
+ console.log(`[TOKEN/${new Date().toISOString()}] We are not the owner of the token and the token did not change. Check in 3 seconds if the owner updated the token`);
565
588
  // What 3 seconds and check again, maybe the owner connection will update the token
566
589
  this._refreshTimer = setTimeout(() => {
567
590
  this._refreshTimer = null;
@@ -714,10 +737,10 @@ export class Connection {
714
737
  */
715
738
  authenticate() {
716
739
  if (window.location.search.includes('&href=')) {
717
- window.location.href = `${window.location.protocol}//${window.location.host}${window.location.pathname}${window.location.search}${window.location.hash}`;
740
+ window.location.href = `${window.location.protocol}//${window.location.host}${window.location.pathname}${window.location.search}`;
718
741
  }
719
742
  else {
720
- window.location.href = `${window.location.protocol}//${window.location.host}${window.location.pathname}?login&href=${window.location.search}${window.location.hash}`;
743
+ window.location.href = `${window.location.protocol}//${window.location.host}${window.location.pathname}?login&href=${encodeURIComponent(window.location.search + window.location.hash)}`;
721
744
  }
722
745
  }
723
746
  async subscribeState(...args) {
@@ -590,7 +590,11 @@ export class BaseCustomWebComponentNoAttachedTemplate extends HTMLElement {
590
590
  //@ts-ignore
591
591
  for (let i in this.constructor.properties) {
592
592
  //@ts-ignore
593
- this.constructor._propertiesDictionary.set(i.replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`), [i, this.constructor.properties[i]]);
593
+ let type = this.constructor.properties[i];
594
+ if (type.type)
595
+ type = type.type;
596
+ //@ts-ignore
597
+ this.constructor._propertiesDictionary.set(i.replace(/([A-Z])/g, (g) => `-${g[0].toLowerCase()}`), [i, type]);
594
598
  }
595
599
  }
596
600
  for (const a of this.attributes) {
@@ -53,4 +53,38 @@ export function arraysEqual(a, b) {
53
53
  }
54
54
  return true;
55
55
  }
56
+ let nullObject;
57
+ export function deepValue(obj, path, returnNullObject = false) {
58
+ if (path === undefined || path === null) {
59
+ return obj;
60
+ }
61
+ const pathParts = path.split('.');
62
+ for (let i = 0; i < pathParts.length; i++) {
63
+ if (obj != null) {
64
+ obj = obj[pathParts[i]];
65
+ }
66
+ else {
67
+ return returnNullObject ? nullObject : null;
68
+ }
69
+ }
70
+ return obj;
71
+ }
72
+ export function setDeepValue(obj, path, value) {
73
+ if (path === undefined || path === null) {
74
+ return;
75
+ }
76
+ const pathParts = path.split('.');
77
+ for (let i = 0; i < pathParts.length - 1; i++) {
78
+ if (obj != null) {
79
+ let newObj = obj[pathParts[i]];
80
+ if (newObj == null) {
81
+ newObj = {};
82
+ obj[pathParts[i]] = newObj;
83
+ }
84
+ obj = newObj;
85
+ }
86
+ }
87
+ if (obj != null)
88
+ obj[pathParts[pathParts.length - 1]] = value;
89
+ }
56
90
  //# sourceMappingURL=Helper.js.map
@@ -307,19 +307,28 @@ export function getResultingTransformationBetweenElementAndAllAncestors(node, an
307
307
  let lastOffsetParent = null;
308
308
  while (actualElement != ancestor && actualElement != null) {
309
309
  const parentElement = getParentElementIncludingSlots(actualElement, iframes);
310
- if (actualElement instanceof (actualElement.ownerDocument.defaultView ?? window).HTMLElement) {
311
- if (lastOffsetParent !== actualElement.offsetParent && !(actualElement instanceof (actualElement.ownerDocument.defaultView ?? window).HTMLSlotElement)) {
312
- const offsets = getElementOffsetsInContainer(actualElement, actualElement !== node, iframes);
313
- lastOffsetParent = actualElement.offsetParent;
314
- const mvMat = new DOMMatrix().translate(offsets.x, offsets.y);
310
+ if (actualElement.assignedSlot != null) {
311
+ const st = (perspectiveParentElement.ownerDocument.defaultView ?? window).getComputedStyle(actualElement);
312
+ if (st.position !== "static") {
313
+ const mvMat = new DOMMatrix().translate(parseFloat(st.left), parseFloat(st.top));
315
314
  originalElementAndAllParentsMultipliedMatrix = mvMat.multiply(originalElementAndAllParentsMultipliedMatrix);
316
315
  }
317
316
  }
318
317
  else {
319
- const offsets = getElementOffsetsInContainer(actualElement, actualElement !== node, iframes);
320
- lastOffsetParent = null;
321
- const mvMat = new DOMMatrix().translate(offsets.x, offsets.y);
322
- originalElementAndAllParentsMultipliedMatrix = mvMat.multiply(originalElementAndAllParentsMultipliedMatrix);
318
+ if (actualElement instanceof (actualElement.ownerDocument.defaultView ?? window).HTMLElement) {
319
+ if (lastOffsetParent !== actualElement.offsetParent && !(actualElement instanceof (actualElement.ownerDocument.defaultView ?? window).HTMLSlotElement)) {
320
+ const offsets = getElementOffsetsInContainer(actualElement, actualElement !== node, iframes);
321
+ lastOffsetParent = actualElement.offsetParent;
322
+ const mvMat = new DOMMatrix().translate(offsets.x, offsets.y);
323
+ originalElementAndAllParentsMultipliedMatrix = mvMat.multiply(originalElementAndAllParentsMultipliedMatrix);
324
+ }
325
+ }
326
+ else {
327
+ const offsets = getElementOffsetsInContainer(actualElement, actualElement !== node, iframes);
328
+ lastOffsetParent = null;
329
+ const mvMat = new DOMMatrix().translate(offsets.x, offsets.y);
330
+ originalElementAndAllParentsMultipliedMatrix = mvMat.multiply(originalElementAndAllParentsMultipliedMatrix);
331
+ }
323
332
  }
324
333
  if (parentElement) {
325
334
  parentElementMatrix = getElementCombinedTransform(parentElement, iframes);
@@ -6,10 +6,11 @@ import { CssAttributeParser } from '../helper/CssAttributeParser.js';
6
6
  import { PropertiesHelper } from '../services/propertiesService/services/PropertiesHelper.js';
7
7
  import { InsertChildAction } from '../services/undoService/transactionItems/InsertChildAction.js';
8
8
  import { DomConverter } from '../widgets/designerView/DomConverter.js';
9
- import { DeleteAction } from '../services/undoService/transactionItems/DeleteAction.js';
10
9
  import { enableStylesheetService } from '../widgets/designerView/extensions/buttons/StylesheetServiceDesignViewConfigButtons.js';
11
10
  import { TypedEvent } from '@node-projects/base-custom-webcomponent';
12
11
  import { TextContentChangeAction } from '../services/undoService/transactionItems/TextContentChangeAction.js';
12
+ import { PropertyChangeAction } from '../services/undoService/transactionItems/PropertyChangeAction.js';
13
+ import { deepValue } from '../helper/Helper.js';
13
14
  export const hideAtDesignTimeAttributeName = 'node-projects-hide-at-design-time';
14
15
  export const hideAtRunTimeAttributeName = 'node-projects-hide-at-run-time';
15
16
  export const lockAtDesignTimeAttributeName = 'node-projects-lock-at-design-time';
@@ -213,12 +214,10 @@ export class DesignItem {
213
214
  this.instanceServiceContainer.undoService.execute(action);
214
215
  }
215
216
  removeChild(designItem) {
216
- const action = new DeleteAction([designItem]);
217
- this.instanceServiceContainer.undoService.execute(action);
217
+ this.serviceContainer.deletionService.removeItems([designItem]);
218
218
  }
219
219
  remove() {
220
- const action = new DeleteAction([this]);
221
- this.instanceServiceContainer.undoService.execute(action);
220
+ this.serviceContainer.deletionService.removeItems([this]);
222
221
  }
223
222
  clearChildren() {
224
223
  for (let i = this._childArray.length - 1; i >= 0; i--) {
@@ -600,6 +599,13 @@ export class DesignItem {
600
599
  const action = new AttributeChangeAction(this, name, null, this._attributes.get(name));
601
600
  this.instanceServiceContainer.undoService.execute(action);
602
601
  }
602
+ setProperty(name, value) {
603
+ if (this.isRootItem)
604
+ throw 'not allowed to set attribute on root item';
605
+ const oldValue = deepValue(this.node, name);
606
+ const action = new PropertyChangeAction(this, name, value, oldValue);
607
+ this.instanceServiceContainer.undoService.execute(action);
608
+ }
603
609
  // Internal implementations wich don't use undo/redo
604
610
  _insertChildInternal(designItem, index) {
605
611
  if (designItem.parent && this.instanceServiceContainer.selectionService.primarySelection == designItem) {
@@ -104,6 +104,7 @@ import { SimpleToolButtonProvider } from '../widgets/designerView/tools/toolBar/
104
104
  import { assetsPath } from '../../Constants.js';
105
105
  import { PaddingTool } from '../widgets/designerView/tools/PaddingTool.js';
106
106
  import { DesignItemService } from './designItemService/DesignItemService.js';
107
+ import { DeletionService } from './deletionService/DeletionService.js';
107
108
  export function createDefaultServiceContainer() {
108
109
  let serviceContainer = new ServiceContainer();
109
110
  let defaultPlacementService = new DefaultPlacementService();
@@ -132,6 +133,7 @@ export function createDefaultServiceContainer() {
132
133
  serviceContainer.register("demoProviderService", new SimpleDemoProviderService());
133
134
  serviceContainer.register("eventsService", new EventsService());
134
135
  serviceContainer.register("designItemService", new DesignItemService());
136
+ serviceContainer.register("deletionService", new DeletionService());
135
137
  serviceContainer.register("undoService", (designerCanvas) => new UndoService(designerCanvas));
136
138
  serviceContainer.register("selectionService", (designerCanvas) => new SelectionService(designerCanvas, false));
137
139
  serviceContainer.register("contentService", (designerCanvas) => new ContentService(designerCanvas.rootDesignItem));
@@ -107,5 +107,8 @@ export class ServiceContainer extends BaseServiceContainer {
107
107
  get refactorServices() {
108
108
  return this.getServices('refactorService');
109
109
  }
110
+ get deletionService() {
111
+ return this.getLastService('deletionService');
112
+ }
110
113
  }
111
114
  //# sourceMappingURL=ServiceContainer.js.map
@@ -0,0 +1,7 @@
1
+ import { DeleteAction } from "../undoService/transactionItems/DeleteAction.js";
2
+ export class DeletionService {
3
+ removeItems(items) {
4
+ items[0].instanceServiceContainer.undoService.execute(new DeleteAction(items));
5
+ }
6
+ }
7
+ //# sourceMappingURL=DeletionService.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IDeletionService.js.map
@@ -106,6 +106,7 @@ export class AbsolutePlacementService {
106
106
  const translationMatrix = new DOMMatrix().translate(transformedPoint.x, transformedPoint.y);
107
107
  combineTransforms(designItem.element, designItem.getStyle('transform'), translationMatrix.toString());
108
108
  }
109
+ designerCanvas?.raiseDesignItemsChanged(filteredItems, 'place', false);
109
110
  }
110
111
  moveElements(designItems, position, absolute) {
111
112
  //TODO: Check if we set left or right
@@ -117,10 +118,11 @@ export class AbsolutePlacementService {
117
118
  d.setStyle('top', parseInt(d.element.style.top) - position.y + 'px');
118
119
  }
119
120
  designItems[0].instanceServiceContainer.designerCanvas.extensionManager.refreshExtensions(designItems);
121
+ designItems[0].instanceServiceContainer.designerCanvas?.raiseDesignItemsChanged(designItems, 'place', true);
120
122
  }
121
123
  enterContainer(container, items, mode) {
122
- let filterdItems = filterChildPlaceItems(items);
123
- for (let i of filterdItems) {
124
+ let filteredItems = filterChildPlaceItems(items);
125
+ for (let i of filteredItems) {
124
126
  if (mode == 'drop')
125
127
  i.setStyle('position', 'absolute');
126
128
  container.insertChild(i);
@@ -131,12 +133,15 @@ export class AbsolutePlacementService {
131
133
  i.setStyle('height', i.lastContainerSize.height + 'px');
132
134
  }
133
135
  }
136
+ items[0].instanceServiceContainer.designerCanvas?.raiseDesignItemsChanged(filteredItems, 'place', true);
134
137
  }
135
138
  leaveContainer(container, items) {
139
+ let filteredItems = filterChildPlaceItems(items);
140
+ items[0].instanceServiceContainer.designerCanvas?.raiseDesignItemsChanged(filteredItems, 'place', true);
136
141
  }
137
142
  finishPlace(event, designerCanvas, container, startPoint, offsetInControl, newPoint, items) {
138
- let filterdItems = filterChildPlaceItems(items);
139
- for (const designItem of filterdItems) {
143
+ let filteredItems = filterChildPlaceItems(items);
144
+ for (const designItem of filteredItems) {
140
145
  let translation = extractTranslationFromDOMMatrix(new DOMMatrix(designItem.element.style.transform));
141
146
  const stylesMapOffset = extractTranslationFromDOMMatrix(new DOMMatrix(designItem.getStyle('transform') ?? ''));
142
147
  designItem.element.style.transform = designItem.getStyle('transform') ?? '';
@@ -146,6 +151,7 @@ export class AbsolutePlacementService {
146
151
  for (const item of items) {
147
152
  designerCanvas.extensionManager.removeExtension(item, ExtensionType.Placement);
148
153
  }
154
+ items[0].instanceServiceContainer.designerCanvas?.raiseDesignItemsChanged(filteredItems, 'place', true);
149
155
  }
150
156
  }
151
157
  //# sourceMappingURL=AbsolutePlacementService.js.map
@@ -125,6 +125,7 @@ export class DefaultPlacementService {
125
125
  const translationMatrix = new DOMMatrix().translate(transformedPoint.x, transformedPoint.y);
126
126
  combineTransforms(designItem.element, designItem.getStyle('transform'), translationMatrix.toString());
127
127
  }
128
+ items[0].instanceServiceContainer.designerCanvas?.raiseDesignItemsChanged(filteredItems, 'place', false);
128
129
  }
129
130
  moveElements(designItems, position, absolute) {
130
131
  //TODO: Check if we set left or right
@@ -136,10 +137,11 @@ export class DefaultPlacementService {
136
137
  d.setStyle('top', parseInt(d.element.style.top) - position.y + 'px');
137
138
  }
138
139
  designItems[0].instanceServiceContainer.designerCanvas.extensionManager.refreshExtensions(designItems);
140
+ designItems[0].instanceServiceContainer.designerCanvas?.raiseDesignItemsChanged(designItems, 'place', true);
139
141
  }
140
142
  enterContainer(container, items, mode) {
141
- let filterdItems = filterChildPlaceItems(items);
142
- for (let i of filterdItems) {
143
+ let filteredItems = filterChildPlaceItems(items);
144
+ for (let i of filteredItems) {
143
145
  if (mode == 'drop')
144
146
  i.setStyle('position', 'absolute');
145
147
  container.insertChild(i);
@@ -150,12 +152,15 @@ export class DefaultPlacementService {
150
152
  i.setStyle('height', i.lastContainerSize.height + 'px');
151
153
  }
152
154
  }
155
+ items[0].instanceServiceContainer.designerCanvas?.raiseDesignItemsChanged(filteredItems, 'place', true);
153
156
  }
154
157
  leaveContainer(container, items) {
158
+ let filteredItems = filterChildPlaceItems(items);
159
+ items[0].instanceServiceContainer.designerCanvas?.raiseDesignItemsChanged(filteredItems, 'place', true);
155
160
  }
156
161
  finishPlace(event, placementView, container, startPoint, offsetInControl, newPoint, items) {
157
- let filterdItems = filterChildPlaceItems(items);
158
- for (const designItem of filterdItems) {
162
+ let filteredItems = filterChildPlaceItems(items);
163
+ for (const designItem of filteredItems) {
159
164
  let translation = extractTranslationFromDOMMatrix(new DOMMatrix(designItem.element.style.transform));
160
165
  const stylesMapOffset = extractTranslationFromDOMMatrix(new DOMMatrix(designItem.getStyle('transform') ?? ''));
161
166
  designItem.element.style.transform = designItem.getStyle('transform') ?? '';
@@ -174,6 +179,7 @@ export class DefaultPlacementService {
174
179
  for (const item of items) {
175
180
  placementView.extensionManager.removeExtension(item, ExtensionType.Placement);
176
181
  }
182
+ items[0].instanceServiceContainer.designerCanvas?.raiseDesignItemsChanged(filteredItems, 'place', true);
177
183
  }
178
184
  }
179
185
  //# sourceMappingURL=DefaultPlacementService.js.map
@@ -16,34 +16,39 @@ export class AbstractPolymerLikePropertiesService extends AbstractPropertiesServ
16
16
  for (const name in list) {
17
17
  const polymerProperty = list[name];
18
18
  let type = polymerProperty;
19
- if (polymerProperty.type)
19
+ let description = null;
20
+ let example = null;
21
+ if (polymerProperty.type) {
20
22
  type = polymerProperty.type;
23
+ description = polymerProperty.description;
24
+ example = polymerProperty.example;
25
+ }
21
26
  if (type === String) {
22
- let property = { name: name, type: "string", service: this, propertyType: PropertyType.propertyAndAttribute };
27
+ let property = { name: name, type: "string", service: this, propertyType: PropertyType.propertyAndAttribute, description: description, example: example };
23
28
  properties.push(property);
24
29
  }
25
30
  else if (type === Object) {
26
- let property = { name: name, type: "object", service: this, propertyType: PropertyType.propertyAndAttribute };
31
+ let property = { name: name, type: "object", service: this, propertyType: PropertyType.propertyAndAttribute, description: description, example: example };
27
32
  properties.push(property);
28
33
  }
29
34
  else if (type === Number) {
30
- let property = { name: name, type: "number", service: this, propertyType: PropertyType.propertyAndAttribute };
35
+ let property = { name: name, type: "number", service: this, propertyType: PropertyType.propertyAndAttribute, description: description, example: example };
31
36
  properties.push(property);
32
37
  }
33
38
  else if (type === Date) {
34
- let property = { name: name, type: "date", service: this, propertyType: PropertyType.propertyAndAttribute };
39
+ let property = { name: name, type: "date", service: this, propertyType: PropertyType.propertyAndAttribute, description: description, example: example };
35
40
  properties.push(property);
36
41
  }
37
42
  else if (type === Boolean) {
38
- let property = { name: name, type: "boolean", service: this, propertyType: PropertyType.propertyAndAttribute };
43
+ let property = { name: name, type: "boolean", service: this, propertyType: PropertyType.propertyAndAttribute, description: description, example: example };
39
44
  properties.push(property);
40
45
  }
41
46
  else if (PropertiesHelper.isTypescriptEnum(type)) {
42
- let property = { name: name, type: "enum", enumValues: PropertiesHelper.getTypescriptEnumEntries(type), service: this, propertyType: PropertyType.propertyAndAttribute };
47
+ let property = { name: name, type: "enum", enumValues: PropertiesHelper.getTypescriptEnumEntries(type), service: this, propertyType: PropertyType.propertyAndAttribute, description: description, example: example };
43
48
  properties.push(property);
44
49
  }
45
50
  else {
46
- let property = { name: name, type: "string", service: this, propertyType: PropertyType.propertyAndAttribute };
51
+ let property = { name: name, type: "string", service: this, propertyType: PropertyType.propertyAndAttribute, description: description, example: example };
47
52
  properties.push(property);
48
53
  }
49
54
  }
@@ -0,0 +1,32 @@
1
+ import { setDeepValue } from '../../../helper/Helper.js';
2
+ export class PropertyChangeAction {
3
+ constructor(designItem, name, newValue, oldValue) {
4
+ this.title = "Change Property " + name + " of &lt;" + designItem.name + "&gt;";
5
+ this.designItem = designItem;
6
+ this.name = name;
7
+ this.newValue = newValue;
8
+ this.oldValue = oldValue;
9
+ }
10
+ title;
11
+ get affectedItems() {
12
+ return [this.designItem];
13
+ }
14
+ undo() {
15
+ setDeepValue(this.designItem.node, this.name, this.oldValue);
16
+ }
17
+ do() {
18
+ setDeepValue(this.designItem.node, this.name, this.newValue);
19
+ }
20
+ designItem;
21
+ name;
22
+ newValue;
23
+ oldValue;
24
+ mergeWith(other) {
25
+ if (other instanceof PropertyChangeAction && this.designItem === other.designItem && this.name === other.name) {
26
+ this.newValue = other.newValue;
27
+ return true;
28
+ }
29
+ return false;
30
+ }
31
+ }
32
+ //# sourceMappingURL=PropertyChangeAction.js.map