@node-projects/web-component-designer 0.1.152 → 0.1.153

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.
@@ -20,10 +20,18 @@ export declare class PropertyGroupsService implements IPropertyGroupsService {
20
20
  name: string;
21
21
  propertiesService: IPropertiesService;
22
22
  }[];
23
+ protected _grid: {
24
+ name: string;
25
+ propertiesService: IPropertiesService;
26
+ }[];
23
27
  protected _flexChild: {
24
28
  name: string;
25
29
  propertiesService: IPropertiesService;
26
30
  }[];
31
+ protected _flex: {
32
+ name: string;
33
+ propertiesService: IPropertiesService;
34
+ }[];
27
35
  getPropertygroups(designItems: IDesignItem[]): {
28
36
  name: string;
29
37
  propertiesService: IPropertiesService;
@@ -11,8 +11,6 @@ export class PropertyGroupsService {
11
11
  { name: 'styles', propertiesService: new CssCurrentPropertiesService() },
12
12
  { name: 'css vars', propertiesService: new CssCustomPropertiesService() },
13
13
  { name: 'layout', propertiesService: new CssPropertiesService("layout") },
14
- { name: 'flex', propertiesService: new CssPropertiesService("flex") },
15
- { name: 'grid', propertiesService: new CssPropertiesService("grid") },
16
14
  ];
17
15
  _pgList = [
18
16
  { name: 'properties', propertiesService: null },
@@ -22,8 +20,6 @@ export class PropertyGroupsService {
22
20
  { name: 'styles', propertiesService: new CssCurrentPropertiesService() },
23
21
  { name: 'css vars', propertiesService: new CssCustomPropertiesService() },
24
22
  { name: 'layout', propertiesService: new CssPropertiesService("layout") },
25
- { name: 'flex', propertiesService: new CssPropertiesService("flex") },
26
- { name: 'grid', propertiesService: new CssPropertiesService("grid") },
27
23
  ];
28
24
  _svgPgList = [
29
25
  { name: 'properties', propertiesService: null },
@@ -38,28 +34,46 @@ export class PropertyGroupsService {
38
34
  _gridChild = [
39
35
  { name: 'gridChild', propertiesService: new CssPropertiesService("gridChild") },
40
36
  ];
37
+ _grid = [
38
+ { name: 'grid', propertiesService: new CssPropertiesService("grid") },
39
+ ];
41
40
  _flexChild = [
42
41
  { name: 'flexChild', propertiesService: new CssPropertiesService("flexChild") },
43
42
  ];
43
+ _flex = [
44
+ { name: 'flex', propertiesService: new CssPropertiesService("flex") },
45
+ ];
44
46
  getPropertygroups(designItems) {
45
47
  if (designItems == null || designItems.length == 0)
46
48
  return [];
47
49
  if (designItems[0].nodeType == NodeType.TextNode || designItems[0].nodeType == NodeType.Comment)
48
50
  return [];
49
- if (designItems[0].isRootItem)
50
- return this._rootPgList;
51
+ if (designItems[0].isRootItem) {
52
+ const style = designItems[0].getComputedStyle();
53
+ let lst = this._rootPgList;
54
+ if (style.display.includes('grid'))
55
+ lst = [...lst, ...this._grid];
56
+ else if (style.display.includes('flex'))
57
+ lst = [...lst, ...this._flex];
58
+ return lst;
59
+ }
51
60
  this._pgList[0].propertiesService = designItems[0].serviceContainer.getLastServiceWhere('propertyService', x => x.isHandledElement(designItems[0]));
52
61
  this._svgPgList[0].propertiesService = designItems[0].serviceContainer.getLastServiceWhere('propertyService', x => x.isHandledElement(designItems[0]));
53
62
  let lst = this._pgList;
54
63
  if (designItems[0].element instanceof SVGElement)
55
64
  lst = this._svgPgList;
65
+ const style = designItems[0].getComputedStyle();
66
+ if (style.display.includes('grid'))
67
+ lst = [...lst, ...this._grid];
68
+ else if (style.display.includes('flex'))
69
+ lst = [...lst, ...this._flex];
56
70
  if (designItems[0].parent) {
57
71
  const parentStyle = designItems[0].parent.getComputedStyle();
58
72
  if (parentStyle.display.includes('grid'))
59
- lst = [...lst, this._gridChild[0]];
73
+ lst = [...lst, ...this._gridChild];
60
74
  else if (parentStyle.display.includes('flex'))
61
- lst = [...lst, this._flexChild[0]];
75
+ lst = [...lst, ...this._flexChild];
62
76
  }
63
- return lst; //.filter(x => x.propertiesService.isHandledElement(designItems[0]));
77
+ return lst;
64
78
  }
65
79
  }
@@ -8,11 +8,6 @@ export class CommonPropertiesService extends AbstractPropertiesService {
8
8
  //@ts-ignore
9
9
  commonProperties = [
10
10
  {
11
- name: "id",
12
- type: "string",
13
- service: this,
14
- propertyType: PropertyType.propertyAndAttribute
15
- }, {
16
11
  name: "class",
17
12
  type: "string",
18
13
  service: this,
@@ -88,6 +88,15 @@ export class PropertyGrid extends BaseCustomWebComponentLazyAppend {
88
88
  if (lst.createElements(items[0]))
89
89
  visibleDict.add(p.name);
90
90
  }
91
+ let parentEl = this._designerTabControl;
92
+ for (const v of visibleDict) {
93
+ let el = this._propertyGridPropertyListsDict[v];
94
+ if (parentEl === this._designerTabControl)
95
+ parentEl.insertAdjacentElement('afterbegin', el);
96
+ else
97
+ parentEl.insertAdjacentElement('afterend', el);
98
+ parentEl = el;
99
+ }
91
100
  for (let p of this._propertyGridPropertyLists) {
92
101
  if (visibleDict.has(p.title))
93
102
  p.style.display = 'block';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "A WYSIWYG designer webcomponent for html components",
3
3
  "name": "@node-projects/web-component-designer",
4
- "version": "0.1.152",
4
+ "version": "0.1.153",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",