@node-projects/web-component-designer 0.0.110 → 0.0.113
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/README.md +19 -25
- package/dist/elements/controls/DesignerTabControl.js +5 -0
- package/dist/elements/services/ServiceContainer.d.ts +5 -0
- package/dist/elements/services/propertiesService/IPropertiesService.d.ts +2 -0
- package/dist/elements/services/propertiesService/services/AttributesPropertiesService.d.ts +2 -0
- package/dist/elements/services/propertiesService/services/AttributesPropertiesService.js +7 -0
- package/dist/elements/services/propertiesService/services/CommonPropertiesService.d.ts +2 -0
- package/dist/elements/services/propertiesService/services/CommonPropertiesService.js +7 -0
- package/dist/elements/services/propertiesService/services/CssPropertiesService.d.ts +2 -0
- package/dist/elements/services/propertiesService/services/CssPropertiesService.js +7 -0
- package/dist/elements/services/propertiesService/services/UnkownElementPropertiesService.d.ts +2 -0
- package/dist/elements/services/propertiesService/services/UnkownElementPropertiesService.js +8 -1
- package/dist/elements/widgets/propertyGrid/PropertyGridPropertyList.d.ts +2 -0
- package/dist/elements/widgets/propertyGrid/PropertyGridPropertyList.js +21 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
# web-component-designer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
```This is a preview version. It's already useable but big refactorings could still happen.```
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Based on PolymerLabs Wizzywid (but it does not use Polymer any more.)
|
|
9
|
-
|
|
10
|
-
This is a Designer Framework wich could easily be included in your own Software..
|
|
5
|
+
A HTML web component for designing web components and HTML pages based on PolymerLabs wizzywid which can easily be integrated in your own software.
|
|
6
|
+
Meanwhile polymer is not used anymore.
|
|
11
7
|
|
|
12
8
|

