@node-projects/web-component-designer 0.0.154 → 0.0.156

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 (65) hide show
  1. package/dist/elements/helper/ElementHelper.js +31 -6
  2. package/dist/elements/helper/SvgHelper.d.ts +1 -0
  3. package/dist/elements/helper/SvgHelper.js +13 -0
  4. package/dist/elements/helper/TransformHelper.d.ts +5 -1
  5. package/dist/elements/helper/TransformHelper.js +35 -27
  6. package/dist/elements/helper/contextMenu/ContextMenu.js +9 -1
  7. package/dist/elements/item/DesignItem.d.ts +12 -2
  8. package/dist/elements/item/DesignItem.js +55 -20
  9. package/dist/elements/item/IDesignItem.d.ts +10 -2
  10. package/dist/elements/services/bindingsService/BaseCustomWebcomponentBindingsService.js +1 -1
  11. package/dist/elements/services/htmlParserService/DefaultHtmlParserService.d.ts +1 -1
  12. package/dist/elements/services/htmlParserService/DefaultHtmlParserService.js +3 -3
  13. package/dist/elements/services/htmlParserService/LitElementParserService.js +2 -2
  14. package/dist/elements/services/htmlParserService/NodeHtmlParserService.js +2 -2
  15. package/dist/elements/services/htmlWriterService/AbstractHtmlWriterService.js +3 -3
  16. package/dist/elements/services/htmlWriterService/FormatingHtmlWriterService.js +3 -3
  17. package/dist/elements/services/htmlWriterService/SimpleHtmlWriterService.js +3 -3
  18. package/dist/elements/services/manifestParsers/WebcomponentManifestParserService.d.ts +2 -2
  19. package/dist/elements/services/manifestParsers/WebcomponentManifestParserService.js +3 -2
  20. package/dist/elements/services/modelCommandService/DefaultModelCommandService.js +6 -4
  21. package/dist/elements/services/placementService/DefaultPlacementService.js +5 -5
  22. package/dist/elements/services/propertiesService/IPropertiesService.d.ts +6 -1
  23. package/dist/elements/services/propertiesService/IPropertiesService.js +6 -1
  24. package/dist/elements/services/propertiesService/IProperty.d.ts +1 -0
  25. package/dist/elements/services/propertiesService/propertyEditors/BasePropertyEditor.js +4 -4
  26. package/dist/elements/services/propertiesService/services/AbstractPolymerLikePropertiesService.d.ts +2 -1
  27. package/dist/elements/services/propertiesService/services/AbstractPolymerLikePropertiesService.js +3 -2
  28. package/dist/elements/services/propertiesService/services/AbstractPropertiesService.d.ts +3 -3
  29. package/dist/elements/services/propertiesService/services/AbstractPropertiesService.js +16 -20
  30. package/dist/elements/services/propertiesService/services/AttributesPropertiesService.d.ts +3 -3
  31. package/dist/elements/services/propertiesService/services/AttributesPropertiesService.js +10 -11
  32. package/dist/elements/services/propertiesService/services/CommonPropertiesService.d.ts +2 -1
  33. package/dist/elements/services/propertiesService/services/CommonPropertiesService.js +3 -2
  34. package/dist/elements/services/propertiesService/services/CssPropertiesService.d.ts +2 -1
  35. package/dist/elements/services/propertiesService/services/CssPropertiesService.js +4 -3
  36. package/dist/elements/services/propertiesService/services/ListPropertiesService.d.ts +2 -1
  37. package/dist/elements/services/propertiesService/services/ListPropertiesService.js +3 -2
  38. package/dist/elements/services/propertiesService/services/NativeElementsPropertiesService.d.ts +2 -1
  39. package/dist/elements/services/propertiesService/services/NativeElementsPropertiesService.js +3 -2
  40. package/dist/elements/services/propertiesService/services/WebcomponentManifestPropertiesService.d.ts +2 -2
  41. package/dist/elements/services/propertiesService/services/WebcomponentManifestPropertiesService.js +3 -2
  42. package/dist/elements/services/selectionService/SelectionService.d.ts +4 -0
  43. package/dist/elements/services/selectionService/SelectionService.js +11 -0
  44. package/dist/elements/services/undoService/UndoService.d.ts +1 -1
  45. package/dist/elements/services/undoService/transactionItems/AttributeChangeAction.js +4 -4
  46. package/dist/elements/services/undoService/transactionItems/CssStyleChangeAction.js +4 -4
  47. package/dist/elements/services/undoService/transactionItems/InsertAction.d.ts +2 -2
  48. package/dist/elements/services/undoService/transactionItems/InsertAction.js +5 -5
  49. package/dist/elements/services/undoService/transactionItems/SelectionChangedAction.d.ts +14 -0
  50. package/dist/elements/services/undoService/transactionItems/SelectionChangedAction.js +28 -0
  51. package/dist/elements/widgets/codeView/code-view-monaco.js +21 -1
  52. package/dist/elements/widgets/designerView/designerCanvas.js +8 -4
  53. package/dist/elements/widgets/designerView/extensions/ResizeExtension.js +36 -31
  54. package/dist/elements/widgets/designerView/extensions/RotateExtensionProvider.js +3 -0
  55. package/dist/elements/widgets/designerView/extensions/TransformOriginExtension.js +2 -2
  56. package/dist/elements/widgets/designerView/extensions/svg/EllipsisExtensionProvider.js +2 -1
  57. package/dist/elements/widgets/designerView/extensions/svg/LineExtensionProvider.js +3 -1
  58. package/dist/elements/widgets/designerView/extensions/svg/PathExtensionProvider.js +3 -1
  59. package/dist/elements/widgets/designerView/extensions/svg/RectExtensionProvider.js +3 -1
  60. package/dist/elements/widgets/propertyGrid/PropertyGrid.js +5 -0
  61. package/dist/elements/widgets/propertyGrid/PropertyGridPropertyList.d.ts +1 -0
  62. package/dist/elements/widgets/propertyGrid/PropertyGridPropertyList.js +34 -7
  63. package/dist/index.d.ts +0 -1
  64. package/dist/index.js +0 -1
  65. package/package.json +4 -4
