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

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.
@@ -59,7 +59,7 @@ export class WebcomponentManifestParserService extends AbstractPropertiesService
59
59
  let pType = PropertyType.property;
60
60
  if (declaration.attributes)
61
61
  pType = declaration.attributes.find(x => x.fieldName == d.name) != null ? PropertyType.propertyAndAttribute : PropertyType.property;
62
- const p = this.manifestClassPropertyTypeToEditorPropertyType(d.type?.text);
62
+ const p = this.manifestClassPropertyTypeToEditorPropertyType(d.type?.text, d.type?.editor);
63
63
  properties.push({ name: d.name, service: this, propertyType: pType, type: p[0], values: p[1], description: d.description });
64
64
  }
65
65
  }
@@ -73,7 +73,11 @@ export class WebcomponentManifestParserService extends AbstractPropertiesService
73
73
  }
74
74
  }
75
75
  }
76
- manifestClassPropertyTypeToEditorPropertyType(type) {
76
+ manifestClassPropertyTypeToEditorPropertyType(type, editor) {
77
+ if (editor) {
78
+ if (editor.toLowerCase() === 'color')
79
+ return ['color'];
80
+ }
77
81
  if (type) {
78
82
  if (type.toLowerCase() === 'boolean')
79
83
  return ['boolean'];
@@ -3,6 +3,6 @@ export declare enum PropertyType {
3
3
  attribute = "attribute",
4
4
  propertyAndAttribute = "propertyAndAttribute",
5
5
  cssValue = "cssvalue",
6
- complex = "complex",
6
+ complex = "complex",// editor is special and could write multiple properties
7
7
  add = "add"
8
8
  }
@@ -38,13 +38,13 @@ export class AbstractPropertiesService {
38
38
  if (property.propertyType == PropertyType.property || property.propertyType == PropertyType.propertyAndAttribute)
39
39
  d.element[property.name] = value;
40
40
  }
41
- else if (property.type == 'boolean' && !value) {
41
+ else if (property.type == 'boolean' && (value === false || value == null)) {
42
42
  if (property.propertyType == PropertyType.attribute || property.propertyType == PropertyType.propertyAndAttribute)
43
43
  d.removeAttribute(attributeName);
44
44
  if (property.propertyType == PropertyType.property || property.propertyType == PropertyType.propertyAndAttribute)
45
45
  d.element[property.name] = false;
46
46
  }
47
- else if (property.type == 'boolean' && value) {
47
+ else if (property.type == 'boolean' && value === true) {
48
48
  if (property.propertyType == PropertyType.attribute || property.propertyType == PropertyType.propertyAndAttribute)
49
49
  d.setAttribute(attributeName, "");
50
50
  if (property.propertyType == PropertyType.property || property.propertyType == PropertyType.propertyAndAttribute)
@@ -155,8 +155,15 @@ export class AbstractPropertiesService {
155
155
  let attributeName = property.attributeName;
156
156
  if (!attributeName)
157
157
  attributeName = PropertiesHelper.camelToDashCase(property.name);
158
- if (property.type == 'boolean')
159
- return designItems[0].hasAttribute(attributeName);
158
+ if (property.type == 'boolean') {
159
+ if (designItems[0].hasAttribute(attributeName)) {
160
+ const val = designItems[0].getAttribute(attributeName);
161
+ if (val == "")
162
+ return true;
163
+ return val;
164
+ }
165
+ return false;
166
+ }
160
167
  let lastValue = designItems[0].getAttribute(attributeName);
161
168
  /*
162
169
  for (const x of designItems) {
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.23",
4
+ "version": "0.1.24",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "jochen.kuehner@gmx.de",