@node-projects/web-component-designer 0.0.243 → 0.0.245
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/documentContainer.d.ts +1 -1
- package/dist/elements/helper/GridHelper.js +4 -3
- package/dist/elements/helper/TransformHelper.d.ts +1 -0
- package/dist/elements/helper/TransformHelper.js +20 -2
- package/dist/elements/services/placementService/FlexBoxPlacementService.js +36 -12
- package/dist/elements/services/propertiesService/services/CssProperties.json +48 -6
- package/dist/elements/services/stylesheetService/AbstractStylesheetService.d.ts +2 -1
- package/dist/elements/services/stylesheetService/AbstractStylesheetService.js +1 -8
- package/dist/elements/services/stylesheetService/CssToolsStylesheetService.d.ts +2 -0
- package/dist/elements/services/stylesheetService/CssToolsStylesheetService.js +16 -1
- package/dist/elements/services/stylesheetService/CssTreeStylesheetService.d.ts +2 -0
- package/dist/elements/services/stylesheetService/CssTreeStylesheetService.js +7 -1
- package/dist/elements/services/stylesheetService/IStylesheetService.d.ts +2 -1
- package/dist/elements/services/undoService/transactionItems/StylesheetChangedAction.js +2 -2
- package/dist/elements/widgets/designerView/designerCanvas.js +1 -1
- package/dist/elements/widgets/designerView/extensions/AbstractExtensionBase.d.ts +1 -0
- package/dist/elements/widgets/designerView/extensions/AbstractExtensionBase.js +7 -0
- package/dist/elements/widgets/designerView/extensions/grid/DisplayGridExtension.d.ts +1 -0
- package/dist/elements/widgets/designerView/extensions/grid/DisplayGridExtension.js +9 -1
- package/dist/elements/widgets/designerView/extensions/grid/EditGridColumnRowSizesExtension.d.ts +1 -0
- package/dist/elements/widgets/designerView/extensions/grid/EditGridColumnRowSizesExtension.js +7 -0
- package/dist/elements/widgets/designerView/overlayLayerView.d.ts +1 -0
- package/dist/elements/widgets/designerView/overlayLayerView.js +9 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/package.json +7 -7
|
@@ -26,7 +26,7 @@ export declare class DocumentContainer extends BaseCustomWebComponentLazyAppend
|
|
|
26
26
|
name: string;
|
|
27
27
|
newStyle: string;
|
|
28
28
|
oldStyle: string;
|
|
29
|
-
changeSource: 'extern' | 'styleupdate';
|
|
29
|
+
changeSource: 'extern' | 'styleupdate' | 'undo';
|
|
30
30
|
}>;
|
|
31
31
|
onContentChanged: TypedEvent<void>;
|
|
32
32
|
private _serviceContainer;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { getDesignerCanvasNormalizedTransformedCornerDOMPoints } from "./TransformHelper.js";
|
|
1
2
|
export function CalculateGridInformation(designItem) {
|
|
2
3
|
//todo:
|
|
3
4
|
//same name should combine columns/rows
|
|
4
5
|
let itemRect = designItem.instanceServiceContainer.designerCanvas.getNormalizedElementCoordinates(designItem.element);
|
|
5
|
-
|
|
6
|
+
let transformedCornerPoints = getDesignerCanvasNormalizedTransformedCornerDOMPoints(designItem.element, null, designItem.instanceServiceContainer.designerCanvas);
|
|
6
7
|
const computedStyle = getComputedStyle(designItem.element);
|
|
7
8
|
const rows = computedStyle.gridTemplateRows.split(' ');
|
|
8
9
|
const columns = computedStyle.gridTemplateColumns.split(' ');
|
|
@@ -12,8 +13,8 @@ export function CalculateGridInformation(designItem) {
|
|
|
12
13
|
let xGap = 0;
|
|
13
14
|
let yGap = 0;
|
|
14
15
|
let rw = 0;
|
|
15
|
-
let xOffset =
|
|
16
|
-
let yOffset =
|
|
16
|
+
let xOffset = transformedCornerPoints[0].x;
|
|
17
|
+
let yOffset = transformedCornerPoints[0].y;
|
|
17
18
|
let gridA = null;
|
|
18
19
|
if (computedStyle.gridTemplateAreas && computedStyle.gridTemplateAreas !== 'none')
|
|
19
20
|
gridA = computedStyle.gridTemplateAreas.split('\"');
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { IPoint } from "../../interfaces/IPoint.js";
|
|
2
2
|
import { IDesignerCanvas } from "../widgets/designerView/IDesignerCanvas.js";
|
|
3
|
+
export declare function getElementCombinedTransform(element: HTMLElement): DOMMatrix;
|
|
3
4
|
export declare function combineTransforms(element: HTMLElement, actualTransforms: string, requestedTransformation: string): void;
|
|
4
5
|
export declare function getDomMatrix(element: HTMLElement): DOMMatrix;
|
|
5
6
|
export declare function transformPointByInverseMatrix(point: DOMPoint, matrix: DOMMatrix): DOMPoint;
|
|
@@ -5,6 +5,24 @@ let identityMatrix = [
|
|
|
5
5
|
0, 0, 1, 0,
|
|
6
6
|
0, 0, 0, 1
|
|
7
7
|
];
|
|
8
|
+
export function getElementCombinedTransform(element) {
|
|
9
|
+
//https://www.w3.org/TR/css-transforms-2/#ctm
|
|
10
|
+
let s = getComputedStyle(element);
|
|
11
|
+
let m = new DOMMatrix();
|
|
12
|
+
if (s.translate != 'none') {
|
|
13
|
+
m = m.multiply(new DOMMatrix('translate(' + s.translate + ')'));
|
|
14
|
+
}
|
|
15
|
+
if (s.rotate != 'none') {
|
|
16
|
+
m = m.multiply(new DOMMatrix('rotate(' + s.rotate + ')'));
|
|
17
|
+
}
|
|
18
|
+
if (s.scale != 'none') {
|
|
19
|
+
m = m.multiply(new DOMMatrix('scale(' + s.rotate + ')'));
|
|
20
|
+
}
|
|
21
|
+
if (s.transform != 'none') {
|
|
22
|
+
m = m.multiply(new DOMMatrix(s.transform));
|
|
23
|
+
}
|
|
24
|
+
return m;
|
|
25
|
+
}
|
|
8
26
|
export function combineTransforms(element, actualTransforms, requestedTransformation) {
|
|
9
27
|
if (actualTransforms == null || actualTransforms == '') {
|
|
10
28
|
element.style.transform = requestedTransformation;
|
|
@@ -100,8 +118,8 @@ export function getResultingTransformationBetweenElementAndAllAncestors(element,
|
|
|
100
118
|
let originalElementAndAllParentsMultipliedMatrix;
|
|
101
119
|
while (actualElement != ancestor) {
|
|
102
120
|
const newElement = getParentElementIncludingSlots(actualElement);
|
|
103
|
-
actualElementMatrix =
|
|
104
|
-
newElementMatrix =
|
|
121
|
+
actualElementMatrix = getElementCombinedTransform(actualElement);
|
|
122
|
+
newElementMatrix = getElementCombinedTransform(newElement);
|
|
105
123
|
newElementMatrix.m41 = newElementMatrix.m42 = 0;
|
|
106
124
|
if (actualElement == element) {
|
|
107
125
|
originalElementAndAllParentsMultipliedMatrix = actualElementMatrix.multiply(newElementMatrix);
|
|
@@ -44,23 +44,31 @@ export class FlexBoxPlacementService {
|
|
|
44
44
|
const pos = placementView.getNormalizedEventCoordinates(event);
|
|
45
45
|
const style = getComputedStyle(container.element);
|
|
46
46
|
const childrenWithPos = Array.from(container.children()).filter(x => !x.isEmptyTextNode).map(x => [x, placementView.getNormalizedElementCoordinates(x.element)]);
|
|
47
|
-
if (style.flexDirection == 'row') {
|
|
47
|
+
if (style.flexDirection == 'row' || style.flexDirection == 'row-reverse') {
|
|
48
48
|
childrenWithPos.sort(x => x[1].x);
|
|
49
49
|
let elBefore = null;
|
|
50
50
|
for (let c of childrenWithPos) {
|
|
51
51
|
if (c[1].x + c[1].width / 2 < pos.x) {
|
|
52
52
|
elBefore = c;
|
|
53
|
+
if (style.flexDirection == 'row-reverse')
|
|
54
|
+
break;
|
|
53
55
|
}
|
|
54
56
|
}
|
|
55
57
|
let posBefore = childrenWithPos.indexOf(elBefore);
|
|
56
58
|
let posDrag = childrenWithPos.indexOf(childrenWithPos.find(x => x[0] == items[0]));
|
|
57
59
|
if (elBefore && elBefore[0] != items[0]) {
|
|
58
|
-
if (posBefore
|
|
60
|
+
if (style.flexDirection == 'row-reverse' && posBefore - 1 === posDrag)
|
|
61
|
+
return;
|
|
62
|
+
if (style.flexDirection == 'row' && posBefore + 1 === posDrag)
|
|
59
63
|
return;
|
|
60
64
|
const sel = [...container.instanceServiceContainer.selectionService.selectedElements];
|
|
61
65
|
let cg = items[0].openGroup('move in flexbox');
|
|
62
|
-
items[0].
|
|
63
|
-
|
|
66
|
+
if (items[0].parent)
|
|
67
|
+
items[0].remove();
|
|
68
|
+
if (style.flexDirection == 'row-reverse')
|
|
69
|
+
elBefore[0].insertAdjacentElement(items[0], 'beforebegin');
|
|
70
|
+
else
|
|
71
|
+
elBefore[0].insertAdjacentElement(items[0], 'afterend');
|
|
64
72
|
cg.commit();
|
|
65
73
|
container.instanceServiceContainer.selectionService.setSelectedElements(sel);
|
|
66
74
|
}
|
|
@@ -69,29 +77,41 @@ export class FlexBoxPlacementService {
|
|
|
69
77
|
return;
|
|
70
78
|
const sel = [...container.instanceServiceContainer.selectionService.selectedElements];
|
|
71
79
|
let cg = items[0].openGroup('move in flexbox');
|
|
72
|
-
items[0].
|
|
73
|
-
|
|
80
|
+
if (items[0].parent)
|
|
81
|
+
items[0].remove();
|
|
82
|
+
if (style.flexDirection == 'row-reverse')
|
|
83
|
+
container.insertChild(items[0]);
|
|
84
|
+
else
|
|
85
|
+
container.insertChild(items[0], 0);
|
|
74
86
|
cg.commit();
|
|
75
87
|
container.instanceServiceContainer.selectionService.setSelectedElements(sel);
|
|
76
88
|
}
|
|
77
89
|
}
|
|
78
|
-
else if (style.flexDirection == 'column') {
|
|
90
|
+
else if (style.flexDirection == 'column' || style.flexDirection == 'column-reverse') {
|
|
79
91
|
childrenWithPos.sort(x => x[1].y);
|
|
80
92
|
let elBefore = null;
|
|
81
93
|
for (let c of childrenWithPos) {
|
|
82
94
|
if (c[1].y + c[1].height / 2 < pos.y) {
|
|
83
95
|
elBefore = c;
|
|
96
|
+
if (style.flexDirection == 'column-reverse')
|
|
97
|
+
break;
|
|
84
98
|
}
|
|
85
99
|
}
|
|
86
100
|
let posBefore = childrenWithPos.indexOf(elBefore);
|
|
87
101
|
let posDrag = childrenWithPos.indexOf(childrenWithPos.find(x => x[0] == items[0]));
|
|
88
102
|
if (elBefore && elBefore[0] != items[0]) {
|
|
89
|
-
if (posBefore
|
|
103
|
+
if (style.flexDirection == 'column-reverse' && posBefore - 1 === posDrag)
|
|
104
|
+
return;
|
|
105
|
+
if (style.flexDirection == 'column' && posBefore + 1 === posDrag)
|
|
90
106
|
return;
|
|
91
107
|
const sel = [...container.instanceServiceContainer.selectionService.selectedElements];
|
|
92
108
|
let cg = items[0].openGroup('move in flexbox');
|
|
93
|
-
items[0].
|
|
94
|
-
|
|
109
|
+
if (items[0].parent)
|
|
110
|
+
items[0].remove();
|
|
111
|
+
if (style.flexDirection == 'column-reverse')
|
|
112
|
+
elBefore[0].insertAdjacentElement(items[0], 'beforebegin');
|
|
113
|
+
else
|
|
114
|
+
elBefore[0].insertAdjacentElement(items[0], 'afterend');
|
|
95
115
|
cg.commit();
|
|
96
116
|
container.instanceServiceContainer.selectionService.setSelectedElements(sel);
|
|
97
117
|
}
|
|
@@ -100,8 +120,12 @@ export class FlexBoxPlacementService {
|
|
|
100
120
|
return;
|
|
101
121
|
const sel = [...container.instanceServiceContainer.selectionService.selectedElements];
|
|
102
122
|
let cg = items[0].openGroup('move in flexbox');
|
|
103
|
-
items[0].
|
|
104
|
-
|
|
123
|
+
if (items[0].parent)
|
|
124
|
+
items[0].remove();
|
|
125
|
+
if (style.flexDirection == 'column-reverse')
|
|
126
|
+
container.insertChild(items[0]);
|
|
127
|
+
else
|
|
128
|
+
container.insertChild(items[0], 0);
|
|
105
129
|
cg.commit();
|
|
106
130
|
container.instanceServiceContainer.selectionService.setSelectedElements(sel);
|
|
107
131
|
}
|
|
@@ -3,7 +3,26 @@
|
|
|
3
3
|
"type": "color"
|
|
4
4
|
},
|
|
5
5
|
"additiveSymbols": {},
|
|
6
|
-
"alignContent": {
|
|
6
|
+
"alignContent": {
|
|
7
|
+
"type": "list",
|
|
8
|
+
"values": [
|
|
9
|
+
"start",
|
|
10
|
+
"end",
|
|
11
|
+
"flex-start",
|
|
12
|
+
"flex-end",
|
|
13
|
+
"center",
|
|
14
|
+
"normal",
|
|
15
|
+
"baseline",
|
|
16
|
+
"first baseline",
|
|
17
|
+
"last baseline",
|
|
18
|
+
"space-between",
|
|
19
|
+
"space-around",
|
|
20
|
+
"space-evenly",
|
|
21
|
+
"stretch",
|
|
22
|
+
"safe",
|
|
23
|
+
"unsafe"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
7
26
|
"alignItems": {},
|
|
8
27
|
"alignSelf": {},
|
|
9
28
|
"alignmentBaseline": {},
|
|
@@ -229,11 +248,30 @@
|
|
|
229
248
|
"filter": {},
|
|
230
249
|
"flex": {},
|
|
231
250
|
"flexBasis": {},
|
|
232
|
-
"flexDirection": {
|
|
251
|
+
"flexDirection": {
|
|
252
|
+
"type": "list",
|
|
253
|
+
"values": [
|
|
254
|
+
"row",
|
|
255
|
+
"column",
|
|
256
|
+
"row-reverse",
|
|
257
|
+
"column-reverse"
|
|
258
|
+
]
|
|
259
|
+
},
|
|
233
260
|
"flexFlow": {},
|
|
234
|
-
"flexGrow": {
|
|
235
|
-
|
|
236
|
-
|
|
261
|
+
"flexGrow": {
|
|
262
|
+
"type": "number"
|
|
263
|
+
},
|
|
264
|
+
"flexShrink": {
|
|
265
|
+
"type": "number"
|
|
266
|
+
},
|
|
267
|
+
"flexWrap": {
|
|
268
|
+
"type": "list",
|
|
269
|
+
"values": [
|
|
270
|
+
"nowrap",
|
|
271
|
+
"wrap",
|
|
272
|
+
"wrap-reverse"
|
|
273
|
+
]
|
|
274
|
+
},
|
|
237
275
|
"float": {},
|
|
238
276
|
"floodColor": {
|
|
239
277
|
"type": "color"
|
|
@@ -413,7 +451,11 @@
|
|
|
413
451
|
"pointerEvents": {},
|
|
414
452
|
"position": {
|
|
415
453
|
"type": "list",
|
|
416
|
-
"values": [
|
|
454
|
+
"values": [
|
|
455
|
+
"static",
|
|
456
|
+
"relative",
|
|
457
|
+
"absolute"
|
|
458
|
+
]
|
|
417
459
|
},
|
|
418
460
|
"prefix": {},
|
|
419
461
|
"quotes": {},
|
|
@@ -32,12 +32,13 @@ export declare abstract class AbstractStylesheetService implements IStylesheetSe
|
|
|
32
32
|
abstract insertDeclarationIntoRule(rule: IStyleRule, property: string, value: string, important: boolean): boolean;
|
|
33
33
|
abstract removeDeclarationFromRule(rule: IStyleRule, property: string): boolean;
|
|
34
34
|
abstract updateCompleteStylesheet(name: string, newStyle: string): any;
|
|
35
|
+
abstract updateCompleteStylesheetWithoutUndo(name: string, newStyle: string): any;
|
|
35
36
|
abstract updateDeclarationValueWithoutUndo(declaration: IStyleDeclaration, value: string, important: boolean): any;
|
|
36
37
|
stylesheetChanged: TypedEvent<{
|
|
37
38
|
name: string;
|
|
38
39
|
newStyle: string;
|
|
39
40
|
oldStyle: string;
|
|
40
|
-
changeSource: 'extern' | 'styleupdate';
|
|
41
|
+
changeSource: 'extern' | 'styleupdate' | 'undo';
|
|
41
42
|
}>;
|
|
42
43
|
stylesheetsChanged: TypedEvent<void>;
|
|
43
44
|
protected elementMatchesASelector(designItem: IDesignItem, selectors: string[]): boolean;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { TypedEvent } from "@node-projects/base-custom-webcomponent";
|
|
2
2
|
import { DesignerCanvas } from '../../widgets/designerView/designerCanvas.js';
|
|
3
|
-
import { StylesheetStyleChangeAction } from "../undoService/transactionItems/StylesheetStyleChangeAction.js";
|
|
4
3
|
export class AbstractStylesheetService {
|
|
5
4
|
_stylesheets = new Map();
|
|
6
5
|
_documentStylesheets = new Map();
|
|
@@ -74,13 +73,7 @@ export class AbstractStylesheetService {
|
|
|
74
73
|
return stylesheets;
|
|
75
74
|
}
|
|
76
75
|
updateDeclarationValue(declaration, value, important) {
|
|
77
|
-
|
|
78
|
-
const action = new StylesheetStyleChangeAction(this, declaration, value, declaration.value);
|
|
79
|
-
this._instanceServiceContainer.undoService.execute(action);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
this.updateDeclarationValueWithoutUndo(declaration, value, important);
|
|
83
|
-
}
|
|
76
|
+
this.updateDeclarationValueWithoutUndo(declaration, value, important);
|
|
84
77
|
}
|
|
85
78
|
stylesheetChanged = new TypedEvent();
|
|
86
79
|
stylesheetsChanged = new TypedEvent();
|
|
@@ -36,5 +36,7 @@ export declare class CssToolsStylesheetService extends AbstractStylesheetService
|
|
|
36
36
|
removeDeclarationFromRule(rule: IRuleWithAST, property: string): boolean;
|
|
37
37
|
private updateStylesheet;
|
|
38
38
|
updateCompleteStylesheet(name: string, newStyle: string): void;
|
|
39
|
+
updateCompleteStylesheetWithoutUndo(name: string, newStyle: string, noUndo?: boolean): void;
|
|
40
|
+
private updateCompleteStylesheetInternal;
|
|
39
41
|
}
|
|
40
42
|
export {};
|
|
@@ -57,6 +57,15 @@ export class CssToolsStylesheetService extends AbstractStylesheetService {
|
|
|
57
57
|
declaration.ast.value = important ? value + ' !important' : value;
|
|
58
58
|
let ss = this._allStylesheets.get(declaration.parent.stylesheetName);
|
|
59
59
|
this.updateStylesheet(ss);
|
|
60
|
+
/*
|
|
61
|
+
declaration.ast.value = important ? value + ' !important' : value;
|
|
62
|
+
let ss = declaration.ast;
|
|
63
|
+
while (ss?.parent)
|
|
64
|
+
ss = ss?.parent;
|
|
65
|
+
let obj = { ast: ss, stylesheet: declaration.stylesheet };
|
|
66
|
+
this._allStylesheets.set(declaration.parent.stylesheetName, obj)
|
|
67
|
+
this.updateStylesheet(obj);
|
|
68
|
+
*/
|
|
60
69
|
}
|
|
61
70
|
insertDeclarationIntoRule(rule, property, value, important) {
|
|
62
71
|
rule.ast.declarations.push({
|
|
@@ -85,6 +94,12 @@ export class CssToolsStylesheetService extends AbstractStylesheetService {
|
|
|
85
94
|
this.stylesheetChanged.emit({ name: ss.stylesheet.name, newStyle: ss.stylesheet.content, oldStyle: old, changeSource: 'styleupdate' });
|
|
86
95
|
}
|
|
87
96
|
updateCompleteStylesheet(name, newStyle) {
|
|
97
|
+
this.updateCompleteStylesheetInternal(name, newStyle, 'styleupdate');
|
|
98
|
+
}
|
|
99
|
+
updateCompleteStylesheetWithoutUndo(name, newStyle, noUndo = false) {
|
|
100
|
+
this.updateCompleteStylesheetInternal(name, newStyle, 'undo');
|
|
101
|
+
}
|
|
102
|
+
updateCompleteStylesheetInternal(name, newStyle, changeSource) {
|
|
88
103
|
const ss = this._allStylesheets.get(name);
|
|
89
104
|
if (ss.stylesheet.content != newStyle) {
|
|
90
105
|
const old = ss.stylesheet.content;
|
|
@@ -93,7 +108,7 @@ export class CssToolsStylesheetService extends AbstractStylesheetService {
|
|
|
93
108
|
ss.stylesheet.designItem.content = ss.stylesheet.content;
|
|
94
109
|
}
|
|
95
110
|
else
|
|
96
|
-
this.stylesheetChanged.emit({ name: ss.stylesheet.name, newStyle: ss.stylesheet.content, oldStyle: old, changeSource
|
|
111
|
+
this.stylesheetChanged.emit({ name: ss.stylesheet.name, newStyle: ss.stylesheet.content, oldStyle: old, changeSource });
|
|
97
112
|
}
|
|
98
113
|
}
|
|
99
114
|
}
|
|
@@ -45,6 +45,8 @@ export declare class CssTreeStylesheetService extends AbstractStylesheetService
|
|
|
45
45
|
insertDeclarationIntoRule(rule: IRuleWithAST, property: string, value: string, important: boolean): boolean;
|
|
46
46
|
removeDeclarationFromRule(rule: IRuleWithAST, property: string): boolean;
|
|
47
47
|
updateCompleteStylesheet(name: string, newStyle: string): void;
|
|
48
|
+
updateCompleteStylesheetWithoutUndo(name: string, newStyle: string, noUndo?: boolean): void;
|
|
49
|
+
private updateCompleteStylesheetInternal;
|
|
48
50
|
private rulesFromAST;
|
|
49
51
|
private astHasChildren;
|
|
50
52
|
private buildSelectorString;
|
|
@@ -113,6 +113,12 @@ export class CssTreeStylesheetService extends AbstractStylesheetService {
|
|
|
113
113
|
return true;
|
|
114
114
|
}
|
|
115
115
|
updateCompleteStylesheet(name, newStyle) {
|
|
116
|
+
this.updateCompleteStylesheetInternal(name, newStyle, 'styleupdate');
|
|
117
|
+
}
|
|
118
|
+
updateCompleteStylesheetWithoutUndo(name, newStyle, noUndo = false) {
|
|
119
|
+
this.updateCompleteStylesheetInternal(name, newStyle, 'undo');
|
|
120
|
+
}
|
|
121
|
+
updateCompleteStylesheetInternal(name, newStyle, changeSource) {
|
|
116
122
|
const ss = this._allStylesheets.get(name);
|
|
117
123
|
if (ss.stylesheet.content != newStyle) {
|
|
118
124
|
const old = ss.stylesheet.content;
|
|
@@ -121,7 +127,7 @@ export class CssTreeStylesheetService extends AbstractStylesheetService {
|
|
|
121
127
|
ss.stylesheet.designItem.content = ss.stylesheet.content;
|
|
122
128
|
}
|
|
123
129
|
else
|
|
124
|
-
this.stylesheetChanged.emit({ name: ss.stylesheet.name, newStyle: ss.stylesheet.content, oldStyle: old, changeSource
|
|
130
|
+
this.stylesheetChanged.emit({ name: ss.stylesheet.name, newStyle: ss.stylesheet.content, oldStyle: old, changeSource });
|
|
125
131
|
}
|
|
126
132
|
}
|
|
127
133
|
/* Section covers the internal traversal creation of rules and declarations */
|
|
@@ -31,11 +31,12 @@ export interface IStylesheetService {
|
|
|
31
31
|
insertDeclarationIntoRule(rule: IStyleRule, property: string, value: string, important: boolean): boolean;
|
|
32
32
|
removeDeclarationFromRule(rule: IStyleRule, property: string): boolean;
|
|
33
33
|
updateCompleteStylesheet(name: string, newStyle: string): void;
|
|
34
|
+
updateCompleteStylesheetWithoutUndo(name: string, newStyle: string): void;
|
|
34
35
|
stylesheetChanged: TypedEvent<{
|
|
35
36
|
name: string;
|
|
36
37
|
newStyle: string;
|
|
37
38
|
oldStyle: string;
|
|
38
|
-
changeSource: 'extern' | 'styleupdate';
|
|
39
|
+
changeSource: 'extern' | 'styleupdate' | 'undo';
|
|
39
40
|
}>;
|
|
40
41
|
stylesheetsChanged: TypedEvent<void>;
|
|
41
42
|
}
|
|
@@ -12,10 +12,10 @@ export class StylesheetChangedAction {
|
|
|
12
12
|
return [];
|
|
13
13
|
}
|
|
14
14
|
undo() {
|
|
15
|
-
this.stylesheetService.
|
|
15
|
+
this.stylesheetService.updateCompleteStylesheetWithoutUndo(this.name, this.oldValue);
|
|
16
16
|
}
|
|
17
17
|
do() {
|
|
18
|
-
this.stylesheetService.
|
|
18
|
+
this.stylesheetService.updateCompleteStylesheetWithoutUndo(this.name, this.newValue);
|
|
19
19
|
}
|
|
20
20
|
name;
|
|
21
21
|
newValue;
|
|
@@ -544,7 +544,7 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
544
544
|
const instance = stylesheetService(this);
|
|
545
545
|
this.instanceServiceContainer.register("stylesheetService", instance);
|
|
546
546
|
this.instanceServiceContainer.stylesheetService.stylesheetChanged.on((ss) => {
|
|
547
|
-
if (ss.changeSource
|
|
547
|
+
if (ss.changeSource != 'undo') {
|
|
548
548
|
const ssca = new StylesheetChangedAction(this.instanceServiceContainer.stylesheetService, ss.name, ss.newStyle, ss.oldStyle);
|
|
549
549
|
this.instanceServiceContainer.undoService.execute(ssca);
|
|
550
550
|
}
|
|
@@ -11,6 +11,7 @@ export declare abstract class AbstractExtensionBase {
|
|
|
11
11
|
constructor(extensionManager: IExtensionManager, designerCanvas: IDesignerCanvas);
|
|
12
12
|
protected _removeAllOverlays(): void;
|
|
13
13
|
protected _addOverlay(element: SVGGraphicsElement, overlayLayer?: OverlayLayer): void;
|
|
14
|
+
protected _drawGroup(className?: string, group?: SVGGElement, overlayLayer?: OverlayLayer): SVGGElement;
|
|
14
15
|
protected _drawLine(x1: number, y1: number, x2: number, y2: number, className?: string, line?: SVGLineElement, overlayLayer?: OverlayLayer): SVGLineElement;
|
|
15
16
|
protected _drawCircle(x: number, y: number, radius: number, className?: string, circle?: SVGCircleElement, overlayLayer?: OverlayLayer): SVGCircleElement;
|
|
16
17
|
protected _drawRect(x: number, y: number, w: number, h: number, className?: string, rect?: SVGRectElement, overlayLayer?: OverlayLayer): SVGRectElement;
|
|
@@ -24,6 +24,13 @@ export class AbstractExtensionBase {
|
|
|
24
24
|
this.overlayLayerView.addOverlay(this.constructor.name, element, overlayLayer);
|
|
25
25
|
this.overlays.push(element);
|
|
26
26
|
}
|
|
27
|
+
_drawGroup(className, group, overlayLayer) {
|
|
28
|
+
const newGroup = this.overlayLayerView.drawGroup(this.constructor.name, className, group, overlayLayer);
|
|
29
|
+
if (!group) {
|
|
30
|
+
this.overlays.push(newGroup);
|
|
31
|
+
}
|
|
32
|
+
return newGroup;
|
|
33
|
+
}
|
|
27
34
|
_drawLine(x1, y1, x2, y2, className, line, overlayLayer) {
|
|
28
35
|
const newLine = this.overlayLayerView.drawLine(this.constructor.name, x1, y1, x2, y2, className, line, overlayLayer);
|
|
29
36
|
if (!line) {
|
|
@@ -6,6 +6,7 @@ export declare class DisplayGridExtension extends AbstractExtension {
|
|
|
6
6
|
private _cells;
|
|
7
7
|
private _texts;
|
|
8
8
|
private _gaps;
|
|
9
|
+
private _group;
|
|
9
10
|
private gridInformation;
|
|
10
11
|
constructor(extensionManager: IExtensionManager, designerView: IDesignerCanvas, extendedItem: IDesignItem);
|
|
11
12
|
extend(event?: Event): void;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { CalculateGridInformation } from "../../../../helper/GridHelper.js";
|
|
2
|
+
import { getElementCombinedTransform } from "../../../../helper/TransformHelper.js";
|
|
2
3
|
import { AbstractExtension } from '../AbstractExtension.js';
|
|
3
4
|
import { OverlayLayer } from "../OverlayLayer.js";
|
|
4
5
|
export class DisplayGridExtension extends AbstractExtension {
|
|
5
6
|
_cells;
|
|
6
7
|
_texts;
|
|
7
8
|
_gaps;
|
|
9
|
+
_group;
|
|
8
10
|
gridInformation;
|
|
9
11
|
constructor(extensionManager, designerView, extendedItem) {
|
|
10
12
|
super(extensionManager, designerView, extendedItem);
|
|
@@ -16,17 +18,23 @@ export class DisplayGridExtension extends AbstractExtension {
|
|
|
16
18
|
refresh(event) {
|
|
17
19
|
this.gridInformation = CalculateGridInformation(this.extendedItem);
|
|
18
20
|
let cells = this.gridInformation.cells;
|
|
21
|
+
this._group = this._drawGroup(null, this._group, OverlayLayer.Background);
|
|
22
|
+
this._group.style.transform = getElementCombinedTransform(this.extendedItem.element).toString();
|
|
23
|
+
this._group.style.transformOrigin = '0 0';
|
|
24
|
+
this._group.style.transformBox = 'fill-box';
|
|
19
25
|
if (cells[0][0] && !isNaN(cells[0][0].height) && !isNaN(cells[0][0].width)) {
|
|
20
26
|
if (this.gridInformation.cells.length != this._cells.length || this.gridInformation.cells[0].length != this._cells[0].length)
|
|
21
27
|
this._initSVGArrays();
|
|
22
28
|
//draw gaps
|
|
23
29
|
this.gridInformation.gaps.forEach((gap, i) => {
|
|
24
|
-
this._gaps[i] = this._drawRect(gap.x, gap.y, gap.width, gap.height, 'svg-grid-gap', this._gaps[i], OverlayLayer.
|
|
30
|
+
this._gaps[i] = this._drawRect(gap.x, gap.y, gap.width, gap.height, 'svg-grid-gap', this._gaps[i], OverlayLayer.Background);
|
|
31
|
+
this._group.appendChild(this._gaps[i]);
|
|
25
32
|
});
|
|
26
33
|
//draw cells
|
|
27
34
|
cells.forEach((row, i) => {
|
|
28
35
|
row.forEach((cell, j) => {
|
|
29
36
|
this._cells[i][j] = this._drawRect(cell.x, cell.y, cell.width, cell.height, 'svg-grid', this._cells[i][j], OverlayLayer.Background);
|
|
37
|
+
this._group.appendChild(this._cells[i][j]);
|
|
30
38
|
if (cell.name) {
|
|
31
39
|
this._texts[i][j] = this._drawText(cell.name, cell.x, cell.y, 'svg-grid-area', this._texts[i][j], OverlayLayer.Background);
|
|
32
40
|
this._texts[i][j].setAttribute("dominant-baseline", "hanging");
|
package/dist/elements/widgets/designerView/extensions/grid/EditGridColumnRowSizesExtension.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare class EditGridColumnRowSizesExtension extends AbstractExtension {
|
|
|
8
8
|
private _resizers;
|
|
9
9
|
private _initalPos;
|
|
10
10
|
private _initialSizes;
|
|
11
|
+
private _group;
|
|
11
12
|
constructor(extensionManager: IExtensionManager, designerView: IDesignerCanvas, extendedItem: IDesignItem);
|
|
12
13
|
extend(event?: Event): void;
|
|
13
14
|
refresh(event?: Event): void;
|
package/dist/elements/widgets/designerView/extensions/grid/EditGridColumnRowSizesExtension.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EventNames } from "../../../../../enums/EventNames.js";
|
|
2
2
|
import { convertCssUnit, convertCssUnitToPixel, getCssUnit } from "../../../../helper/CssUnitConverter.js";
|
|
3
3
|
import { CalculateGridInformation } from "../../../../helper/GridHelper.js";
|
|
4
|
+
import { getElementCombinedTransform } from "../../../../helper/TransformHelper.js";
|
|
4
5
|
import { AbstractExtension } from '../AbstractExtension.js';
|
|
5
6
|
import { OverlayLayer } from "../OverlayLayer.js";
|
|
6
7
|
export class EditGridColumnRowSizesExtension extends AbstractExtension {
|
|
@@ -8,6 +9,7 @@ export class EditGridColumnRowSizesExtension extends AbstractExtension {
|
|
|
8
9
|
_resizers = [];
|
|
9
10
|
_initalPos;
|
|
10
11
|
_initialSizes;
|
|
12
|
+
_group;
|
|
11
13
|
constructor(extensionManager, designerView, extendedItem) {
|
|
12
14
|
super(extensionManager, designerView, extendedItem);
|
|
13
15
|
}
|
|
@@ -16,6 +18,10 @@ export class EditGridColumnRowSizesExtension extends AbstractExtension {
|
|
|
16
18
|
}
|
|
17
19
|
refresh(event) {
|
|
18
20
|
this.gridInformation = CalculateGridInformation(this.extendedItem);
|
|
21
|
+
this._group = this._drawGroup(null, this._group, OverlayLayer.Background);
|
|
22
|
+
this._group.style.transform = getElementCombinedTransform(this.extendedItem.element).toString();
|
|
23
|
+
this._group.style.transformOrigin = '0 0';
|
|
24
|
+
this._group.style.transformBox = 'fill-box';
|
|
19
25
|
this.gridInformation.gaps.forEach((gap, i) => {
|
|
20
26
|
if (gap.width < 3) {
|
|
21
27
|
gap.width = 3;
|
|
@@ -26,6 +32,7 @@ export class EditGridColumnRowSizesExtension extends AbstractExtension {
|
|
|
26
32
|
gap.y--;
|
|
27
33
|
}
|
|
28
34
|
let rect = this._drawRect(gap.x, gap.y, gap.width, gap.height, 'svg-grid-resizer-' + gap.type, this._resizers[i], OverlayLayer.Normal);
|
|
35
|
+
this._group.appendChild(rect);
|
|
29
36
|
if (!this._resizers[i]) {
|
|
30
37
|
this._resizers[i] = rect;
|
|
31
38
|
rect.addEventListener(EventNames.PointerDown, event => this._pointerActionTypeResize(event, rect, gap));
|
|
@@ -20,6 +20,7 @@ export declare class OverlayLayerView extends BaseCustomWebComponentConstructorA
|
|
|
20
20
|
removeAllOverlays(): void;
|
|
21
21
|
createPoint(): DOMPointInit;
|
|
22
22
|
elementFromPoint(x: number, y: number): Element;
|
|
23
|
+
drawGroup(overlaySource: string, className?: string, group?: SVGGElement, overlayLayer?: OverlayLayer): SVGGElement;
|
|
23
24
|
drawLine(overlaySource: string, x1: number, y1: number, x2: number, y2: number, className?: string, line?: SVGLineElement, overlayLayer?: OverlayLayer): SVGLineElement;
|
|
24
25
|
drawCircle(overlaySource: string, x: number, y: number, radius: number, className?: string, circle?: SVGCircleElement, overlayLayer?: OverlayLayer): SVGCircleElement;
|
|
25
26
|
drawRect(overlaySource: string, x: number, y: number, w: number, h: number, className?: string, rect?: SVGRectElement, overlayLayer?: OverlayLayer): SVGRectElement;
|
|
@@ -101,6 +101,15 @@ export class OverlayLayerView extends BaseCustomWebComponentConstructorAppend {
|
|
|
101
101
|
//@ts-ignore
|
|
102
102
|
return this.shadowRoot.elementFromPoint(x, y);
|
|
103
103
|
}
|
|
104
|
+
drawGroup(overlaySource, className, group, overlayLayer) {
|
|
105
|
+
if (!group) {
|
|
106
|
+
group = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
|
107
|
+
this.addOverlay(overlaySource, group, overlayLayer);
|
|
108
|
+
}
|
|
109
|
+
if (className)
|
|
110
|
+
group.setAttribute('class', className);
|
|
111
|
+
return group;
|
|
112
|
+
}
|
|
104
113
|
drawLine(overlaySource, x1, y1, x2, y2, className, line, overlayLayer) {
|
|
105
114
|
if (!line) {
|
|
106
115
|
line = document.createElementNS("http://www.w3.org/2000/svg", "line");
|
package/dist/index.d.ts
CHANGED
|
@@ -128,7 +128,6 @@ export * from "./elements/services/undoService/transactionItems/DeleteAction.js"
|
|
|
128
128
|
export * from "./elements/services/undoService/transactionItems/InsertAction.js";
|
|
129
129
|
export * from "./elements/services/undoService/transactionItems/InsertChildAction.js";
|
|
130
130
|
export * from "./elements/services/undoService/transactionItems/StylesheetChangedAction.js";
|
|
131
|
-
export * from "./elements/services/undoService/transactionItems/StylesheetStyleChangeAction.js";
|
|
132
131
|
export * from "./elements/services/undoService/transactionItems/SetDesignItemsAction.js";
|
|
133
132
|
export * from "./elements/services/BaseServiceContainer.js";
|
|
134
133
|
export * from "./elements/services/InstanceServiceContainer.js";
|
package/dist/index.js
CHANGED
|
@@ -88,7 +88,6 @@ export * from "./elements/services/undoService/transactionItems/DeleteAction.js"
|
|
|
88
88
|
export * from "./elements/services/undoService/transactionItems/InsertAction.js";
|
|
89
89
|
export * from "./elements/services/undoService/transactionItems/InsertChildAction.js";
|
|
90
90
|
export * from "./elements/services/undoService/transactionItems/StylesheetChangedAction.js";
|
|
91
|
-
export * from "./elements/services/undoService/transactionItems/StylesheetStyleChangeAction.js";
|
|
92
91
|
export * from "./elements/services/undoService/transactionItems/SetDesignItemsAction.js";
|
|
93
92
|
export * from "./elements/services/BaseServiceContainer.js";
|
|
94
93
|
export * from "./elements/services/InstanceServiceContainer.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.
|
|
4
|
+
"version": "0.0.245",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"author": "",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
"prepublishOnly": "npm run build"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@node-projects/base-custom-webcomponent": "^0.
|
|
16
|
+
"@node-projects/base-custom-webcomponent": "^0.13.0"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@adobe/css-tools": "4.3.0-
|
|
19
|
+
"@adobe/css-tools": "4.3.0-rc.1",
|
|
20
20
|
"@node-projects/lean-he-esm": "^3.3.0",
|
|
21
21
|
"@node-projects/node-html-parser-esm": "^6.1.5",
|
|
22
22
|
"@papyrs/stylo": "^0.0.45",
|
|
@@ -24,17 +24,17 @@
|
|
|
24
24
|
"@types/css-tree": "^2.3.1",
|
|
25
25
|
"@types/jquery": "^3.5.16",
|
|
26
26
|
"@types/jquery.fancytree": "0.0.7",
|
|
27
|
-
"@types/node": "^20.
|
|
28
|
-
"ace-builds": "^1.23.
|
|
27
|
+
"@types/node": "^20.4.5",
|
|
28
|
+
"ace-builds": "^1.23.4",
|
|
29
29
|
"codemirror": "^5.0.0",
|
|
30
30
|
"css-tree": "^2.3.1",
|
|
31
31
|
"esprima-next": "^5.8.4",
|
|
32
32
|
"html2canvas": "*",
|
|
33
|
-
"jest": "^29.
|
|
33
|
+
"jest": "^29.6.2",
|
|
34
34
|
"jquery": "^3.7.0",
|
|
35
35
|
"jquery.fancytree": "^2.38.3",
|
|
36
36
|
"mdn-data": "^2.0.32",
|
|
37
|
-
"monaco-editor": "^0.
|
|
37
|
+
"monaco-editor": "^0.40.0",
|
|
38
38
|
"ts-jest": "^29.1.1",
|
|
39
39
|
"typescript": "^5.1.6",
|
|
40
40
|
"typescript-lit-html-plugin": "^0.9.0"
|