@node-projects/web-component-designer 0.0.290 → 0.0.292
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/NpmPackageHacks.json +4 -0
- package/dist/elements/helper/NpmPackageLoader.d.ts +1 -0
- package/dist/elements/helper/NpmPackageLoader.js +3 -0
- package/dist/elements/item/DesignItem.js +6 -1
- package/dist/elements/services/dragDropService/DragDropService.js +0 -3
- package/dist/elements/services/eventsService/EventsService.d.ts +42 -10
- package/dist/elements/services/eventsService/EventsService.js +75 -63
- package/dist/elements/services/eventsService/IEvent.d.ts +1 -0
- package/dist/elements/services/eventsService/IEventsService.d.ts +1 -0
- package/dist/elements/services/placementService/DefaultPlacementService.js +1 -0
- package/dist/elements/services/placementService/FlexBoxPlacementService.js +1 -0
- package/dist/elements/services/placementService/GridPlacementService.js +1 -0
- package/dist/elements/services/propertiesService/PropertyTabsService.js +3 -0
- package/dist/elements/services/propertiesService/services/CssCustomPropertiesService.js +1 -1
- package/dist/elements/services/propertiesService/services/UnkownElementsPropertiesService.d.ts +10 -0
- package/dist/elements/services/propertiesService/services/UnkownElementsPropertiesService.js +28 -0
- package/dist/elements/services/propertiesService/services/UnkownElemntPropertiesService.d.ts +24 -0
- package/dist/elements/services/propertiesService/services/UnkownElemntPropertiesService.js +198 -0
- package/dist/elements/services/propertiesService/services/WebcomponentManifestPropertiesService.js +2 -1
- package/dist/elements/services/undoService/transactionItems/AttributeChangeAction copy.d.ts +15 -0
- package/dist/elements/services/undoService/transactionItems/AttributeChangeAction copy.js +70 -0
- package/dist/elements/services/undoService/transactionItems/TextContentChangeAction.d.ts +14 -0
- package/dist/elements/services/undoService/transactionItems/TextContentChangeAction.js +24 -0
- package/dist/elements/widgets/debugView/debug-view.js +3 -1
- package/dist/elements/widgets/designerView/extensions/SelectionDefaultExtensionProvider.js +2 -1
- package/dist/elements/widgets/designerView/tools/PointerTool.js +4 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +1 -1
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
"@microsoft/fast-components": {
|
|
6
6
|
"script": "let res = await import('@microsoft/fast-components');\nres.provideFASTDesignSystem().register(res.allComponents);"
|
|
7
7
|
},
|
|
8
|
+
"@zooplus/zoo-web-components": {
|
|
9
|
+
"script": "let res = await import('@zooplus/zoo-web-components');\nres.registerComponents(res);",
|
|
10
|
+
"style": ":root {\n--primary-mid: #3C9700;\n--primary-light: #66B100;\n--primary-dark: #286400;\n--primary-ultralight: #EBF4E5;\n--secondary-mid: #FF6200;\n--secondary-light: #F80;\n--secondary-dark: #CC4E00;\n--info-ultralight: #ECF5FA;\n--info-mid: #459FD0;\n--warning-ultralight: #FDE8E9;\n--warning-mid: #ED1C24;\n}"
|
|
11
|
+
},
|
|
8
12
|
"@material/web": {
|
|
9
13
|
"import": "@material/web/all.js"
|
|
10
14
|
}
|
|
@@ -8,6 +8,7 @@ export declare class NpmPackageLoader {
|
|
|
8
8
|
static patchCustomElementsRegistryToHandleErrors(): void;
|
|
9
9
|
loadNpmPackage(pkg: string, serviceContainer?: ServiceContainer, paletteTree?: PaletteTreeView, loadAllImports?: boolean, reportState?: (state: string) => void): Promise<{
|
|
10
10
|
html: string;
|
|
11
|
+
style: string;
|
|
11
12
|
}>;
|
|
12
13
|
loadDependency(dependency: string, version?: string, reportState?: (state: string) => void): Promise<void>;
|
|
13
14
|
addToImportmap(baseUrl: string, packageJsonObj: {
|
|
@@ -209,6 +209,9 @@ export class NpmPackageLoader {
|
|
|
209
209
|
if (packageHacks[pkg]?.html) {
|
|
210
210
|
retVal.html = (packageHacks[pkg]?.html).replaceAll("${baseUrl}", baseUrl);
|
|
211
211
|
}
|
|
212
|
+
if (packageHacks[pkg]?.style) {
|
|
213
|
+
retVal.style = (packageHacks[pkg]?.style).replaceAll("${baseUrl}", baseUrl);
|
|
214
|
+
}
|
|
212
215
|
return retVal;
|
|
213
216
|
}
|
|
214
217
|
async loadDependency(dependency, version, reportState) {
|
|
@@ -10,6 +10,7 @@ import { DeleteAction } from '../services/undoService/transactionItems/DeleteAct
|
|
|
10
10
|
import { enableStylesheetService } from '../widgets/designerView/extensions/buttons/StylesheetServiceDesignViewConfigButtons.js';
|
|
11
11
|
import { AbstractStylesheetService } from '../services/stylesheetService/AbstractStylesheetService.js';
|
|
12
12
|
import { TypedEvent, cssFromString } from '@node-projects/base-custom-webcomponent';
|
|
13
|
+
import { TextContentChangeAction } from '../services/undoService/transactionItems/TextContentChangeAction.js';
|
|
13
14
|
const hideAtDesignTimeAttributeName = 'node-projects-hide-at-design-time';
|
|
14
15
|
const hideAtRunTimeAttributeName = 'node-projects-hide-at-run-time';
|
|
15
16
|
const lockAtDesignTimeAttributeName = 'node-projects-lock-at-design-time';
|
|
@@ -205,7 +206,7 @@ export class DesignItem {
|
|
|
205
206
|
}
|
|
206
207
|
//abstract text content to own property. so only change via designer api will use it.
|
|
207
208
|
get hasContent() {
|
|
208
|
-
return this.nodeType == NodeType.TextNode || (this._childArray.length === 0 && this.content !== null);
|
|
209
|
+
return this.nodeType == NodeType.TextNode || (this.nodeType == NodeType.Comment && this.element.textContent != "") || (this._childArray.length === 0 && this.content !== null);
|
|
209
210
|
}
|
|
210
211
|
get content() {
|
|
211
212
|
if (!this.hasChildren)
|
|
@@ -224,6 +225,10 @@ export class DesignItem {
|
|
|
224
225
|
this.remove();
|
|
225
226
|
parent.insertChild(di, idx);
|
|
226
227
|
}
|
|
228
|
+
else if (this.nodeType == NodeType.Comment) {
|
|
229
|
+
const action = new TextContentChangeAction(this, value, this.content);
|
|
230
|
+
this.instanceServiceContainer.undoService.execute(action);
|
|
231
|
+
}
|
|
227
232
|
else
|
|
228
233
|
this.insertChild(di);
|
|
229
234
|
grp.commit();
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DesignItem } from '../../item/DesignItem.js';
|
|
2
|
-
import { InsertAction } from "../undoService/transactionItems/InsertAction.js";
|
|
3
2
|
import { ExtensionType } from "../../widgets/designerView/extensions/ExtensionType.js";
|
|
4
3
|
import { dragDropFormatNameElementDefinition } from "../../../Constants.js";
|
|
5
4
|
export class DragDropService {
|
|
@@ -37,7 +36,6 @@ export class DragDropService {
|
|
|
37
36
|
let [newContainer] = this.getPossibleContainerForDragDrop(designerCanvas, event);
|
|
38
37
|
if (!newContainer)
|
|
39
38
|
newContainer = designerCanvas.rootDesignItem;
|
|
40
|
-
//TODO : we need to use container service for adding to element, so also grid and flexbox work correct
|
|
41
39
|
const transferData = event.dataTransfer.getData(dragDropFormatNameElementDefinition);
|
|
42
40
|
const elementDefinition = JSON.parse(transferData);
|
|
43
41
|
const di = await designerCanvas.serviceContainer.forSomeServicesTillResult("instanceService", (service) => service.getElement(elementDefinition, designerCanvas.serviceContainer, designerCanvas.instanceServiceContainer));
|
|
@@ -50,7 +48,6 @@ export class DragDropService {
|
|
|
50
48
|
const pos = { x: evCoord.x - containerPos.x, y: evCoord.y - containerPos.y };
|
|
51
49
|
containerService.place(event, designerCanvas, newContainer, { x: 0, y: 0 }, { x: 0, y: 0 }, pos, [di]);
|
|
52
50
|
containerService.finishPlace(event, designerCanvas, newContainer, { x: 0, y: 0 }, { x: 0, y: 0 }, pos, [di]);
|
|
53
|
-
designerCanvas.instanceServiceContainer.undoService.execute(new InsertAction(newContainer, newContainer.childCount, di));
|
|
54
51
|
requestAnimationFrame(() => {
|
|
55
52
|
designerCanvas.instanceServiceContainer.selectionService.setSelectedElements([di]);
|
|
56
53
|
grp.commit();
|
|
@@ -2,16 +2,48 @@ import { IDesignItem } from "../../item/IDesignItem.js";
|
|
|
2
2
|
import { IEvent } from "./IEvent.js";
|
|
3
3
|
import { IEventsService } from "./IEventsService.js";
|
|
4
4
|
export declare class EventsService implements IEventsService {
|
|
5
|
-
|
|
6
|
-
protected
|
|
7
|
-
protected
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
protected
|
|
13
|
-
protected
|
|
14
|
-
|
|
5
|
+
constructor();
|
|
6
|
+
protected _allEvents: IEvent[];
|
|
7
|
+
protected _windowEvents: {
|
|
8
|
+
name: string;
|
|
9
|
+
propertyName: string;
|
|
10
|
+
eventObjectName: string;
|
|
11
|
+
}[];
|
|
12
|
+
protected _allElements: IEvent[];
|
|
13
|
+
protected _focusableEvents: {
|
|
14
|
+
name: string;
|
|
15
|
+
propertyName: string;
|
|
16
|
+
eventObjectName: string;
|
|
17
|
+
}[];
|
|
18
|
+
protected _form: {
|
|
19
|
+
name: string;
|
|
20
|
+
propertyName: string;
|
|
21
|
+
eventObjectName: string;
|
|
22
|
+
}[];
|
|
23
|
+
protected _simpleMouseEvents: IEvent[];
|
|
24
|
+
protected _mouseEvents: {
|
|
25
|
+
name: string;
|
|
26
|
+
propertyName: string;
|
|
27
|
+
eventObjectName: string;
|
|
28
|
+
}[];
|
|
29
|
+
protected _pointerEvents: IEvent[];
|
|
30
|
+
protected _touchEvents: IEvent[];
|
|
31
|
+
protected _dragEvents: {
|
|
32
|
+
name: string;
|
|
33
|
+
propertyName: string;
|
|
34
|
+
eventObjectName: string;
|
|
35
|
+
}[];
|
|
36
|
+
protected _clipboard: {
|
|
37
|
+
name: string;
|
|
38
|
+
propertyName: string;
|
|
39
|
+
eventObjectName: string;
|
|
40
|
+
}[];
|
|
41
|
+
protected _details: {
|
|
42
|
+
name: string;
|
|
43
|
+
propertyName: string;
|
|
44
|
+
eventObjectName: string;
|
|
45
|
+
}[];
|
|
15
46
|
isHandledElement(designItem: IDesignItem): boolean;
|
|
16
47
|
getPossibleEvents(designItem: IDesignItem): IEvent[];
|
|
48
|
+
getEvent(name: string): IEvent;
|
|
17
49
|
}
|
|
@@ -1,91 +1,103 @@
|
|
|
1
1
|
export class EventsService {
|
|
2
|
+
constructor() {
|
|
3
|
+
this._allEvents = [...this._windowEvents, ...this._form, ...this._simpleMouseEvents, ...this._mouseEvents, ...this._pointerEvents, ...this._touchEvents, ...this._allElements, ...this._focusableEvents, ...this._dragEvents, ...this._clipboard, ...this._dragEvents];
|
|
4
|
+
}
|
|
5
|
+
_allEvents;
|
|
2
6
|
_windowEvents = [
|
|
3
|
-
"afterprint",
|
|
4
|
-
"beforeprint",
|
|
5
|
-
"beforeunload",
|
|
6
|
-
"error",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"message",
|
|
10
|
-
"offline",
|
|
11
|
-
"online",
|
|
12
|
-
"pageshow",
|
|
13
|
-
"popstate",
|
|
14
|
-
"resize",
|
|
15
|
-
"storage",
|
|
16
|
-
"unload"
|
|
7
|
+
{ name: "afterprint", propertyName: "onafterprint", eventObjectName: "Event" },
|
|
8
|
+
{ name: "beforeprint", propertyName: "onbeforeprint", eventObjectName: "Event" },
|
|
9
|
+
{ name: "beforeunload", propertyName: "onbeforeunload", eventObjectName: "Event" },
|
|
10
|
+
{ name: "error", propertyName: "onerror", eventObjectName: "Event" },
|
|
11
|
+
{ name: "load", propertyName: "onload", eventObjectName: "Event" },
|
|
12
|
+
{ name: "hashchange", propertyName: "onhashchange", eventObjectName: "Event" },
|
|
13
|
+
{ name: "message", propertyName: "onmessage", eventObjectName: "Event" },
|
|
14
|
+
{ name: "offline", propertyName: "onoffline", eventObjectName: "Event" },
|
|
15
|
+
{ name: "online", propertyName: "ononline", eventObjectName: "Event" },
|
|
16
|
+
{ name: "pageshow", propertyName: "onpageshow", eventObjectName: "Event" },
|
|
17
|
+
{ name: "popstate", propertyName: "onpopstate", eventObjectName: "Event" },
|
|
18
|
+
{ name: "resize", propertyName: "onresize", eventObjectName: "Event" },
|
|
19
|
+
{ name: "storage", propertyName: "onstorage", eventObjectName: "Event" },
|
|
20
|
+
{ name: "unload", propertyName: "onunload", eventObjectName: "Event" }
|
|
17
21
|
];
|
|
18
22
|
_allElements = [
|
|
19
|
-
"contextmenu",
|
|
23
|
+
{ name: "contextmenu", propertyName: "oncontextmenu", eventObjectName: "PointerEvent" }
|
|
20
24
|
];
|
|
21
25
|
_focusableEvents = [
|
|
22
|
-
"blur",
|
|
23
|
-
"focus",
|
|
24
|
-
"keydown",
|
|
25
|
-
"
|
|
26
|
-
"keyup"
|
|
26
|
+
{ name: "blur", propertyName: "onblur", eventObjectName: "FocusEvent" },
|
|
27
|
+
{ name: "focus", propertyName: "onfocus", eventObjectName: "FocusEvent" },
|
|
28
|
+
{ name: "keydown", propertyName: "onkeydown", eventObjectName: "KeyboardEvent" },
|
|
29
|
+
{ name: "keyup", propertyName: "onkeyup", eventObjectName: "KeyboardEvent" }
|
|
27
30
|
];
|
|
28
31
|
_form = [
|
|
29
|
-
"
|
|
30
|
-
"input",
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"select",
|
|
35
|
-
"submit"
|
|
32
|
+
{ name: "beforeinput", propertyName: "onbeforeinput", eventObjectName: "InputEvent" },
|
|
33
|
+
{ name: "input", propertyName: "oninput", eventObjectName: "InputEvent" },
|
|
34
|
+
{ name: "change", propertyName: "onchange", eventObjectName: "Event" },
|
|
35
|
+
{ name: "invalid", propertyName: "oninvalid", eventObjectName: "Event" },
|
|
36
|
+
{ name: "reset", propertyName: "onreset", eventObjectName: "Event" },
|
|
37
|
+
{ name: "select", propertyName: "onselect", eventObjectName: "Event" },
|
|
38
|
+
{ name: "submit", propertyName: "onsubmit", eventObjectName: "SubmitEvent" }
|
|
39
|
+
];
|
|
40
|
+
_simpleMouseEvents = [
|
|
41
|
+
{ name: "click", propertyName: "onclick", eventObjectName: "PointerEvent" },
|
|
42
|
+
{ name: "dblclick", propertyName: "ondblclick", eventObjectName: "MouseEvent" },
|
|
43
|
+
{ name: "wheel", propertyName: "onwheel", eventObjectName: "WheelEvent" },
|
|
44
|
+
{ name: "scroll", propertyName: "onscroll", eventObjectName: "Event" },
|
|
36
45
|
];
|
|
37
46
|
_mouseEvents = [
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"mouseover",
|
|
44
|
-
"mouseout",
|
|
45
|
-
"mousewheel",
|
|
46
|
-
"wheel"
|
|
47
|
+
{ name: "mousedown", propertyName: "onmousedown", eventObjectName: "MouseEvent" },
|
|
48
|
+
{ name: "mouseup", propertyName: "onmouseup", eventObjectName: "MouseEvent" },
|
|
49
|
+
{ name: "mousemove", propertyName: "onmousemove", eventObjectName: "MouseEvent" },
|
|
50
|
+
{ name: "mouseover", propertyName: "onmouseover", eventObjectName: "MouseEvent" },
|
|
51
|
+
{ name: "mouseout", propertyName: "onmouseout", eventObjectName: "MouseEvent" }
|
|
47
52
|
];
|
|
48
53
|
_pointerEvents = [
|
|
49
|
-
"pointerdown",
|
|
50
|
-
"pointerup",
|
|
51
|
-
"pointerenter",
|
|
52
|
-
"pointerleave",
|
|
53
|
-
"pointermove",
|
|
54
|
-
"pointerover",
|
|
55
|
-
"pointerout",
|
|
56
|
-
"pointercancel"
|
|
54
|
+
{ name: "pointerdown", propertyName: "onpointerdown", eventObjectName: "PointerEvent" },
|
|
55
|
+
{ name: "pointerup", propertyName: "onpointerup", eventObjectName: "PointerEvent" },
|
|
56
|
+
{ name: "pointerenter", propertyName: "onpointerenter", eventObjectName: "PointerEvent" },
|
|
57
|
+
{ name: "pointerleave", propertyName: "onpointerleave", eventObjectName: "PointerEvent" },
|
|
58
|
+
{ name: "pointermove", propertyName: "onpointermove", eventObjectName: "PointerEvent" },
|
|
59
|
+
{ name: "pointerover", propertyName: "onpointerover", eventObjectName: "PointerEvent" },
|
|
60
|
+
{ name: "pointerout", propertyName: "onpointerout", eventObjectName: "PointerEvent" },
|
|
61
|
+
{ name: "pointercancel", propertyName: "onpointercancel", eventObjectName: "PointerEvent" }
|
|
57
62
|
];
|
|
58
63
|
_touchEvents = [
|
|
59
|
-
"touchstart",
|
|
60
|
-
"touchend",
|
|
61
|
-
"touchmove",
|
|
62
|
-
"touchcancel"
|
|
64
|
+
{ name: "touchstart", propertyName: "ontouchstart", eventObjectName: "TouchEvent" },
|
|
65
|
+
{ name: "touchend", propertyName: "ontouchend", eventObjectName: "TouchEvent" },
|
|
66
|
+
{ name: "touchmove", propertyName: "ontouchmove", eventObjectName: "TouchEvent" },
|
|
67
|
+
{ name: "touchcancel", propertyName: "ontouchcancel", eventObjectName: "TouchEvent" }
|
|
63
68
|
];
|
|
64
69
|
_dragEvents = [
|
|
65
|
-
"drag",
|
|
66
|
-
"dragend",
|
|
67
|
-
"dragenter",
|
|
68
|
-
"dragleave",
|
|
69
|
-
"dragover",
|
|
70
|
-
"dragstart",
|
|
71
|
-
"drop",
|
|
72
|
-
"scroll"
|
|
70
|
+
{ name: "drag", propertyName: "ondrag", eventObjectName: "DragEvent" },
|
|
71
|
+
{ name: "dragend", propertyName: "ondragend", eventObjectName: "DragEvent" },
|
|
72
|
+
{ name: "dragenter", propertyName: "ondragenter", eventObjectName: "DragEvent" },
|
|
73
|
+
{ name: "dragleave", propertyName: "ondragleave", eventObjectName: "DragEvent" },
|
|
74
|
+
{ name: "dragover", propertyName: "ondragover", eventObjectName: "DragEvent" },
|
|
75
|
+
{ name: "dragstart", propertyName: "ondragstart", eventObjectName: "DragEvent" },
|
|
76
|
+
{ name: "drop", propertyName: "ondrop", eventObjectName: "DragEvent" }
|
|
73
77
|
];
|
|
74
78
|
_clipboard = [
|
|
75
|
-
"copy",
|
|
76
|
-
"cut",
|
|
77
|
-
"paste"
|
|
79
|
+
{ name: "copy", propertyName: "oncopy", eventObjectName: "ClipboardEvent" },
|
|
80
|
+
{ name: "cut", propertyName: "oncut", eventObjectName: "ClipboardEvent" },
|
|
81
|
+
{ name: "paste", propertyName: "onpaste", eventObjectName: "ClipboardEvent" }
|
|
78
82
|
];
|
|
79
83
|
_details = [
|
|
80
|
-
"toggle"
|
|
84
|
+
{ name: "toggle", propertyName: "ontoggle", eventObjectName: "Event" }
|
|
81
85
|
];
|
|
82
86
|
isHandledElement(designItem) {
|
|
83
87
|
return true;
|
|
84
88
|
}
|
|
85
89
|
getPossibleEvents(designItem) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
if (designItem.element instanceof HTMLInputElement ||
|
|
91
|
+
designItem.element instanceof HTMLTextAreaElement ||
|
|
92
|
+
designItem.element instanceof HTMLSelectElement) {
|
|
93
|
+
let events = [...this._form, ...this._simpleMouseEvents, ...this._pointerEvents, ...this._allElements, ...this._focusableEvents];
|
|
94
|
+
return events;
|
|
95
|
+
}
|
|
96
|
+
let events = [...this._simpleMouseEvents, ...this._pointerEvents, ...this._allElements, ...this._focusableEvents];
|
|
89
97
|
return events;
|
|
90
98
|
}
|
|
99
|
+
getEvent(name) {
|
|
100
|
+
let evt = this._allEvents.find(x => x.name == name);
|
|
101
|
+
return evt ?? { name, propertyName: 'on' + name, eventObjectName: 'Event' };
|
|
102
|
+
}
|
|
91
103
|
}
|
|
@@ -121,6 +121,7 @@ export class DefaultPlacementService {
|
|
|
121
121
|
enterContainer(container, items) {
|
|
122
122
|
let filterdItems = filterChildPlaceItems(items);
|
|
123
123
|
for (let i of filterdItems) {
|
|
124
|
+
container.insertChild(i);
|
|
124
125
|
if (i.lastContainerSize) {
|
|
125
126
|
if (!i.hasStyle('width'))
|
|
126
127
|
i.setStyle('width', i.lastContainerSize.width + 'px');
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NodeType } from '../../item/NodeType.js';
|
|
1
2
|
import { AttachedPropertiesService } from './services/AttachedPropertiesService.js';
|
|
2
3
|
import { AttributesPropertiesService } from './services/AttributesPropertiesService.js';
|
|
3
4
|
import { CommonPropertiesService } from './services/CommonPropertiesService.js';
|
|
@@ -35,6 +36,8 @@ export class PropertyTabsService {
|
|
|
35
36
|
getPropertygroups(designItems) {
|
|
36
37
|
if (designItems == null || designItems.length == 0)
|
|
37
38
|
return [];
|
|
39
|
+
if (designItems[0].nodeType == NodeType.TextNode || designItems[0].nodeType == NodeType.Comment)
|
|
40
|
+
return [];
|
|
38
41
|
this._pgList[0].propertiesService = designItems[0].serviceContainer.getLastServiceWhere('propertyService', x => x.isHandledElement(designItems[0]));
|
|
39
42
|
this._svgPgList[0].propertiesService = designItems[0].serviceContainer.getLastServiceWhere('propertyService', x => x.isHandledElement(designItems[0]));
|
|
40
43
|
let lst = this._pgList;
|
|
@@ -17,7 +17,7 @@ export class CssCustomPropertiesService extends CommonPropertiesService {
|
|
|
17
17
|
return { name: name, type: 'string', service: this, propertyType: PropertyType.cssValue };
|
|
18
18
|
}
|
|
19
19
|
getProperties(designItem) {
|
|
20
|
-
if (!designItem
|
|
20
|
+
if (!designItem?.element?.computedStyleMap)
|
|
21
21
|
return null;
|
|
22
22
|
let rootMap = Array.from(designItem.instanceServiceContainer.designerCanvas.rootDesignItem.element.computedStyleMap()).map(x => x[0]).filter(key => key.startsWith("--"));
|
|
23
23
|
let props = Array.from(designItem.element.computedStyleMap()).map(x => x[0]).filter(key => key.startsWith("--"));
|
package/dist/elements/services/propertiesService/services/UnkownElementsPropertiesService.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IProperty } from '../IProperty.js';
|
|
2
|
+
import { IDesignItem } from '../../../item/IDesignItem.js';
|
|
3
|
+
import { IPropertyGroup } from '../IPropertyGroup.js';
|
|
4
|
+
import { AbstractPropertiesService } from './AbstractPropertiesService.js';
|
|
5
|
+
import { RefreshMode } from '../IPropertiesService.js';
|
|
6
|
+
export declare class UnkownElementsPropertiesService extends AbstractPropertiesService {
|
|
7
|
+
getRefreshMode(designItem: IDesignItem): RefreshMode;
|
|
8
|
+
isHandledElement(designItem: IDesignItem): boolean;
|
|
9
|
+
getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AbstractPropertiesService } from './AbstractPropertiesService.js';
|
|
2
|
+
import { RefreshMode } from '../IPropertiesService.js';
|
|
3
|
+
import { PropertyType } from '../PropertyType.js';
|
|
4
|
+
export class UnkownElementsPropertiesService extends AbstractPropertiesService {
|
|
5
|
+
getRefreshMode(designItem) {
|
|
6
|
+
return RefreshMode.full;
|
|
7
|
+
}
|
|
8
|
+
isHandledElement(designItem) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
getProperties(designItem) {
|
|
12
|
+
let list = Object.getOwnPropertyNames(Object.getPrototypeOf(designItem.element));
|
|
13
|
+
let props = [];
|
|
14
|
+
for (let p of list) {
|
|
15
|
+
let desc = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(designItem.element), p);
|
|
16
|
+
if (desc.get || desc.set) {
|
|
17
|
+
let v = designItem.element[p];
|
|
18
|
+
if (typeof v == 'boolean')
|
|
19
|
+
props.push({ name: p, type: 'boolean', service: this, propertyType: PropertyType.propertyAndAttribute });
|
|
20
|
+
else if (typeof v == 'number')
|
|
21
|
+
props.push({ name: p, type: 'bonumberolean', service: this, propertyType: PropertyType.propertyAndAttribute });
|
|
22
|
+
else
|
|
23
|
+
props.push({ name: p, type: 'string', service: this, propertyType: PropertyType.propertyAndAttribute });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return props;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { IPropertiesService, RefreshMode } from '../IPropertiesService.js';
|
|
3
|
+
import { IProperty } from '../IProperty.js';
|
|
4
|
+
import { IDesignItem } from '../../../item/IDesignItem.js';
|
|
5
|
+
import { ValueType } from '../ValueType.js';
|
|
6
|
+
import { BindingTarget } from '../../../item/BindingTarget.js';
|
|
7
|
+
import { IBinding } from '../../../item/IBinding.js';
|
|
8
|
+
import { IPropertyGroup } from '../IPropertyGroup.js';
|
|
9
|
+
export declare abstract class AbstractPropertiesService implements IPropertiesService {
|
|
10
|
+
_stylesCache: Map<IDesignItem, Set<string>>;
|
|
11
|
+
_cacheClearTimer: NodeJS.Timeout;
|
|
12
|
+
abstract getRefreshMode(designItem: IDesignItem): RefreshMode;
|
|
13
|
+
abstract isHandledElement(designItem: IDesignItem): boolean;
|
|
14
|
+
protected _notifyChangedProperty(designItem: IDesignItem, property: IProperty, value: any): void;
|
|
15
|
+
getProperty(designItem: IDesignItem, name: string): IProperty;
|
|
16
|
+
getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
|
|
17
|
+
setValue(designItems: IDesignItem[], property: IProperty, value: any): void;
|
|
18
|
+
getPropertyTarget(designItem: IDesignItem, property: IProperty): BindingTarget;
|
|
19
|
+
clearValue(designItems: IDesignItem[], property: IProperty, clearType: 'all' | 'binding' | 'value'): void;
|
|
20
|
+
isSet(designItems: IDesignItem[], property: IProperty): ValueType;
|
|
21
|
+
getValue(designItems: IDesignItem[], property: IProperty): string | boolean;
|
|
22
|
+
getBinding(designItems: IDesignItem[], property: IProperty): IBinding;
|
|
23
|
+
getUnsetValue(designItems: IDesignItem[], property: IProperty): any;
|
|
24
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { ValueType } from '../ValueType.js';
|
|
2
|
+
import { PropertiesHelper } from './PropertiesHelper.js';
|
|
3
|
+
import { BindingTarget } from '../../../item/BindingTarget.js';
|
|
4
|
+
import { PropertyType } from '../PropertyType.js';
|
|
5
|
+
import { NodeType } from '../../../item/NodeType.js';
|
|
6
|
+
export class AbstractPropertiesService {
|
|
7
|
+
_stylesCache = new Map;
|
|
8
|
+
_cacheClearTimer;
|
|
9
|
+
_notifyChangedProperty(designItem, property, value) {
|
|
10
|
+
}
|
|
11
|
+
getProperty(designItem, name) {
|
|
12
|
+
let properties = this.getProperties(designItem);
|
|
13
|
+
if ('properties' in properties[0]) {
|
|
14
|
+
return properties.flatMap(x => x.properties).find(x => x.name == name);
|
|
15
|
+
}
|
|
16
|
+
else
|
|
17
|
+
return properties.find(x => x.name == name);
|
|
18
|
+
}
|
|
19
|
+
getProperties(designItem) {
|
|
20
|
+
Object.getOwnPropertyNames(Object.getPrototypeOf(designItem.element));
|
|
21
|
+
}
|
|
22
|
+
setValue(designItems, property, value) {
|
|
23
|
+
const cg = designItems[0].openGroup("property changed: " + property.name + " to " + value);
|
|
24
|
+
for (let d of designItems) {
|
|
25
|
+
if (property.propertyType == PropertyType.cssValue) {
|
|
26
|
+
d.updateStyleInSheetOrLocal(property.name, value);
|
|
27
|
+
//unkown css property names do not trigger the mutation observer of property grid,
|
|
28
|
+
//fixed by assinging stle again to the attribute
|
|
29
|
+
d.element.setAttribute('style', d.element.getAttribute('style'));
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
let attributeName = property.attributeName;
|
|
33
|
+
if (!attributeName)
|
|
34
|
+
attributeName = PropertiesHelper.camelToDashCase(property.name);
|
|
35
|
+
if (property.type === 'object') {
|
|
36
|
+
const json = JSON.stringify(value);
|
|
37
|
+
if (property.propertyType == PropertyType.attribute || property.propertyType == PropertyType.propertyAndAttribute)
|
|
38
|
+
d.setAttribute(attributeName, json);
|
|
39
|
+
if (property.propertyType == PropertyType.property || property.propertyType == PropertyType.propertyAndAttribute)
|
|
40
|
+
d.element[property.name] = value;
|
|
41
|
+
}
|
|
42
|
+
else if (property.type == 'boolean' && !value) {
|
|
43
|
+
if (property.propertyType == PropertyType.attribute || property.propertyType == PropertyType.propertyAndAttribute)
|
|
44
|
+
d.removeAttribute(attributeName);
|
|
45
|
+
if (property.propertyType == PropertyType.property || property.propertyType == PropertyType.propertyAndAttribute)
|
|
46
|
+
d.element[property.name] = false;
|
|
47
|
+
}
|
|
48
|
+
else if (property.type == 'boolean' && value) {
|
|
49
|
+
if (property.propertyType == PropertyType.attribute || property.propertyType == PropertyType.propertyAndAttribute)
|
|
50
|
+
d.setAttribute(attributeName, "");
|
|
51
|
+
if (property.propertyType == PropertyType.property || property.propertyType == PropertyType.propertyAndAttribute)
|
|
52
|
+
d.element[property.name] = true;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
if (property.propertyType == PropertyType.attribute || property.propertyType == PropertyType.propertyAndAttribute)
|
|
56
|
+
d.setAttribute(attributeName, value.toString());
|
|
57
|
+
if (property.propertyType == PropertyType.property || property.propertyType == PropertyType.propertyAndAttribute)
|
|
58
|
+
d.element[property.name] = value;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
this._notifyChangedProperty(d, property, value);
|
|
62
|
+
}
|
|
63
|
+
cg.commit();
|
|
64
|
+
}
|
|
65
|
+
getPropertyTarget(designItem, property) {
|
|
66
|
+
return BindingTarget.property;
|
|
67
|
+
}
|
|
68
|
+
clearValue(designItems, property, clearType) {
|
|
69
|
+
const cg = designItems[0].openGroup("property cleared: " + property.name);
|
|
70
|
+
for (let d of designItems) {
|
|
71
|
+
if (clearType != 'binding') {
|
|
72
|
+
if (property.propertyType == PropertyType.cssValue) {
|
|
73
|
+
d.removeStyle(property.name);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
let attributeName = property.attributeName;
|
|
77
|
+
if (!attributeName)
|
|
78
|
+
attributeName = PropertiesHelper.camelToDashCase(property.name);
|
|
79
|
+
d.removeAttribute(attributeName);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (clearType != 'value') {
|
|
83
|
+
d.serviceContainer.forSomeServicesTillResult('bindingService', (s) => {
|
|
84
|
+
return s.clearBinding(d, property.name, this.getPropertyTarget(d, property));
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
this._notifyChangedProperty(d, property, undefined);
|
|
88
|
+
}
|
|
89
|
+
cg.commit();
|
|
90
|
+
}
|
|
91
|
+
isSet(designItems, property) {
|
|
92
|
+
let all = true;
|
|
93
|
+
let some = false;
|
|
94
|
+
if (designItems != null && designItems.length !== 0) {
|
|
95
|
+
let attributeName = property.attributeName;
|
|
96
|
+
if (!attributeName)
|
|
97
|
+
attributeName = PropertiesHelper.camelToDashCase(property.name);
|
|
98
|
+
for (let x of designItems) {
|
|
99
|
+
let has = false;
|
|
100
|
+
if (property.propertyType == PropertyType.cssValue)
|
|
101
|
+
has = x.hasStyle(property.name);
|
|
102
|
+
else
|
|
103
|
+
has = x.hasAttribute(attributeName);
|
|
104
|
+
all = all && has;
|
|
105
|
+
some = some || has;
|
|
106
|
+
if (!all && some)
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
;
|
|
110
|
+
//todo: optimize perf, do not call bindings service for each property.
|
|
111
|
+
const bindings = designItems[0].serviceContainer.forSomeServicesTillResult('bindingService', (s) => {
|
|
112
|
+
return s.getBindings(designItems[0]);
|
|
113
|
+
});
|
|
114
|
+
if (property.propertyType == PropertyType.cssValue) {
|
|
115
|
+
if (bindings && bindings.find(x => x.target == BindingTarget.css && x.targetName == property.name))
|
|
116
|
+
return ValueType.bound;
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
if (bindings && bindings.find(x => x.target == BindingTarget.property && x.targetName == property.name))
|
|
120
|
+
return ValueType.bound;
|
|
121
|
+
}
|
|
122
|
+
if (!all && property.propertyType == PropertyType.cssValue) {
|
|
123
|
+
let styles = this._stylesCache.get(designItems[0]);
|
|
124
|
+
if (!styles) {
|
|
125
|
+
styles = new Set(designItems[0].getAllStyles().filter(x => x.selector != null).flatMap(x => x.declarations).map(x => x.name));
|
|
126
|
+
this._stylesCache.set(designItems[0], styles);
|
|
127
|
+
clearTimeout(this._cacheClearTimer);
|
|
128
|
+
this._cacheClearTimer = setTimeout(() => this._stylesCache.clear(), 30);
|
|
129
|
+
}
|
|
130
|
+
let cssValue = styles.has(property.name);
|
|
131
|
+
if (cssValue)
|
|
132
|
+
return ValueType.fromStylesheet;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
else
|
|
136
|
+
return ValueType.none;
|
|
137
|
+
return all ? ValueType.all : some ? ValueType.some : ValueType.none;
|
|
138
|
+
}
|
|
139
|
+
getValue(designItems, property) {
|
|
140
|
+
if (designItems != null && designItems.length !== 0) {
|
|
141
|
+
if (property.propertyType == PropertyType.cssValue) {
|
|
142
|
+
let lastValue = designItems[0].getStyle(property.name);
|
|
143
|
+
for (const d of designItems) {
|
|
144
|
+
let value = d.getStyle(property.name);
|
|
145
|
+
if (value != lastValue) {
|
|
146
|
+
lastValue = null;
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return lastValue;
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
let attributeName = property.attributeName;
|
|
154
|
+
if (!attributeName)
|
|
155
|
+
attributeName = PropertiesHelper.camelToDashCase(property.name);
|
|
156
|
+
if (property.type == 'boolean')
|
|
157
|
+
return designItems[0].hasAttribute(attributeName);
|
|
158
|
+
let lastValue = designItems[0].getAttribute(attributeName);
|
|
159
|
+
/*
|
|
160
|
+
for (const x of designItems) {
|
|
161
|
+
let value = x.attributes.get(attributeName);
|
|
162
|
+
if (value != lastValue) {
|
|
163
|
+
lastValue = null;
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
*/
|
|
168
|
+
return lastValue;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return null;
|
|
172
|
+
}
|
|
173
|
+
getBinding(designItems, property) {
|
|
174
|
+
//TODO: optimize perf, do not call bindings service for each property.
|
|
175
|
+
const bindings = designItems[0].serviceContainer.forSomeServicesTillResult('bindingService', (s) => {
|
|
176
|
+
return s.getBindings(designItems[0]);
|
|
177
|
+
});
|
|
178
|
+
if (property.propertyType == PropertyType.cssValue) {
|
|
179
|
+
return bindings.find(x => (x.target == BindingTarget.css) && x.targetName == property.name);
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
return bindings.find(x => (x.target == BindingTarget.property || x.target == BindingTarget.attribute) && x.targetName == property.name);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
getUnsetValue(designItems, property) {
|
|
186
|
+
if (property.propertyType == PropertyType.cssValue) {
|
|
187
|
+
if (designItems != null && designItems.length !== 0) {
|
|
188
|
+
if (designItems[0].nodeType == NodeType.Element) {
|
|
189
|
+
let v = window.getComputedStyle(designItems[0].element)[property.name];
|
|
190
|
+
return v;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
else
|
|
196
|
+
return property.defaultValue;
|
|
197
|
+
}
|
|
198
|
+
}
|
package/dist/elements/services/propertiesService/services/WebcomponentManifestPropertiesService.js
CHANGED
|
@@ -34,7 +34,8 @@ export class WebcomponentManifestPropertiesService extends AbstractPropertiesSer
|
|
|
34
34
|
if (declaration.attributes)
|
|
35
35
|
pType = declaration.attributes.find(x => x.fieldName == d.name) != null ? PropertyType.propertyAndAttribute : PropertyType.property;
|
|
36
36
|
const p = this.manifestClassPropertyTypeToEditorPropertyType(d.type?.text);
|
|
37
|
-
|
|
37
|
+
if (d.name)
|
|
38
|
+
properties.push({ name: d.name, service: this, propertyType: pType, type: p[0], values: p[1], description: d.description });
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
this._propertiesList[e.name] = properties;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ITransactionItem } from '../ITransactionItem.js';
|
|
2
|
+
import { IDesignItem } from '../../../item/IDesignItem.js';
|
|
3
|
+
import { IBinding } from '../../../item/IBinding.js';
|
|
4
|
+
export declare class AttributeChangeAction implements ITransactionItem {
|
|
5
|
+
constructor(designItem: IDesignItem, name: string, newValue: string | IBinding | null, oldValue: string | IBinding | null);
|
|
6
|
+
title?: string;
|
|
7
|
+
get affectedItems(): IDesignItem[];
|
|
8
|
+
undo(): void;
|
|
9
|
+
do(): void;
|
|
10
|
+
designItem: IDesignItem;
|
|
11
|
+
name: string;
|
|
12
|
+
newValue: any;
|
|
13
|
+
oldValue: any;
|
|
14
|
+
mergeWith(other: ITransactionItem): boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export class AttributeChangeAction {
|
|
2
|
+
constructor(designItem, name, newValue, oldValue) {
|
|
3
|
+
this.title = "Change Attribute " + name + " of <" + designItem.name + ">";
|
|
4
|
+
this.designItem = designItem;
|
|
5
|
+
this.name = name;
|
|
6
|
+
this.newValue = newValue;
|
|
7
|
+
this.oldValue = oldValue;
|
|
8
|
+
}
|
|
9
|
+
title;
|
|
10
|
+
get affectedItems() {
|
|
11
|
+
return [this.designItem];
|
|
12
|
+
}
|
|
13
|
+
undo() {
|
|
14
|
+
if (this.oldValue == null) {
|
|
15
|
+
this.designItem._withoutUndoRemoveAttribute(this.name);
|
|
16
|
+
try {
|
|
17
|
+
this.designItem.element.removeAttribute(this.name);
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
console.warn(e);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
this.designItem._withoutUndoSetAttribute(this.name, this.oldValue);
|
|
25
|
+
if (this.name != "draggable") {
|
|
26
|
+
try {
|
|
27
|
+
if (typeof this.oldValue === 'string')
|
|
28
|
+
this.designItem.element.setAttribute(this.name, this.oldValue);
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
console.warn(e);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
do() {
|
|
37
|
+
if (this.newValue == null) {
|
|
38
|
+
this.designItem._withoutUndoRemoveAttribute(this.name);
|
|
39
|
+
try {
|
|
40
|
+
this.designItem.element.removeAttribute(this.name);
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
console.warn(e);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.designItem._withoutUndoSetAttribute(this.name, this.newValue);
|
|
48
|
+
if (this.name != "draggable") {
|
|
49
|
+
try {
|
|
50
|
+
if (typeof this.newValue === 'string')
|
|
51
|
+
this.designItem.element.setAttribute(this.name, this.newValue);
|
|
52
|
+
}
|
|
53
|
+
catch (e) {
|
|
54
|
+
console.warn(e);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
designItem;
|
|
60
|
+
name;
|
|
61
|
+
newValue;
|
|
62
|
+
oldValue;
|
|
63
|
+
mergeWith(other) {
|
|
64
|
+
if (other instanceof AttributeChangeAction && this.designItem === other.designItem && this.name === other.name) {
|
|
65
|
+
this.newValue = other.newValue;
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ITransactionItem } from '../ITransactionItem.js';
|
|
2
|
+
import { IDesignItem } from '../../../item/IDesignItem.js';
|
|
3
|
+
import { IBinding } from '../../../item/IBinding.js';
|
|
4
|
+
export declare class TextContentChangeAction implements ITransactionItem {
|
|
5
|
+
constructor(designItem: IDesignItem, newValue: string | IBinding | null, oldValue: string | IBinding | null);
|
|
6
|
+
title?: string;
|
|
7
|
+
get affectedItems(): IDesignItem[];
|
|
8
|
+
undo(): void;
|
|
9
|
+
do(): void;
|
|
10
|
+
designItem: IDesignItem;
|
|
11
|
+
newValue: any;
|
|
12
|
+
oldValue: any;
|
|
13
|
+
mergeWith(other: ITransactionItem): boolean;
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export class TextContentChangeAction {
|
|
2
|
+
constructor(designItem, newValue, oldValue) {
|
|
3
|
+
this.title = "Change TextContent from '" + oldValue + "' to '" + newValue + "'";
|
|
4
|
+
this.designItem = designItem;
|
|
5
|
+
this.newValue = newValue;
|
|
6
|
+
this.oldValue = oldValue;
|
|
7
|
+
}
|
|
8
|
+
title;
|
|
9
|
+
get affectedItems() {
|
|
10
|
+
return [this.designItem];
|
|
11
|
+
}
|
|
12
|
+
undo() {
|
|
13
|
+
this.designItem.element.textContent = this.oldValue;
|
|
14
|
+
}
|
|
15
|
+
do() {
|
|
16
|
+
this.designItem.element.textContent = this.newValue;
|
|
17
|
+
}
|
|
18
|
+
designItem;
|
|
19
|
+
newValue;
|
|
20
|
+
oldValue;
|
|
21
|
+
mergeWith(other) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { BaseCustomWebComponentConstructorAppend, css, html } from "@node-projects/base-custom-webcomponent";
|
|
2
2
|
import { DesignItem } from "../../item/DesignItem.js";
|
|
3
3
|
function generateSelector(element) {
|
|
4
|
+
if (!element)
|
|
5
|
+
return '';
|
|
4
6
|
let selector, tag = element.nodeName.toLowerCase();
|
|
5
7
|
if (element.id) {
|
|
6
8
|
selector = '#' + element.getAttribute('id');
|
|
@@ -193,7 +195,7 @@ export class DebugView extends BaseCustomWebComponentConstructorAppend {
|
|
|
193
195
|
if (this._ready) {
|
|
194
196
|
requestAnimationFrame(() => {
|
|
195
197
|
let element = designItem?.element;
|
|
196
|
-
if (element) {
|
|
198
|
+
if (element && element.nodeType != 8) {
|
|
197
199
|
if (element.nodeType == 3)
|
|
198
200
|
element = element.parentNode;
|
|
199
201
|
this.computedStyle = getComputedStyle(element);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { SelectionDefaultExtension } from './SelectionDefaultExtension.js';
|
|
2
2
|
import { css } from "@node-projects/base-custom-webcomponent";
|
|
3
|
+
import { NodeType } from '../../../item/NodeType.js';
|
|
3
4
|
export class SelectionDefaultExtensionProvider {
|
|
4
5
|
shouldExtend(extensionManager, designerView, designItem) {
|
|
5
|
-
return
|
|
6
|
+
return designItem.nodeType != NodeType.Comment;
|
|
6
7
|
}
|
|
7
8
|
getExtension(extensionManager, designerView, designItem) {
|
|
8
9
|
return new SelectionDefaultExtension(extensionManager, designerView, designItem);
|
|
@@ -207,16 +207,18 @@ export class PointerTool {
|
|
|
207
207
|
}
|
|
208
208
|
if (!this._actionStartedDesignItem)
|
|
209
209
|
return;
|
|
210
|
+
if (!this._changeGroup)
|
|
211
|
+
this._changeGroup = designerCanvas.rootDesignItem.openGroup("Move Elements");
|
|
210
212
|
if (event.ctrlKey && !this._copiedItemsInserted) {
|
|
213
|
+
this._changeGroup.title = "Copy Elements";
|
|
211
214
|
this._copiedItemsInserted = true;
|
|
212
|
-
if (!this._changeGroup)
|
|
213
|
-
this._changeGroup = designerCanvas.rootDesignItem.openGroup("Copy Elements");
|
|
214
215
|
for (let i = 0; i < this._clonedItems.length; i++) {
|
|
215
216
|
this._actionStartedDesignItems[i].insertAdjacentElement(this._clonedItems[i], 'beforebegin');
|
|
216
217
|
}
|
|
217
218
|
designerCanvas.instanceServiceContainer.contentService.onContentChanged.emit({ changeType: 'added', designItems: this._clonedItems });
|
|
218
219
|
}
|
|
219
220
|
else if (!event.ctrlKey && this._copiedItemsInserted) {
|
|
221
|
+
this._changeGroup.title = "Move Elements";
|
|
220
222
|
for (let d of this._clonedItems) {
|
|
221
223
|
d.remove();
|
|
222
224
|
}
|
|
@@ -270,8 +272,6 @@ export class PointerTool {
|
|
|
270
272
|
const newOffset = newContainerService.getElementOffset(newContainerElementDesignItem, this._actionStartedDesignItem);
|
|
271
273
|
this._moveItemsOffset = { x: newOffset.x - oldOffset.x + this._moveItemsOffset.x, y: newOffset.y - oldOffset.y + this._moveItemsOffset.y };
|
|
272
274
|
currentContainerService.leaveContainer(this._actionStartedDesignItem.parent, this._actionStartedDesignItems);
|
|
273
|
-
for (let di of this._actionStartedDesignItems)
|
|
274
|
-
newContainerElementDesignItem._insertChildInternal(di); //todo -> maybe in enter container???
|
|
275
275
|
const cp = { x: currentPoint.x - this._moveItemsOffset.x, y: currentPoint.y - this._moveItemsOffset.y };
|
|
276
276
|
newContainerService.enterContainer(newContainerElementDesignItem, this._actionStartedDesignItems);
|
|
277
277
|
newContainerService.place(event, designerCanvas, this._actionStartedDesignItem.parent, this._initialPoint, this._initialOffset, cp, this._actionStartedDesignItems);
|
package/dist/index.d.ts
CHANGED
|
@@ -119,6 +119,7 @@ export * from "./elements/services/propertiesService/services/AbstractProperties
|
|
|
119
119
|
export * from "./elements/services/propertiesService/services/WebcomponentManifestPropertiesService.js";
|
|
120
120
|
export * from "./elements/services/propertiesService/services/AttributesPropertiesService.js";
|
|
121
121
|
export * from "./elements/services/propertiesService/services/CssCustomPropertiesService.js";
|
|
122
|
+
export * from "./elements/services/propertiesService/services/UnkownElementsPropertiesService.js";
|
|
122
123
|
export * from "./elements/services/propertiesService/PropertyType.js";
|
|
123
124
|
export * from "./elements/services/propertiesService/ValueType.js";
|
|
124
125
|
export * from "./elements/services/propertiesService/PropertyTabsService.js";
|
|
@@ -140,6 +141,7 @@ export * from "./elements/services/undoService/transactionItems/InsertAction.js"
|
|
|
140
141
|
export * from "./elements/services/undoService/transactionItems/InsertChildAction.js";
|
|
141
142
|
export * from "./elements/services/undoService/transactionItems/StylesheetChangedAction.js";
|
|
142
143
|
export * from "./elements/services/undoService/transactionItems/SetDesignItemsAction.js";
|
|
144
|
+
export * from "./elements/services/undoService/transactionItems/TextContentChangeAction.js";
|
|
143
145
|
export * from "./elements/services/BaseServiceContainer.js";
|
|
144
146
|
export * from "./elements/services/InstanceServiceContainer.js";
|
|
145
147
|
export type { IService } from "./elements/services/IService.js";
|
package/dist/index.js
CHANGED
|
@@ -79,6 +79,7 @@ export * from "./elements/services/propertiesService/services/AbstractProperties
|
|
|
79
79
|
export * from "./elements/services/propertiesService/services/WebcomponentManifestPropertiesService.js";
|
|
80
80
|
export * from "./elements/services/propertiesService/services/AttributesPropertiesService.js";
|
|
81
81
|
export * from "./elements/services/propertiesService/services/CssCustomPropertiesService.js";
|
|
82
|
+
export * from "./elements/services/propertiesService/services/UnkownElementsPropertiesService.js";
|
|
82
83
|
export * from "./elements/services/propertiesService/PropertyType.js";
|
|
83
84
|
export * from "./elements/services/propertiesService/ValueType.js";
|
|
84
85
|
export * from "./elements/services/propertiesService/PropertyTabsService.js";
|
|
@@ -95,6 +96,7 @@ export * from "./elements/services/undoService/transactionItems/InsertAction.js"
|
|
|
95
96
|
export * from "./elements/services/undoService/transactionItems/InsertChildAction.js";
|
|
96
97
|
export * from "./elements/services/undoService/transactionItems/StylesheetChangedAction.js";
|
|
97
98
|
export * from "./elements/services/undoService/transactionItems/SetDesignItemsAction.js";
|
|
99
|
+
export * from "./elements/services/undoService/transactionItems/TextContentChangeAction.js";
|
|
98
100
|
export * from "./elements/services/BaseServiceContainer.js";
|
|
99
101
|
export * from "./elements/services/InstanceServiceContainer.js";
|
|
100
102
|
export * from "./elements/services/ServiceContainer.js";
|