@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.
- package/dist/elements/helper/CssUnitConverter.d.ts +2 -2
- package/dist/elements/helper/CssUnitConverter.js +3 -3
- package/dist/elements/helper/GridHelper.d.ts +2 -0
- package/dist/elements/helper/GridHelper.js +16 -1
- package/dist/elements/item/DesignItem.d.ts +1 -0
- package/dist/elements/item/DesignItem.js +10 -7
- package/dist/elements/services/propertiesService/PropertyGroupsService.d.ts +2 -2
- package/dist/elements/services/propertiesService/PropertyTabsService.js +3 -2
- package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService copy.d.ts +18 -0
- package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService copy.js +221 -0
- package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService.d.ts +17 -0
- package/dist/elements/services/propertiesService/services/CssCurrentPropertiesService.js +53 -0
- package/dist/elements/services/propertiesService/services/CssProperties.json +541 -0
- package/dist/elements/services/propertiesService/services/CssPropertiesService copy.d.ts +18 -0
- package/dist/elements/services/propertiesService/services/CssPropertiesService copy.js +221 -0
- package/dist/elements/services/propertiesService/services/CssPropertiesService.d.ts +5 -6
- package/dist/elements/services/propertiesService/services/CssPropertiesService.js +43 -192
- package/dist/elements/services/propertiesService/services/NativeElementsPropertiesService.js +6 -0
- package/dist/elements/services/stylesheetService/CssToolsStylesheetService.d.ts +17 -0
- package/dist/elements/services/stylesheetService/CssToolsStylesheetService.js +45 -0
- package/dist/elements/services/stylesheetService/CssTreeStylesheetService copy.d.ts +48 -0
- package/dist/elements/services/stylesheetService/CssTreeStylesheetService copy.js +185 -0
- package/dist/elements/services/stylesheetService/CssTreeStylesheetService.d.ts +4 -3
- package/dist/elements/services/stylesheetService/CssTreeStylesheetService.js +34 -17
- package/dist/elements/services/stylesheetService/IStylesheetService.d.ts +5 -4
- package/dist/elements/widgets/designerView/designerCanvas.js +2 -0
- package/dist/elements/widgets/designerView/extensions/GridExtension.d.ts +35 -4
- package/dist/elements/widgets/designerView/extensions/GridExtension.js +277 -90
- package/dist/elements/widgets/designerView/extensions/GridExtensionProvider.js +3 -1
- package/dist/elements/widgets/designerView/extensions/TransformOriginExtension.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +2 -1
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { TypedEvent } from "@node-projects/base-custom-webcomponent";
|
|
2
|
+
import { calculate as calculateSpecifity } from "./SpecificityCalculator.js";
|
|
3
|
+
export class CssTreeStylesheetService {
|
|
4
|
+
_stylesheets = new Map();
|
|
5
|
+
stylesheetChanged = new TypedEvent();
|
|
6
|
+
stylesheetsChanged = new TypedEvent();
|
|
7
|
+
constructor() { }
|
|
8
|
+
setStylesheets(stylesheets) {
|
|
9
|
+
if (stylesheets != null) {
|
|
10
|
+
this._stylesheets = new Map();
|
|
11
|
+
for (let stylesheet of stylesheets) {
|
|
12
|
+
this._stylesheets.set(stylesheet.name, {
|
|
13
|
+
stylesheet: stylesheet,
|
|
14
|
+
ast: window.csstree.toPlainObject((window.csstree.parse(stylesheet.stylesheet, { positions: true, parseValue: false })))
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
this.stylesheetsChanged.emit();
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
this._stylesheets = null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
getStylesheets() {
|
|
24
|
+
let stylesheets = [];
|
|
25
|
+
for (let item of this._stylesheets) {
|
|
26
|
+
stylesheets.push(item[1].stylesheet);
|
|
27
|
+
}
|
|
28
|
+
;
|
|
29
|
+
return stylesheets;
|
|
30
|
+
}
|
|
31
|
+
/* Section covers the retrieval of rules and declarations */
|
|
32
|
+
getAppliedRulesInternal(designItem) {
|
|
33
|
+
let styles = [];
|
|
34
|
+
for (let item of this._stylesheets) {
|
|
35
|
+
if (!item[1].ast || !this.astHasChildren(item[1].ast))
|
|
36
|
+
break;
|
|
37
|
+
styles = styles.concat(Array.from(this.rulesFromAST(item[1].ast, item[1].stylesheet.stylesheet, item[0], designItem)));
|
|
38
|
+
}
|
|
39
|
+
;
|
|
40
|
+
return styles;
|
|
41
|
+
}
|
|
42
|
+
getAppliedRules(designItem) {
|
|
43
|
+
let rules = this.getAppliedRulesInternal(designItem);
|
|
44
|
+
if (!rules || rules.length == 0)
|
|
45
|
+
return [];
|
|
46
|
+
let retCollection = [];
|
|
47
|
+
for (let rule of rules) {
|
|
48
|
+
retCollection.push({
|
|
49
|
+
...rule,
|
|
50
|
+
declarations: rule.ast.block.children.map((declaration) => {
|
|
51
|
+
return {
|
|
52
|
+
name: declaration.property,
|
|
53
|
+
value: declaration.value.value,
|
|
54
|
+
important: declaration.important == true,
|
|
55
|
+
specificity: rule.specificity,
|
|
56
|
+
parent: rule,
|
|
57
|
+
ast: declaration,
|
|
58
|
+
};
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return retCollection;
|
|
63
|
+
}
|
|
64
|
+
getDeclarationInternal(designItem, prop) {
|
|
65
|
+
let rules = this.getAppliedRulesInternal(designItem);
|
|
66
|
+
if (!rules)
|
|
67
|
+
return null;
|
|
68
|
+
let declarations = [];
|
|
69
|
+
for (let rule of rules) {
|
|
70
|
+
let declaration = this.findDeclarationInRule(rule.ast, prop);
|
|
71
|
+
if (!declaration)
|
|
72
|
+
continue;
|
|
73
|
+
declarations.push({
|
|
74
|
+
ast: declaration,
|
|
75
|
+
parent: rule,
|
|
76
|
+
name: prop.name,
|
|
77
|
+
value: declaration.value.value,
|
|
78
|
+
important: declaration.important == true,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
;
|
|
82
|
+
return declarations;
|
|
83
|
+
}
|
|
84
|
+
getDeclarations(designItem, prop) {
|
|
85
|
+
let declarations = this.getDeclarationInternal(designItem, prop);
|
|
86
|
+
if (!declarations)
|
|
87
|
+
return null;
|
|
88
|
+
return this.sortDeclarations(declarations);
|
|
89
|
+
}
|
|
90
|
+
/* Section covers the update of rules and declarations */
|
|
91
|
+
updateDeclarationWithProperty(designItem, property, value, important) {
|
|
92
|
+
let sortedDecl = this.sortDeclarations(this.getDeclarationInternal(designItem, property));
|
|
93
|
+
if (!sortedDecl) {
|
|
94
|
+
// no declaration of property yet
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
updateDeclarationWithDeclaration(declaration, value, important) {
|
|
100
|
+
declaration.ast.value = window.csstree.toPlainObject(window.csstree.parse(declaration.name + ": " + value, { context: 'declaration', parseValue: false })).value;
|
|
101
|
+
this._stylesheets.get(declaration.parent.stylesheetName).stylesheet.stylesheet = window.csstree.generate(window.csstree.fromPlainObject(this._stylesheets.get(declaration.parent.stylesheetName).ast));
|
|
102
|
+
this.stylesheetChanged.emit({ stylesheet: this._stylesheets.get(declaration.parent.stylesheetName).stylesheet });
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
/* Section covers the internal traversal creation of rules and declarations */
|
|
106
|
+
*rulesFromAST(ast, stylesheet, source, designItem, previousCheck = '') {
|
|
107
|
+
let parent = ast["children"] != null ? ast : ast.block;
|
|
108
|
+
for (const child of parent.children) {
|
|
109
|
+
if (child.type == "Atrule") {
|
|
110
|
+
const currentCheck = this.buildAtRuleString(child, stylesheet);
|
|
111
|
+
if (currentCheck.type === "@media" && !window.matchMedia(currentCheck.sel))
|
|
112
|
+
continue;
|
|
113
|
+
if (currentCheck.type === "@supports" && !CSS.supports(currentCheck.sel))
|
|
114
|
+
continue;
|
|
115
|
+
let ruleCollection = this.rulesFromAST(child, stylesheet, source, designItem, previousCheck + currentCheck.type + " " + currentCheck.sel + "\n");
|
|
116
|
+
if (ruleCollection) {
|
|
117
|
+
for (const r of ruleCollection) {
|
|
118
|
+
if (!this.elementMatchesASelector(designItem, this.buildSelectorString(r.ast.prelude)))
|
|
119
|
+
continue;
|
|
120
|
+
yield r;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (child.type == "Rule") {
|
|
125
|
+
let selectors = this.buildSelectorString(child.prelude);
|
|
126
|
+
if (!this.elementMatchesASelector(designItem, selectors))
|
|
127
|
+
continue;
|
|
128
|
+
yield ({
|
|
129
|
+
ast: child,
|
|
130
|
+
selector: previousCheck + this.buildSelectorString(child.prelude).join(", "),
|
|
131
|
+
specificity: this.getSpecificity(child.prelude),
|
|
132
|
+
stylesheetName: source,
|
|
133
|
+
declarations: null,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
;
|
|
138
|
+
}
|
|
139
|
+
/* Utility functions for building selectors, specificity and so on */
|
|
140
|
+
astHasChildren(ast) {
|
|
141
|
+
return ast != null && ast["children"] != null && ast["children"].length > 0;
|
|
142
|
+
}
|
|
143
|
+
buildSelectorString(selectorsAST) {
|
|
144
|
+
let selectors = [];
|
|
145
|
+
for (let selector of selectorsAST.children) {
|
|
146
|
+
let sel = "";
|
|
147
|
+
for (let fraction of selector.children) {
|
|
148
|
+
sel += fraction.name;
|
|
149
|
+
}
|
|
150
|
+
selectors.push(sel);
|
|
151
|
+
}
|
|
152
|
+
;
|
|
153
|
+
return selectors;
|
|
154
|
+
}
|
|
155
|
+
getSpecificity(selector) {
|
|
156
|
+
const specificities = calculateSpecifity(selector);
|
|
157
|
+
let sum = 0;
|
|
158
|
+
specificities.forEach(specificity => sum += specificity.a * 10000 + specificity.b * 100 + specificity.c);
|
|
159
|
+
return sum;
|
|
160
|
+
}
|
|
161
|
+
findDeclarationInRule(rule, property) {
|
|
162
|
+
return rule.block.children.find(declaration => declaration.property == property.name);
|
|
163
|
+
}
|
|
164
|
+
elementMatchesASelector(designItem, selectors) {
|
|
165
|
+
for (const selector of selectors)
|
|
166
|
+
if (designItem.element.matches(selector))
|
|
167
|
+
return true;
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
buildAtRuleString(ast, stylesheet) {
|
|
171
|
+
return {
|
|
172
|
+
sel: stylesheet.slice(ast.prelude.loc.start.offset, ast.prelude.loc.end.offset),
|
|
173
|
+
type: "@" + ast.name
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
sortDeclarations(declarations) {
|
|
177
|
+
if (declarations == null || declarations.length == 0)
|
|
178
|
+
return null;
|
|
179
|
+
return declarations.sort((dec1, dec2) => {
|
|
180
|
+
if (dec1.parent.specificity > dec2.parent.specificity)
|
|
181
|
+
return -1;
|
|
182
|
+
return 1;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { IDesignItem } from "../../item/IDesignItem.js";
|
|
2
|
-
import { IProperty } from "../propertiesService/IProperty.js";
|
|
3
2
|
import { IStyleDeclaration, IStyleRule, IStylesheet, IStylesheetService } from "./IStylesheetService.js";
|
|
4
3
|
import type * as csstree from 'css-tree';
|
|
5
4
|
import { TypedEvent } from "@node-projects/base-custom-webcomponent";
|
|
@@ -26,15 +25,17 @@ export declare class CssTreeStylesheetService implements IStylesheetService {
|
|
|
26
25
|
stylesheetChanged: TypedEvent<{
|
|
27
26
|
stylesheet: IStylesheet;
|
|
28
27
|
}>;
|
|
28
|
+
stylesheetsChanged: TypedEvent<void>;
|
|
29
29
|
constructor();
|
|
30
30
|
setStylesheets(stylesheets: IStylesheet[]): void;
|
|
31
31
|
getStylesheets(): IStylesheet[];
|
|
32
32
|
private getAppliedRulesInternal;
|
|
33
33
|
getAppliedRules(designItem: IDesignItem): IRuleWithAST[];
|
|
34
34
|
private getDeclarationInternal;
|
|
35
|
-
getDeclarations(designItem: IDesignItem,
|
|
36
|
-
updateDeclarationWithProperty(designItem: IDesignItem, property: IProperty, value: string, important: boolean): boolean;
|
|
35
|
+
getDeclarations(designItem: IDesignItem, stlyeName: string): IDeclarationWithAST[];
|
|
37
36
|
updateDeclarationWithDeclaration(declaration: IDeclarationWithAST, value: string, important: boolean): boolean;
|
|
37
|
+
insertDeclarationIntoRule(rule: IRuleWithAST, declaration: IStyleDeclaration, important: boolean): boolean;
|
|
38
|
+
removeDeclarationFromRule(rule: IRuleWithAST, declaration: IDeclarationWithAST): boolean;
|
|
38
39
|
private rulesFromAST;
|
|
39
40
|
private astHasChildren;
|
|
40
41
|
private buildSelectorString;
|
|
@@ -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;
|
|
@@ -31,7 +33,7 @@ export class CssTreeStylesheetService {
|
|
|
31
33
|
let styles = [];
|
|
32
34
|
for (let item of this._stylesheets) {
|
|
33
35
|
if (!item[1].ast || !this.astHasChildren(item[1].ast))
|
|
34
|
-
|
|
36
|
+
continue;
|
|
35
37
|
styles = styles.concat(Array.from(this.rulesFromAST(item[1].ast, item[1].stylesheet.stylesheet, item[0], designItem)));
|
|
36
38
|
}
|
|
37
39
|
;
|
|
@@ -59,19 +61,19 @@ export class CssTreeStylesheetService {
|
|
|
59
61
|
}
|
|
60
62
|
return retCollection;
|
|
61
63
|
}
|
|
62
|
-
getDeclarationInternal(designItem,
|
|
64
|
+
getDeclarationInternal(designItem, styleName) {
|
|
63
65
|
let rules = this.getAppliedRulesInternal(designItem);
|
|
64
66
|
if (!rules)
|
|
65
67
|
return null;
|
|
66
68
|
let declarations = [];
|
|
67
69
|
for (let rule of rules) {
|
|
68
|
-
let declaration = this.findDeclarationInRule(rule.ast,
|
|
70
|
+
let declaration = this.findDeclarationInRule(rule.ast, styleName);
|
|
69
71
|
if (!declaration)
|
|
70
72
|
continue;
|
|
71
73
|
declarations.push({
|
|
72
74
|
ast: declaration,
|
|
73
75
|
parent: rule,
|
|
74
|
-
name:
|
|
76
|
+
name: styleName,
|
|
75
77
|
value: declaration.value.value,
|
|
76
78
|
important: declaration.important == true,
|
|
77
79
|
});
|
|
@@ -79,27 +81,37 @@ export class CssTreeStylesheetService {
|
|
|
79
81
|
;
|
|
80
82
|
return declarations;
|
|
81
83
|
}
|
|
82
|
-
getDeclarations(designItem,
|
|
83
|
-
let declarations = this.getDeclarationInternal(designItem,
|
|
84
|
+
getDeclarations(designItem, stlyeName) {
|
|
85
|
+
let declarations = this.getDeclarationInternal(designItem, stlyeName);
|
|
84
86
|
if (!declarations)
|
|
85
87
|
return null;
|
|
86
88
|
return this.sortDeclarations(declarations);
|
|
87
89
|
}
|
|
88
90
|
/* Section covers the update of rules and declarations */
|
|
89
|
-
updateDeclarationWithProperty(designItem, property, value, important) {
|
|
90
|
-
let sortedDecl = this.sortDeclarations(this.getDeclarationInternal(designItem, property));
|
|
91
|
-
if (!sortedDecl) {
|
|
92
|
-
// no declaration of property yet
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
91
|
updateDeclarationWithDeclaration(declaration, value, important) {
|
|
98
92
|
declaration.ast.value = window.csstree.toPlainObject(window.csstree.parse(declaration.name + ": " + value, { context: 'declaration', parseValue: false })).value;
|
|
99
93
|
this._stylesheets.get(declaration.parent.stylesheetName).stylesheet.stylesheet = window.csstree.generate(window.csstree.fromPlainObject(this._stylesheets.get(declaration.parent.stylesheetName).ast));
|
|
94
|
+
this._stylesheets.get(declaration.parent.stylesheetName).ast = window.csstree.toPlainObject(window.csstree.fromPlainObject(this._stylesheets.get(declaration.parent.stylesheetName).ast));
|
|
100
95
|
this.stylesheetChanged.emit({ stylesheet: this._stylesheets.get(declaration.parent.stylesheetName).stylesheet });
|
|
101
96
|
return true;
|
|
102
97
|
}
|
|
98
|
+
insertDeclarationIntoRule(rule, declaration, important) {
|
|
99
|
+
rule.ast.block.children.push(window.csstree.toPlainObject(window.csstree.parse(declaration.name + ": " + declaration.value + (declaration.important ? "!important" : ""), { context: 'declaration', parseValue: false })));
|
|
100
|
+
this._stylesheets.get(rule.stylesheetName).stylesheet.stylesheet = window.csstree.generate(window.csstree.fromPlainObject(this._stylesheets.get(rule.stylesheetName).ast));
|
|
101
|
+
this._stylesheets.get(rule.stylesheetName).ast = window.csstree.toPlainObject(window.csstree.fromPlainObject(this._stylesheets.get(rule.stylesheetName).ast));
|
|
102
|
+
this.stylesheetChanged.emit({ stylesheet: this._stylesheets.get(rule.stylesheetName).stylesheet });
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
removeDeclarationFromRule(rule, declaration) {
|
|
106
|
+
let index = rule.ast.block.children.indexOf(declaration.ast);
|
|
107
|
+
if (index == -1)
|
|
108
|
+
return false;
|
|
109
|
+
rule.ast.block.children.splice(index, 1);
|
|
110
|
+
this._stylesheets.get(rule.stylesheetName).stylesheet.stylesheet = window.csstree.generate(window.csstree.fromPlainObject(this._stylesheets.get(rule.stylesheetName).ast));
|
|
111
|
+
this._stylesheets.get(rule.stylesheetName).ast = window.csstree.toPlainObject(window.csstree.fromPlainObject(this._stylesheets.get(rule.stylesheetName).ast));
|
|
112
|
+
this.stylesheetChanged.emit({ stylesheet: this._stylesheets.get(rule.stylesheetName).stylesheet });
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
103
115
|
/* Section covers the internal traversal creation of rules and declarations */
|
|
104
116
|
*rulesFromAST(ast, stylesheet, source, designItem, previousCheck = '') {
|
|
105
117
|
let parent = ast["children"] != null ? ast : ast.block;
|
|
@@ -143,7 +155,12 @@ export class CssTreeStylesheetService {
|
|
|
143
155
|
for (let selector of selectorsAST.children) {
|
|
144
156
|
let sel = "";
|
|
145
157
|
for (let fraction of selector.children) {
|
|
146
|
-
|
|
158
|
+
if (fraction.type == "IdSelector")
|
|
159
|
+
sel += "#" + fraction.name;
|
|
160
|
+
else if (fraction.type == "ClassSelector")
|
|
161
|
+
sel += "." + fraction.name;
|
|
162
|
+
else
|
|
163
|
+
sel += fraction.name;
|
|
147
164
|
}
|
|
148
165
|
selectors.push(sel);
|
|
149
166
|
}
|
|
@@ -156,8 +173,8 @@ export class CssTreeStylesheetService {
|
|
|
156
173
|
specificities.forEach(specificity => sum += specificity.a * 10000 + specificity.b * 100 + specificity.c);
|
|
157
174
|
return sum;
|
|
158
175
|
}
|
|
159
|
-
findDeclarationInRule(rule,
|
|
160
|
-
return rule.block.children.find(declaration => declaration.property ==
|
|
176
|
+
findDeclarationInRule(rule, styleName) {
|
|
177
|
+
return rule.block.children.find(declaration => declaration.property == styleName);
|
|
161
178
|
}
|
|
162
179
|
elementMatchesASelector(designItem, selectors) {
|
|
163
180
|
for (const selector of selectors)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { TypedEvent } from "@node-projects/base-custom-webcomponent";
|
|
2
2
|
import { IDesignItem } from "../../item/IDesignItem.js";
|
|
3
|
-
import { IProperty } from "../propertiesService/IProperty.js";
|
|
4
3
|
export interface IStyleRule {
|
|
5
4
|
selector: string;
|
|
6
5
|
declarations: IStyleDeclaration[];
|
|
@@ -17,13 +16,15 @@ export interface IStylesheet {
|
|
|
17
16
|
name: string;
|
|
18
17
|
}
|
|
19
18
|
export interface IStylesheetService {
|
|
20
|
-
setStylesheets(stylesheets: IStylesheet[]):
|
|
19
|
+
setStylesheets(stylesheets: IStylesheet[]): void;
|
|
21
20
|
getStylesheets(): IStylesheet[];
|
|
22
21
|
getAppliedRules(designItem: IDesignItem): IStyleRule[];
|
|
23
|
-
getDeclarations(designItem: IDesignItem,
|
|
24
|
-
updateDeclarationWithProperty(designItem: IDesignItem, property: IProperty, value: string, important: boolean): boolean;
|
|
22
|
+
getDeclarations(designItem: IDesignItem, styleName: string): IStyleDeclaration[];
|
|
25
23
|
updateDeclarationWithDeclaration(declaration: IStyleDeclaration, value: string, important: boolean): boolean;
|
|
24
|
+
insertDeclarationIntoRule(rule: IStyleRule, declaration: IStyleDeclaration, important: boolean): boolean;
|
|
25
|
+
removeDeclarationFromRule(rule: IStyleRule, declaration: IStyleDeclaration): boolean;
|
|
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);
|
|
@@ -5,16 +5,47 @@ import { IExtensionManager } from './IExtensionManger.js';
|
|
|
5
5
|
export declare class GridExtension extends AbstractExtension {
|
|
6
6
|
private _initialPoint;
|
|
7
7
|
private _initialSizes;
|
|
8
|
-
private
|
|
8
|
+
private _cells;
|
|
9
9
|
private _gaps;
|
|
10
|
+
private _headers;
|
|
11
|
+
private _headerTexts;
|
|
12
|
+
private _plusCircles;
|
|
10
13
|
private _resizeCircles;
|
|
11
14
|
private minPixelSize;
|
|
15
|
+
private gridInformation;
|
|
16
|
+
private defaultHeaderSize;
|
|
17
|
+
private defaultPlusSize;
|
|
18
|
+
private defaultDistanceToBox;
|
|
19
|
+
private defaultDistanceBetweenHeaders;
|
|
20
|
+
private defaultSizeOfNewRowOrColumn;
|
|
12
21
|
constructor(extensionManager: IExtensionManager, designerView: IDesignerCanvas, extendedItem: IDesignItem);
|
|
13
22
|
extend(): void;
|
|
14
23
|
refresh(): void;
|
|
15
24
|
dispose(): void;
|
|
16
|
-
|
|
25
|
+
_initSVGArrays(): void;
|
|
26
|
+
_drawResizeCircle(gap: any, oldCircle?: SVGCircleElement): SVGCircleElement;
|
|
27
|
+
_drawHeader(cell: any, oldHeader: any, index: any, alignment: "vertical" | "horizontal"): SVGRectElement;
|
|
28
|
+
_drawHeaderText(cell: any, oldHeaderText: any, alignment: "vertical" | "horizontal"): SVGTextElement;
|
|
29
|
+
_drawPlusCircle(x: any, y: any, oldPlusElement: {
|
|
30
|
+
circle: SVGCircleElement;
|
|
31
|
+
verticalLine: SVGLineElement;
|
|
32
|
+
horizontalLine: SVGLineElement;
|
|
33
|
+
}, index: any, alignment: "vertical" | "horizontal", final?: boolean): {
|
|
34
|
+
circle: any;
|
|
35
|
+
verticalLine: any;
|
|
36
|
+
horizontalLine: any;
|
|
37
|
+
};
|
|
38
|
+
_getHeaderText(size: number, unit: string, percentTarget: "width" | "height"): string;
|
|
39
|
+
_getInitialSizes(): {
|
|
40
|
+
x: any[];
|
|
41
|
+
xUnit: any[];
|
|
42
|
+
y: any[];
|
|
43
|
+
yUnit: any[];
|
|
44
|
+
};
|
|
17
45
|
_pointerActionTypeResize(event: PointerEvent, circle: SVGCircleElement, gapColumn: any, gapRow: any): void;
|
|
18
|
-
_calculateNewSize(iSizes:
|
|
19
|
-
|
|
46
|
+
_calculateNewSize(iSizes: number[], iUnits: string[], diff: any, gapIndex: any, percentTarget: 'width' | 'height', pointerUp?: boolean): string;
|
|
47
|
+
_editGrid(pos: number, alignment: "vertical" | "horizontal", task: "add" | "del"): void;
|
|
48
|
+
_calculateNewElementSize(elementTarget: "width" | "height"): string;
|
|
49
|
+
_toggleDisplayPlusCircles(index: any, alignment: "vertical" | "horizontal", double?: boolean): void;
|
|
50
|
+
_convertCssUnit(cssValue: string | number, target: HTMLElement, percentTarget: 'width' | 'height', unit: string): string | number;
|
|
20
51
|
}
|