@@ -21,6 +21,7 @@ export class DefaultModelCommandService {
21
21
  }
22
22
  async executeCommand(designerCanvas, command) {
23
23
  let sel = designerCanvas.instanceServiceContainer.selectionService.primarySelection;
24
+ const selection = [...designerCanvas.instanceServiceContainer.selectionService.selectedElements];
24
25
  if (command.type == CommandType.moveBackward) {
25
26
  let idx = sel.parent.indexOf(sel) - 1;
26
27
  if (idx >= 0)
@@ -55,7 +56,7 @@ export class DefaultModelCommandService {
55
56
  }
56
57
  else if (command.type == CommandType.unifyHeight) {
57
58
  const grp = designerCanvas.instanceServiceContainer.selectionService.primarySelection.openGroup('unifyHeight');
58
- const height = designerCanvas.instanceServiceContainer.selectionService.primarySelection.styles.get('height');
59
+ const height = designerCanvas.instanceServiceContainer.selectionService.primarySelection.getStyle('height');
59
60
  for (let s of designerCanvas.instanceServiceContainer.selectionService.selectedElements) {
60
61
  s.setStyle('height', height);
61
62
  }
@@ -63,7 +64,7 @@ export class DefaultModelCommandService {
63
64
  }
64
65
  else if (command.type == CommandType.unifyWidth) {
65
66
  const grp = designerCanvas.instanceServiceContainer.selectionService.primarySelection.openGroup('unifyWidth');
66
- const width = designerCanvas.instanceServiceContainer.selectionService.primarySelection.styles.get('width');
67
+ const width = designerCanvas.instanceServiceContainer.selectionService.primarySelection.getStyle('width');
67
68
  for (let s of designerCanvas.instanceServiceContainer.selectionService.selectedElements) {
68
69
  s.setStyle('width', width);
69
70
  }
@@ -71,7 +72,7 @@ export class DefaultModelCommandService {
71
72
  }
72
73
  else if (command.type == CommandType.rotateCounterClockwise) {
73
74
  const grp = designerCanvas.instanceServiceContainer.selectionService.primarySelection.openGroup('rotateCounterClockwise');
74
- var trf = designerCanvas.instanceServiceContainer.selectionService.primarySelection.styles.get('transform');
75
+ var trf = designerCanvas.instanceServiceContainer.selectionService.primarySelection.getStyle('transform');
75
76
  let degree = 0;
76
77
  let rotation = "";
77
78
  if (trf != null) {
@@ -96,7 +97,7 @@ export class DefaultModelCommandService {
96
97
  }
97
98
  else if (command.type == CommandType.rotateClockwise) {
98
99
  const grp = designerCanvas.instanceServiceContainer.selectionService.primarySelection.openGroup('rotateClockwise');
99
- var trf = designerCanvas.instanceServiceContainer.selectionService.primarySelection.styles.get('transform');
100
+ var trf = designerCanvas.instanceServiceContainer.selectionService.primarySelection.getStyle('transform');
100
101
  let degree = 0;
101
102
  let rotation = "";
102
103
  if (trf != null) {
@@ -121,6 +122,7 @@ export class DefaultModelCommandService {
121
122
  }
122
123
  else
123
124
  return null;
125
+ designerCanvas.instanceServiceContainer.selectionService.setSelectedElements(selection);
124
126
  return true;
125
127
  }
126
128
  }
@@ -102,16 +102,16 @@ export class DefaultPlacementService {
102
102
  transformMatrixParentTransformsCompensated = new DOMPoint(track.x, track.y, 0, 0);
103
103
  }
104
104
  const translationMatrix = new DOMMatrix().translate(transformMatrixParentTransformsCompensated.x, transformMatrixParentTransformsCompensated.y);
105
- combineTransforms(designItem.element, designItem.styles.get('transform'), translationMatrix.toString());
105
+ combineTransforms(designItem.element, designItem.getStyle('transform'), translationMatrix.toString());
106
106
  }
107
107
  }
108
108
  enterContainer(container, items) {
109
109
  let filterdItems = filterChildPlaceItems(items);
110
110
  for (let i of filterdItems) {
111
111
  if (i.lastContainerSize) {
112
- if (!i.styles.has('width'))
112
+ if (!i.hasStyle('width'))
113
113
  i.setStyle('width', i.lastContainerSize.width + 'px');
114
- if (!i.styles.has('height'))
114
+ if (!i.hasStyle('height'))
115
115
  i.setStyle('height', i.lastContainerSize.height + 'px');
116
116
  }
117
117
  }
@@ -122,8 +122,8 @@ export class DefaultPlacementService {
122
122
  let filterdItems = filterChildPlaceItems(items);
123
123
  for (const designItem of filterdItems) {
124
124
  let translation = extractTranslationFromDOMMatrix(new DOMMatrix(designItem.element.style.transform));
125
- const stylesMapOffset = extractTranslationFromDOMMatrix(new DOMMatrix(designItem.styles.get('transform') ?? ''));
126
- designItem.element.style.transform = designItem.styles.get('transform') ?? '';
125
+ const stylesMapOffset = extractTranslationFromDOMMatrix(new DOMMatrix(designItem.getStyle('transform') ?? ''));
126
+ designItem.element.style.transform = designItem.getStyle('transform') ?? '';
127
127
  let track = { x: translation.x, y: translation.y };
128
128
  placeDesignItem(container, designItem, { x: track.x - stylesMapOffset.x, y: track.y - stylesMapOffset.y }, 'position');
129
129
  }
@@ -4,8 +4,13 @@ import { IDesignItem } from '../../item/IDesignItem';
4
4
  import { ValueType } from './ValueType';
5
5
  import { BindingTarget } from '../../item/BindingTarget';
6
6
  import { IBinding } from '../../item/IBinding';
7
+ export declare enum RefreshMode {
8
+ none = 0,
9
+ full = 1,
10
+ fullOnValueChange = 2
11
+ }
7
12
  export interface IPropertiesService extends IService {
8
- listNeedsRefresh(designItem: IDesignItem): boolean;
13
+ getRefreshMode(designItem: IDesignItem): RefreshMode;
9
14
  isHandledElement(designItem: IDesignItem): boolean;
10
15
  getProperties(designItem: IDesignItem): IProperty[];
11
16
  getProperty(designItem: IDesignItem, name: string): IProperty;
@@ -1 +1,6 @@
1
- export {};
1
+ export var RefreshMode;
2
+ (function (RefreshMode) {
3
+ RefreshMode[RefreshMode["none"] = 0] = "none";
4
+ RefreshMode[RefreshMode["full"] = 1] = "full";
5
+ RefreshMode[RefreshMode["fullOnValueChange"] = 2] = "fullOnValueChange";
6
+ })(RefreshMode || (RefreshMode = {}));
@@ -3,6 +3,7 @@ import { IPropertyEditor } from './IPropertyEditor';
3
3
  import { PropertyType } from './PropertyType';
4
4
  export interface IProperty {
5
5
  name: string;
6
+ renamable?: boolean;
6
7
  propertyName?: string;
7
8
  attributeName?: string;
8
9
  description?: string;
@@ -1,5 +1,4 @@
1
1
  import { ValueType } from '../ValueType';
2
- import { PropertyChangeAction } from "../../undoService/transactionItems/PropertyChangeAction";
3
2
  export class BasePropertyEditor {
4
3
  element;
5
4
  property;
@@ -13,9 +12,10 @@ export class BasePropertyEditor {
13
12
  if (this.designItems && this.designItems.length) {
14
13
  const cg = this.designItems[0].openGroup("set property: " + this.property.name);
15
14
  for (let d of this.designItems) {
16
- const oldValue = this.property.service.getValue([d], this.property);
17
- const action = new PropertyChangeAction(d, this.property, newValue, oldValue);
18
- d.instanceServiceContainer.undoService.execute(action);
15
+ if (newValue == null)
16
+ this.property.service.clearValue([d], this.property);
17
+ else
18
+ this.property.service.setValue([d], this.property, newValue);
19
19
  }
20
20
  cg.commit();
21
21
  }
@@ -1,8 +1,9 @@
1
1
  import { IProperty } from '../IProperty';
2
2
  import { IDesignItem } from '../../../item/IDesignItem';
3
3
  import { AbstractPropertiesService } from "./AbstractPropertiesService";
4
+ import { RefreshMode } from '../IPropertiesService';
4
5
  export declare abstract class AbstractPolymerLikePropertiesService extends AbstractPropertiesService {
5
- listNeedsRefresh(designItem: IDesignItem): boolean;
6
+ getRefreshMode(designItem: IDesignItem): RefreshMode;
6
7
  getProperties(designItem: IDesignItem): IProperty[];
7
8
  protected parseProperties(list: any): IProperty[];
8
9
  }
@@ -1,9 +1,10 @@
1
1
  import { PropertiesHelper } from './PropertiesHelper';
2
2
  import { AbstractPropertiesService } from "./AbstractPropertiesService";
3
3
  import { PropertyType } from '../PropertyType';
4
+ import { RefreshMode } from '../IPropertiesService';
4
5
  export class AbstractPolymerLikePropertiesService extends AbstractPropertiesService {
5
- listNeedsRefresh(designItem) {
6
- return true;
6
+ getRefreshMode(designItem) {
7
+ return RefreshMode.full;
7
8
  }
8
9
  getProperties(designItem) {
9
10
  if (!this.isHandledElement(designItem))
@@ -1,11 +1,11 @@
1
- import { IPropertiesService } from "../IPropertiesService";
1
+ import { IPropertiesService, RefreshMode } from "../IPropertiesService";
2
2
  import { IProperty } from '../IProperty';
3
3
  import { IDesignItem } from '../../../item/IDesignItem';
4
4
  import { ValueType } from "../ValueType";
5
5
  import { BindingTarget } from "../../../item/BindingTarget";
6
6
  import { IBinding } from "../../../item/IBinding";
7
7
  export declare abstract class AbstractPropertiesService implements IPropertiesService {
8
- abstract listNeedsRefresh(designItem: IDesignItem): boolean;
8
+ abstract getRefreshMode(designItem: IDesignItem): RefreshMode;
9
9
  abstract isHandledElement(designItem: IDesignItem): boolean;
10
10
  protected _notifyChangedProperty(designItem: IDesignItem, property: IProperty, value: any): void;
11
11
  getProperty(designItem: IDesignItem, name: string): IProperty;
@@ -14,7 +14,7 @@ export declare abstract class AbstractPropertiesService implements IPropertiesSe
14
14
  getPropertyTarget(designItem: IDesignItem, property: IProperty): BindingTarget;
15
15
  clearValue(designItems: IDesignItem[], property: IProperty): void;
16
16
  isSet(designItems: IDesignItem[], property: IProperty): ValueType;
17
- getValue(designItems: IDesignItem[], property: IProperty): string | boolean;
17
+ getValue(designItems: IDesignItem[], property: IProperty): any;
18
18
  getBinding(designItems: IDesignItem[], property: IProperty): IBinding;
19
19
  getUnsetValue(designItems: IDesignItem[], property: IProperty): any;
20
20
  }
@@ -13,8 +13,10 @@ export class AbstractPropertiesService {
13
13
  const cg = designItems[0].openGroup("properties changed");
14
14
  for (let d of designItems) {
15
15
  if (property.propertyType == PropertyType.cssValue) {
16
- d.styles.set(property.name, value);
17
- d.element.style[property.name] = value;
16
+ d.setStyle(property.name, value);
17
+ //unkown css property names do not trigger the mutation observer of property grid,
18
+ //fixed by assinging stle again to the attribute
19
+ d.element.setAttribute('style', d.element.getAttribute('style'));
18
20
  }
19
21
  else {
20
22
  let attributeName = property.attributeName;
@@ -22,20 +24,16 @@ export class AbstractPropertiesService {
22
24
  attributeName = PropertiesHelper.camelToDashCase(property.name);
23
25
  if (property.type === 'object') {
24
26
  const json = JSON.stringify(value);
25
- d.attributes.set(attributeName, json);
26
- d.element.setAttribute(attributeName, json);
27
+ d.setAttribute(attributeName, json);
27
28
  }
28
29
  else if (property.type == 'boolean' && !value) {
29
- d.attributes.delete(attributeName);
30
- d.element.removeAttribute(attributeName);
30
+ d.removeAttribute(attributeName);
31
31
  }
32
32
  else if (property.type == 'boolean' && value) {
33
- d.attributes.set(attributeName, "");
34
- d.element.setAttribute(attributeName, "");
33
+ d.setAttribute(attributeName, "");
35
34
  }
36
35
  else {
37
- d.attributes.set(attributeName, value);
38
- d.element.setAttribute(attributeName, value);
36
+ d.setAttribute(attributeName, value);
39
37
  }
40
38
  }
41
39
  this._notifyChangedProperty(d, property, value);
@@ -49,15 +47,13 @@ export class AbstractPropertiesService {
49
47
  const cg = designItems[0].openGroup("properties cleared");
50
48
  for (let d of designItems) {
51
49
  if (property.propertyType == PropertyType.cssValue) {
52
- d.styles.delete(property.name);
53
- d.element.style[property.name] = '';
50
+ d.removeStyle(property.name);
54
51
  }
55
52
  else {
56
53
  let attributeName = property.attributeName;
57
54
  if (!attributeName)
58
55
  attributeName = PropertiesHelper.camelToDashCase(property.name);
59
- d.attributes.delete(attributeName);
60
- d.element.removeAttribute(attributeName);
56
+ d.removeAttribute(attributeName);
61
57
  }
62
58
  d.serviceContainer.forSomeServicesTillResult('bindingService', (s) => {
63
59
  return s.clearBinding(d, property.name, this.getPropertyTarget(d, property));
@@ -76,9 +72,9 @@ export class AbstractPropertiesService {
76
72
  designItems.forEach((x) => {
77
73
  let has = false;
78
74
  if (property.propertyType == PropertyType.cssValue)
79
- has = x.styles.has(property.name);
75
+ has = x.hasStyle(property.name);
80
76
  else
81
- has = x.attributes.has(attributeName);
77
+ has = x.hasAttribute(attributeName);
82
78
  all = all && has;
83
79
  some = some || has;
84
80
  });
@@ -102,9 +98,9 @@ export class AbstractPropertiesService {
102
98
  getValue(designItems, property) {
103
99
  if (designItems != null && designItems.length !== 0) {
104
100
  if (property.propertyType == PropertyType.cssValue) {
105
- let lastValue = designItems[0].styles.get(property.name);
101
+ let lastValue = designItems[0].getStyle(property.name);
106
102
  for (const x of designItems) {
107
- let value = x.styles.get(property.name);
103
+ let value = x.getStyle(property.name);
108
104
  if (value != lastValue) {
109
105
  lastValue = null;
110
106
  break;
@@ -117,8 +113,8 @@ export class AbstractPropertiesService {
117
113
  if (!attributeName)
118
114
  attributeName = PropertiesHelper.camelToDashCase(property.name);
119
115
  if (property.type == 'boolean')
120
- return designItems[0].attributes.has(attributeName);
121
- let lastValue = designItems[0].attributes.get(attributeName);
116
+ return designItems[0].hasAttribute(attributeName);
117
+ let lastValue = designItems[0].getAttribute(attributeName);
122
118
  /*
123
119
  for (const x of designItems) {
124
120
  let value = x.attributes.get(attributeName);
@@ -1,4 +1,4 @@
1
- import { IPropertiesService } from "../IPropertiesService";
1
+ import { IPropertiesService, RefreshMode } from "../IPropertiesService";
2
2
  import { IProperty } from '../IProperty';
3
3
  import { IDesignItem } from '../../../item/IDesignItem';
4
4
  import { ValueType } from "../ValueType";
@@ -6,7 +6,7 @@ import { IBinding } from "../../../item/IBinding.js";
6
6
  import { BindingTarget } from "../../../item/BindingTarget";
7
7
  export declare class AttributesPropertiesService implements IPropertiesService {
8
8
  name: string;
9
- listNeedsRefresh(designItem: IDesignItem): boolean;
9
+ getRefreshMode(designItem: IDesignItem): RefreshMode;
10
10
  isHandledElement(designItem: IDesignItem): boolean;
11
11
  getProperty(designItem: IDesignItem, name: string): IProperty;
12
12
  getProperties(designItem: IDesignItem): IProperty[];
@@ -14,7 +14,7 @@ export declare class AttributesPropertiesService implements IPropertiesService {
14
14
  getPropertyTarget(designItem: IDesignItem, property: IProperty): BindingTarget;
15
15
  clearValue(designItems: IDesignItem[], property: IProperty): void;
16
16
  isSet(designItems: IDesignItem[], property: IProperty): ValueType;
17
- getValue(designItems: IDesignItem[], property: IProperty): string;
17
+ getValue(designItems: IDesignItem[], property: IProperty): any;
18
18
  getBinding(designItems: IDesignItem[], property: IProperty): IBinding;
19
19
  getUnsetValue(designItems: IDesignItem[], property: IProperty): any;
20
20
  }
@@ -1,10 +1,11 @@
1
+ import { RefreshMode } from "../IPropertiesService";
1
2
  import { ValueType } from "../ValueType";
2
3
  import { BindingTarget } from "../../../item/BindingTarget";
3
4
  import { PropertyType } from "../PropertyType";
4
5
  export class AttributesPropertiesService {
5
6
  name = "attributes";
6
- listNeedsRefresh(designItem) {
7
- return true;
7
+ getRefreshMode(designItem) {
8
+ return RefreshMode.fullOnValueChange;
8
9
  }
9
10
  isHandledElement(designItem) {
10
11
  return true;
@@ -15,8 +16,8 @@ export class AttributesPropertiesService {
15
16
  getProperties(designItem) {
16
17
  if (designItem) {
17
18
  let p = [];
18
- for (let a of designItem.attributes.keys()) {
19
- p.push({ name: a, type: 'string', service: this, propertyType: PropertyType.propertyAndAttribute });
19
+ for (let a of designItem.attributes()) {
20
+ p.push({ name: a[0], renamable: true, type: 'string', service: this, propertyType: PropertyType.propertyAndAttribute });
20
21
  }
21
22
  p.push({ name: '', type: 'addNew', service: this, propertyType: PropertyType.complex });
22
23
  return p;
@@ -26,8 +27,7 @@ export class AttributesPropertiesService {
26
27
  setValue(designItems, property, value) {
27
28
  const cg = designItems[0].openGroup("properties changed");
28
29
  for (let d of designItems) {
29
- d.attributes.set(property.name, value);
30
- d.element.setAttribute(property.name, value);
30
+ d.setAttribute(property.name, value);
31
31
  }
32
32
  cg.commit();
33
33
  }
@@ -36,8 +36,7 @@ export class AttributesPropertiesService {
36
36
  }
37
37
  clearValue(designItems, property) {
38
38
  for (let d of designItems) {
39
- d.attributes.delete(property.name);
40
- d.element.removeAttribute(property.name);
39
+ d.removeAttribute(property.name);
41
40
  d.serviceContainer.forSomeServicesTillResult('bindingService', (s) => {
42
41
  return s.clearBinding(d, property.name, this.getPropertyTarget(d, property));
43
42
  });
@@ -47,11 +46,11 @@ export class AttributesPropertiesService {
47
46
  let all = true;
48
47
  let some = false;
49
48
  if (designItems != null && designItems.length !== 0) {
50
- if (designItems.length == 1 && typeof designItems[0].attributes.get(property.name) == 'object')
49
+ if (designItems.length == 1 && typeof designItems[0].getAttribute(property.name) == 'object')
51
50
  return ValueType.bound;
52
51
  let attributeName = property.name;
53
52
  designItems.forEach((x) => {
54
- let has = x.attributes.has(attributeName);
53
+ let has = x.hasAttribute(attributeName);
55
54
  all = all && has;
56
55
  some = some || has;
57
56
  });
@@ -63,7 +62,7 @@ export class AttributesPropertiesService {
63
62
  getValue(designItems, property) {
64
63
  if (designItems != null && designItems.length !== 0) {
65
64
  let attributeName = property.name;
66
- let lastValue = designItems[0].attributes.get(attributeName);
65
+ let lastValue = designItems[0].getAttribute(attributeName);
67
66
  if (typeof lastValue === 'object')
68
67
  return lastValue.rawValue;
69
68
  /*
@@ -1,8 +1,9 @@
1
1
  import { IProperty } from '../IProperty';
2
2
  import { IDesignItem } from '../../../item/IDesignItem';
3
3
  import { AbstractPropertiesService } from "./AbstractPropertiesService";
4
+ import { RefreshMode } from '../IPropertiesService';
4
5
  export declare class CommonPropertiesService extends AbstractPropertiesService {
5
- listNeedsRefresh(designItem: IDesignItem): boolean;
6
+ getRefreshMode(designItem: IDesignItem): RefreshMode;
6
7
  private commonProperties;
7
8
  name: string;
8
9
  isHandledElement(designItem: IDesignItem): boolean;
@@ -1,8 +1,9 @@
1
1
  import { PropertyType } from "../PropertyType";
2
2
  import { AbstractPropertiesService } from "./AbstractPropertiesService";
3
+ import { RefreshMode } from '../IPropertiesService';
3
4
  export class CommonPropertiesService extends AbstractPropertiesService {
4
- listNeedsRefresh(designItem) {
5
- return false;
5
+ getRefreshMode(designItem) {
6
+ return RefreshMode.none;
6
7
  }
7
8
  //@ts-ignore
8
9
  commonProperties = [
@@ -2,8 +2,9 @@ import { IProperty } from '../IProperty';
2
2
  import { IDesignItem } from '../../../item/IDesignItem';
3
3
  import { BindingTarget } from '../../../item/BindingTarget.js';
4
4
  import { CommonPropertiesService } from './CommonPropertiesService';
5
+ import { RefreshMode } from '../IPropertiesService';
5
6
  export declare class CssPropertiesService extends CommonPropertiesService {
6
- listNeedsRefresh(designItem: IDesignItem): boolean;
7
+ getRefreshMode(designItem: IDesignItem): RefreshMode.none | RefreshMode.fullOnValueChange;
7
8
  layout: IProperty[];
8
9
  grid: IProperty[];
9
10
  flex: IProperty[];
@@ -1,9 +1,10 @@
1
1
  import { BindingTarget } from '../../../item/BindingTarget.js';
2
2
  import { PropertyType } from '../PropertyType';
3
3
  import { CommonPropertiesService } from './CommonPropertiesService';
4
+ import { RefreshMode } from '../IPropertiesService';
4
5
  export class CssPropertiesService extends CommonPropertiesService {
5
- listNeedsRefresh(designItem) {
6
- return this.name == 'styles' ? true : false;
6
+ getRefreshMode(designItem) {
7
+ return this.name == 'styles' ? RefreshMode.fullOnValueChange : RefreshMode.none;
7
8
  }
8
9
  layout = [
9
10
  {
@@ -194,7 +195,7 @@ export class CssPropertiesService extends CommonPropertiesService {
194
195
  if (this.name == 'styles') {
195
196
  if (!designItem)
196
197
  return [];
197
- let arr = Array.from(designItem.styles.keys(), x => ({ name: x, type: 'string', service: this, propertyType: PropertyType.cssValue }));
198
+ let arr = Array.from(designItem.styles(), ([key, value]) => ({ name: key, renamable: true, type: 'string', service: this, propertyType: PropertyType.cssValue }));
198
199
  arr.push({ name: '', type: 'addNew', service: this, propertyType: PropertyType.complex });
199
200
  return arr;
200
201
  }
@@ -2,8 +2,9 @@ import { IProperty } from '../IProperty';
2
2
  import { IDesignItem } from '../../../item/IDesignItem';
3
3
  import { IJsonPropertyDefinitions } from './IJsonPropertyDefinitions';
4
4
  import { AbstractPropertiesService } from './AbstractPropertiesService';
5
+ import { RefreshMode } from '../IPropertiesService';
5
6
  export declare class ListPropertiesService extends AbstractPropertiesService {
6
- listNeedsRefresh(designItem: IDesignItem): boolean;
7
+ getRefreshMode(designItem: IDesignItem): RefreshMode;
7
8
  name: string;
8
9
  private _propertys;
9
10
  constructor(propertyDefinitions: IJsonPropertyDefinitions);
@@ -1,8 +1,9 @@
1
1
  import { AbstractPropertiesService } from './AbstractPropertiesService';
2
2
  import { PropertyType } from '../PropertyType';
3
+ import { RefreshMode } from '../IPropertiesService';
3
4
  export class ListPropertiesService extends AbstractPropertiesService {
4
- listNeedsRefresh(designItem) {
5
- return true;
5
+ getRefreshMode(designItem) {
6
+ return RefreshMode.full;
6
7
  }
7
8
  name = "list";
8
9
  _propertys = new Map();
@@ -1,6 +1,7 @@
1
1
  import { IProperty } from '../IProperty';
2
2
  import { IDesignItem } from '../../../item/IDesignItem';
3
3
  import { CommonPropertiesService } from "./CommonPropertiesService";
4
+ import { RefreshMode } from '../IPropertiesService';
4
5
  export declare class NativeElementsPropertiesService extends CommonPropertiesService {
5
6
  private inputProperties;
6
7
  private textareaProperties;
@@ -12,7 +13,7 @@ export declare class NativeElementsPropertiesService extends CommonPropertiesSer
12
13
  private iframeProperties;
13
14
  private formElementProperties;
14
15
  name: string;
15
- listNeedsRefresh(designItem: IDesignItem): boolean;
16
+ getRefreshMode(designItem: IDesignItem): RefreshMode;
16
17
  isHandledElement(designItem: IDesignItem): boolean;
17
18
  getProperty(designItem: IDesignItem, name: string): IProperty;
18
19
  getProperties(designItem: IDesignItem): IProperty[];
@@ -1,5 +1,6 @@
1
1
  import { CommonPropertiesService } from "./CommonPropertiesService";
2
2
  import { PropertyType } from '../PropertyType';
3
+ import { RefreshMode } from '../IPropertiesService';
3
4
  export class NativeElementsPropertiesService extends CommonPropertiesService {
4
5
  inputProperties = [
5
6
  {
@@ -156,8 +157,8 @@ export class NativeElementsPropertiesService extends CommonPropertiesService {
156
157
  }
157
158
  ];
158
159
  name = "native";
159
- listNeedsRefresh(designItem) {
160
- return true;
160
+ getRefreshMode(designItem) {
161
+ return RefreshMode.full;
161
162
  }
162
163
  isHandledElement(designItem) {
163
164
  switch (designItem.element.localName) {
@@ -1,10 +1,10 @@
1
1
  import { BindingTarget } from "../../../item/BindingTarget.js";
2
2
  import { IDesignItem } from "../../../item/IDesignItem.js";
3
- import { IPropertiesService } from "../IPropertiesService.js";
3
+ import { IPropertiesService, RefreshMode } from "../IPropertiesService.js";
4
4
  import { IProperty } from "../IProperty.js";
5
5
  import { AbstractPropertiesService } from "./AbstractPropertiesService.js";
6
6
  export declare class WebcomponentManifestPropertiesService extends AbstractPropertiesService implements IPropertiesService {
7
- listNeedsRefresh(designItem: IDesignItem): boolean;
7
+ getRefreshMode(designItem: IDesignItem): RefreshMode;
8
8
  private _name;
9
9
  get name(): string;
10
10
  private _propertiesList;
@@ -1,9 +1,10 @@
1
1
  import { BindingTarget } from "../../../item/BindingTarget.js";
2
+ import { RefreshMode } from "../IPropertiesService.js";
2
3
  import { PropertyType } from "../PropertyType.js";
3
4
  import { AbstractPropertiesService } from "./AbstractPropertiesService.js";
4
5
  export class WebcomponentManifestPropertiesService extends AbstractPropertiesService {
5
- listNeedsRefresh(designItem) {
6
- return true;
6
+ getRefreshMode(designItem) {
7
+ return RefreshMode.full;
7
8
  }
8
9
  _name;
9
10
  get name() { return this._name; }
@@ -2,10 +2,14 @@ import { ISelectionService } from './ISelectionService';
2
2
  import { IDesignItem } from '../../item/IDesignItem';
3
3
  import { ISelectionChangedEvent } from './ISelectionChangedEvent';
4
4
  import { TypedEvent } from '@node-projects/base-custom-webcomponent';
5
+ import { IDesignerCanvas } from '../../widgets/designerView/IDesignerCanvas';
5
6
  export declare class SelectionService implements ISelectionService {
6
7
  primarySelection: IDesignItem;
7
8
  selectedElements: IDesignItem[];
9
+ _designerCanvas: IDesignerCanvas;
10
+ constructor(designerCanvas: IDesignerCanvas);
8
11
  setSelectedElements(designItems: IDesignItem[]): void;
12
+ _withoutUndoSetSelectedElements(designItems: IDesignItem[]): void;
9
13
  clearSelectedElements(): void;
10
14
  isSelected(designItem: IDesignItem): boolean;
11
15
  readonly onSelectionChanged: TypedEvent<ISelectionChangedEvent>;
@@ -1,8 +1,19 @@
1
1
  import { TypedEvent } from '@node-projects/base-custom-webcomponent';
2
+ import { SelectionChangedAction } from '../undoService/transactionItems/SelectionChangedAction';
2
3
  export class SelectionService {
3
4
  primarySelection;
4
5
  selectedElements = [];
6
+ _designerCanvas;
7
+ constructor(designerCanvas) {
8
+ this._designerCanvas = designerCanvas;
9
+ }
5
10
  setSelectedElements(designItems) {
11
+ if (this.selectedElements != designItems) {
12
+ const action = new SelectionChangedAction(this.selectedElements, designItems, this);
13
+ this._designerCanvas.instanceServiceContainer.undoService.execute(action);
14
+ }
15
+ }
16
+ _withoutUndoSetSelectedElements(designItems) {
6
17
  let oldSelectedElements = this.selectedElements;
7
18
  if (!designItems) {
8
19
  this.selectedElements = [];
@@ -7,7 +7,7 @@ export declare class UndoService implements IUndoService {
7
7
  private _redoStack;
8
8
  private _transactionStack;
9
9
  private _designerCanvas;
10
- constructor(designerCanvas?: IDesignerCanvas);
10
+ constructor(designerCanvas: IDesignerCanvas);
11
11
  openGroup(title: string): ChangeGroup;
12
12
  private commitTransactionItem;
13
13
  private abortTransactionItem;
@@ -12,7 +12,7 @@ export class AttributeChangeAction {
12
12
  }
13
13
  undo() {
14
14
  if (this.oldValue == null) {
15
- this.designItem.attributes.delete(this.name);
15
+ this.designItem._withoutUndoRemoveAttribute(this.name);
16
16
  try {
17
17
  this.designItem.element.removeAttribute(this.name);
18
18
  }
@@ -21,7 +21,7 @@ export class AttributeChangeAction {
21
21
  }
22
22
  }
23
23
  else {
24
- this.designItem.attributes.set(this.name, this.oldValue);
24
+ this.designItem._withoutUndoSetAttribute(this.name, this.oldValue);
25
25
  if (this.name != "draggable") {
26
26
  try {
27
27
  if (typeof this.oldValue === 'string')
@@ -35,7 +35,7 @@ export class AttributeChangeAction {
35
35
  }
36
36
  do() {
37
37
  if (this.newValue == null) {
38
- this.designItem.attributes.delete(this.name);
38
+ this.designItem._withoutUndoRemoveAttribute(this.name);
39
39
  try {
40
40
  this.designItem.element.removeAttribute(this.name);
41
41
  }
@@ -44,7 +44,7 @@ export class AttributeChangeAction {
44
44
  }
45
45
  }
46
46
  else {
47
- this.designItem.attributes.set(this.name, this.newValue);
47
+ this.designItem._withoutUndoSetAttribute(this.name, this.newValue);
48
48
  if (this.name != "draggable") {
49
49
  try {
50
50
  if (typeof this.newValue === 'string')
@@ -12,21 +12,21 @@ export class CssStyleChangeAction {
12
12
  }
13
13
  undo() {
14
14
  if (this.oldValue === '' || this.oldValue == null) {
15
- this.designItem.styles.delete(this.name);
15
+ this.designItem._withoutUndoRemoveStyle(this.name);
16
16
  this.designItem.element.style[this.name] = '';
17
17
  }
18
18
  else {
19
- this.designItem.styles.set(this.name, this.oldValue);
19
+ this.designItem._withoutUndoSetStyle(this.name, this.oldValue);
20
20
  this.designItem.element.style[this.name] = this.oldValue;
21
21
  }
22
22
  }
23
23
  do() {
24
24
  if (this.newValue === '' || this.newValue == null) {
25
- this.designItem.styles.delete(this.name);
25
+ this.designItem._withoutUndoRemoveStyle(this.name);
26
26
  this.designItem.element.style[this.name] = '';
27
27
  }
28
28
  else {
29
- this.designItem.styles.set(this.name, this.newValue);
29
+ this.designItem._withoutUndoSetStyle(this.name, this.newValue);
30
30
  this.designItem.element.style[this.name] = this.newValue;
31
31
  }
32
32
  }