@node-projects/web-component-designer 0.0.168 → 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.
Files changed (50) hide show
  1. package/dist/elements/documentContainer.d.ts +7 -0
  2. package/dist/elements/documentContainer.js +23 -0
  3. package/dist/elements/helper/CssUnitConverter.js +11 -1
  4. package/dist/elements/item/DesignItem.d.ts +4 -1
  5. package/dist/elements/item/DesignItem.js +28 -1
  6. package/dist/elements/item/IDesignItem.d.ts +4 -1
  7. package/dist/elements/services/BaseServiceContainer.d.ts +4 -0
  8. package/dist/elements/services/BaseServiceContainer.js +4 -0
  9. package/dist/elements/services/DefaultServiceBootstrap.js +9 -2
  10. package/dist/elements/services/InstanceServiceContainer.d.ts +3 -0
  11. package/dist/elements/services/InstanceServiceContainer.js +3 -0
  12. package/dist/elements/services/ServiceContainer.d.ts +12 -3
  13. package/dist/elements/services/elementsService/IElementDefinition.d.ts +0 -3
  14. package/dist/elements/services/instanceService/DefaultInstanceService.js +0 -12
  15. package/dist/elements/services/propertiesService/IPropertiesService.d.ts +2 -1
  16. package/dist/elements/services/propertiesService/IProperty copy.d.ts +22 -0
  17. package/dist/elements/services/propertiesService/IProperty copy.js +1 -0
  18. package/dist/elements/services/propertiesService/IPropertyGroup.d.ts +6 -0
  19. package/dist/elements/services/propertiesService/IPropertyGroup.js +1 -0
  20. package/dist/elements/services/propertiesService/IPropertyTabsService.d.ts +8 -0
  21. package/dist/elements/services/propertiesService/IPropertyTabsService.js +1 -0
  22. package/dist/elements/services/propertiesService/PropertyGroupsService.d.ts +2 -2
  23. package/dist/elements/services/propertiesService/PropertyTabsService.d.ts +17 -0
  24. package/dist/elements/services/propertiesService/PropertyTabsService.js +30 -0
  25. package/dist/elements/services/propertiesService/services/AbstractPropertiesService.d.ts +2 -1
  26. package/dist/elements/services/propertiesService/services/AbstractPropertiesService.js +7 -7
  27. package/dist/elements/services/propertiesService/services/CommonPropertiesService.d.ts +2 -1
  28. package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService copy.d.ts +18 -0
  29. package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService copy.js +221 -0
  30. package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService.d.ts +17 -0
  31. package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService.js +36 -0
  32. package/dist/elements/services/propertiesService/services/CssPropertiesService copy.d.ts +18 -0
  33. package/dist/elements/services/propertiesService/services/CssPropertiesService copy.js +221 -0
  34. package/dist/elements/services/propertiesService/services/CssPropertiesService.d.ts +3 -3
  35. package/dist/elements/services/propertiesService/services/CssPropertiesService.js +1 -19
  36. package/dist/elements/services/stylesheetService/CssTreeStylesheetService.d.ts +48 -0
  37. package/dist/elements/services/stylesheetService/CssTreeStylesheetService.js +185 -0
  38. package/dist/elements/services/stylesheetService/IStylesheetService.d.ts +30 -0
  39. package/dist/elements/services/stylesheetService/IStylesheetService.js +1 -0
  40. package/dist/elements/services/stylesheetService/SpecificityCalculator.d.ts +7 -0
  41. package/dist/elements/services/stylesheetService/SpecificityCalculator.js +178 -0
  42. package/dist/elements/services/stylesheetService/StylesheetService.d.ts +28 -0
  43. package/dist/elements/services/stylesheetService/StylesheetService.js +108 -0
  44. package/dist/elements/widgets/designerView/designerCanvas.d.ts +6 -0
  45. package/dist/elements/widgets/designerView/designerCanvas.js +75 -34
  46. package/dist/elements/widgets/propertyGrid/PropertyGridPropertyList.d.ts +2 -0
  47. package/dist/elements/widgets/propertyGrid/PropertyGridPropertyList.js +96 -66
  48. package/dist/index.d.ts +7 -2
  49. package/dist/index.js +4 -1
  50. package/package.json +6 -3
@@ -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
+ }
@@ -3,15 +3,15 @@ import { IDesignItem } from '../../../item/IDesignItem.js';
3
3
  import { BindingTarget } from '../../../item/BindingTarget.js';
