@node-projects/web-component-designer 0.0.38 → 0.0.44
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/commandHandling/CommandType.d.ts +3 -3
- package/dist/commandHandling/CommandType.js +3 -3
- package/dist/elements/controls/NumericInput.d.ts +0 -0
- package/dist/elements/controls/NumericInput.js +1 -0
- package/dist/elements/controls/NumericPopup.d.ts +6 -0
- package/dist/elements/controls/NumericPopup.js +39 -0
- package/dist/elements/controls/NumericStyleInput.d.ts +16 -0
- package/dist/elements/controls/NumericStyleInput.js +56 -0
- package/dist/elements/controls/ThicknessEditor copy.d.ts +33 -0
- package/dist/elements/controls/ThicknessEditor copy.js +145 -0
- package/dist/elements/controls/ThicknessEditor.js +1 -1
- package/dist/elements/helper/LayoutHelper.d.ts +0 -0
- package/dist/elements/helper/LayoutHelper.js +4 -0
- package/dist/elements/services/BaseServiceContainer.js +0 -2
- package/dist/elements/services/DefaultServiceBootstrap.js +2 -0
- package/dist/elements/services/ServiceContainer.d.ts +5 -0
- package/dist/elements/services/ServiceContainer.js +4 -0
- package/dist/elements/services/htmlWriterService/HtmlWriterService.js +2 -2
- package/dist/elements/services/modelCommandService/DefaultInstanceService.d.ts +8 -0
- package/dist/elements/services/modelCommandService/DefaultInstanceService.js +14 -0
- package/dist/elements/services/modelCommandService/DefaultModelCommandService.d.ts +7 -0
- package/dist/elements/services/modelCommandService/DefaultModelCommandService.js +68 -0
- package/dist/elements/services/modelCommandService/IInstanceService.d.ts +8 -0
- package/dist/elements/services/modelCommandService/IInstanceService.js +1 -0
- package/dist/elements/services/modelCommandService/IModelCommandService.d.ts +7 -0
- package/dist/elements/services/modelCommandService/IModelCommandService.js +1 -0
- package/dist/elements/services/placementService/DefaultPlacementService.js +2 -2
- package/dist/elements/services/undoService/UndoService.d.ts +3 -0
- package/dist/elements/services/undoService/UndoService.js +7 -0
- package/dist/elements/widgets/designerView/DomConverter.js +2 -2
- package/dist/elements/widgets/designerView/designerCanvas.d.ts +1 -2
- package/dist/elements/widgets/designerView/designerCanvas.js +24 -20
- package/dist/elements/widgets/designerView/extensions/AbstractExtension copy.d.ts +22 -0
- package/dist/elements/widgets/designerView/extensions/AbstractExtension copy.js +52 -0
- package/dist/elements/widgets/designerView/extensions/AbstractExtension.d.ts +2 -12
- package/dist/elements/widgets/designerView/extensions/AbstractExtension.js +3 -73
- package/dist/elements/widgets/designerView/extensions/AbstractExtensionBase.d.ts +16 -0
- package/dist/elements/widgets/designerView/extensions/AbstractExtensionBase.js +50 -0
- package/dist/elements/widgets/designerView/extensions/AltToEnterContainerExtension.js +2 -2
- package/dist/elements/widgets/designerView/extensions/CanvasExtension.js +2 -2
- package/dist/elements/widgets/designerView/extensions/EditText/EditTextExtension.js +4 -4
- package/dist/elements/widgets/designerView/extensions/ExtensionManager.d.ts +1 -0
- package/dist/elements/widgets/designerView/extensions/ExtensionManager.js +14 -0
- package/dist/elements/widgets/designerView/extensions/ExtensionType.d.ts +0 -3
- package/dist/elements/widgets/designerView/extensions/ExtensionType.js +0 -3
- package/dist/elements/widgets/designerView/extensions/GrayOutExtension.js +5 -5
- package/dist/elements/widgets/designerView/extensions/GridExtension.js +2 -2
- package/dist/elements/widgets/designerView/extensions/IExtensionManger.d.ts +1 -0
- package/dist/elements/widgets/designerView/extensions/InvisibleDivExtension.js +1 -1
- package/dist/elements/widgets/designerView/extensions/MouseOverExtension.js +2 -2
- package/dist/elements/widgets/designerView/extensions/PathExtension.js +2 -2
- package/dist/elements/widgets/designerView/extensions/PositionExtension.js +6 -6
- package/dist/elements/widgets/designerView/extensions/PrimarySelectionDefaultExtension.js +2 -2
- package/dist/elements/widgets/designerView/extensions/PrimarySelectionDefaultExtensionProvider.d.ts +1 -0
- package/dist/elements/widgets/designerView/extensions/PrimarySelectionDefaultExtensionProvider.js +4 -0
- package/dist/elements/widgets/designerView/extensions/ResizeExtension.js +21 -21
- package/dist/elements/widgets/designerView/extensions/ResizeExtensionProvider.d.ts +1 -0
- package/dist/elements/widgets/designerView/extensions/ResizeExtensionProvider.js +4 -0
- package/dist/elements/widgets/designerView/extensions/RotateExtension.js +3 -3
- package/dist/elements/widgets/designerView/extensions/SelectionDefaultExtension.js +1 -1
- package/dist/elements/widgets/designerView/extensions/TransformOriginExtension.js +6 -6
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/AbstractDesignerPointerExtension.d.ts +3 -14
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/AbstractDesignerPointerExtension.js +4 -75
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorLinePointerExtension copy.d.ts +13 -0
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorLinePointerExtension copy.js +27 -0
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorLinePointerExtension.d.ts +13 -0
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorLinePointerExtension.js +26 -0
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorLinePointerExtensionProvider.d.ts +7 -0
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorLinePointerExtensionProvider.js +10 -0
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorRectanglePointerExtension copy.d.ts +7 -1
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/CursorRectanglePointerExtension copy.js +15 -8
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/IDesignerPointerExtension.d.ts +1 -1
- package/dist/elements/widgets/designerView/extensions/pointerExtensions/IDesignerPointerExtensionProvider.d.ts +1 -4
- package/dist/elements/widgets/designerView/overlayLayerView.d.ts +4 -0
- package/dist/elements/widgets/designerView/overlayLayerView.js +55 -2
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3 -0
- package/package.json +1 -1
|
@@ -12,12 +12,12 @@ export declare enum CommandType {
|
|
|
12
12
|
'moveToBack' = "moveToBack",
|
|
13
13
|
'arrangeLeft' = "arrangeLeft",
|
|
14
14
|
'arrangeCenter' = "arrangeCenter",
|
|
15
|
-
'
|
|
15
|
+
'arrangeRight' = "arrangeRight",
|
|
16
16
|
'arrangeTop' = "arrangeTop",
|
|
17
17
|
'arrangeMiddle' = "arrangeMiddle",
|
|
18
18
|
'arrangeBottom' = "arrangeBottom",
|
|
19
|
-
'
|
|
20
|
-
'
|
|
19
|
+
'unifyWidth' = "unifyWidth",
|
|
20
|
+
'unifyHeight' = "unifyHeight",
|
|
21
21
|
'distributeHorizontal' = "distributeHorizontaly",
|
|
22
22
|
'distributeVertical' = "distributeVertical",
|
|
23
23
|
'setTool' = "setTool",
|
|
@@ -13,12 +13,12 @@ export var CommandType;
|
|
|
13
13
|
CommandType["moveToBack"] = "moveToBack";
|
|
14
14
|
CommandType["arrangeLeft"] = "arrangeLeft";
|
|
15
15
|
CommandType["arrangeCenter"] = "arrangeCenter";
|
|
16
|
-
CommandType["
|
|
16
|
+
CommandType["arrangeRight"] = "arrangeRight";
|
|
17
17
|
CommandType["arrangeTop"] = "arrangeTop";
|
|
18
18
|
CommandType["arrangeMiddle"] = "arrangeMiddle";
|
|
19
19
|
CommandType["arrangeBottom"] = "arrangeBottom";
|
|
20
|
-
CommandType["
|
|
21
|
-
CommandType["
|
|
20
|
+
CommandType["unifyWidth"] = "unifyWidth";
|
|
21
|
+
CommandType["unifyHeight"] = "unifyHeight";
|
|
22
22
|
CommandType["distributeHorizontal"] = "distributeHorizontaly";
|
|
23
23
|
CommandType["distributeVertical"] = "distributeVertical";
|
|
24
24
|
CommandType["setTool"] = "setTool";
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseCustomWebComponentConstructorAppend } from '@node-projects/base-custom-webcomponent';
|
|
2
|
+
export declare class NumericPopup extends BaseCustomWebComponentConstructorAppend {
|
|
3
|
+
static readonly style: CSSStyleSheet;
|
|
4
|
+
static readonly template: HTMLTemplateElement;
|
|
5
|
+
ready(): void;
|
|
6
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { BaseCustomWebComponentConstructorAppend, css, html } from '@node-projects/base-custom-webcomponent';
|
|
2
|
+
export class NumericPopup extends BaseCustomWebComponentConstructorAppend {
|
|
3
|
+
static style = css `
|
|
4
|
+
:host {
|
|
5
|
+
}
|
|
6
|
+
.predefined {
|
|
7
|
+
grid-template-rows: 1fr 1fr 1fr 1fr 1fr;
|
|
8
|
+
grid-template-columns: 1fr 1fr;
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
static template = html `
|
|
12
|
+
<div>
|
|
13
|
+
<input type="range" min="0" max="100">
|
|
14
|
+
<input id="value">
|
|
15
|
+
<select>
|
|
16
|
+
<option>px</option>
|
|
17
|
+
<option>%</option>
|
|
18
|
+
<option>pt</option>
|
|
19
|
+
<option>em</option>
|
|
20
|
+
<option>rem</option>
|
|
21
|
+
<option>auto</option>
|
|
22
|
+
</select>
|
|
23
|
+
</div>
|
|
24
|
+
<div class="predefined">
|
|
25
|
+
<button>Auto</button>
|
|
26
|
+
<button>0</button>
|
|
27
|
+
<button>10</button>
|
|
28
|
+
<button>20</button>
|
|
29
|
+
<button>40</button>
|
|
30
|
+
<button>50</button>
|
|
31
|
+
<button>70</button>
|
|
32
|
+
<button>90</button>
|
|
33
|
+
<button>100</button>
|
|
34
|
+
</div>
|
|
35
|
+
`;
|
|
36
|
+
ready() {
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
customElements.define('node-projects-numeric-popup', NumericPopup);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseCustomWebComponentConstructorAppend, TypedEvent } from '@node-projects/base-custom-webcomponent';
|
|
2
|
+
export declare type ImageButtonListSelectorValueChangedEventArgs = {
|
|
3
|
+
newValue?: string;
|
|
4
|
+
oldValue?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare class NumericStyleInput extends BaseCustomWebComponentConstructorAppend {
|
|
7
|
+
static readonly style: CSSStyleSheet;
|
|
8
|
+
static readonly template: HTMLTemplateElement;
|
|
9
|
+
private _value;
|
|
10
|
+
get value(): string;
|
|
11
|
+
set value(value: string);
|
|
12
|
+
valueChanged: TypedEvent<ImageButtonListSelectorValueChangedEventArgs>;
|
|
13
|
+
private _input;
|
|
14
|
+
constructor();
|
|
15
|
+
private _updateValue;
|
|
16
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { BaseCustomWebComponentConstructorAppend, css, html, TypedEvent } from '@node-projects/base-custom-webcomponent';
|
|
2
|
+
export class NumericStyleInput extends BaseCustomWebComponentConstructorAppend {
|
|
3
|
+
static style = css `
|
|
4
|
+
:host {
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
input {
|
|
8
|
+
cursor: ew-resize;
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
static template = html `
|
|
12
|
+
<input id="input" type="text">
|
|
13
|
+
<select id="select">
|
|
14
|
+
<option>px</option>
|
|
15
|
+
<option>%</option>
|
|
16
|
+
<option>pt</option>
|
|
17
|
+
</select>
|
|
18
|
+
`;
|
|
19
|
+
_value;
|
|
20
|
+
get value() {
|
|
21
|
+
return this._value;
|
|
22
|
+
}
|
|
23
|
+
set value(value) {
|
|
24
|
+
const oldValue = this._value;
|
|
25
|
+
this._value = value;
|
|
26
|
+
this._updateValue();
|
|
27
|
+
this.valueChanged.emit({ newValue: this._value, oldValue: oldValue });
|
|
28
|
+
}
|
|
29
|
+
valueChanged = new TypedEvent();
|
|
30
|
+
_input;
|
|
31
|
+
//private _select: HTMLSelectElement;
|
|
32
|
+
constructor() {
|
|
33
|
+
super();
|
|
34
|
+
this._input = this._getDomElement('input');
|
|
35
|
+
//this._select = this._getDomElement<HTMLSelectElement>('select');
|
|
36
|
+
let oldX = null;
|
|
37
|
+
this._input.onpointerdown = (e) => {
|
|
38
|
+
oldX = e.x;
|
|
39
|
+
this._input.setPointerCapture(e.pointerId);
|
|
40
|
+
};
|
|
41
|
+
this._input.onpointermove = (e) => {
|
|
42
|
+
if (oldX !== null) {
|
|
43
|
+
let diffX = e.x - oldX;
|
|
44
|
+
if (diffX != 0)
|
|
45
|
+
this._input.value = parseInt(this._input.value) + diffX;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
this._input.onpointerup = (e) => {
|
|
49
|
+
oldX = null;
|
|
50
|
+
this._input.releasePointerCapture(e.pointerId);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
_updateValue() {
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
customElements.define('node-projects-numeric-style-input', NumericStyleInput);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BaseCustomWebComponentConstructorAppend, TypedEvent } from '@node-projects/base-custom-webcomponent';
|
|
2
|
+
export declare type ThicknessEditorValueChangedEventArgs = {
|
|
3
|
+
newValue?: string;
|
|
4
|
+
oldValue?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare class ThicknessEditor extends BaseCustomWebComponentConstructorAppend {
|
|
7
|
+
static readonly style: CSSStyleSheet;
|
|
8
|
+
static readonly template: HTMLTemplateElement;
|
|
9
|
+
private _leftInput;
|
|
10
|
+
private _topInput;
|
|
11
|
+
private _rightInput;
|
|
12
|
+
private _bottomInput;
|
|
13
|
+
private _valueLeft;
|
|
14
|
+
get valueLeft(): string;
|
|
15
|
+
set valueLeft(value: string);
|
|
16
|
+
valueLeftChanged: TypedEvent<ThicknessEditorValueChangedEventArgs>;
|
|
17
|
+
private _valueTop;
|
|
18
|
+
get valueTop(): string;
|
|
19
|
+
set valueTop(value: string);
|
|
20
|
+
valueTopChanged: TypedEvent<ThicknessEditorValueChangedEventArgs>;
|
|
21
|
+
private _valueRight;
|
|
22
|
+
get valueRight(): string;
|
|
23
|
+
set valueRight(value: string);
|
|
24
|
+
valueRightChanged: TypedEvent<ThicknessEditorValueChangedEventArgs>;
|
|
25
|
+
private _valueBottom;
|
|
26
|
+
get valueBottom(): string;
|
|
27
|
+
set valueBottom(value: string);
|
|
28
|
+
valueBottomChanged: TypedEvent<ThicknessEditorValueChangedEventArgs>;
|
|
29
|
+
property: string;
|
|
30
|
+
unsetValue: string;
|
|
31
|
+
_updateValue(): void;
|
|
32
|
+
ready(): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { BaseCustomWebComponentConstructorAppend, css, html, TypedEvent } from '@node-projects/base-custom-webcomponent';
|
|
2
|
+
export class ThicknessEditor extends BaseCustomWebComponentConstructorAppend {
|
|
3
|
+
static style = css `
|
|
4
|
+
:host {
|
|
5
|
+
margin: 4px;
|
|
6
|
+
margin-left: auto;
|
|
7
|
+
margin-right: auto;
|
|
8
|
+
}
|
|
9
|
+
#container {
|
|
10
|
+
display: grid;
|
|
11
|
+
grid-template-columns: minmax(30px, 40px) minmax(30px, 60px) minmax(30px, 40px);
|
|
12
|
+
grid-template-rows: auto;
|
|
13
|
+
grid-template-areas:
|
|
14
|
+
" . top ."
|
|
15
|
+
"left middle right"
|
|
16
|
+
" . bottom .";
|
|
17
|
+
column-gap: 2px;
|
|
18
|
+
row-gap: 2px;
|
|
19
|
+
}
|
|
20
|
+
input {
|
|
21
|
+
width: 20px;
|
|
22
|
+
text-align: center;
|
|
23
|
+
font-size: 10px;
|
|
24
|
+
height: 20px;
|
|
25
|
+
padding: 0;
|
|
26
|
+
}
|
|
27
|
+
#left {
|
|
28
|
+
grid-area: left;
|
|
29
|
+
justify-self: end;
|
|
30
|
+
}
|
|
31
|
+
#top {
|
|
32
|
+
grid-area: top;
|
|
33
|
+
align-self: end;
|
|
34
|
+
justify-self: center;
|
|
35
|
+
}
|
|
36
|
+
#right {
|
|
37
|
+
grid-area: right;
|
|
38
|
+
justify-self: start;
|
|
39
|
+
}
|
|
40
|
+
#bottom {
|
|
41
|
+
grid-area: bottom;
|
|
42
|
+
align-self: start;
|
|
43
|
+
justify-self: center;
|
|
44
|
+
}
|
|
45
|
+
#rect {
|
|
46
|
+
grid-area: middle;
|
|
47
|
+
border: 1px solid black;
|
|
48
|
+
background: lightgray;
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
static template = html `
|
|
52
|
+
<div id="container">
|
|
53
|
+
<input id="left">
|
|
54
|
+
<input id="top">
|
|
55
|
+
<input id="right">
|
|
56
|
+
<input id="bottom">
|
|
57
|
+
<div id="rect"></div>
|
|
58
|
+
</div>
|
|
59
|
+
`;
|
|
60
|
+
_leftInput;
|
|
61
|
+
_topInput;
|
|
62
|
+
_rightInput;
|
|
63
|
+
_bottomInput;
|
|
64
|
+
_valueLeft;
|
|
65
|
+
get valueLeft() {
|
|
66
|
+
return this._valueLeft;
|
|
67
|
+
}
|
|
68
|
+
set valueLeft(value) {
|
|
69
|
+
const oldValue = this._valueLeft;
|
|
70
|
+
this._valueLeft = value;
|
|
71
|
+
if (oldValue !== value) {
|
|
72
|
+
this._updateValue();
|
|
73
|
+
this.valueLeftChanged.emit({ newValue: value, oldValue: oldValue });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
valueLeftChanged = new TypedEvent();
|
|
77
|
+
_valueTop;
|
|
78
|
+
get valueTop() {
|
|
79
|
+
return this._valueTop;
|
|
80
|
+
}
|
|
81
|
+
set valueTop(value) {
|
|
82
|
+
const oldValue = this._valueTop;
|
|
83
|
+
this._valueTop = value;
|
|
84
|
+
if (oldValue !== value) {
|
|
85
|
+
this._updateValue();
|
|
86
|
+
this.valueTopChanged.emit({ newValue: value, oldValue: oldValue });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
valueTopChanged = new TypedEvent();
|
|
90
|
+
_valueRight;
|
|
91
|
+
get valueRight() {
|
|
92
|
+
return this._valueRight;
|
|
93
|
+
}
|
|
94
|
+
set valueRight(value) {
|
|
95
|
+
const oldValue = this._valueRight;
|
|
96
|
+
this._valueRight = value;
|
|
97
|
+
if (oldValue !== value) {
|
|
98
|
+
this._updateValue();
|
|
99
|
+
this.valueRightChanged.emit({ newValue: value, oldValue: oldValue });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
valueRightChanged = new TypedEvent();
|
|
103
|
+
_valueBottom;
|
|
104
|
+
get valueBottom() {
|
|
105
|
+
return this._valueBottom;
|
|
106
|
+
}
|
|
107
|
+
set valueBottom(value) {
|
|
108
|
+
const oldValue = this._valueBottom;
|
|
109
|
+
this._valueBottom = value;
|
|
110
|
+
if (oldValue !== value) {
|
|
111
|
+
this._updateValue();
|
|
112
|
+
this.valueBottomChanged.emit({ newValue: value, oldValue: oldValue });
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
valueBottomChanged = new TypedEvent();
|
|
116
|
+
property;
|
|
117
|
+
unsetValue;
|
|
118
|
+
_updateValue() {
|
|
119
|
+
this._leftInput.value = this.valueLeft;
|
|
120
|
+
this._topInput.value = this.valueTop;
|
|
121
|
+
this._rightInput.value = this.valueRight;
|
|
122
|
+
this._bottomInput.value = this._valueBottom;
|
|
123
|
+
}
|
|
124
|
+
ready() {
|
|
125
|
+
this._parseAttributesToProperties();
|
|
126
|
+
this._leftInput = this._getDomElement('left');
|
|
127
|
+
this._topInput = this._getDomElement('top');
|
|
128
|
+
this._rightInput = this._getDomElement('right');
|
|
129
|
+
this._bottomInput = this._getDomElement('bottom');
|
|
130
|
+
this._leftInput.onkeyup = (e) => { if (e.key === 'Enter')
|
|
131
|
+
this._valueLeft = this._leftInput.value; };
|
|
132
|
+
this._topInput.onkeyup = (e) => { if (e.key === 'Enter')
|
|
133
|
+
this._valueTop = this._topInput.value; };
|
|
134
|
+
this._rightInput.onkeyup = (e) => { if (e.key === 'Enter')
|
|
135
|
+
this._valueRight = this._rightInput.value; };
|
|
136
|
+
this._bottomInput.onkeyup = (e) => { if (e.key === 'Enter')
|
|
137
|
+
this._valueBottom = this._bottomInput.value; };
|
|
138
|
+
this._leftInput.onblur = (e) => this._valueLeft = this._leftInput.value;
|
|
139
|
+
this._topInput.onblur = (e) => this._valueTop = this._topInput.value;
|
|
140
|
+
this._rightInput.onblur = (e) => this._valueRight = this._rightInput.value;
|
|
141
|
+
this._bottomInput.onblur = (e) => this._valueBottom = this._bottomInput.value;
|
|
142
|
+
this._updateValue();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
customElements.define('node-projects-thickness-editor', ThicknessEditor);
|
|
@@ -123,7 +123,6 @@ export class ThicknessEditor extends BaseCustomWebComponentConstructorAppend {
|
|
|
123
123
|
}
|
|
124
124
|
ready() {
|
|
125
125
|
this._parseAttributesToProperties();
|
|
126
|
-
this._updateValue();
|
|
127
126
|
this._leftInput = this._getDomElement('left');
|
|
128
127
|
this._topInput = this._getDomElement('top');
|
|
129
128
|
this._rightInput = this._getDomElement('right');
|
|
@@ -140,6 +139,7 @@ export class ThicknessEditor extends BaseCustomWebComponentConstructorAppend {
|
|
|
140
139
|
this._topInput.onblur = (e) => this._valueTop = this._topInput.value;
|
|
141
140
|
this._rightInput.onblur = (e) => this._valueRight = this._rightInput.value;
|
|
142
141
|
this._bottomInput.onblur = (e) => this._valueBottom = this._bottomInput.value;
|
|
142
|
+
this._updateValue();
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
customElements.define('node-projects-thickness-editor', ThicknessEditor);
|
|
File without changes
|
|
@@ -17,7 +17,6 @@ export class BaseServiceContainer {
|
|
|
17
17
|
forSomeServicesTillResult(service, callback) {
|
|
18
18
|
let services = this.getServices(service);
|
|
19
19
|
if (services == null) {
|
|
20
|
-
console.warn('no services of type: ' + service + ' found');
|
|
21
20
|
return null;
|
|
22
21
|
}
|
|
23
22
|
for (let index = services.length - 1; index >= 0; index--) {
|
|
@@ -31,7 +30,6 @@ export class BaseServiceContainer {
|
|
|
31
30
|
getLastServiceWhere(service, callback) {
|
|
32
31
|
let services = this.getServices(service);
|
|
33
32
|
if (services == null) {
|
|
34
|
-
console.warn('no services of type: ' + service + ' found');
|
|
35
33
|
return null;
|
|
36
34
|
}
|
|
37
35
|
for (let index = services.length - 1; index >= 0; index--) {
|
|
@@ -44,6 +44,7 @@ import { PrepareElementsForDesignerService } from './instanceService/PrepareElem
|
|
|
44
44
|
import { DragDropService } from './dragDropService/DragDropService';
|
|
45
45
|
import { EditTextExtensionProvider } from '../widgets/designerView/extensions/EditText/EditTextExtensionProvider.js';
|
|
46
46
|
import { CopyPasteService } from './copyPasteService/CopyPasteService';
|
|
47
|
+
import { DefaultModelCommandService } from './modelCommandService/DefaultModelCommandService';
|
|
47
48
|
export function createDefaultServiceContainer() {
|
|
48
49
|
let serviceContainer = new ServiceContainer();
|
|
49
50
|
serviceContainer.register("propertyService", new PolymerPropertiesService());
|
|
@@ -63,6 +64,7 @@ export function createDefaultServiceContainer() {
|
|
|
63
64
|
serviceContainer.register("prepareElementsForDesignerService", new PrepareElementsForDesignerService());
|
|
64
65
|
serviceContainer.register("dragDropService", new DragDropService());
|
|
65
66
|
serviceContainer.register("copyPasteService", new CopyPasteService());
|
|
67
|
+
serviceContainer.register("modelCommandService", new DefaultModelCommandService());
|
|
66
68
|
serviceContainer.designerExtensions.set(ExtensionType.Permanent, [
|
|
67
69
|
new ResizeExtensionProvider(false),
|
|
68
70
|
new InvisibleDivExtensionProvider()
|
|
@@ -21,6 +21,8 @@ import { ISnaplinesProviderService } from "./placementService/ISnaplinesProvider
|
|
|
21
21
|
import { IPrepareElementsForDesignerService } from './instanceService/IPrepareElementsForDesignerService';
|
|
22
22
|
import { IDragDropService } from './dragDropService/IDragDropService';
|
|
23
23
|
import { ICopyPasteService } from "./copyPasteService/ICopyPasteService.js";
|
|
24
|
+
import { IDesignerPointerExtensionProvider } from "../widgets/designerView/extensions/pointerExtensions/IDesignerPointerExtensionProvider.js";
|
|
25
|
+
import { IModelCommandService } from "./modelCommandService/IModelCommandService.js";
|
|
24
26
|
interface ServiceNameMap {
|
|
25
27
|
"propertyService": IPropertiesService;
|
|
26
28
|
"containerService": IPlacementService;
|
|
@@ -36,6 +38,7 @@ interface ServiceNameMap {
|
|
|
36
38
|
"prepareElementsForDesignerService": IPrepareElementsForDesignerService;
|
|
37
39
|
"dragDropService": IDragDropService;
|
|
38
40
|
"copyPasteService": ICopyPasteService;
|
|
41
|
+
"modelCommandService": IModelCommandService;
|
|
39
42
|
}
|
|
40
43
|
export declare class ServiceContainer extends BaseServiceContainer<ServiceNameMap> {
|
|
41
44
|
readonly config: {
|
|
@@ -43,6 +46,7 @@ export declare class ServiceContainer extends BaseServiceContainer<ServiceNameMa
|
|
|
43
46
|
demoViewWidget: new (...args: any[]) => IDemoView & HTMLElement;
|
|
44
47
|
};
|
|
45
48
|
readonly designerExtensions: Map<(ExtensionType | string), IDesignerExtensionProvider[]>;
|
|
49
|
+
readonly designerPointerExtensions: IDesignerPointerExtensionProvider[];
|
|
46
50
|
designerContextMenuExtensions: IContextMenuExtension[];
|
|
47
51
|
readonly globalContext: GlobalContext;
|
|
48
52
|
readonly designerTools: Map<string | NamedTools, ITool>;
|
|
@@ -60,5 +64,6 @@ export declare class ServiceContainer extends BaseServiceContainer<ServiceNameMa
|
|
|
60
64
|
get prepareElementsForDesignerService(): IPrepareElementsForDesignerService;
|
|
61
65
|
get dragDropService(): IDragDropService;
|
|
62
66
|
get copyPasteService(): ICopyPasteService;
|
|
67
|
+
get modelCommandService(): IModelCommandService;
|
|
63
68
|
}
|
|
64
69
|
export {};
|
|
@@ -8,6 +8,7 @@ export class ServiceContainer extends BaseServiceContainer {
|
|
|
8
8
|
demoViewWidget: DemoView
|
|
9
9
|
};
|
|
10
10
|
designerExtensions = new Map();
|
|
11
|
+
designerPointerExtensions = [];
|
|
11
12
|
designerContextMenuExtensions;
|
|
12
13
|
globalContext = new GlobalContext(this);
|
|
13
14
|
designerTools = new Map();
|
|
@@ -53,4 +54,7 @@ export class ServiceContainer extends BaseServiceContainer {
|
|
|
53
54
|
get copyPasteService() {
|
|
54
55
|
return this.getLastService('copyPasteService');
|
|
55
56
|
}
|
|
57
|
+
get modelCommandService() {
|
|
58
|
+
return this.getLastService('modelCommandService');
|
|
59
|
+
}
|
|
56
60
|
}
|
|
@@ -9,12 +9,12 @@ export class HtmlWriterService {
|
|
|
9
9
|
}
|
|
10
10
|
_conditionalyWriteIndent(indentedTextWriter, designItem) {
|
|
11
11
|
if ((designItem.element instanceof HTMLElement && !isInline(designItem.element)) ||
|
|
12
|
-
(designItem.element.
|
|
12
|
+
(designItem.element.previousElementSibling instanceof HTMLElement && !isInline(designItem.element.previousElementSibling)))
|
|
13
13
|
indentedTextWriter.writeIndent();
|
|
14
14
|
}
|
|
15
15
|
_conditionalyWriteNewline(indentedTextWriter, designItem) {
|
|
16
16
|
if ((designItem.element instanceof HTMLElement && !isInline(designItem.element)) ||
|
|
17
|
-
(designItem.element.
|
|
17
|
+
(designItem.element.nextElementSibling instanceof HTMLElement && !isInline(designItem.element.nextElementSibling)))
|
|
18
18
|
indentedTextWriter.writeNewline();
|
|
19
19
|
}
|
|
20
20
|
write(indentedTextWriter, designItem, options, designItemsAssignmentList) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IInstanceService } from './IInstanceService';
|
|
2
|
+
import { IElementDefinition } from '../elementsService/IElementDefinition';
|
|
3
|
+
import type { ServiceContainer } from '../ServiceContainer';
|
|
4
|
+
import type { InstanceServiceContainer } from '../InstanceServiceContainer';
|
|
5
|
+
import { IDesignItem } from '../../item/IDesignItem';
|
|
6
|
+
export declare class DefaultInstanceService implements IInstanceService {
|
|
7
|
+
getElement(definition: IElementDefinition, serviceContainer: ServiceContainer, instanceServiceContainer: InstanceServiceContainer): Promise<IDesignItem>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DesignItem } from '../../item/DesignItem';
|
|
2
|
+
export class DefaultInstanceService {
|
|
3
|
+
handleMoveCommand(command) {
|
|
4
|
+
let sel = this.instanceServiceContainer.selectionService.primarySelection;
|
|
5
|
+
if (command == CommandType.moveBackward)
|
|
6
|
+
this.instanceServiceContainer.undoService.execute(new MoveElementInDomAction(sel, DesignItem.GetDesignItem(sel.element.previousElementSibling), 'beforebegin', DesignItem.GetDesignItem(sel.element.previousElementSibling), 'afterend'));
|
|
7
|
+
else if (command == CommandType.moveForward)
|
|
8
|
+
this.instanceServiceContainer.undoService.execute(new MoveElementInDomAction(sel, DesignItem.GetDesignItem(sel.element.nextElementSibling), 'afterend', DesignItem.GetDesignItem(sel.element.nextElementSibling), 'beforebegin'));
|
|
9
|
+
else if (command == CommandType.moveToBack)
|
|
10
|
+
this.instanceServiceContainer.undoService.execute(new MoveElementInDomAction(sel, DesignItem.GetDesignItem(sel.element.parentElement), 'afterbegin', DesignItem.GetDesignItem(sel.element.previousElementSibling), 'afterend'));
|
|
11
|
+
else if (command == CommandType.moveToFront)
|
|
12
|
+
this.instanceServiceContainer.undoService.execute(new MoveElementInDomAction(sel, DesignItem.GetDesignItem(sel.element.parentElement), 'beforeend', DesignItem.GetDesignItem(sel.element.nextElementSibling), 'beforebegin'));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IUiCommand } from "../../../commandHandling/IUiCommand.js";
|
|
2
|
+
import { IDesignerCanvas } from "../../widgets/designerView/IDesignerCanvas.js";
|
|
3
|
+
import { IModelCommandService } from "./IModelCommandService.js";
|
|
4
|
+
export declare class DefaultModelCommandService implements IModelCommandService {
|
|
5
|
+
canExecuteCommand(designerCanvas: IDesignerCanvas, command: IUiCommand): boolean;
|
|
6
|
+
executeCommand(designerCanvas: IDesignerCanvas, command: IUiCommand): Promise<boolean>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { CommandType } from "../../../commandHandling/CommandType.js";
|
|
2
|
+
import { DesignItem } from "../../item/DesignItem.js";
|
|
3
|
+
import { MoveElementInDomAction } from "../undoService/transactionItems/MoveElementInDomAction.js";
|
|
4
|
+
export class DefaultModelCommandService {
|
|
5
|
+
canExecuteCommand(designerCanvas, command) {
|
|
6
|
+
if (command.type == CommandType.moveBackward ||
|
|
7
|
+
command.type == CommandType.moveForward ||
|
|
8
|
+
command.type == CommandType.moveToBack ||
|
|
9
|
+
command.type == CommandType.moveToFront)
|
|
10
|
+
return designerCanvas.instanceServiceContainer.selectionService.primarySelection != null;
|
|
11
|
+
if (command.type == CommandType.arrangeBottom ||
|
|
12
|
+
command.type == CommandType.arrangeCenter ||
|
|
13
|
+
command.type == CommandType.arrangeLeft ||
|
|
14
|
+
command.type == CommandType.arrangeMiddle ||
|
|
15
|
+
command.type == CommandType.arrangeRight ||
|
|
16
|
+
command.type == CommandType.arrangeTop ||
|
|
17
|
+
command.type == CommandType.unifyHeight ||
|
|
18
|
+
command.type == CommandType.unifyWidth)
|
|
19
|
+
return designerCanvas.instanceServiceContainer.selectionService.selectedElements.length > 1;
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
async executeCommand(designerCanvas, command) {
|
|
23
|
+
let sel = designerCanvas.instanceServiceContainer.selectionService.primarySelection;
|
|
24
|
+
if (command.type == CommandType.moveBackward)
|
|
25
|
+
designerCanvas.instanceServiceContainer.undoService.execute(new MoveElementInDomAction(sel, DesignItem.GetDesignItem(sel.element.previousElementSibling), 'beforebegin', DesignItem.GetDesignItem(sel.element.previousElementSibling), 'afterend'));
|
|
26
|
+
else if (command.type == CommandType.moveForward)
|
|
27
|
+
designerCanvas.instanceServiceContainer.undoService.execute(new MoveElementInDomAction(sel, DesignItem.GetDesignItem(sel.element.nextElementSibling), 'afterend', DesignItem.GetDesignItem(sel.element.nextElementSibling), 'beforebegin'));
|
|
28
|
+
else if (command.type == CommandType.moveToBack)
|
|
29
|
+
designerCanvas.instanceServiceContainer.undoService.execute(new MoveElementInDomAction(sel, DesignItem.GetDesignItem(sel.element.parentElement), 'afterbegin', DesignItem.GetDesignItem(sel.element.previousElementSibling), 'afterend'));
|
|
30
|
+
else if (command.type == CommandType.moveToFront)
|
|
31
|
+
designerCanvas.instanceServiceContainer.undoService.execute(new MoveElementInDomAction(sel, DesignItem.GetDesignItem(sel.element.parentElement), 'beforeend', DesignItem.GetDesignItem(sel.element.nextElementSibling), 'beforebegin'));
|
|
32
|
+
else if (command.type == CommandType.arrangeLeft) {
|
|
33
|
+
const grp = designerCanvas.instanceServiceContainer.selectionService.primarySelection.openGroup('arrangeLeft');
|
|
34
|
+
const left = designerCanvas.instanceServiceContainer.selectionService.primarySelection.styles.get('left');
|
|
35
|
+
for (let s of designerCanvas.instanceServiceContainer.selectionService.selectedElements) {
|
|
36
|
+
s.setStyle('left', left);
|
|
37
|
+
}
|
|
38
|
+
grp.commit();
|
|
39
|
+
}
|
|
40
|
+
else if (command.type == CommandType.arrangeTop) {
|
|
41
|
+
const grp = designerCanvas.instanceServiceContainer.selectionService.primarySelection.openGroup('arrangeTop');
|
|
42
|
+
const top = designerCanvas.instanceServiceContainer.selectionService.primarySelection.styles.get('top');
|
|
43
|
+
for (let s of designerCanvas.instanceServiceContainer.selectionService.selectedElements) {
|
|
44
|
+
s.setStyle('top', top);
|
|
45
|
+
}
|
|
46
|
+
grp.commit();
|
|
47
|
+
}
|
|
48
|
+
else if (command.type == CommandType.unifyHeight) {
|
|
49
|
+
const grp = designerCanvas.instanceServiceContainer.selectionService.primarySelection.openGroup('unifyHeight');
|
|
50
|
+
const height = designerCanvas.instanceServiceContainer.selectionService.primarySelection.styles.get('height');
|
|
51
|
+
for (let s of designerCanvas.instanceServiceContainer.selectionService.selectedElements) {
|
|
52
|
+
s.setStyle('height', height);
|
|
53
|
+
}
|
|
54
|
+
grp.commit();
|
|
55
|
+
}
|
|
56
|
+
else if (command.type == CommandType.unifyWidth) {
|
|
57
|
+
const grp = designerCanvas.instanceServiceContainer.selectionService.primarySelection.openGroup('unifyWidth');
|
|
58
|
+
const width = designerCanvas.instanceServiceContainer.selectionService.primarySelection.styles.get('width');
|
|
59
|
+
for (let s of designerCanvas.instanceServiceContainer.selectionService.selectedElements) {
|
|
60
|
+
s.setStyle('width', width);
|
|
61
|
+
}
|
|
62
|
+
grp.commit();
|
|
63
|
+
}
|
|
64
|
+
else
|
|
65
|
+
return null;
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IService } from '../IService';
|
|
2
|
+
import { IElementDefinition } from '../elementsService/IElementDefinition';
|
|
3
|
+
import type { ServiceContainer } from '../ServiceContainer';
|
|
4
|
+
import type { InstanceServiceContainer } from '../InstanceServiceContainer';
|
|
5
|
+
import { IDesignItem } from '../../item/IDesignItem';
|
|
6
|
+
export interface IInstanceService extends IService {
|
|
7
|
+
getElement(definition: IElementDefinition, serviceContainer: ServiceContainer, instanceServiceContainer: InstanceServiceContainer): Promise<IDesignItem>;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IUiCommand } from '../../../commandHandling/IUiCommand.js';
|
|
2
|
+
import { IDesignerCanvas } from '../../widgets/designerView/IDesignerCanvas.js';
|
|
3
|
+
import { IService } from '../IService';
|
|
4
|
+
export interface IModelCommandService extends IService {
|
|
5
|
+
canExecuteCommand(designerCanvas: IDesignerCanvas, command: IUiCommand): boolean | null;
|
|
6
|
+
executeCommand(designerCanvas: IDesignerCanvas, command: IUiCommand): any;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -89,9 +89,9 @@ export class DefaultPlacementService {
|
|
|
89
89
|
let track = this.calculateTrack(event, placementView, startPoint, offsetInControl, newPoint, items[0]);
|
|
90
90
|
for (const designItem of items) {
|
|
91
91
|
let movedElement = designItem.element;
|
|
92
|
-
let oldLeft =
|
|
92
|
+
let oldLeft = parseFloat(movedElement.style.left);
|
|
93
93
|
oldLeft = Number.isNaN(oldLeft) ? 0 : oldLeft;
|
|
94
|
-
let oldTop =
|
|
94
|
+
let oldTop = parseFloat(movedElement.style.top);
|
|
95
95
|
oldTop = Number.isNaN(oldTop) ? 0 : oldTop;
|
|
96
96
|
//let oldPosition = movedElement.style.position;
|
|
97
97
|
designItem.element.style.transform = null;
|
|
@@ -2,10 +2,13 @@ import { ITransactionItem } from './ITransactionItem.js';
|
|
|
2
2
|
import { ChangeGroup } from "./ChangeGroup.js";
|
|
3
3
|
import { IUndoService } from './IUndoService.js';
|
|
4
4
|
import { IDesignItem } from '../../item/IDesignItem';
|
|
5
|
+
import { IDesignerCanvas } from '../../widgets/designerView/IDesignerCanvas.js';
|
|
5
6
|
export declare class UndoService implements IUndoService {
|
|
6
7
|
private _undoStack;
|
|
7
8
|
private _redoStack;
|
|
8
9
|
private _transactionStack;
|
|
10
|
+
private _designerCanvas;
|
|
11
|
+
constructor(designerCanvas?: IDesignerCanvas);
|
|
9
12
|
openGroup(title: string, affectedItems: IDesignItem[]): ChangeGroup;
|
|
10
13
|
private commitTransactionItem;
|
|
11
14
|
private abortTransactionItem;
|