|
|
13
9
|
|
|
14
10
|
## NPM Package
|
|
15
11
|
|
|
16
|
-
At the moment there is no
|
|
17
|
-
But there will be one when project is in Release Candidate state.
|
|
12
|
+
At the moment there is no npm package available, but there will be one as soon as the software has reached RC status.
|
|
18
13
|
|
|
19
14
|
## Demo
|
|
20
15
|
|
|
@@ -35,9 +30,7 @@ repository: https://github.com/node-projects/web-component-designer-simple-demo
|
|
|
35
30
|
|
|
36
31
|
## Features we are workin on
|
|
37
32
|
|
|
38
|
-
|
|
39
|
-
- look at the issues
|
|
40
|
-
- Much, much more ...
|
|
33
|
+
https://github.com/node-projects/web-component-designer/issues
|
|
41
34
|
|
|
42
35
|
## Developing
|
|
43
36
|
|
|
@@ -46,38 +39,39 @@ repository: https://github.com/node-projects/web-component-designer-simple-demo
|
|
|
46
39
|
$ npm install
|
|
47
40
|
```
|
|
48
41
|
|
|
49
|
-
* Compile
|
|
42
|
+
* Compile typescript after doing changes
|
|
50
43
|
```
|
|
51
|
-
$ npm run build
|
|
44
|
+
$ npm run build (if you use Visual Studio Code, you can also run the build task via Ctrl + Shift + B > tsc:build - tsconfig.json)
|
|
52
45
|
```
|
|
53
46
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
* *Link node module*<br/>
|
|
48
|
+
```
|
|
49
|
+
$ npm link
|
|
50
|
+
```
|
|
57
51
|
|
|
58
|
-
##
|
|
52
|
+
## Using
|
|
59
53
|
|
|
60
|
-
|
|
54
|
+
At first you have to setup a service container providing services for history, properties, elements, ...
|
|
61
55
|
|
|
62
56
|
## Code Editor
|
|
63
57
|
|
|
64
|
-
You can select to use
|
|
65
|
-
If you use one of the
|
|
58
|
+
You can select to use one of 3 code editors available (ACE, CodeMirrow, Monaco).
|
|
59
|
+
If you use one of the widgets, you need to include the JS lib in your index.html and then use the specific widget.
|
|
66
60
|
|
|
67
61
|
## TreeView
|
|
68
62
|
|
|
69
|
-
We have 2
|
|
63
|
+
We have 2 tree components. One independent and one feature rich which uses FancyTree (and cause of this it needs JQuery and JqueryUI).
|
|
70
64
|
|
|
71
65
|
## DragDrop
|
|
72
66
|
|
|
73
|
-
If you'd like to use the
|
|
74
|
-
Your
|
|
67
|
+
If you'd like to use the designer on mobile, you need the mobile-drag-drop npm library and include our polyfill.
|
|
68
|
+
Your index.html should be extended as follows:
|
|
75
69
|
|
|
76
70
|
<link rel="stylesheet" href="/node_modules/mobile-drag-drop/default.css">
|
|
77
71
|
<script src="/node_modules/mobile-drag-drop/index.js"></script>
|
|
78
72
|
<script src="/node_modules/@node-projects/web-component-designer/dist/polyfill/mobileDragDrop.js"></script>
|
|
79
73
|
|
|
80
|
-
## Copyright notice
|
|
74
|
+
## Copyright notice
|
|
81
75
|
|
|
82
76
|
The Library uses Images from the Chrome Dev Tools, see
|
|
83
77
|
https://github.com/ChromeDevTools/devtools-frontend/tree/main/front_end/Images/src
|
|
@@ -136,8 +136,13 @@ export class DesignerTabControl extends BaseCustomWebComponentLazyAppend {
|
|
|
136
136
|
let w = 0;
|
|
137
137
|
DomHelper.removeAllChildnodes(this._moreContainer);
|
|
138
138
|
DomHelper.removeAllChildnodes(this._headerDiv);
|
|
139
|
+
let reloadOnce = true;
|
|
139
140
|
for (let item of this.children) {
|
|
140
141
|
let htmlItem = item;
|
|
142
|
+
if (!this._elementMap.has(htmlItem) && reloadOnce) {
|
|
143
|
+
this.refreshItems();
|
|
144
|
+
reloadOnce = false;
|
|
145
|
+
}
|
|
141
146
|
const tabHeaderDiv = this._elementMap.get(htmlItem);
|
|
142
147
|
this._moreContainer.appendChild(tabHeaderDiv);
|
|
143
148
|
if (this._headerDiv.children.length == 0 || (w + (tabHeaderDiv.clientWidth / 2)) < this._headerDiv.clientWidth) {
|
|
@@ -28,6 +28,10 @@ import { IBindableObjectsService } from "./bindableObjectsService/IBindableObjec
|
|
|
28
28
|
import { IBindableObjectDragDropService } from "./bindableObjectsService/IBindableObjectDragDropService.js";
|
|
29
29
|
import { IDesignViewToolbarButtonProvider } from "../widgets/designerView/tools/toolBar/IDesignViewToolbarButtonProvider.js";
|
|
30
30
|
import { IElementInteractionService } from './elementInteractionService/IElementInteractionService';
|
|
31
|
+
import { IProperty } from "./propertiesService/IProperty.js";
|
|
32
|
+
import { IDesignItem } from "../item/IDesignItem.js";
|
|
33
|
+
import { IBinding } from "../item/IBinding";
|
|
34
|
+
import { BindingTarget } from "../item/BindingTarget";
|
|
31
35
|
interface ServiceNameMap {
|
|
32
36
|
"propertyService": IPropertiesService;
|
|
33
37
|
"containerService": IPlacementService;
|
|
@@ -52,6 +56,7 @@ export declare class ServiceContainer extends BaseServiceContainer<ServiceNameMa
|
|
|
52
56
|
readonly config: {
|
|
53
57
|
codeViewWidget: new (...args: any[]) => ICodeView & HTMLElement;
|
|
54
58
|
demoViewWidget: new (...args: any[]) => IDemoView & HTMLElement;
|
|
59
|
+
openBindingsEditor?: (property: IProperty, designItems: IDesignItem[], binding: IBinding, bindingTarget: BindingTarget) => Promise<void>;
|
|
55
60
|
};
|
|
56
61
|
readonly designerExtensions: Map<(ExtensionType | string), IDesignerExtensionProvider[]>;
|
|
57
62
|
removeDesignerExtensionOfType(container: (ExtensionType | string), lambda: new (...args: any[]) => IDesignerExtensionProvider): void;
|
|
@@ -3,10 +3,12 @@ import { IService } from '../IService';
|
|
|
3
3
|
import { IDesignItem } from '../../item/IDesignItem';
|
|
4
4
|
import { ValueType } from './ValueType';
|
|
5
5
|
import { BindingTarget } from '../../item/BindingTarget';
|
|
6
|
+
import { IBinding } from '../../item/IBinding';
|
|
6
7
|
export interface IPropertiesService extends IService {
|
|
7
8
|
isHandledElement(designItem: IDesignItem): boolean;
|
|
8
9
|
getProperties(designItem: IDesignItem): IProperty[];
|
|
9
10
|
getProperty(designItem: IDesignItem, name: string): IProperty;
|
|
11
|
+
getBinding(designItems: IDesignItem[], property: IProperty): IBinding;
|
|
10
12
|
getPropertyTarget(designItem: IDesignItem, property: IProperty): BindingTarget;
|
|
11
13
|
setValue(designItems: IDesignItem[], property: IProperty, value: any): any;
|
|
12
14
|
clearValue(designItems: IDesignItem[], property: IProperty): any;
|
|
@@ -2,6 +2,7 @@ import { IPropertiesService } from "../IPropertiesService";
|
|
|
2
2
|
import { IProperty } from '../IProperty';
|
|
3
3
|
import { IDesignItem } from '../../../item/IDesignItem';
|
|
4
4
|
import { ValueType } from "../ValueType";
|
|
5
|
+
import { IBinding } from "../../../item/IBinding.js";
|
|
5
6
|
import { BindingTarget } from "../../../item/BindingTarget";
|
|
6
7
|
export declare class AttributesPropertiesService implements IPropertiesService {
|
|
7
8
|
name: string;
|
|
@@ -13,5 +14,6 @@ export declare class AttributesPropertiesService implements IPropertiesService {
|
|
|
13
14
|
clearValue(designItems: IDesignItem[], property: IProperty): void;
|
|
14
15
|
isSet(designItems: IDesignItem[], property: IProperty): ValueType;
|
|
15
16
|
getValue(designItems: IDesignItem[], property: IProperty): string;
|
|
17
|
+
getBinding(designItems: IDesignItem[], property: IProperty): IBinding;
|
|
16
18
|
getUnsetValue(designItems: IDesignItem[], property: IProperty): any;
|
|
17
19
|
}
|
|
@@ -62,6 +62,13 @@ export class AttributesPropertiesService {
|
|
|
62
62
|
}
|
|
63
63
|
return null;
|
|
64
64
|
}
|
|
65
|
+
getBinding(designItems, property) {
|
|
66
|
+
//TODO: optimize perf, do not call bindings service for each property.
|
|
67
|
+
const bindings = designItems[0].serviceContainer.forSomeServicesTillResult('bindingService', (s) => {
|
|
68
|
+
return s.getBindings(designItems[0]);
|
|
69
|
+
});
|
|
70
|
+
return bindings.find(x => (x.target == BindingTarget.property || x.target == BindingTarget.attribute) && x.targetName == property.name);
|
|
71
|
+
}
|
|
65
72
|
getUnsetValue(designItems, property) {
|
|
66
73
|
return property.defaultValue;
|
|
67
74
|
}
|
|
@@ -3,6 +3,7 @@ import { IProperty } from '../IProperty';
|
|
|
3
3
|
import { IDesignItem } from '../../../item/IDesignItem';
|
|
4
4
|
import { ValueType } from "../ValueType";
|
|
5
5
|
import { BindingTarget } from "../../../item/BindingTarget";
|
|
6
|
+
import { IBinding } from "../../../item/IBinding";
|
|
6
7
|
export declare class CommonPropertiesService implements IPropertiesService {
|
|
7
8
|
private commonProperties;
|
|
8
9
|
name: string;
|
|
@@ -14,5 +15,6 @@ export declare class CommonPropertiesService implements IPropertiesService {
|
|
|
14
15
|
clearValue(designItems: IDesignItem[], property: IProperty): void;
|
|
15
16
|
isSet(designItems: IDesignItem[], property: IProperty): ValueType;
|
|
16
17
|
getValue(designItems: IDesignItem[], property: IProperty): string | boolean;
|
|
18
|
+
getBinding(designItems: IDesignItem[], property: IProperty): IBinding;
|
|
17
19
|
getUnsetValue(designItems: IDesignItem[], property: IProperty): any;
|
|
18
20
|
}
|
|
@@ -106,6 +106,13 @@ export class CommonPropertiesService {
|
|
|
106
106
|
}
|
|
107
107
|
return null;
|
|
108
108
|
}
|
|
109
|
+
getBinding(designItems, property) {
|
|
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
|
+
return bindings.find(x => (x.target == BindingTarget.property || x.target == BindingTarget.attribute) && x.targetName == property.name);
|
|
115
|
+
}
|
|
109
116
|
getUnsetValue(designItems, property) {
|
|
110
117
|
return property.defaultValue;
|
|
111
118
|
}
|
|
@@ -3,6 +3,7 @@ import { IProperty } from '../IProperty';
|
|
|
3
3
|
import { IDesignItem } from '../../../item/IDesignItem';
|
|
4
4
|
import { ValueType } from '../ValueType';
|
|
5
5
|
import { BindingTarget } from '../../../item/BindingTarget.js';
|
|
6
|
+
import { IBinding } from '../../../item/IBinding';
|
|
6
7
|
export declare class CssPropertiesService implements IPropertiesService {
|
|
7
8
|
private styles;
|
|
8
9
|
private alignment;
|
|
@@ -18,5 +19,6 @@ export declare class CssPropertiesService implements IPropertiesService {
|
|
|
18
19
|
clearValue(designItems: IDesignItem[], property: IProperty): void;
|
|
19
20
|
isSet(designItems: IDesignItem[], property: IProperty): ValueType;
|
|
20
21
|
getValue(designItems: IDesignItem[], property: IProperty): string;
|
|
22
|
+
getBinding(designItems: IDesignItem[], property: IProperty): IBinding;
|
|
21
23
|
getUnsetValue(designItems: IDesignItem[], property: IProperty): any;
|
|
22
24
|
}
|
|
@@ -312,6 +312,13 @@ export class CssPropertiesService {
|
|
|
312
312
|
}
|
|
313
313
|
return null;
|
|
314
314
|
}
|
|
315
|
+
getBinding(designItems, property) {
|
|
316
|
+
//TODO: optimize perf, do not call bindings service for each property.
|
|
317
|
+
const bindings = designItems[0].serviceContainer.forSomeServicesTillResult('bindingService', (s) => {
|
|
318
|
+
return s.getBindings(designItems[0]);
|
|
319
|
+
});
|
|
320
|
+
return bindings.find(x => (x.target == BindingTarget.css) && x.targetName == property.name);
|
|
321
|
+
}
|
|
315
322
|
//todo: optimize perf, call window.getComputedStyle only once per item, and not per property
|
|
316
323
|
getUnsetValue(designItems, property) {
|
|
317
324
|
if (designItems != null && designItems.length !== 0) {
|
package/dist/elements/services/propertiesService/services/UnkownElementPropertiesService.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { IProperty } from '../IProperty';
|
|
|
3
3
|
import { IDesignItem } from '../../../item/IDesignItem';
|
|
4
4
|
import { ValueType } from "../ValueType";
|
|
5
5
|
import { BindingTarget } from "../../../item/BindingTarget";
|
|
6
|
+
import { IBinding } from "../../../item/IBinding";
|
|
6
7
|
export declare abstract class UnkownElementPropertiesService implements IPropertiesService {
|
|
7
8
|
isHandledElement(designItem: IDesignItem): boolean;
|
|
8
9
|
protected _notifyChangedProperty(designItem: IDesignItem, property: IProperty, value: any): void;
|
|
@@ -12,6 +13,7 @@ export declare abstract class UnkownElementPropertiesService implements IPropert
|
|
|
12
13
|
getPropertyTarget(designItem: IDesignItem, property: IProperty): BindingTarget;
|
|
13
14
|
clearValue(designItems: IDesignItem[], property: IProperty): void;
|
|
14
15
|
isSet(designItems: IDesignItem[], property: IProperty): ValueType;
|
|
16
|
+
getBinding(designItems: IDesignItem[], property: IProperty): IBinding;
|
|
15
17
|
getValue(designItems: IDesignItem[], property: IProperty): string | boolean;
|
|
16
18
|
getUnsetValue(designItems: IDesignItem[], property: IProperty): any;
|
|
17
19
|
}
|
|
@@ -69,7 +69,7 @@ export class UnkownElementPropertiesService {
|
|
|
69
69
|
all = all && has;
|
|
70
70
|
some = some || has;
|
|
71
71
|
});
|
|
72
|
-
//
|
|
72
|
+
//TODO: optimize perf, do not call bindings service for each property.
|
|
73
73
|
const bindings = designItems[0].serviceContainer.forSomeServicesTillResult('bindingService', (s) => {
|
|
74
74
|
return s.getBindings(designItems[0]);
|
|
75
75
|
});
|
|
@@ -80,6 +80,13 @@ export class UnkownElementPropertiesService {
|
|
|
80
80
|
return ValueType.none;
|
|
81
81
|
return all ? ValueType.all : some ? ValueType.some : ValueType.none;
|
|
82
82
|
}
|
|
83
|
+
getBinding(designItems, property) {
|
|
84
|
+
//TODO: optimize perf, do not call bindings service for each property.
|
|
85
|
+
const bindings = designItems[0].serviceContainer.forSomeServicesTillResult('bindingService', (s) => {
|
|
86
|
+
return s.getBindings(designItems[0]);
|
|
87
|
+
});
|
|
88
|
+
return bindings.find(x => (x.target == BindingTarget.property || x.target == BindingTarget.attribute) && x.targetName == property.name);
|
|
89
|
+
}
|
|
83
90
|
getValue(designItems, property) {
|
|
84
91
|
if (designItems != null && designItems.length !== 0) {
|
|
85
92
|
let attributeName = PropertiesHelper.camelToDashCase(property.name);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IProperty } from '../../services/propertiesService/IProperty';
|
|
1
2
|
import { ServiceContainer } from '../../services/ServiceContainer';
|
|
2
3
|
import { BaseCustomWebComponentLazyAppend } from '@node-projects/base-custom-webcomponent';
|
|
3
4
|
import { IDesignItem } from '../../item/IDesignItem';
|
|
@@ -12,6 +13,7 @@ export declare class PropertyGridPropertyList extends BaseCustomWebComponentLazy
|
|
|
12
13
|
constructor(serviceContainer: ServiceContainer);
|
|
13
14
|
setPropertiesService(propertiesService: IPropertiesService): void;
|
|
14
15
|
createElements(designItem: IDesignItem): void;
|
|
16
|
+
openContextMenu(event: MouseEvent, property: IProperty): void;
|
|
15
17
|
designItemsChanged(designItems: IDesignItem[]): void;
|
|
16
18
|
refreshForDesignItems(items: IDesignItem[]): void;
|
|
17
19
|
}
|
|
@@ -114,10 +114,10 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
|
|
|
114
114
|
rect.style.border = '1px white solid';
|
|
115
115
|
rectContainer.appendChild(rect);
|
|
116
116
|
this._div.appendChild(rectContainer);
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
rect.oncontextmenu = (event) => {
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
this.openContextMenu(event, p);
|
|
120
|
+
};
|
|
121
121
|
let label = document.createElement("label");
|
|
122
122
|
label.htmlFor = p.name;
|
|
123
123
|
label.textContent = p.name;
|
|
@@ -131,6 +131,23 @@ export class PropertyGridPropertyList extends BaseCustomWebComponentLazyAppend {
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
+
openContextMenu(event, property) {
|
|
135
|
+
const ctxMenu = [
|
|
136
|
+
{ title: 'clear', action: (e) => property.service.clearValue(this._designItems, property) },
|
|
137
|
+
];
|
|
138
|
+
if (this._serviceContainer.config.openBindingsEditor) {
|
|
139
|
+
ctxMenu.push(...[
|
|
140
|
+
{ title: '-' },
|
|
141
|
+
{ title: 'edit binding', action: () => {
|
|
142
|
+
let target = this._propertiesService.getPropertyTarget(this._designItems[0], property);
|
|
143
|
+
let binding = this._propertiesService.getBinding(this._designItems, property);
|
|
144
|
+
this._serviceContainer.config.openBindingsEditor(property, this._designItems, binding, target);
|
|
145
|
+
} }
|
|
146
|
+
]);
|
|
147
|
+
}
|
|
148
|
+
;
|
|
149
|
+
ContextMenuHelper.showContextMenu(null, event, null, ctxMenu);
|
|
150
|
+
}
|
|
134
151
|
designItemsChanged(designItems) {
|
|
135
152
|
this._designItems = designItems;
|
|
136
153
|
for (let m of this._propertyMap) {
|
package/dist/index.d.ts
CHANGED
|
@@ -15,8 +15,8 @@ export type { IContextMenuItem } from "./elements/helper/contextMenu/IContextmen
|
|
|
15
15
|
export * from "./elements/item/DesignItem.js";
|
|
16
16
|
export type { IDesignItem } from "./elements/item/IDesignItem.js";
|
|
17
17
|
export type { IBinding } from "./elements/item/IBinding.js";
|
|
18
|
-
export
|
|
19
|
-
export
|
|
18
|
+
export * from "./elements/item/BindingMode.js";
|
|
19
|
+
export * from "./elements/item/BindingTarget.js";
|
|
20
20
|
export * from "./elements/services/bindableObjectsService/BindableObjectType.js";
|
|
21
21
|
export type { IBindableObject } from "./elements/services/bindableObjectsService/IBindableObject.js";
|
|
22
22
|
export type { IBindableObjectsService } from "./elements/services/bindableObjectsService/IBindableObjectsService.js";
|
package/dist/index.js
CHANGED
|
@@ -12,6 +12,8 @@ export * from "./elements/helper/w3color.js";
|
|
|
12
12
|
export * from "./elements/helper/contextMenu/ContextMenuHelper.js";
|
|
13
13
|
export * from "./elements/helper/Helper.js";
|
|
14
14
|
export * from "./elements/item/DesignItem.js";
|
|
15
|
+
export * from "./elements/item/BindingMode.js";
|
|
16
|
+
export * from "./elements/item/BindingTarget.js";
|
|
15
17
|
export * from "./elements/services/bindableObjectsService/BindableObjectType.js";
|
|
16
18
|
export * from "./elements/services/bindingsService/BaseCustomWebcomponentBindingsService.js";
|
|
17
19
|
export * from "./elements/services/bindingsService/SpecialTagsBindingService.js";
|