@node-projects/web-component-designer 0.0.75 → 0.0.76
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 +2 -2
- package/dist/elements/services/BaseServiceContainer.d.ts +1 -0
- package/dist/elements/services/BaseServiceContainer.js +7 -0
- package/dist/elements/services/demoProviderService/DemoProviderService.js +1 -1
- package/dist/elements/services/instanceService/DefaultInstanceService.js +1 -1
- package/dist/elements/services/manifestLoaders/WebcomponentManifestParserService.d.ts +26 -0
- package/dist/elements/services/manifestLoaders/WebcomponentManifestParserService.js +69 -0
- package/dist/elements/services/manifestParsers/WebcomponentManifestParserService.d.ts +23 -0
- package/dist/elements/services/manifestParsers/WebcomponentManifestParserService.js +80 -0
- package/dist/elements/services/propertiesService/DefaultEditorTypesService.js +0 -1
- package/dist/elements/services/propertiesService/IPropertiesService.d.ts +0 -1
- package/dist/elements/services/propertiesService/IProperty.d.ts +5 -1
- package/dist/elements/services/propertiesService/PropertyType.d.ts +6 -0
- package/dist/elements/services/propertiesService/PropertyType.js +7 -0
- package/dist/elements/services/propertiesService/services/AbstractBasePropertiesService.js +7 -6
- package/dist/elements/services/propertiesService/services/AttributesPropertiesService.js +3 -2
- package/dist/elements/services/propertiesService/services/CommonPropertiesService.js +11 -4
- package/dist/elements/services/propertiesService/services/CssPropertiesService.js +81 -41
- package/dist/elements/services/propertiesService/services/IJsonPropertyDefinition.d.ts +4 -0
- package/dist/elements/services/propertiesService/services/ListPropertiesService.js +5 -1
- package/dist/elements/services/propertiesService/services/Lit2PropertiesService.js +7 -6
- package/dist/elements/services/propertiesService/services/NativeElementsPropertiesService.js +25 -12
- package/dist/elements/services/propertiesService/services/UnkownElementPropertiesService.d.ts +1 -2
- package/dist/elements/services/propertiesService/services/UnkownElementPropertiesService.js +1 -1
- package/dist/elements/services/webcomponentManifestParserService/WebcomponentManifestParserService.1.d.ts +0 -0
- package/dist/elements/services/webcomponentManifestParserService/WebcomponentManifestParserService.1.js +1 -0
- package/dist/elements/services/webcomponentManifestParserService/webcomponentManifestParserService.d.ts +26 -0
- package/dist/elements/services/webcomponentManifestParserService/webcomponentManifestParserService.js +69 -0
- package/dist/elements/widgets/designerView/designerCanvas.js +6 -0
- package/dist/elements/widgets/paletteView/paletteTreeView.js +13 -8
- package/dist/elements/widgets/paletteView/paletteView.js +10 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# web-component-designer
|
|
2
2
|
|
|
3
|
-
## Caution - this is a preview Version, a RC is planed for
|
|
3
|
+
## Caution - this is a preview Version, a RC is planed for January 2022
|
|
4
4
|
|
|
5
5
|
A HTML WebComponent for Designing Webcomponents and HTML Pages.
|
|
6
6
|
|
|
@@ -81,4 +81,4 @@ Your addition to your index.html should look like this:
|
|
|
81
81
|
The Library uses Images from the Chrome Dev Tools, see
|
|
82
82
|
https://github.com/ChromeDevTools/devtools-frontend/tree/main/front_end/Images/src
|
|
83
83
|
and
|
|
84
|
-
https://github.com/ChromeDevTools/devtools-frontend/blob/main/LICENSE
|
|
84
|
+
https://github.com/ChromeDevTools/devtools-frontend/blob/main/LICENSE
|
|
@@ -4,6 +4,7 @@ export declare class BaseServiceContainer<NameMap> {
|
|
|
4
4
|
getLastService<K extends keyof NameMap>(service: K): NameMap[K];
|
|
5
5
|
getServices<K extends keyof NameMap>(service: K): NameMap[K][];
|
|
6
6
|
register<K extends keyof NameMap>(name: K, service: NameMap[K]): void;
|
|
7
|
+
registerMultiple<K extends keyof NameMap>(names: K[], service: NameMap[K]): void;
|
|
7
8
|
forSomeServicesTillResult<K extends keyof NameMap, Y>(service: K, callback: (service: NameMap[K]) => Y): Y;
|
|
8
9
|
getLastServiceWhere<K extends keyof NameMap, Y>(service: K, callback: (service: NameMap[K]) => Y): NameMap[K];
|
|
9
10
|
}
|
|
@@ -14,6 +14,13 @@ export class BaseServiceContainer {
|
|
|
14
14
|
this._services.set(name, []);
|
|
15
15
|
this._services.get(name).push(service);
|
|
16
16
|
}
|
|
17
|
+
registerMultiple(names, service) {
|
|
18
|
+
for (const name of names) {
|
|
19
|
+
if (!this._services.has(name))
|
|
20
|
+
this._services.set(name, []);
|
|
21
|
+
this._services.get(name).push(service);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
17
24
|
forSomeServicesTillResult(service, callback) {
|
|
18
25
|
let services = this.getServices(service);
|
|
19
26
|
if (services == null) {
|
|
@@ -21,7 +21,7 @@ export class DemoProviderService {
|
|
|
21
21
|
}
|
|
22
22
|
doc.write("document.body.style.display='';");
|
|
23
23
|
doc.write('</script>');
|
|
24
|
-
doc.write('<body style="display:none">' + code + '</body>');
|
|
24
|
+
doc.write('<body style="display:none; width: 100%; height: 100%; margin: 0; padding: 0; position: absolute;">' + code + '</body>');
|
|
25
25
|
doc.close();
|
|
26
26
|
});
|
|
27
27
|
}
|
|
@@ -53,7 +53,7 @@ export class DefaultInstanceService {
|
|
|
53
53
|
if (definition.defaultProperties) {
|
|
54
54
|
let propertiesService = null;
|
|
55
55
|
if (definition.type) {
|
|
56
|
-
propertiesService = serviceContainer.getLastServiceWhere('propertyService', (x) => x.
|
|
56
|
+
propertiesService = serviceContainer.getLastServiceWhere('propertyService', (x) => x.isHandledElement(designItem));
|
|
57
57
|
}
|
|
58
58
|
let properties = propertiesService.getProperties(designItem);
|
|
59
59
|
for (let a in definition.defaultProperties) {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IDesignItem } from "../../..";
|
|
2
|
+
import { BindingTarget } from "../../item/BindingTarget";
|
|
3
|
+
import { IElementDefinition } from "../elementsService/IElementDefinition";
|
|
4
|
+
import { IElementsService } from "../elementsService/IElementsService";
|
|
5
|
+
import { IPropertiesService } from "../propertiesService/IPropertiesService";
|
|
6
|
+
import { IProperty } from "../propertiesService/IProperty";
|
|
7
|
+
import { ValueType } from "../propertiesService/ValueType";
|
|
8
|
+
export declare class WebcomponentManifestParserService implements IElementsService, IPropertiesService {
|
|
9
|
+
private _name;
|
|
10
|
+
get name(): string;
|
|
11
|
+
private _packageData;
|
|
12
|
+
private _elementList;
|
|
13
|
+
private _resolveStored;
|
|
14
|
+
private _rejectStored;
|
|
15
|
+
constructor(name: string, file: string);
|
|
16
|
+
getElements(): Promise<IElementDefinition[]>;
|
|
17
|
+
isHandledElement(designItem: IDesignItem): boolean;
|
|
18
|
+
getProperties(designItem: IDesignItem): IProperty[];
|
|
19
|
+
getProperty(designItem: IDesignItem, name: string): IProperty;
|
|
20
|
+
getPropertyTarget(designItem: IDesignItem, property: IProperty): BindingTarget;
|
|
21
|
+
setValue(designItems: IDesignItem[], property: IProperty, value: any): void;
|
|
22
|
+
clearValue(designItems: IDesignItem[], property: IProperty): void;
|
|
23
|
+
isSet(designItems: IDesignItem[], property: IProperty): ValueType;
|
|
24
|
+
getValue(designItems: IDesignItem[], property: IProperty): void;
|
|
25
|
+
getUnsetValue(designItems: IDesignItem[], property: IProperty): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export class WebcomponentManifestParserService {
|
|
2
|
+
_name;
|
|
3
|
+
get name() { return this._name; }
|
|
4
|
+
_packageData;
|
|
5
|
+
_elementList;
|
|
6
|
+
_resolveStored;
|
|
7
|
+
_rejectStored;
|
|
8
|
+
constructor(name, file) {
|
|
9
|
+
this._name = name;
|
|
10
|
+
import(file, { assert: { type: 'json' } }).then(module => {
|
|
11
|
+
this._packageData = module.default;
|
|
12
|
+
this._elementList = [];
|
|
13
|
+
for (let m of this._packageData.modules) {
|
|
14
|
+
for (let e of m.exports) {
|
|
15
|
+
if (e.kind == 'custom-element-definition') {
|
|
16
|
+
this._elementList.push({ tag: e.name });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (this._resolveStored) {
|
|
20
|
+
this._resolveStored.forEach(x => x(this._elementList));
|
|
21
|
+
this._resolveStored = null;
|
|
22
|
+
this._rejectStored = null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}).catch(err => {
|
|
26
|
+
if (this._rejectStored) {
|
|
27
|
+
this._rejectStored.forEach(x => x(err));
|
|
28
|
+
this._resolveStored = null;
|
|
29
|
+
this._rejectStored = null;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
async getElements() {
|
|
34
|
+
if (this._packageData)
|
|
35
|
+
return Promise.resolve(this._elementList);
|
|
36
|
+
if (!this._resolveStored) {
|
|
37
|
+
this._resolveStored = [];
|
|
38
|
+
this._rejectStored = [];
|
|
39
|
+
}
|
|
40
|
+
return new Promise((resolve, reject) => { this._resolveStored.push(resolve); this._rejectStored.push(reject); });
|
|
41
|
+
}
|
|
42
|
+
isHandledElement(designItem) {
|
|
43
|
+
throw new Error("Method not implemented.");
|
|
44
|
+
}
|
|
45
|
+
getProperties(designItem) {
|
|
46
|
+
throw new Error("Method not implemented.");
|
|
47
|
+
}
|
|
48
|
+
getProperty(designItem, name) {
|
|
49
|
+
throw new Error("Method not implemented.");
|
|
50
|
+
}
|
|
51
|
+
getPropertyTarget(designItem, property) {
|
|
52
|
+
throw new Error("Method not implemented.");
|
|
53
|
+
}
|
|
54
|
+
setValue(designItems, property, value) {
|
|
55
|
+
throw new Error("Method not implemented.");
|
|
56
|
+
}
|
|
57
|
+
clearValue(designItems, property) {
|
|
58
|
+
throw new Error("Method not implemented.");
|
|
59
|
+
}
|
|
60
|
+
isSet(designItems, property) {
|
|
61
|
+
throw new Error("Method not implemented.");
|
|
62
|
+
}
|
|
63
|
+
getValue(designItems, property) {
|
|
64
|
+
throw new Error("Method not implemented.");
|
|
65
|
+
}
|
|
66
|
+
getUnsetValue(designItems, property) {
|
|
67
|
+
throw new Error("Method not implemented.");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BindingTarget } from "../../item/BindingTarget";
|
|
2
|
+
import { IElementDefinition } from "../elementsService/IElementDefinition";
|
|
3
|
+
import { IElementsService } from "../elementsService/IElementsService";
|
|
4
|
+
import { IPropertiesService } from "../propertiesService/IPropertiesService";
|
|
5
|
+
import { IProperty } from "../propertiesService/IProperty";
|
|
6
|
+
import { IDesignItem } from "../../item/IDesignItem";
|
|
7
|
+
import { UnkownElementPropertiesService } from "../propertiesService/services/UnkownElementPropertiesService";
|
|
8
|
+
export declare class WebcomponentManifestParserService extends UnkownElementPropertiesService implements IElementsService, IPropertiesService {
|
|
9
|
+
private _name;
|
|
10
|
+
get name(): string;
|
|
11
|
+
private _packageData;
|
|
12
|
+
private _elementList;
|
|
13
|
+
private _propertiesList;
|
|
14
|
+
private _resolveStored;
|
|
15
|
+
private _rejectStored;
|
|
16
|
+
constructor(name: string, file: string);
|
|
17
|
+
private manifestClassPropertyTypeToEditorPropertyType;
|
|
18
|
+
getElements(): Promise<IElementDefinition[]>;
|
|
19
|
+
isHandledElement(designItem: IDesignItem): boolean;
|
|
20
|
+
getProperties(designItem: IDesignItem): IProperty[];
|
|
21
|
+
getProperty(designItem: IDesignItem, name: string): IProperty;
|
|
22
|
+
getPropertyTarget(designItem: IDesignItem, property: IProperty): BindingTarget;
|
|
23
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { BindingTarget } from "../../item/BindingTarget";
|
|
2
|
+
import { PropertyType } from "../propertiesService/PropertyType";
|
|
3
|
+
import { UnkownElementPropertiesService } from "../propertiesService/services/UnkownElementPropertiesService";
|
|
4
|
+
export class WebcomponentManifestParserService extends UnkownElementPropertiesService {
|
|
5
|
+
_name;
|
|
6
|
+
get name() { return this._name; }
|
|
7
|
+
_packageData;
|
|
8
|
+
_elementList;
|
|
9
|
+
_propertiesList;
|
|
10
|
+
_resolveStored;
|
|
11
|
+
_rejectStored;
|
|
12
|
+
constructor(name, file) {
|
|
13
|
+
super();
|
|
14
|
+
this._name = name;
|
|
15
|
+
let path = file.split('/').slice(0, -1).join('/');
|
|
16
|
+
import(file, { assert: { type: 'json' } }).then(module => {
|
|
17
|
+
this._packageData = module.default;
|
|
18
|
+
this._elementList = [];
|
|
19
|
+
this._propertiesList = {};
|
|
20
|
+
for (let m of this._packageData.modules) {
|
|
21
|
+
for (let e of m.exports) {
|
|
22
|
+
if (e.kind == 'custom-element-definition') {
|
|
23
|
+
this._elementList.push({ tag: e.name, import: path + '/' + e.declaration.module });
|
|
24
|
+
let properties = [];
|
|
25
|
+
let declaration = m.declarations.find(x => x.name == e.declaration.name);
|
|
26
|
+
for (let d of declaration.members) {
|
|
27
|
+
if (d.kind == 'field') {
|
|
28
|
+
let pType = PropertyType.property;
|
|
29
|
+
pType = declaration.attributes.find(x => x.fieldName == d.name) != null ? PropertyType.propertyAndAttribute : PropertyType.property;
|
|
30
|
+
properties.push({ name: d.name, service: this, propertyType: pType, type: this.manifestClassPropertyTypeToEditorPropertyType(d.type?.text) });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
this._propertiesList[e.name] = properties;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (this._resolveStored) {
|
|
37
|
+
this._resolveStored.forEach(x => x(this._elementList));
|
|
38
|
+
this._resolveStored = null;
|
|
39
|
+
this._rejectStored = null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}).catch(err => {
|
|
43
|
+
if (this._rejectStored) {
|
|
44
|
+
this._rejectStored.forEach(x => x(err));
|
|
45
|
+
this._resolveStored = null;
|
|
46
|
+
this._rejectStored = null;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
manifestClassPropertyTypeToEditorPropertyType(type) {
|
|
51
|
+
if (type) {
|
|
52
|
+
if (type.toLowerCase() === 'boolean')
|
|
53
|
+
return 'boolean';
|
|
54
|
+
if (type.toLowerCase() === 'number')
|
|
55
|
+
return 'number';
|
|
56
|
+
}
|
|
57
|
+
return type;
|
|
58
|
+
}
|
|
59
|
+
async getElements() {
|
|
60
|
+
if (this._packageData)
|
|
61
|
+
return Promise.resolve(this._elementList);
|
|
62
|
+
if (!this._resolveStored) {
|
|
63
|
+
this._resolveStored = [];
|
|
64
|
+
this._rejectStored = [];
|
|
65
|
+
}
|
|
66
|
+
return new Promise((resolve, reject) => { this._resolveStored.push(resolve); this._rejectStored.push(reject); });
|
|
67
|
+
}
|
|
68
|
+
isHandledElement(designItem) {
|
|
69
|
+
return this._elementList.find(x => x.tag == designItem.name) != null;
|
|
70
|
+
}
|
|
71
|
+
getProperties(designItem) {
|
|
72
|
+
return this._propertiesList[designItem.name];
|
|
73
|
+
}
|
|
74
|
+
getProperty(designItem, name) {
|
|
75
|
+
return this._propertiesList[designItem.name].find(x => x.name == name);
|
|
76
|
+
}
|
|
77
|
+
getPropertyTarget(designItem, property) {
|
|
78
|
+
return this._propertiesList[designItem.name].find(x => x.name == property.name).propertyType == PropertyType.attribute ? BindingTarget.attribute : BindingTarget.property;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -4,7 +4,6 @@ import { IDesignItem } from '../../item/IDesignItem';
|
|
|
4
4
|
import { ValueType } from './ValueType';
|
|
5
5
|
import { BindingTarget } from '../../item/BindingTarget';
|
|
6
6
|
export interface IPropertiesService extends IService {
|
|
7
|
-
readonly name: string;
|
|
8
7
|
isHandledElement(designItem: IDesignItem): boolean;
|
|
9
8
|
getProperties(designItem: IDesignItem): IProperty[];
|
|
10
9
|
getProperty(designItem: IDesignItem, name: string): IProperty;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { IPropertiesService } from './IPropertiesService';
|
|
2
2
|
import { IPropertyEditor } from './IPropertyEditor';
|
|
3
|
+
import { PropertyType } from './PropertyType';
|
|
3
4
|
export interface IProperty {
|
|
4
5
|
name: string;
|
|
6
|
+
propertyName?: string;
|
|
7
|
+
attributeName?: string;
|
|
5
8
|
description?: string;
|
|
6
|
-
type?: string;
|
|
9
|
+
type?: 'json' | 'color' | 'date' | 'number' | 'list' | 'enum' | 'boolean' | 'img-lis' | 'thickness' | 'css-length' | 'string' | string;
|
|
7
10
|
default?: any;
|
|
8
11
|
min?: number;
|
|
9
12
|
max?: number;
|
|
@@ -14,4 +17,5 @@ export interface IProperty {
|
|
|
14
17
|
value?: any;
|
|
15
18
|
service: IPropertiesService;
|
|
16
19
|
defaultValue?: any;
|
|
20
|
+
propertyType: PropertyType;
|
|
17
21
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var PropertyType;
|
|
2
|
+
(function (PropertyType) {
|
|
3
|
+
PropertyType["property"] = "property";
|
|
4
|
+
PropertyType["attribute"] = "attribute";
|
|
5
|
+
PropertyType["propertyAndAttribute"] = "propertyAndAttribute";
|
|
6
|
+
PropertyType["cssValue"] = "cssvalue";
|
|
7
|
+
})(PropertyType || (PropertyType = {}));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PropertiesHelper } from './PropertiesHelper';
|
|
2
2
|
import { UnkownElementPropertiesService } from "./UnkownElementPropertiesService";
|
|
3
|
+
import { PropertyType } from '../PropertyType';
|
|
3
4
|
export class AbstractBasePropertiesService extends UnkownElementPropertiesService {
|
|
4
5
|
getProperties(designItem) {
|
|
5
6
|
if (!this.isHandledElement(designItem))
|
|
@@ -14,27 +15,27 @@ export class AbstractBasePropertiesService extends UnkownElementPropertiesServic
|
|
|
14
15
|
if (polymerProperty.type)
|
|
15
16
|
type = polymerProperty.type;
|
|
16
17
|
if (type === String) {
|
|
17
|
-
let property = { name: name, type: "string", service: this };
|
|
18
|
+
let property = { name: name, type: "string", service: this, propertyType: PropertyType.propertyAndAttribute };
|
|
18
19
|
properties.push(property);
|
|
19
20
|
}
|
|
20
21
|
else if (type === Object) {
|
|
21
|
-
let property = { name: name, type: "object", service: this };
|
|
22
|
+
let property = { name: name, type: "object", service: this, propertyType: PropertyType.propertyAndAttribute };
|
|
22
23
|
properties.push(property);
|
|
23
24
|
}
|
|
24
25
|
else if (type === Number) {
|
|
25
|
-
let property = { name: name, type: "number", service: this };
|
|
26
|
+
let property = { name: name, type: "number", service: this, propertyType: PropertyType.propertyAndAttribute };
|
|
26
27
|
properties.push(property);
|
|
27
28
|
}
|
|
28
29
|
else if (type === Date) {
|
|
29
|
-
let property = { name: name, type: "date", service: this };
|
|
30
|
+
let property = { name: name, type: "date", service: this, propertyType: PropertyType.propertyAndAttribute };
|
|
30
31
|
properties.push(property);
|
|
31
32
|
}
|
|
32
33
|
else if (type === Boolean) {
|
|
33
|
-
let property = { name: name, type: "boolean", service: this };
|
|
34
|
+
let property = { name: name, type: "boolean", service: this, propertyType: PropertyType.propertyAndAttribute };
|
|
34
35
|
properties.push(property);
|
|
35
36
|
}
|
|
36
37
|
else if (PropertiesHelper.isTypescriptEnum(type)) {
|
|
37
|
-
let property = { name: name, type: "enum", enumValues: PropertiesHelper.getTypescriptEnumEntries(type), service: this };
|
|
38
|
+
let property = { name: name, type: "enum", enumValues: PropertiesHelper.getTypescriptEnumEntries(type), service: this, propertyType: PropertyType.propertyAndAttribute };
|
|
38
39
|
properties.push(property);
|
|
39
40
|
}
|
|
40
41
|
}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { ValueType } from "../ValueType";
|
|
2
2
|
import { BindingTarget } from "../../../item/BindingTarget";
|
|
3
|
+
import { PropertyType } from "../PropertyType";
|
|
3
4
|
export class AttributesPropertiesService {
|
|
4
5
|
name = "attributes";
|
|
5
6
|
isHandledElement(designItem) {
|
|
6
7
|
return true;
|
|
7
8
|
}
|
|
8
9
|
getProperty(designItem, name) {
|
|
9
|
-
return { name: name, type: 'string', service: this };
|
|
10
|
+
return { name: name, type: 'string', service: this, propertyType: PropertyType.propertyAndAttribute };
|
|
10
11
|
}
|
|
11
12
|
getProperties(designItem) {
|
|
12
13
|
if (designItem) {
|
|
13
14
|
let p = [];
|
|
14
15
|
for (let a of designItem.attributes.keys()) {
|
|
15
|
-
p.push({ name: a, type: 'string', service: this });
|
|
16
|
+
p.push({ name: a, type: 'string', service: this, propertyType: PropertyType.propertyAndAttribute });
|
|
16
17
|
}
|
|
17
18
|
return p;
|
|
18
19
|
}
|
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import { ValueType } from "../ValueType";
|
|
2
2
|
import { BindingTarget } from "../../../item/BindingTarget";
|
|
3
|
+
import { PropertyType } from "../PropertyType";
|
|
3
4
|
export class CommonPropertiesService {
|
|
4
5
|
//@ts-ignore
|
|
5
6
|
commonProperties = [
|
|
6
7
|
{
|
|
7
8
|
name: "id",
|
|
8
9
|
type: "string",
|
|
9
|
-
service: this
|
|
10
|
+
service: this,
|
|
11
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
10
12
|
}, {
|
|
11
13
|
name: "class",
|
|
12
14
|
type: "string",
|
|
13
|
-
service: this
|
|
15
|
+
service: this,
|
|
16
|
+
attributeName: "class",
|
|
17
|
+
propertyName: "className",
|
|
18
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
14
19
|
}, {
|
|
15
20
|
name: "title",
|
|
16
21
|
type: "string",
|
|
17
|
-
service: this
|
|
22
|
+
service: this,
|
|
23
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
18
24
|
}, {
|
|
19
25
|
name: "tabindex",
|
|
20
26
|
type: "number",
|
|
21
|
-
service: this
|
|
27
|
+
service: this,
|
|
28
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
22
29
|
}
|
|
23
30
|
];
|
|
24
31
|
name = "common";
|
|
@@ -1,85 +1,103 @@
|
|
|
1
1
|
import { ValueType } from '../ValueType';
|
|
2
2
|
import { NodeType } from '../../../item/NodeType';
|
|
3
3
|
import { BindingTarget } from '../../../item/BindingTarget.js';
|
|
4
|
+
import { PropertyType } from '../PropertyType';
|
|
4
5
|
export class CssPropertiesService {
|
|
5
6
|
//@ts-ignore
|
|
6
7
|
styles = [
|
|
7
8
|
{
|
|
8
9
|
name: "color",
|
|
9
10
|
type: "color",
|
|
10
|
-
service: this
|
|
11
|
+
service: this,
|
|
12
|
+
propertyType: PropertyType.cssValue
|
|
11
13
|
}, {
|
|
12
14
|
name: "background-color",
|
|
13
15
|
type: "color",
|
|
14
|
-
service: this
|
|
16
|
+
service: this,
|
|
17
|
+
propertyType: PropertyType.cssValue
|
|
15
18
|
}, {
|
|
16
19
|
name: "box-sizing",
|
|
17
20
|
type: "list",
|
|
18
21
|
values: ["border-box", "content-box"],
|
|
19
|
-
service: this
|
|
22
|
+
service: this,
|
|
23
|
+
propertyType: PropertyType.cssValue
|
|
20
24
|
}, {
|
|
21
25
|
name: "border",
|
|
22
26
|
type: "string",
|
|
23
27
|
default: "0px none rbg(0,0,0)",
|
|
24
|
-
service: this
|
|
28
|
+
service: this,
|
|
29
|
+
propertyType: PropertyType.cssValue
|
|
25
30
|
}, {
|
|
26
31
|
name: "box-shadow",
|
|
27
32
|
type: "string",
|
|
28
33
|
default: "none",
|
|
29
|
-
service: this
|
|
34
|
+
service: this,
|
|
35
|
+
propertyType: PropertyType.cssValue
|
|
30
36
|
}, {
|
|
31
37
|
name: "opacity",
|
|
32
38
|
type: "number",
|
|
33
39
|
min: 0,
|
|
34
40
|
max: 1,
|
|
35
41
|
step: 0.1,
|
|
36
|
-
service: this
|
|
42
|
+
service: this,
|
|
43
|
+
propertyType: PropertyType.cssValue
|
|
37
44
|
}, {
|
|
38
45
|
name: "padding",
|
|
39
46
|
type: "thickness",
|
|
40
|
-
service: this
|
|
47
|
+
service: this,
|
|
48
|
+
propertyType: PropertyType.cssValue
|
|
41
49
|
}, {
|
|
42
50
|
name: "margin",
|
|
43
51
|
type: "thickness",
|
|
44
|
-
service: this
|
|
52
|
+
service: this,
|
|
53
|
+
propertyType: PropertyType.cssValue
|
|
45
54
|
}, {
|
|
46
55
|
name: "position",
|
|
47
56
|
type: "list",
|
|
48
57
|
values: ["static", "relative", "absolute"],
|
|
49
|
-
service: this
|
|
58
|
+
service: this,
|
|
59
|
+
propertyType: PropertyType.cssValue
|
|
50
60
|
}, {
|
|
51
61
|
name: "left",
|
|
52
62
|
type: "css-length",
|
|
53
|
-
service: this
|
|
63
|
+
service: this,
|
|
64
|
+
propertyType: PropertyType.cssValue
|
|
54
65
|
}, {
|
|
55
66
|
name: "top",
|
|
56
67
|
type: "css-length",
|
|
57
|
-
service: this
|
|
68
|
+
service: this,
|
|
69
|
+
propertyType: PropertyType.cssValue
|
|
58
70
|
}, {
|
|
59
71
|
name: "right",
|
|
60
72
|
type: "css-length",
|
|
61
|
-
service: this
|
|
73
|
+
service: this,
|
|
74
|
+
propertyType: PropertyType.cssValue
|
|
62
75
|
}, {
|
|
63
76
|
name: "bottom",
|
|
64
77
|
type: "css-length",
|
|
65
|
-
service: this
|
|
78
|
+
service: this,
|
|
79
|
+
propertyType: PropertyType.cssValue
|
|
66
80
|
}, {
|
|
67
81
|
name: "width",
|
|
68
82
|
type: "css-length",
|
|
69
|
-
service: this
|
|
83
|
+
service: this,
|
|
84
|
+
propertyType: PropertyType.cssValue
|
|
70
85
|
}, {
|
|
71
86
|
name: "height",
|
|
72
87
|
type: "css-length",
|
|
73
|
-
service: this
|
|
88
|
+
service: this,
|
|
89
|
+
propertyType: PropertyType.cssValue
|
|
74
90
|
}, {
|
|
75
91
|
name: "font-size",
|
|
76
92
|
type: "css-length",
|
|
77
|
-
service: this
|
|
93
|
+
service: this,
|
|
94
|
+
propertyType: PropertyType.cssValue
|
|
78
95
|
}, {
|
|
79
96
|
name: "font-weight",
|
|
80
97
|
type: "list",
|
|
81
98
|
values: ["normal", "bold", "100", "200", "300", "400", "500", "600", "700", "800", "900", "lighter", "bolder"],
|
|
82
|
-
service: this
|
|
99
|
+
service: this,
|
|
100
|
+
propertyType: PropertyType.cssValue
|
|
83
101
|
}
|
|
84
102
|
];
|
|
85
103
|
//@ts-ignore
|
|
@@ -88,24 +106,29 @@ export class CssPropertiesService {
|
|
|
88
106
|
name: "display",
|
|
89
107
|
type: "list",
|
|
90
108
|
values: ["block", "inline-block", "flex", "contents", "grid", "inherit", "initial", "none"],
|
|
91
|
-
service: this
|
|
109
|
+
service: this,
|
|
110
|
+
propertyType: PropertyType.cssValue
|
|
92
111
|
}, {
|
|
93
112
|
name: "position",
|
|
94
113
|
type: "list",
|
|
95
114
|
values: ["static", "relative", "absolute"],
|
|
96
|
-
service: this
|
|
115
|
+
service: this,
|
|
116
|
+
propertyType: PropertyType.cssValue
|
|
97
117
|
}, {
|
|
98
118
|
name: "inset",
|
|
99
119
|
type: "thickness",
|
|
100
|
-
service: this
|
|
120
|
+
service: this,
|
|
121
|
+
propertyType: PropertyType.cssValue
|
|
101
122
|
}, {
|
|
102
123
|
name: "margin",
|
|
103
124
|
type: "thickness",
|
|
104
|
-
service: this
|
|
125
|
+
service: this,
|
|
126
|
+
propertyType: PropertyType.cssValue
|
|
105
127
|
}, {
|
|
106
128
|
name: "padding",
|
|
107
129
|
type: "thickness",
|
|
108
|
-
service: this
|
|
130
|
+
service: this,
|
|
131
|
+
propertyType: PropertyType.cssValue
|
|
109
132
|
}
|
|
110
133
|
];
|
|
111
134
|
//@ts-ignore
|
|
@@ -114,48 +137,58 @@ export class CssPropertiesService {
|
|
|
114
137
|
name: "display",
|
|
115
138
|
type: "list",
|
|
116
139
|
values: ["block", "inline-block", "flex", "contents", "grid", "inherit", "initial", "none"],
|
|
117
|
-
service: this
|
|
140
|
+
service: this,
|
|
141
|
+
propertyType: PropertyType.cssValue
|
|
118
142
|
}, {
|
|
119
143
|
name: "position",
|
|
120
144
|
type: "list",
|
|
121
145
|
values: ["static", "relative", "absolute"],
|
|
122
|
-
service: this
|
|
146
|
+
service: this,
|
|
147
|
+
propertyType: PropertyType.cssValue
|
|
123
148
|
}, {
|
|
124
149
|
name: "grid-template-columns",
|
|
125
150
|
type: "string",
|
|
126
|
-
service: this
|
|
151
|
+
service: this,
|
|
152
|
+
propertyType: PropertyType.cssValue
|
|
127
153
|
}, {
|
|
128
154
|
name: "grid-template-rows",
|
|
129
155
|
type: "string",
|
|
130
|
-
service: this
|
|
156
|
+
service: this,
|
|
157
|
+
propertyType: PropertyType.cssValue
|
|
131
158
|
}, {
|
|
132
159
|
name: "column-gap",
|
|
133
160
|
type: "css-length",
|
|
134
|
-
service: this
|
|
161
|
+
service: this,
|
|
162
|
+
propertyType: PropertyType.cssValue
|
|
135
163
|
}, {
|
|
136
164
|
name: "row-gap",
|
|
137
165
|
type: "css-length",
|
|
138
|
-
service: this
|
|
166
|
+
service: this,
|
|
167
|
+
propertyType: PropertyType.cssValue
|
|
139
168
|
}, {
|
|
140
169
|
name: "align-content",
|
|
141
170
|
type: "img-list",
|
|
142
171
|
values: ["center", "space-between", "space-around", "space-evenly", "stretch"],
|
|
143
|
-
service: this
|
|
172
|
+
service: this,
|
|
173
|
+
propertyType: PropertyType.cssValue
|
|
144
174
|
}, {
|
|
145
175
|
name: "justify-content",
|
|
146
176
|
type: "img-list",
|
|
147
177
|
values: ["center", "start", "end", "space-between", "space-around", "space-evenly"],
|
|
148
|
-
service: this
|
|
178
|
+
service: this,
|
|
179
|
+
propertyType: PropertyType.cssValue
|
|
149
180
|
}, {
|
|
150
181
|
name: "align-items",
|
|
151
182
|
type: "img-list",
|
|
152
183
|
values: ["center", "start", "end", "stretch", "baseline"],
|
|
153
|
-
service: this
|
|
184
|
+
service: this,
|
|
185
|
+
propertyType: PropertyType.cssValue
|
|
154
186
|
}, {
|
|
155
187
|
name: "justify-items",
|
|
156
188
|
type: "img-list",
|
|
157
189
|
values: ["center", "start", "end", "stretch"],
|
|
158
|
-
service: this
|
|
190
|
+
service: this,
|
|
191
|
+
propertyType: PropertyType.cssValue
|
|
159
192
|
}
|
|
160
193
|
];
|
|
161
194
|
//@ts-ignore
|
|
@@ -164,37 +197,44 @@ export class CssPropertiesService {
|
|
|
164
197
|
name: "display",
|
|
165
198
|
type: "list",
|
|
166
199
|
values: ["block", "inline-block", "flex", "contents", "grid", "inherit", "initial", "none"],
|
|
167
|
-
service: this
|
|
200
|
+
service: this,
|
|
201
|
+
propertyType: PropertyType.cssValue
|
|
168
202
|
}, {
|
|
169
203
|
name: "position",
|
|
170
204
|
type: "list",
|
|
171
205
|
values: ["static", "relative", "absolute"],
|
|
172
|
-
service: this
|
|
206
|
+
service: this,
|
|
207
|
+
propertyType: PropertyType.cssValue
|
|
173
208
|
}, {
|
|
174
209
|
name: "flex-direction",
|
|
175
210
|
type: "img-list",
|
|
176
211
|
values: ["row", "column"],
|
|
177
|
-
service: this
|
|
212
|
+
service: this,
|
|
213
|
+
propertyType: PropertyType.cssValue
|
|
178
214
|
}, {
|
|
179
215
|
name: "flex-wrap",
|
|
180
216
|
type: "img-list",
|
|
181
217
|
values: ["nowrap", "wrap"],
|
|
182
|
-
service: this
|
|
218
|
+
service: this,
|
|
219
|
+
propertyType: PropertyType.cssValue
|
|
183
220
|
}, {
|
|
184
221
|
name: "align-content",
|
|
185
222
|
type: "img-list",
|
|
186
223
|
values: ["center", "flex-start", "flex-end", "space-between", "space-around", "stretch"],
|
|
187
|
-
service: this
|
|
224
|
+
service: this,
|
|
225
|
+
propertyType: PropertyType.cssValue
|
|
188
226
|
}, {
|
|
189
227
|
name: "justify-content",
|
|
190
228
|
type: "img-list",
|
|
191
229
|
values: ["center", "flex-start", "flex-end", "space-between", "space-around", "space-evenly"],
|
|
192
|
-
service: this
|
|
230
|
+
service: this,
|
|
231
|
+
propertyType: PropertyType.cssValue
|
|
193
232
|
}, {
|
|
194
233
|
name: "align-items",
|
|
195
234
|
type: "img-list",
|
|
196
235
|
values: ["center", "flex-start", "flex-end", "stretch", "baseline"],
|
|
197
|
-
service: this
|
|
236
|
+
service: this,
|
|
237
|
+
propertyType: PropertyType.cssValue
|
|
198
238
|
}
|
|
199
239
|
];
|
|
200
240
|
name;
|
|
@@ -206,7 +246,7 @@ export class CssPropertiesService {
|
|
|
206
246
|
}
|
|
207
247
|
getProperty(designItem, name) {
|
|
208
248
|
if (this.name == 'set-styles') {
|
|
209
|
-
return { name: name, type: 'string', service: this };
|
|
249
|
+
return { name: name, type: 'string', service: this, propertyType: PropertyType.cssValue };
|
|
210
250
|
}
|
|
211
251
|
return this[this.name][name];
|
|
212
252
|
}
|
|
@@ -214,7 +254,7 @@ export class CssPropertiesService {
|
|
|
214
254
|
if (this.name == 'set-styles') {
|
|
215
255
|
if (!designItem)
|
|
216
256
|
return [];
|
|
217
|
-
return Array.from(designItem.styles.keys(), x => ({ name: x, type: 'string', service: this }));
|
|
257
|
+
return Array.from(designItem.styles.keys(), x => ({ name: x, type: 'string', service: this, propertyType: PropertyType.cssValue }));
|
|
218
258
|
}
|
|
219
259
|
return this[this.name];
|
|
220
260
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { PropertyType } from "../PropertyType";
|
|
1
2
|
export interface IJsonPropertyDefinition {
|
|
2
3
|
name: string;
|
|
4
|
+
propertyName?: string;
|
|
5
|
+
attributeName?: string;
|
|
3
6
|
description?: string;
|
|
4
7
|
type?: string;
|
|
5
8
|
default?: any;
|
|
@@ -10,4 +13,5 @@ export interface IJsonPropertyDefinition {
|
|
|
10
13
|
enumValues?: [name: string, value: string | number][];
|
|
11
14
|
value?: any;
|
|
12
15
|
defaultValue?: any;
|
|
16
|
+
propertyType?: PropertyType.cssValue;
|
|
13
17
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { UnkownElementPropertiesService } from './UnkownElementPropertiesService';
|
|
2
|
+
import { PropertyType } from '../PropertyType';
|
|
2
3
|
export class ListPropertiesService extends UnkownElementPropertiesService {
|
|
3
4
|
name = "list";
|
|
4
5
|
_propertys = new Map();
|
|
@@ -11,6 +12,8 @@ export class ListPropertiesService extends UnkownElementPropertiesService {
|
|
|
11
12
|
let pdef = propertyDefinitions[e][p];
|
|
12
13
|
parr.push({
|
|
13
14
|
name: pdef.name,
|
|
15
|
+
propertyName: pdef.propertyName,
|
|
16
|
+
attributeName: pdef.attributeName,
|
|
14
17
|
description: pdef.description,
|
|
15
18
|
type: pdef.type,
|
|
16
19
|
default: pdef.default,
|
|
@@ -21,7 +24,8 @@ export class ListPropertiesService extends UnkownElementPropertiesService {
|
|
|
21
24
|
enumValues: pdef.enumValues,
|
|
22
25
|
value: pdef.value,
|
|
23
26
|
defaultValue: pdef.defaultValue,
|
|
24
|
-
service: this
|
|
27
|
+
service: this,
|
|
28
|
+
propertyType: pdef.propertyType ?? PropertyType.propertyAndAttribute
|
|
25
29
|
});
|
|
26
30
|
}
|
|
27
31
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AbstractBasePropertiesService } from "./AbstractBasePropertiesService";
|
|
2
2
|
import { PropertiesHelper } from './PropertiesHelper';
|
|
3
|
+
import { PropertyType } from '../PropertyType';
|
|
3
4
|
export class Lit2PropertiesService extends AbstractBasePropertiesService {
|
|
4
5
|
name = "lit2";
|
|
5
6
|
isHandledElement(designItem) {
|
|
@@ -19,27 +20,27 @@ export class Lit2PropertiesService extends AbstractBasePropertiesService {
|
|
|
19
20
|
if (litProperty.type)
|
|
20
21
|
type = litProperty.type;
|
|
21
22
|
if (type === String) {
|
|
22
|
-
let property = { name: name, type: "string", service: this };
|
|
23
|
+
let property = { name: name, type: "string", service: this, propertyType: PropertyType.propertyAndAttribute };
|
|
23
24
|
properties.push(property);
|
|
24
25
|
}
|
|
25
26
|
else if (type === Object) {
|
|
26
|
-
let property = { name: name, type: "string", service: this };
|
|
27
|
+
let property = { name: name, type: "string", service: this, propertyType: PropertyType.propertyAndAttribute };
|
|
27
28
|
properties.push(property);
|
|
28
29
|
}
|
|
29
30
|
else if (type === Number) {
|
|
30
|
-
let property = { name: name, type: "number", service: this };
|
|
31
|
+
let property = { name: name, type: "number", service: this, propertyType: PropertyType.propertyAndAttribute };
|
|
31
32
|
properties.push(property);
|
|
32
33
|
}
|
|
33
34
|
else if (type === Date) {
|
|
34
|
-
let property = { name: name, type: "date", service: this };
|
|
35
|
+
let property = { name: name, type: "date", service: this, propertyType: PropertyType.propertyAndAttribute };
|
|
35
36
|
properties.push(property);
|
|
36
37
|
}
|
|
37
38
|
else if (type === Boolean) {
|
|
38
|
-
let property = { name: name, type: "boolean", service: this };
|
|
39
|
+
let property = { name: name, type: "boolean", service: this, propertyType: PropertyType.propertyAndAttribute };
|
|
39
40
|
properties.push(property);
|
|
40
41
|
}
|
|
41
42
|
else if (PropertiesHelper.isTypescriptEnum(type)) {
|
|
42
|
-
let property = { name: name, type: "enum", enumValues: PropertiesHelper.getTypescriptEnumEntries(type), service: this };
|
|
43
|
+
let property = { name: name, type: "enum", enumValues: PropertiesHelper.getTypescriptEnumEntries(type), service: this, propertyType: PropertyType.propertyAndAttribute };
|
|
43
44
|
properties.push(property);
|
|
44
45
|
}
|
|
45
46
|
}
|
package/dist/elements/services/propertiesService/services/NativeElementsPropertiesService.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CommonPropertiesService } from "./CommonPropertiesService";
|
|
2
|
+
import { PropertyType } from '../PropertyType';
|
|
2
3
|
export class NativeElementsPropertiesService extends CommonPropertiesService {
|
|
3
4
|
//@ts-ignore
|
|
4
5
|
inputProperties = [
|
|
@@ -7,23 +8,28 @@ export class NativeElementsPropertiesService extends CommonPropertiesService {
|
|
|
7
8
|
type: "list",
|
|
8
9
|
values: ["text", "number", "button", "checkbox", "color", "date", "datetime-local", "email", "file", "hidden", "image", "month", "password", "radio", "range", "reset", "search", "submit", "tel", "time", "url", "week"],
|
|
9
10
|
service: this,
|
|
10
|
-
defaultValue: "text"
|
|
11
|
+
defaultValue: "text",
|
|
12
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
11
13
|
}, {
|
|
12
14
|
name: "value",
|
|
13
15
|
type: "string",
|
|
14
|
-
service: this
|
|
16
|
+
service: this,
|
|
17
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
15
18
|
}, {
|
|
16
19
|
name: "checked",
|
|
17
20
|
type: "boolean",
|
|
18
|
-
service: this
|
|
21
|
+
service: this,
|
|
22
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
19
23
|
}, {
|
|
20
24
|
name: "min",
|
|
21
25
|
type: "number",
|
|
22
|
-
service: this
|
|
26
|
+
service: this,
|
|
27
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
23
28
|
}, {
|
|
24
29
|
name: "max",
|
|
25
30
|
type: "number",
|
|
26
|
-
service: this
|
|
31
|
+
service: this,
|
|
32
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
27
33
|
}
|
|
28
34
|
];
|
|
29
35
|
buttonProperties = [
|
|
@@ -32,43 +38,50 @@ export class NativeElementsPropertiesService extends CommonPropertiesService {
|
|
|
32
38
|
type: "list",
|
|
33
39
|
values: ["button", "submit", "reset"],
|
|
34
40
|
service: this,
|
|
35
|
-
defaultValue: "button"
|
|
41
|
+
defaultValue: "button",
|
|
42
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
36
43
|
}, {
|
|
37
44
|
name: "value",
|
|
38
45
|
type: "string",
|
|
39
|
-
service: this
|
|
46
|
+
service: this,
|
|
47
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
40
48
|
}, {
|
|
41
49
|
name: "disabled",
|
|
42
50
|
type: "boolean",
|
|
43
|
-
service: this
|
|
51
|
+
service: this,
|
|
52
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
44
53
|
}
|
|
45
54
|
];
|
|
46
55
|
anchorProperties = [
|
|
47
56
|
{
|
|
48
57
|
name: "href",
|
|
49
58
|
type: "string",
|
|
50
|
-
service: this
|
|
59
|
+
service: this,
|
|
60
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
51
61
|
}
|
|
52
62
|
];
|
|
53
63
|
divProperties = [
|
|
54
64
|
{
|
|
55
65
|
name: "title",
|
|
56
66
|
type: "string",
|
|
57
|
-
service: this
|
|
67
|
+
service: this,
|
|
68
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
58
69
|
}
|
|
59
70
|
];
|
|
60
71
|
imgProperties = [
|
|
61
72
|
{
|
|
62
73
|
name: "src",
|
|
63
74
|
type: "string",
|
|
64
|
-
service: this
|
|
75
|
+
service: this,
|
|
76
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
65
77
|
}
|
|
66
78
|
];
|
|
67
79
|
iframeProperties = [
|
|
68
80
|
{
|
|
69
81
|
name: "src",
|
|
70
82
|
type: "string",
|
|
71
|
-
service: this
|
|
83
|
+
service: this,
|
|
84
|
+
propertyType: PropertyType.propertyAndAttribute
|
|
72
85
|
}
|
|
73
86
|
];
|
|
74
87
|
name = "native";
|
package/dist/elements/services/propertiesService/services/UnkownElementPropertiesService.d.ts
CHANGED
|
@@ -3,8 +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
|
-
export declare class UnkownElementPropertiesService implements IPropertiesService {
|
|
7
|
-
readonly name: string;
|
|
6
|
+
export declare abstract class UnkownElementPropertiesService implements IPropertiesService {
|
|
8
7
|
isHandledElement(designItem: IDesignItem): boolean;
|
|
9
8
|
protected _notifyChangedProperty(designItem: IDesignItem, property: IProperty, value: any): void;
|
|
10
9
|
getProperty(designItem: IDesignItem, name: string): IProperty;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ValueType } from "../ValueType";
|
|
2
2
|
import { PropertiesHelper } from './PropertiesHelper';
|
|
3
3
|
import { BindingTarget } from "../../../item/BindingTarget";
|
|
4
|
+
//@ts-ignore
|
|
4
5
|
export class UnkownElementPropertiesService {
|
|
5
|
-
name = "unkown";
|
|
6
6
|
isHandledElement(designItem) {
|
|
7
7
|
return true;
|
|
8
8
|
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { IDesignItem } from "../../..";
|
|
2
|
+
import { BindingTarget } from "../../item/BindingTarget";
|
|
3
|
+
import { IElementDefinition } from "../elementsService/IElementDefinition";
|
|
4
|
+
import { IElementsService } from "../elementsService/IElementsService";
|
|
5
|
+
import { IPropertiesService } from "../propertiesService/IPropertiesService";
|
|
6
|
+
import { IProperty } from "../propertiesService/IProperty";
|
|
7
|
+
import { ValueType } from "../propertiesService/ValueType";
|
|
8
|
+
export declare class WebcomponentManifestParserService implements IElementsService, IPropertiesService {
|
|
9
|
+
private _name;
|
|
10
|
+
get name(): string;
|
|
11
|
+
private _packageData;
|
|
12
|
+
private _elementList;
|
|
13
|
+
private _resolveStored;
|
|
14
|
+
private _rejectStored;
|
|
15
|
+
constructor(name: string, file: string);
|
|
16
|
+
getElements(): Promise<IElementDefinition[]>;
|
|
17
|
+
isHandledElement(designItem: IDesignItem): boolean;
|
|
18
|
+
getProperties(designItem: IDesignItem): IProperty[];
|
|
19
|
+
getProperty(designItem: IDesignItem, name: string): IProperty;
|
|
20
|
+
getPropertyTarget(designItem: IDesignItem, property: IProperty): BindingTarget;
|
|
21
|
+
setValue(designItems: IDesignItem[], property: IProperty, value: any): void;
|
|
22
|
+
clearValue(designItems: IDesignItem[], property: IProperty): void;
|
|
23
|
+
isSet(designItems: IDesignItem[], property: IProperty): ValueType;
|
|
24
|
+
getValue(designItems: IDesignItem[], property: IProperty): void;
|
|
25
|
+
getUnsetValue(designItems: IDesignItem[], property: IProperty): void;
|
|
26
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export class WebcomponentManifestParserService {
|
|
2
|
+
_name;
|
|
3
|
+
get name() { return this._name; }
|
|
4
|
+
_packageData;
|
|
5
|
+
_elementList;
|
|
6
|
+
_resolveStored;
|
|
7
|
+
_rejectStored;
|
|
8
|
+
constructor(name, file) {
|
|
9
|
+
this._name = name;
|
|
10
|
+
import(file, { assert: { type: 'json' } }).then(module => {
|
|
11
|
+
this._packageData = module.default;
|
|
12
|
+
this._elementList = [];
|
|
13
|
+
for (let m of this._packageData.modules) {
|
|
14
|
+
for (let e of m.exports) {
|
|
15
|
+
if (e.kind == 'custom-element-definition') {
|
|
16
|
+
this._elementList.push({ tag: e.name });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (this._resolveStored) {
|
|
20
|
+
this._resolveStored.forEach(x => x(this._elementList));
|
|
21
|
+
this._resolveStored = null;
|
|
22
|
+
this._rejectStored = null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}).catch(err => {
|
|
26
|
+
if (this._rejectStored) {
|
|
27
|
+
this._rejectStored.forEach(x => x(err));
|
|
28
|
+
this._resolveStored = null;
|
|
29
|
+
this._rejectStored = null;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
async getElements() {
|
|
34
|
+
if (this._packageData)
|
|
35
|
+
return Promise.resolve(this._elementList);
|
|
36
|
+
if (!this._resolveStored) {
|
|
37
|
+
this._resolveStored = [];
|
|
38
|
+
this._rejectStored = [];
|
|
39
|
+
}
|
|
40
|
+
return new Promise((resolve, reject) => { this._resolveStored.push(resolve); this._rejectStored.push(reject); });
|
|
41
|
+
}
|
|
42
|
+
isHandledElement(designItem) {
|
|
43
|
+
throw new Error("Method not implemented.");
|
|
44
|
+
}
|
|
45
|
+
getProperties(designItem) {
|
|
46
|
+
throw new Error("Method not implemented.");
|
|
47
|
+
}
|
|
48
|
+
getProperty(designItem, name) {
|
|
49
|
+
throw new Error("Method not implemented.");
|
|
50
|
+
}
|
|
51
|
+
getPropertyTarget(designItem, property) {
|
|
52
|
+
throw new Error("Method not implemented.");
|
|
53
|
+
}
|
|
54
|
+
setValue(designItems, property, value) {
|
|
55
|
+
throw new Error("Method not implemented.");
|
|
56
|
+
}
|
|
57
|
+
clearValue(designItems, property) {
|
|
58
|
+
throw new Error("Method not implemented.");
|
|
59
|
+
}
|
|
60
|
+
isSet(designItems, property) {
|
|
61
|
+
throw new Error("Method not implemented.");
|
|
62
|
+
}
|
|
63
|
+
getValue(designItems, property) {
|
|
64
|
+
throw new Error("Method not implemented.");
|
|
65
|
+
}
|
|
66
|
+
getUnsetValue(designItems, property) {
|
|
67
|
+
throw new Error("Method not implemented.");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -73,6 +73,12 @@ export class DesignerCanvas extends BaseCustomWebComponentLazyAppend {
|
|
|
73
73
|
position: relative;
|
|
74
74
|
transform: translateZ(0);
|
|
75
75
|
overflow: hidden;
|
|
76
|
+
|
|
77
|
+
font-family: initial;
|
|
78
|
+
font-size: initial;
|
|
79
|
+
font-weight: initial;
|
|
80
|
+
font-style: initial;
|
|
81
|
+
line-height: initial;
|
|
76
82
|
}
|
|
77
83
|
* {
|
|
78
84
|
touch-action: none;
|
|
@@ -101,14 +101,19 @@ export class PaletteTreeView extends BaseCustomWebComponentConstructorAppend {
|
|
|
101
101
|
title: s.name,
|
|
102
102
|
folder: true
|
|
103
103
|
});
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
104
|
+
try {
|
|
105
|
+
let elements = await s.getElements();
|
|
106
|
+
for (let e of elements) {
|
|
107
|
+
newNode.addChildren({
|
|
108
|
+
title: e.name ?? e.tag,
|
|
109
|
+
folder: false,
|
|
110
|
+
//@ts-ignore
|
|
111
|
+
ref: e
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
console.warn('Error loading elements', err);
|
|
112
117
|
}
|
|
113
118
|
//@ts-ignore
|
|
114
119
|
newNode.updateCounters();
|
|
@@ -20,11 +20,16 @@ export class PaletteView extends BaseCustomWebComponentLazyAppend {
|
|
|
20
20
|
}
|
|
21
21
|
async loadControls(serviceContainer, elementsServices) {
|
|
22
22
|
for (const s of elementsServices) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
try {
|
|
24
|
+
let elements = await s.getElements();
|
|
25
|
+
let paletteElement = new PaletteElements();
|
|
26
|
+
paletteElement.title = s.name;
|
|
27
|
+
this._designerTabControl.appendChild(paletteElement);
|
|
28
|
+
paletteElement.loadElements(serviceContainer, elements);
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
console.warn('Error loading elements', err);
|
|
32
|
+
}
|
|
28
33
|
}
|
|
29
34
|
}
|
|
30
35
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -54,6 +54,7 @@ export * from "./elements/services/instanceService/DefaultInstanceService.js";
|
|
|
54
54
|
export type { IInstanceService } from "./elements/services/instanceService/IInstanceService.js";
|
|
55
55
|
export * from "./elements/services/instanceService/PrepareElementsForDesignerService.js";
|
|
56
56
|
export type { IPrepareElementsForDesignerService } from "./elements/services/instanceService/IPrepareElementsForDesignerService.js";
|
|
57
|
+
export * from "./elements/services/manifestParsers/WebcomponentManifestParserService.js";
|
|
57
58
|
export type { IModelCommandService } from "./elements/services/modelCommandService/IModelCommandService.js";
|
|
58
59
|
export * from "./elements/services/modelCommandService/DefaultModelCommandService.js";
|
|
59
60
|
export * from "./elements/services/propertiesService/DefaultEditorTypesService.js";
|
|
@@ -69,6 +70,7 @@ export * from "./elements/services/propertiesService/services/LitElementProperti
|
|
|
69
70
|
export * from "./elements/services/propertiesService/services/NativeElementsPropertiesService.js";
|
|
70
71
|
export * from "./elements/services/propertiesService/services/PolymerPropertiesService.js";
|
|
71
72
|
export * from "./elements/services/propertiesService/services/UnkownElementPropertiesService.js";
|
|
73
|
+
export * from "./elements/services/propertiesService/PropertyType.js";
|
|
72
74
|
export * from "./elements/services/propertiesService/ValueType.js";
|
|
73
75
|
export type { ISelectionChangedEvent } from "./elements/services/selectionService/ISelectionChangedEvent.js";
|
|
74
76
|
export type { ISelectionService } from "./elements/services/selectionService/ISelectionService.js";
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ export * from "./elements/services/htmlParserService/DefaultHtmlParserService.js
|
|
|
31
31
|
export * from "./elements/services/htmlParserService/NodeHtmlParserService.js";
|
|
32
32
|
export * from "./elements/services/instanceService/DefaultInstanceService.js";
|
|
33
33
|
export * from "./elements/services/instanceService/PrepareElementsForDesignerService.js";
|
|
34
|
+
export * from "./elements/services/manifestParsers/WebcomponentManifestParserService.js";
|
|
34
35
|
export * from "./elements/services/modelCommandService/DefaultModelCommandService.js";
|
|
35
36
|
export * from "./elements/services/propertiesService/DefaultEditorTypesService.js";
|
|
36
37
|
export * from "./elements/services/propertiesService/services/PropertiesHelper.js";
|
|
@@ -42,6 +43,7 @@ export * from "./elements/services/propertiesService/services/LitElementProperti
|
|
|
42
43
|
export * from "./elements/services/propertiesService/services/NativeElementsPropertiesService.js";
|
|
43
44
|
export * from "./elements/services/propertiesService/services/PolymerPropertiesService.js";
|
|
44
45
|
export * from "./elements/services/propertiesService/services/UnkownElementPropertiesService.js";
|
|
46
|
+
export * from "./elements/services/propertiesService/PropertyType.js";
|
|
45
47
|
export * from "./elements/services/propertiesService/ValueType.js";
|
|
46
48
|
export * from "./elements/services/selectionService/SelectionService.js";
|
|
47
49
|
export * from "./elements/services/undoService/ChangeGroup.js";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"description": "A UI designer for Polymer apps",
|
|
3
3
|
"name": "@node-projects/web-component-designer",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.76",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"author": "",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"@types/jquery.fancytree": "0.0.7",
|
|
25
25
|
"ace-builds": "^1.4.13",
|
|
26
26
|
"codemirror": "^5.65.0",
|
|
27
|
+
"custom-elements-manifest": "^1.0.0",
|
|
27
28
|
"esprima-next": "^5.7.0",
|
|
28
29
|
"html2canvas": "*",
|
|
29
30
|
"jest": "^27.4.5",
|