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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/elements/helper/CssUnitConverter.d.ts +2 -2
  2. package/dist/elements/helper/CssUnitConverter.js +3 -3
  3. package/dist/elements/helper/GridHelper.d.ts +2 -0
  4. package/dist/elements/helper/GridHelper.js +16 -1
  5. package/dist/elements/item/DesignItem.d.ts +1 -0
  6. package/dist/elements/item/DesignItem.js +10 -7
  7. package/dist/elements/services/propertiesService/PropertyGroupsService.d.ts +2 -2
  8. package/dist/elements/services/propertiesService/PropertyTabsService.js +3 -2
  9. package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService copy.d.ts +18 -0
  10. package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService copy.js +221 -0
  11. package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService.d.ts +17 -0
  12. package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService.js +53 -0
  13. package/dist/elements/services/propertiesService/services/CssProperties.json +541 -0
  14. package/dist/elements/services/propertiesService/services/CssPropertiesService copy.d.ts +18 -0
  15. package/dist/elements/services/propertiesService/services/CssPropertiesService copy.js +221 -0
  16. package/dist/elements/services/propertiesService/services/CssPropertiesService.d.ts +5 -6
  17. package/dist/elements/services/propertiesService/services/CssPropertiesService.js +43 -192
  18. package/dist/elements/services/propertiesService/services/NativeElementsPropertiesService.js +6 -0
  19. package/dist/elements/services/stylesheetService/CssToolsStylesheetService.d.ts +17 -0
  20. package/dist/elements/services/stylesheetService/CssToolsStylesheetService.js +45 -0
  21. package/dist/elements/services/stylesheetService/CssTreeStylesheetService copy.d.ts +48 -0
  22. package/dist/elements/services/stylesheetService/CssTreeStylesheetService copy.js +185 -0
  23. package/dist/elements/services/stylesheetService/CssTreeStylesheetService.d.ts +4 -3
  24. package/dist/elements/services/stylesheetService/CssTreeStylesheetService.js +34 -17
  25. package/dist/elements/services/stylesheetService/IStylesheetService.d.ts +5 -4
  26. package/dist/elements/widgets/designerView/designerCanvas.js +2 -0
  27. package/dist/elements/widgets/designerView/extensions/GridExtension.d.ts +35 -4
  28. package/dist/elements/widgets/designerView/extensions/GridExtension.js +277 -90
  29. package/dist/elements/widgets/designerView/extensions/GridExtensionProvider.js +3 -1
  30. package/dist/elements/widgets/designerView/extensions/TransformOriginExtension.js +1 -1
  31. package/dist/index.d.ts +2 -0
  32. package/dist/index.js +2 -0
  33. package/package.json +2 -1
@@ -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,14 +5,13 @@ 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;
9
- layout: IProperty[];
10
- grid: IProperty[];
11
- flex: IProperty[];
12
- constructor(name: 'styles' | 'layout' | 'grid' | 'flex');
8
+ getRefreshMode(designItem: IDesignItem): RefreshMode;
9
+ layout: string[];
10
+ grid: string[];
11
+ flex: string[];
12
+ constructor(name: 'layout' | 'grid' | 'flex');
13
13
  isHandledElement(designItem: IDesignItem): boolean;
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
  }
@@ -2,181 +2,48 @@ import { BindingTarget } from '../../../item/BindingTarget.js';
2
2
  import { PropertyType } from '../PropertyType.js';
3
3
  import { CommonPropertiesService } from './CommonPropertiesService.js';
4
4
  import { RefreshMode } from '../IPropertiesService.js';
5
+ import cssProperties from './CssProperties.json' assert { type: 'json' };
5
6
  export class CssPropertiesService extends CommonPropertiesService {
6
7
  getRefreshMode(designItem) {
7
- return this.name == 'styles' ? RefreshMode.fullOnValueChange : RefreshMode.none;
8
+ return RefreshMode.none;
8
9
  }
10
+ //metrics
9
11
  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
- }
12
+ "display",
13
+ "color",
14
+ "background-color",
15
+ "box-sizing",
16
+ "border",
17
+ "box-shadow",
18
+ "opacity",
19
+ "position",
20
+ "font-size",
21
+ "font-weight",
22
+ "inset",
23
+ "margin",
24
+ "border",
25
+ "padding"
76
26
  ];
77
27
  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
- }
28
+ "display",
29
+ "position",
30
+ "grid-template-columns",
31
+ "grid-template-rows",
32
+ "column-gap",
33
+ "row-gap",
34
+ "align-content",
35
+ "justify-content",
36
+ "align-items",
37
+ "justify-items"
135
38
  ];
136
39
  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
