@node-projects/web-component-designer 0.1.24 → 0.1.25

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.
@@ -17,7 +17,6 @@ export declare class WebcomponentManifestParserService extends AbstractPropertie
17
17
  private _importPrefix;
18
18
  constructor(name: string, fileOrObject: string | object, importPrefix?: string);
19
19
  private _parseManifest;
20
- private manifestClassPropertyTypeToEditorPropertyType;
21
20
  getElements(): Promise<IElementDefinition[]>;
22
21
  isHandledElement(designItem: IDesignItem): boolean;
23
22
  getProperties(designItem: IDesignItem): IProperty[];
@@ -3,6 +3,7 @@ import { RefreshMode } from '../propertiesService/IPropertiesService.js';
3
3
  import { PropertyType } from '../propertiesService/PropertyType.js';
4
4
  import { AbstractPropertiesService } from '../propertiesService/services/AbstractPropertiesService.js';
5
5
  import { removeLeading, removeTrailing } from '../../helper/Helper.js';
6
+ import { WebcomponentManifestPropertiesService } from '../propertiesService/services/WebcomponentManifestPropertiesService.js';
6
7
  export class WebcomponentManifestParserService extends AbstractPropertiesService {
7
8
  getRefreshMode(designItem) {
8
9
  return RefreshMode.none;
@@ -59,7 +60,7 @@ export class WebcomponentManifestParserService extends AbstractPropertiesService
59
60
  let pType = PropertyType.property;
60
61
  if (declaration.attributes)
61
62
  pType = declaration.attributes.find(x => x.fieldName == d.name) != null ? PropertyType.propertyAndAttribute : PropertyType.property;
62
- const p = this.manifestClassPropertyTypeToEditorPropertyType(d.type?.text, d.type?.editor);
63
+ const p = WebcomponentManifestPropertiesService.manifestClassPropertyTypeToEditorPropertyType(d.type?.text, d.type?.editor);
63
64
  properties.push({ name: d.name, service: this, propertyType: pType, type: p[0], values: p[1], description: d.description });
64
65
  }
65
66
  }
@@ -73,25 +74,6 @@ export class WebcomponentManifestParserService extends AbstractPropertiesService
73
74
  }
74
75
  }
75
76
  }
76
- manifestClassPropertyTypeToEditorPropertyType(type, editor) {
77
- if (editor) {
78
- if (editor.toLowerCase() === 'color')
79
- return ['color'];
80
- }
81
- if (type) {
82
- if (type.toLowerCase() === 'boolean')
83
- return ['boolean'];
84
- if (type.toLowerCase() === 'number')
85
- return ['number'];
86
- if (type.toLowerCase() === 'string')
87
- return ['string'];
88
- if (type.startsWith("'") && type.includes("|")) {
89
- const values = type.split("|").map(x => x.trim()).map(x => x.substring(1, x.length - 1));
90
- return ['list', values];
91
- }
92
- }
93
- return [type];
94
- }
95
77
  async getElements() {
96
78
  if (this._packageData)
97
79
  return Promise.resolve(this._elementList);
@@ -11,7 +11,7 @@ export declare class WebcomponentManifestPropertiesService extends AbstractPrope
11
11
  private _propertiesList;
12
12
  constructor(name: string, manifest: any);
13
13
  private _parseManifest;
14
- private manifestClassPropertyTypeToEditorPropertyType;
14
+ static manifestClassPropertyTypeToEditorPropertyType(type: string, editor: string): [type: string, values?: string[]];
15
15
  isHandledElement(designItem: IDesignItem): boolean;
16
16
  getProperties(designItem: IDesignItem): IProperty[] | IPropertyGroup[];
17
17
  getProperty(designItem: IDesignItem, name: string): IProperty;
@@ -33,7 +33,7 @@ export class WebcomponentManifestPropertiesService extends AbstractPropertiesSer
33
33
  let pType = PropertyType.property;
34
34
  if (declaration.attributes)
35
35
  pType = declaration.attributes.find(x => x.fieldName == d.name) != null ? PropertyType.propertyAndAttribute : PropertyType.property;
36
- const p = this.manifestClassPropertyTypeToEditorPropertyType(d.type?.text);
36
+ const p = WebcomponentManifestPropertiesService.manifestClassPropertyTypeToEditorPropertyType(d.type?.text, d.type?.editor);
37
37
  if (d.name)
38
38
  properties.push({ name: d.name, service: this, propertyType: pType, type: p[0], values: p[1], description: d.description });
39
39
  }
@@ -48,7 +48,11 @@ export class WebcomponentManifestPropertiesService extends AbstractPropertiesSer
48
48
  }
49
49
  }
50
50
  }
51
- manifestClassPropertyTypeToEditorPropertyType(type) {
51
+ static manifestClassPropertyTypeToEditorPropertyType(type, editor) {
52
+ if (editor) {
53
+ if (editor.toLowerCase() === 'color')
54
+ return ['color'];
55
+ }
52
56
  if (type) {
53
57
  if (type.toLowerCase() === 'boolean')
54
58
  return ['boolean'];
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.1.24",
4
+ "version": "0.1.25",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",