4
4
  import { CommonPropertiesService } from './CommonPropertiesService.js';
5
5
  import { RefreshMode } from '../IPropertiesService.js';
6
+ import { IPropertyGroup } from '../IPropertyGroup.js';
6
7
  export declare class CssPropertiesService extends CommonPropertiesService {
7
- getRefreshMode(designItem: IDesignItem): RefreshMode.none | RefreshMode.fullOnValueChange;
8
+ getRefreshMode(designItem: IDesignItem): RefreshMode;
8
9
  layout: IProperty[];
9
10
  grid: IProperty[];
10
11
  flex: IProperty[];
11
12
  constructor(name: 'styles' | 'layout' | 'grid' | 'flex');
12
13
  isHandledElement(designItem: IDesignItem): boolean;
13
14
  getProperty(designItem: IDesignItem, name: string): IProperty;
14
- getProperties(designItem: IDesignItem): IProperty[];
15
+ getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
15
16
  getPropertyTarget(designItem: IDesignItem, property: IProperty): BindingTarget;
16
- setValue(designItems: IDesignItem[], property: IProperty, value: any): void;
17
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,30 +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 arr = Array.from(designItem.styles(), ([key, value]) => ({ name: key, renamable: true, type: 'string', service: this, propertyType: PropertyType.cssValue }));
199
- arr.push({ name: '', type: 'addNew', service: this, propertyType: PropertyType.complex });
200
- return arr;
201
- }
202
192
  return this[this.name];
203
193
  }
204
194
  getPropertyTarget(designItem, property) {
205
195
  return BindingTarget.css;
206
196
  }
207
- setValue(designItems, property, value) {
208
- if (this.name == 'styles') {
209
- super.setValue(designItems, { ...property, propertyType: PropertyType.cssValue }, value);
210
- }
211
- else {
212
- super.setValue(designItems, property, value);
213
- }
214
- }
215
197
  }
@@ -0,0 +1,48 @@
1
+ import { IDesignItem } from "../../item/IDesignItem.js";
2
+ import { IProperty } from "../propertiesService/IProperty.js";
3
+ import { IStyleDeclaration, IStyleRule, IStylesheet, IStylesheetService } from "./IStylesheetService.js";
4
+ import type * as csstree from 'css-tree';
5
+ import { TypedEvent } from "@node-projects/base-custom-webcomponent";
6
+ declare global {
7
+ interface Window {
8
+ csstree: {
9
+ fromPlainObject(node: csstree.CssNodePlain): csstree.CssNode;
10
+ toPlainObject(node: csstree.CssNode): csstree.CssNodePlain;
11
+ parse(text: string, options?: csstree.ParseOptions): csstree.CssNode;
12
+ generate(ast: csstree.CssNode, options?: csstree.GenerateOptions): string;
13
+ };
14
+ }
15
+ }
16
+ interface IRuleWithAST extends IStyleRule {
17
+ ast: csstree.RulePlain;
18
+ declarations: IDeclarationWithAST[];
19
+ }
20
+ interface IDeclarationWithAST extends IStyleDeclaration {
21
+ ast: csstree.DeclarationPlain;
22
+ parent: IStyleRule;
23
+ }
24
+ export declare class CssTreeStylesheetService implements IStylesheetService {
25
+ private _stylesheets;
26
+ stylesheetChanged: TypedEvent<{
27
+ stylesheet: IStylesheet;
28
+ }>;
29
+ stylesheetsChanged: TypedEvent<void>;
30
+ constructor();
31
+ setStylesheets(stylesheets: IStylesheet[]): void;
32
+ getStylesheets(): IStylesheet[];
33
+ private getAppliedRulesInternal;
34
+ getAppliedRules(designItem: IDesignItem): IRuleWithAST[];
35
+ private getDeclarationInternal;
36
+ getDeclarations(designItem: IDesignItem, prop: IProperty): IDeclarationWithAST[];
37
+ updateDeclarationWithProperty(designItem: IDesignItem, property: IProperty, value: string, important: boolean): boolean;
38
+ updateDeclarationWithDeclaration(declaration: IDeclarationWithAST, value: string, important: boolean): boolean;
39
+ private rulesFromAST;
40
+ private astHasChildren;
41
+ private buildSelectorString;
42
+ private getSpecificity;
43
+ private findDeclarationInRule;
44
+ private elementMatchesASelector;
45
+ private buildAtRuleString;
46
+ private sortDeclarations;
47
+ }
48
+ export {};