- }
40
+ "display",
41
+ "position",
42
+ "flex-direction",
43
+ "flex-wrap",
44
+ "align-content",
45
+ "justify-content",
46
+ "align-items"
180
47
  ];
181
48
  constructor(name) {
182
49
  super();
@@ -186,36 +53,20 @@ export class CssPropertiesService extends CommonPropertiesService {
186
53
  return true;
187
54
  }
188
55
  getProperty(designItem, name) {
189
- if (this.name == 'styles') {
190
- return { name: name, type: 'string', service: this, propertyType: PropertyType.cssValue };
191
- }
192
56
  return this[this.name][name];
193
57
  }
194
58
  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];
59
+ const propNames = this[this.name];
60
+ const propertiesList = propNames.map(x => ({
61
+ name: x,
62
+ type: cssProperties[x]?.type ?? 'string',
63
+ values: cssProperties[x]?.values ? [...cssProperties[x]?.values, 'initial', 'inherit', 'unset'] : ['initial', 'inherit', 'unset'],
64
+ service: this,
65
+ propertyType: PropertyType.cssValue
66
+ }));
67
+ return propertiesList;
209
68
  }
210
69
  getPropertyTarget(designItem, property) {
211
70
  return BindingTarget.css;
212
71
  }
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
72
  }
@@ -77,6 +77,12 @@ export class NativeElementsPropertiesService extends CommonPropertiesService {
77
77
  }
78
78
  ];
79
79
  selectProperties = [
80
+ {
81
+ name: "value",
82
+ type: "string",
83
+ service: this,
84
+ propertyType: PropertyType.property
85
+ },
80
86
  {
81
87
  name: "size",
82
88
  type: "number",
@@ -0,0 +1,17 @@
1
+ import { IDesignItem } from "../../item/IDesignItem.js";
2
+ import { IStyleDeclaration, IStyleRule, IStylesheet, IStylesheetService } from "./IStylesheetService.js";
3
+ import { TypedEvent } from "@node-projects/base-custom-webcomponent";
4
+ export declare class CssToolsStylesheetService implements IStylesheetService {
5
+ private _stylesheets;
6
+ stylesheetChanged: TypedEvent<{
7
+ stylesheet: IStylesheet;
8
+ }>;
9
+ stylesheetsChanged: TypedEvent<void>;
10
+ setStylesheets(stylesheets: IStylesheet[]): Promise<void>;
11
+ getStylesheets(): IStylesheet[];
12
+ getAppliedRules(designItem: IDesignItem): IStyleRule[];
13
+ getDeclarations(designItem: IDesignItem, styleName: string): IStyleDeclaration[];
14
+ updateDeclarationWithDeclaration(declaration: IStyleDeclaration, value: string, important: boolean): boolean;
15
+ insertDeclarationIntoRule(rule: IStyleRule, declaration: IStyleDeclaration, important: boolean): boolean;
16
+ removeDeclarationFromRule(rule: IStyleRule, declaration: IStyleDeclaration): boolean;
17
+ }
@@ -0,0 +1,45 @@
1
+ import { TypedEvent } from "@node-projects/base-custom-webcomponent";
2
+ export class CssToolsStylesheetService {
3
+ _stylesheets = new Map();
4
+ stylesheetChanged = new TypedEvent();
5
+ stylesheetsChanged = new TypedEvent();
6
+ async setStylesheets(stylesheets) {
7
+ if (stylesheets != null) {
8
+ let tools = await import('@adobe/css-tools');
9
+ this._stylesheets = new Map();
10
+ for (let stylesheet of stylesheets) {
11
+ this._stylesheets.set(stylesheet.name, {
12
+ stylesheet: stylesheet,
13
+ ast: tools.parse(stylesheet.stylesheet)
14
+ });
15
+ }
16
+ this.stylesheetsChanged.emit();
17
+ }
18
+ else {
19
+ this._stylesheets = null;
20
+ }
21
+ }
22
+ getStylesheets() {
23
+ let stylesheets = [];
24
+ for (let item of this._stylesheets) {
25
+ stylesheets.push(item[1].stylesheet);
26
+ }
27
+ ;
28
+ return stylesheets;
29
+ }
30
+ getAppliedRules(designItem) {
31
+ return null;
32
+ }
33
+ getDeclarations(designItem, styleName) {
34
+ return null;
35
+ }
36
+ updateDeclarationWithDeclaration(declaration, value, important) {
37
+ return true;
38
+ }
39
+ insertDeclarationIntoRule(rule, declaration, important) {
40
+ return true;
41
+ }
42
+ removeDeclarationFromRule(rule, declaration) {
43
+ return true;
44
+ }
45
+ }
@@ -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 {};