@node-projects/web-component-designer 0.0.169 → 0.0.170

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.
@@ -1,12 +1,13 @@
1
1
  import { AttributesPropertiesService } from './services/AttributesPropertiesService.js';
2
2
  import { CommonPropertiesService } from './services/CommonPropertiesService.js';
3
+ import { CssCurrentPropertiesService } from './services/CssCurrentPropertiesService.js';
3
4
  import { CssPropertiesService } from './services/CssPropertiesService.js';
4
5
  export class PropertyTabsService {
5
6
  _pgList = [
6
7
  { name: 'properties', propertiesService: null },
7
8
  { name: 'attributes', propertiesService: new AttributesPropertiesService() },
8
9
  { name: 'common', propertiesService: new CommonPropertiesService() },
9
- { name: 'styles', propertiesService: new CssPropertiesService("styles") },
10
+ { name: 'styles', propertiesService: new CssCurrentPropertiesService() },
10
11
  { name: 'layout', propertiesService: new CssPropertiesService("layout") },
11
12
  { name: 'flex', propertiesService: new CssPropertiesService("flex") },
12
13
  { name: 'grid', propertiesService: new CssPropertiesService("grid") },
@@ -14,7 +15,7 @@ export class PropertyTabsService {
14
15
  _svgPgList = [
15
16
  { name: 'properties', propertiesService: null },
16
17
  { name: 'attributes', propertiesService: new AttributesPropertiesService() },
17
- { name: 'styles', propertiesService: new CssPropertiesService("styles") },
18
+ { name: 'styles', propertiesService: new CssCurrentPropertiesService() },
18
19
  { name: 'layout', propertiesService: new CssPropertiesService("layout") },
19
20
  ];
20
21
  getPropertygroups(designItems) {
@@ -0,0 +1,18 @@
1
+ import { IProperty } from '../IProperty.js';
2
+ import { IDesignItem } from '../../../item/IDesignItem.js';
3
+ import { BindingTarget } from '../../../item/BindingTarget.js';
4
+ import { CommonPropertiesService } from './CommonPropertiesService.js';
5
+ import { RefreshMode } from '../IPropertiesService.js';
6
+ import { IPropertyGroup } from '../IPropertyGroup.js';
7
+ export declare class CssPropertiesService extends CommonPropertiesService {
8
+ getRefreshMode(designItem: IDesignItem): RefreshMode.none | RefreshMode.fullOnValueChange;
9
+ layout: IProperty[];
10
+ grid: IProperty[];
11
+ flex: IProperty[];
12
+ constructor(name: 'styles' | 'layout' | 'grid' | 'flex');
13
+ isHandledElement(designItem: IDesignItem): boolean;
14
+ getProperty(designItem: IDesignItem, name: string): IProperty;
15
+ getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
16
+ getPropertyTarget(designItem: IDesignItem, property: IProperty): BindingTarget;
17
+ setValue(designItems: IDesignItem[], property: IProperty, value: any): void;
18
+ }
@@ -0,0 +1,221 @@
1
+ import { BindingTarget } from '../../../item/BindingTarget.js';
2
+ import { PropertyType } from '../PropertyType.js';
3
+ import { CommonPropertiesService } from './CommonPropertiesService.js';
4
+ import { RefreshMode } from '../IPropertiesService.js';
5
+ export class CssPropertiesService extends CommonPropertiesService {
6
+ getRefreshMode(designItem) {
7
+ return this.name == 'styles' ? RefreshMode.fullOnValueChange : RefreshMode.none;
8
+ }
9
+ layout = [
10
+ {
11
+ name: "display",
12
+ type: "list",
13
+ values: ["block", "inline", "inline-block", "flex", "inline-flex", "contents", "grid", "inline-grid", "inherit", "initial", "none"],
14
+ service: this,
15
+ propertyType: PropertyType.cssValue
16
+ },
17
+ {
18
+ name: "color",
19
+ type: "color",
20
+ service: this,
21
+ propertyType: PropertyType.cssValue
22
+ }, {
23
+ name: "background-color",
24
+ type: "color",
25
+ service: this,
26
+ propertyType: PropertyType.cssValue
27
+ }, {
28
+ name: "box-sizing",
29
+ type: "list",
30
+ values: ["border-box", "content-box"],
31
+ service: this,
32
+ propertyType: PropertyType.cssValue
33
+ }, {
34
+ name: "border",
35
+ type: "string",
36
+ default: "0px none rbg(0,0,0)",
37
+ service: this,
38
+ propertyType: PropertyType.cssValue
39
+ }, {
40
+ name: "box-shadow",
41
+ type: "string",
42
+ default: "none",
43
+ service: this,
44
+ propertyType: PropertyType.cssValue
45
+ }, {
46
+ name: "opacity",
47
+ type: "number",
48
+ min: 0,
49
+ max: 1,
50
+ step: 0.1,
51
+ service: this,
52
+ propertyType: PropertyType.cssValue
53
+ }, {
54
+ name: "metrics",
55
+ type: "metrics",
56
+ service: this,
57
+ propertyType: PropertyType.complex
58
+ }, {
59
+ name: "position",
60
+ type: "list",
61
+ values: ["static", "relative", "absolute"],
62
+ service: this,
63
+ propertyType: PropertyType.cssValue
64
+ }, {
65
+ name: "font-size",
66
+ type: "css-length",
67
+ service: this,
68
+ propertyType: PropertyType.cssValue
69
+ }, {
70
+ name: "font-weight",
71
+ type: "list",
72
+ values: ["normal", "bold", "100", "200", "300", "400", "500", "600", "700", "800", "900", "lighter", "bolder"],
73
+ service: this,
74
+ propertyType: PropertyType.cssValue
75
+ }
76
+ ];
77
+ grid = [
78
+ {
79
+ name: "display",
80
+ type: "list",
81
+ values: ["block", "inline-block", "flex", "contents", "grid", "inherit", "initial", "none"],
82
+ service: this,
83
+ propertyType: PropertyType.cssValue
84
+ }, {
85
+ name: "position",
86
+ type: "list",
87
+ values: ["static", "relative", "absolute"],
88
+ service: this,
89
+ propertyType: PropertyType.cssValue
90
+ }, {
91
+ name: "grid-template-columns",
92
+ type: "string",
93
+ service: this,
94
+ propertyType: PropertyType.cssValue
95
+ }, {
96
+ name: "grid-template-rows",
97
+ type: "string",
98
+ service: this,
99
+ propertyType: PropertyType.cssValue
100
+ }, {
101
+ name: "column-gap",
102
+ type: "css-length",
103
+ service: this,
104
+ propertyType: PropertyType.cssValue
105
+ }, {
106
+ name: "row-gap",
107
+ type: "css-length",
108
+ service: this,
109
+ propertyType: PropertyType.cssValue
110
+ }, {
111
+ name: "align-content",
112
+ type: "img-list",
113
+ values: ["center", "space-between", "space-around", "space-evenly", "stretch"],
114
+ service: this,
115
+ propertyType: PropertyType.cssValue
116
+ }, {
117
+ name: "justify-content",
118
+ type: "img-list",
119
+ values: ["center", "start", "end", "space-between", "space-around", "space-evenly"],
120
+ service: this,
121
+ propertyType: PropertyType.cssValue
122
+ }, {
123
+ name: "align-items",
124
+ type: "img-list",
125
+ values: ["center", "start", "end", "stretch", "baseline"],
126
+ service: this,
127
+ propertyType: PropertyType.cssValue
128
+ }, {
129
+ name: "justify-items",
130
+ type: "img-list",
131
+ values: ["center", "start", "end", "stretch"],
132
+ service: this,
133
+ propertyType: PropertyType.cssValue
134
+ }
135
+ ];
136
+ flex = [
137
+ {
138
+ name: "display",
139
+ type: "list",
140
+ values: ["block", "inline-block", "flex", "contents", "grid", "inherit", "initial", "none"],
141
+ service: this,
142
+ propertyType: PropertyType.cssValue
143
+ }, {
144
+ name: "position",
145
+ type: "list",
146
+ values: ["static", "relative", "absolute"],
147
+ service: this,
148
+ propertyType: PropertyType.cssValue
149
+ }, {
150
+ name: "flex-direction",
151
+ type: "img-list",
152
+ values: ["row", "column"],
153
+ service: this,
154
+ propertyType: PropertyType.cssValue
155
+ }, {
156
+ name: "flex-wrap",
157
+ type: "img-list",
158
+ values: ["nowrap", "wrap"],
159
+ service: this,
160
+ propertyType: PropertyType.cssValue
161
+ }, {
162
+ name: "align-content",
163
+ type: "img-list",
164
+ values: ["center", "flex-start", "flex-end", "space-between", "space-around", "stretch"],
165
+ service: this,
166
+ propertyType: PropertyType.cssValue
167
+ }, {
168
+ name: "justify-content",
169
+ type: "img-list",
170
+ values: ["center", "flex-start", "flex-end", "space-between", "space-around", "space-evenly"],
171
+ service: this,
172
+ propertyType: PropertyType.cssValue
173
+ }, {
174
+ name: "align-items",
175
+ type: "img-list",
176
+ values: ["center", "flex-start", "flex-end", "stretch", "baseline"],
177
+ service: this,
178
+ propertyType: PropertyType.cssValue
179
+ }
180
+ ];
181
+ constructor(name) {
182
+ super();
183
+ this.name = name;
184
+ }
185
+ isHandledElement(designItem) {
186
+ return true;
187
+ }
188
+ getProperty(designItem, name) {
189
+ if (this.name == 'styles') {
190
+ return { name: name, type: 'string', service: this, propertyType: PropertyType.cssValue };
191
+ }
192
+ return this[this.name][name];
193
+ }
194
+ getProperties(designItem) {
195
+ if (this.name == 'styles') {
196
+ if (!designItem)
197
+ return [];
198
+ let styles = designItem.getAllStyles();
199
+ let arr = styles.map(x => ({ name: x.selector ?? '<local>', description: x.stylesheetName ?? '', properties: [
200
+ ...x.declarations.map(y => ({ name: y.name, renamable: true, type: 'string', service: this, propertyType: PropertyType.cssValue })),
201
+ { name: '', type: 'addNew', service: this, propertyType: PropertyType.complex }
202
+ ]
203
+ }));
204
+ //let arr: IProperty[] = Array.from(designItem.styles(), ([key, value]) => ({ name: key, renamable: true, type: 'string', service: this, propertyType: PropertyType.cssValue }));
205
+ //arr.push({ name: '', type: 'addNew', service: this, propertyType: PropertyType.complex });
206
+ return arr;
207
+ }
208
+ return this[this.name];
209
+ }
210
+ getPropertyTarget(designItem, property) {
211
+ return BindingTarget.css;
212
+ }
213
+ setValue(designItems, property, value) {
214
+ if (this.name == 'styles') {
215
+ super.setValue(designItems, { ...property, propertyType: PropertyType.cssValue }, value);
216
+ }
217
+ else {
218
+ super.setValue(designItems, property, value);
219
+ }
220
+ }
221
+ }
@@ -0,0 +1,17 @@
1
+ import { IProperty } from '../IProperty.js';
2
+ import { IDesignItem } from '../../../item/IDesignItem.js';
3
+ import { RefreshMode } from '../IPropertiesService.js';
4
+ import { IPropertyGroup } from '../IPropertyGroup.js';
5
+ import { CssPropertiesService } from './CssPropertiesService.js';
6
+ import { IStyleDeclaration, IStyleRule } from '../../stylesheetService/IStylesheetService.js';
7
+ export declare class CssCurrentPropertiesService extends CssPropertiesService {
8
+ getRefreshMode(designItem: IDesignItem): RefreshMode;
9
+ constructor();
10
+ isHandledElement(designItem: IDesignItem): boolean;
11
+ getProperty(designItem: IDesignItem, name: string): IProperty;
12
+ getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
13
+ setValue(designItems: IDesignItem[], property: (IProperty & {
14
+ styleRule: IStyleRule;
15
+ styleDeclaration: IStyleDeclaration;
16
+ }), value: any): void;
17
+ }
@@ -0,0 +1,36 @@
1
+ import { PropertyType } from '../PropertyType.js';
2
+ import { RefreshMode } from '../IPropertiesService.js';
3
+ import { CssPropertiesService } from './CssPropertiesService.js';
4
+ export class CssCurrentPropertiesService extends CssPropertiesService {
5
+ getRefreshMode(designItem) {
6
+ return RefreshMode.fullOnValueChange;
7
+ }
8
+ constructor() {
9
+ super('styles');
10
+ }
11
+ isHandledElement(designItem) {
12
+ return true;
13
+ }
14
+ getProperty(designItem, name) {
15
+ return { name: name, type: 'string', service: this, propertyType: PropertyType.cssValue };
16
+ }
17
+ getProperties(designItem) {
18
+ if (!designItem)
19
+ return [];
20
+ let styles = designItem.getAllStyles();
21
+ let arr = styles.map(x => ({
22
+ name: x.selector ?? '<local>', description: x.stylesheetName ?? '', properties: [
23
+ ...x.declarations.map(y => ({ name: y.name, renamable: true, type: 'string', service: this, propertyType: PropertyType.cssValue, styleRule: x, styleDeclaration: y })),
24
+ { name: '', type: 'addNew', service: this, propertyType: PropertyType.complex, styleRule: x }
25
+ ]
26
+ }));
27
+ return arr;
28
+ }
29
+ setValue(designItems, property, value) {
30
+ if (property.styleDeclaration) {
31
+ designItems[0].instanceServiceContainer.stylesheetService.updateDeclarationWithDeclaration(property.styleDeclaration, value, false);
32
+ }
33
+ else
34
+ super.setValue(designItems, { ...property, propertyType: PropertyType.cssValue }, value);
35
+ }
36
+ }
@@ -0,0 +1,18 @@
1
+ import { IProperty } from '../IProperty.js';
2
+ import { IDesignItem } from '../../../item/IDesignItem.js';
3
+ import { BindingTarget } from '../../../item/BindingTarget.js';
4
+ import { CommonPropertiesService } from './CommonPropertiesService.js';
5
+ import { RefreshMode } from '../IPropertiesService.js';
6
+ import { IPropertyGroup } from '../IPropertyGroup.js';
7
+ export declare class CssPropertiesService extends CommonPropertiesService {
8
+ getRefreshMode(designItem: IDesignItem): RefreshMode.none | RefreshMode.fullOnValueChange;
9
+ layout: IProperty[];
10
+ grid: IProperty[];
11
+ flex: IProperty[];
12
+ constructor(name: 'styles' | 'layout' | 'grid' | 'flex');
13
+ isHandledElement(designItem: IDesignItem): boolean;
14
+ getProperty(designItem: IDesignItem, name: string): IProperty;
15
+ getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
16
+ getPropertyTarget(designItem: IDesignItem, property: IProperty): BindingTarget;
17
+ setValue(designItems: IDesignItem[], property: IProperty, value: any): void;
18
+ }
@@ -0,0 +1,221 @@
1
+ import { BindingTarget } from '../../../item/BindingTarget.js';
2
+ import { PropertyType } from '../PropertyType.js';
3
+ import { CommonPropertiesService } from './CommonPropertiesService.js';
4
+ import { RefreshMode } from '../IPropertiesService.js';
5
+ export class CssPropertiesService extends CommonPropertiesService {
6
+ getRefreshMode(designItem) {
7
+ return this.name == 'styles' ? RefreshMode.fullOnValueChange : RefreshMode.none;
8
+ }
9
+ layout = [
10
+ {
11
+ name: "display",
12
+ type: "list",
13
+ values: ["block", "inline", "inline-block", "flex", "inline-flex", "contents", "grid", "inline-grid", "inherit", "initial", "none"],
14
+ service: this,
15
+ propertyType: PropertyType.cssValue
16
+ },
17
+ {
18
+ name: "color",
19
+ type: "color",
20
+ service: this,
21
+ propertyType: PropertyType.cssValue
22
+ }, {
23
+ name: "background-color",
24
+ type: "color",
25
+ service: this,
26
+ propertyType: PropertyType.cssValue
27
+ }, {
28
+ name: "box-sizing",
29
+ type: "list",
30
+ values: ["border-box", "content-box"],
31
+ service: this,
32
+ propertyType: PropertyType.cssValue
33
+ }, {
34
+ name: "border",
35
+ type: "string",
36
+ default: "0px none rbg(0,0,0)",
37
+ service: this,
38
+ propertyType: PropertyType.cssValue
39
+ }, {
40
+ name: "box-shadow",
41
+ type: "string",
42
+ default: "none",
43
+ service: this,
44
+ propertyType: PropertyType.cssValue
45
+ }, {
46
+ name: "opacity",
47
+ type: "number",
48
+ min: 0,
49
+ max: 1,
50
+ step: 0.1,
51
+ service: this,
52
+ propertyType: PropertyType.cssValue
53
+ }, {
54
+ name: "metrics",
55
+ type: "metrics",
56
+ service: this,
57
+ propertyType: PropertyType.complex
58
+ }, {
59
+ name: "position",
60
+ type: "list",
61
+ values: ["static", "relative", "absolute"],
62
+ service: this,
63
+ propertyType: PropertyType.cssValue
64
+ }, {
65
+ name: "font-size",
66
+ type: "css-length",
67
+ service: this,
68
+ propertyType: PropertyType.cssValue
69
+ }, {
70
+ name: "font-weight",
71
+ type: "list",
72
+ values: ["normal", "bold", "100", "200", "300", "400", "500", "600", "700", "800", "900", "lighter", "bolder"],
73
+ service: this,
74
+ propertyType: PropertyType.cssValue
75
+ }
76
+ ];
77
+ grid = [
78
+ {
79
+ name: "display",
80
+ type: "list",
81
+ values: ["block", "inline-block", "flex", "contents", "grid", "inherit", "initial", "none"],
82
+ service: this,
83
+ propertyType: PropertyType.cssValue
84
+ }, {
85
+ name: "position",
86
+ type: "list",
87
+ values: ["static", "relative", "absolute"],
88
+ service: this,
89
+ propertyType: PropertyType.cssValue
90
+ }, {
91
+ name: "grid-template-columns",
92
+ type: "string",
93
+ service: this,
94
+ propertyType: PropertyType.cssValue
95
+ }, {
96
+ name: "grid-template-rows",
97
+ type: "string",
98
+ service: this,
99
+ propertyType: PropertyType.cssValue
100
+ }, {
101
+ name: "column-gap",
102
+ type: "css-length",
103
+ service: this,
104
+ propertyType: PropertyType.cssValue
105
+ }, {
106
+ name: "row-gap",
107
+ type: "css-length",
108
+ service: this,
109
+ propertyType: PropertyType.cssValue
110
+ }, {
111
+ name: "align-content",
112
+ type: "img-list",
113
+ values: ["center", "space-between", "space-around", "space-evenly", "stretch"],
114
+ service: this,
115
+ propertyType: PropertyType.cssValue
116
+ }, {
117
+ name: "justify-content",
118
+ type: "img-list",
119
+ values: ["center", "start", "end", "space-between", "space-around", "space-evenly"],
120
+ service: this,
121
+ propertyType: PropertyType.cssValue
122
+ }, {
123
+ name: "align-items",
124
+ type: "img-list",
125
+ values: ["center", "start", "end", "stretch", "baseline"],
126
+ service: this,
127
+ propertyType: PropertyType.cssValue
128
+ }, {
129
+ name: "justify-items",
130
+ type: "img-list",
131
+ values: ["center", "start", "end", "stretch"],
132
+ service: this,
133
+ propertyType: PropertyType.cssValue
134
+ }
135
+ ];
136
+ flex = [
137
+ {
138
+ name: "display",
139
+ type: "list",
140
+ values: ["block", "inline-block", "flex", "contents", "grid", "inherit", "initial", "none"],
141
+ service: this,
142
+ propertyType: PropertyType.cssValue
143
+ }, {
144
+ name: "position",
145
+ type: "list",
146
+ values: ["static", "relative", "absolute"],
147
+ service: this,
148
+ propertyType: PropertyType.cssValue
149
+ }, {
150
+ name: "flex-direction",
151
+ type: "img-list",
152
+ values: ["row", "column"],
153
+ service: this,
154
+ propertyType: PropertyType.cssValue
155
+ }, {
156
+ name: "flex-wrap",
157
+ type: "img-list",
158
+ values: ["nowrap", "wrap"],
159
+ service: this,
160
+ propertyType: PropertyType.cssValue
161
+ }, {
162
+ name: "align-content",
163
+ type: "img-list",
164
+ values: ["center", "flex-start", "flex-end", "space-between", "space-around", "stretch"],
165
+ service: this,
166
+ propertyType: PropertyType.cssValue
167
+ }, {
168
+ name: "justify-content",
169
+ type: "img-list",
170
+ values: ["center", "flex-start", "flex-end", "space-between", "space-around", "space-evenly"],
171
+ service: this,
172
+ propertyType: PropertyType.cssValue
173
+ }, {
174
+ name: "align-items",
175
+ type: "img-list",
176
+ values: ["center", "flex-start", "flex-end", "stretch", "baseline"],
177
+ service: this,
178
+ propertyType: PropertyType.cssValue
179
+ }
180
+ ];
181
+ constructor(name) {
182
+ super();
183
+ this.name = name;
184
+ }
185
+ isHandledElement(designItem) {
186
+ return true;
187
+ }
188
+ getProperty(designItem, name) {
189
+ if (this.name == 'styles') {
190
+ return { name: name, type: 'string', service: this, propertyType: PropertyType.cssValue };
191
+ }
192
+ return this[this.name][name];
193
+ }
194
+ getProperties(designItem) {
195
+ if (this.name == 'styles') {
196
+ if (!designItem)
197
+ return [];
198
+ let styles = designItem.getAllStyles();
199
+ let arr = styles.map(x => ({ name: x.selector ?? '<local>', description: x.stylesheetName ?? '', properties: [
200
+ ...x.declarations.map(y => ({ name: y.name, renamable: true, type: 'string', service: this, propertyType: PropertyType.cssValue })),
201
+ { name: '', type: 'addNew', service: this, propertyType: PropertyType.complex }
202
+ ]
203
+ }));
204
+ //let arr: IProperty[] = Array.from(designItem.styles(), ([key, value]) => ({ name: key, renamable: true, type: 'string', service: this, propertyType: PropertyType.cssValue }));
205
+ //arr.push({ name: '', type: 'addNew', service: this, propertyType: PropertyType.complex });
206
+ return arr;
207
+ }
208
+ return this[this.name];
209
+ }
210
+ getPropertyTarget(designItem, property) {
211
+ return BindingTarget.css;
212
+ }
213
+ setValue(designItems, property, value) {
214
+ if (this.name == 'styles') {
215
+ super.setValue(designItems, { ...property, propertyType: PropertyType.cssValue }, value);
216
+ }
217
+ else {
218
+ super.setValue(designItems, property, value);
219
+ }
220
+ }
221
+ }
@@ -5,7 +5,7 @@ import { CommonPropertiesService } from './CommonPropertiesService.js';
5
5
  import { RefreshMode } from '../IPropertiesService.js';
6
6
  import { IPropertyGroup } from '../IPropertyGroup.js';
7
7
  export declare class CssPropertiesService extends CommonPropertiesService {
8
- getRefreshMode(designItem: IDesignItem): RefreshMode.none | RefreshMode.fullOnValueChange;
8
+ getRefreshMode(designItem: IDesignItem): RefreshMode;
9
9
  layout: IProperty[];
10
10
  grid: IProperty[];
11
11
  flex: IProperty[];
@@ -14,5 +14,4 @@ export declare class CssPropertiesService extends CommonPropertiesService {
14
14
  getProperty(designItem: IDesignItem, name: string): IProperty;
15
15
  getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
16
16
  getPropertyTarget(designItem: IDesignItem, property: IProperty): BindingTarget;
17
- setValue(designItems: IDesignItem[], property: IProperty, value: any): void;
18
17
  }
@@ -4,7 +4,7 @@ import { CommonPropertiesService } from './CommonPropertiesService.js';
4
4
  import { RefreshMode } from '../IPropertiesService.js';
5
5
  export class CssPropertiesService extends CommonPropertiesService {
6
6
  getRefreshMode(designItem) {
7
- return this.name == 'styles' ? RefreshMode.fullOnValueChange : RefreshMode.none;
7
+ return RefreshMode.none;
8
8
  }
9
9
  layout = [
10
10
  {
@@ -186,36 +186,12 @@ export class CssPropertiesService extends CommonPropertiesService {
186
186
  return true;
187
187
  }
188
188
  getProperty(designItem, name) {
189
- if (this.name == 'styles') {
190
- return { name: name, type: 'string', service: this, propertyType: PropertyType.cssValue };
191
- }
192
189
  return this[this.name][name];
193
190
  }
194
191
  getProperties(designItem) {
195
- if (this.name == 'styles') {
196
- if (!designItem)
197
- return [];
198
- let styles = designItem.getAllStyles();
199
- let arr = styles.map(x => ({ name: x.selector ?? '<local>', description: x.stylesheetName ?? '', properties: [
200
- ...x.declarations.map(y => ({ name: y.name, renamable: true, type: 'string', service: this, propertyType: PropertyType.cssValue })),
201
- { name: '', type: 'addNew', service: this, propertyType: PropertyType.complex }
202
- ]
203
- }));
204
- //let arr: IProperty[] = Array.from(designItem.styles(), ([key, value]) => ({ name: key, renamable: true, type: 'string', service: this, propertyType: PropertyType.cssValue }));
205
- //arr.push({ name: '', type: 'addNew', service: this, propertyType: PropertyType.complex });
206
- return arr;
207
- }
208
192
  return this[this.name];
209
193
  }
210
194
  getPropertyTarget(designItem, property) {
211
195
  return BindingTarget.css;
212
196
  }
213
- setValue(designItems, property, value) {
214
- if (this.name == 'styles') {
215
- super.setValue(designItems, { ...property, propertyType: PropertyType.cssValue }, value);
216
- }
217
- else {
218
- super.setValue(designItems, property, value);
219
- }
220
- }
221
197
  }
@@ -26,6 +26,7 @@ export declare class CssTreeStylesheetService implements IStylesheetService {
26
26
  stylesheetChanged: TypedEvent<{
27
27
  stylesheet: IStylesheet;
28
28
  }>;
29
+ stylesheetsChanged: TypedEvent<void>;
29
30
  constructor();
30
31
  setStylesheets(stylesheets: IStylesheet[]): void;
31
32
  getStylesheets(): IStylesheet[];
@@ -3,6 +3,7 @@ import { calculate as calculateSpecifity } from "./SpecificityCalculator.js";
3
3
  export class CssTreeStylesheetService {
4
4
  _stylesheets = new Map();
5
5
  stylesheetChanged = new TypedEvent();
6
+ stylesheetsChanged = new TypedEvent();
6
7
  constructor() { }
7
8
  setStylesheets(stylesheets) {
8
9
  if (stylesheets != null) {
@@ -13,6 +14,7 @@ export class CssTreeStylesheetService {
13
14
  ast: window.csstree.toPlainObject((window.csstree.parse(stylesheet.stylesheet, { positions: true, parseValue: false })))
14
15
  });
15
16
  }
17
+ this.stylesheetsChanged.emit();
16
18
  }
17
19
  else {
18
20
  this._stylesheets = null;
@@ -26,4 +26,5 @@ export interface IStylesheetService {
26
26
  stylesheetChanged: TypedEvent<{
27
27
  stylesheet: IStylesheet;
28
28
  }>;
29
+ stylesheetsChanged: TypedEvent<void>;
29
30
  }
@@ -429,6 +429,8 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
429
429
  this.instanceServiceContainer.servicesChanged.on(e => {
430
430
  if (e.serviceName == 'stylesheetService') {
431
431
  this.applyAllStyles();
432
+ this.instanceServiceContainer.stylesheetService.stylesheetChanged.on(() => this.applyAllStyles());
433
+ this.instanceServiceContainer.stylesheetService.stylesheetsChanged.on(() => this.applyAllStyles());
432
434
  }
433
435
  });
434
436
  this.extensionManager = new ExtensionManager(this);
package/dist/index.d.ts CHANGED
@@ -84,6 +84,7 @@ export * from "./elements/services/propertiesService/propertyEditors/ThicknessPr
84
84
  export * from "./elements/services/propertiesService/services/PropertiesHelper.js";
85
85
  export * from "./elements/services/propertiesService/services/BaseCustomWebComponentPropertiesService.js";
86
86
  export * from "./elements/services/propertiesService/services/CommonPropertiesService.js";
87
+ export * from "./elements/services/propertiesService/services/CssCurrentPropertiesService.js";
87
88
  export * from "./elements/services/propertiesService/services/CssPropertiesService.js";
88
89
  export * from "./elements/services/propertiesService/services/ListPropertiesService.js";
89
90
  export * from "./elements/services/propertiesService/services/LitElementPropertiesService.js";
package/dist/index.js CHANGED
@@ -54,6 +54,7 @@ export * from "./elements/services/propertiesService/propertyEditors/ThicknessPr
54
54
  export * from "./elements/services/propertiesService/services/PropertiesHelper.js";
55
55
  export * from "./elements/services/propertiesService/services/BaseCustomWebComponentPropertiesService.js";
56
56
  export * from "./elements/services/propertiesService/services/CommonPropertiesService.js";
57
+ export * from "./elements/services/propertiesService/services/CssCurrentPropertiesService.js";
57
58
  export * from "./elements/services/propertiesService/services/CssPropertiesService.js";
58
59
  export * from "./elements/services/propertiesService/services/ListPropertiesService.js";
59
60
  export * from "./elements/services/propertiesService/services/LitElementPropertiesService.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "description": "A UI designer for Polymer apps",
3
3
  "name": "@node-projects/web-component-designer",
4
- "version": "0.0.169",
4
+ "version": "0.0.170",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "",