@node-projects/web-component-designer 0.0.107 → 0.0.108

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.
@@ -4,6 +4,7 @@ export interface IElementDefinition {
4
4
  name?: string;
5
5
  description?: string;
6
6
  import?: string;
7
+ className?: string;
7
8
  type?: string;
8
9
  defaultContent?: any;
9
10
  defaultAttributes?: {
@@ -15,24 +15,8 @@ export class WebcomponentManifestElementsService {
15
15
  for (let m of manifest.modules) {
16
16
  for (let e of m.exports) {
17
17
  if (e.kind == 'custom-element-definition') {
18
- this._elementList.push({ tag: e.name, import: this._importPrefix + '/' + e.declaration.module, defaultWidth: "200px", defaultHeight: "200px" });
19
- try {
20
- //@ts-ignore
21
- if (importShim) {
22
- //@ts-ignore
23
- importShim(this._importPrefix + '/' + e.declaration.module).then(x => {
24
- customElements.define(e.name, x[e.declaration.name]);
25
- });
26
- }
27
- else {
28
- import(this._importPrefix + '/' + e.declaration.module).then(x => {
29
- customElements.define(e.name, x[e.declaration.name]);
30
- });
31
- }
32
- }
33
- catch (err) {
34
- console.warn(err);
35
- }
18
+ let elDef = { tag: e.name, import: this._importPrefix + '/' + e.declaration.module, defaultWidth: "200px", defaultHeight: "200px", className: e.declaration.name };
19
+ this._elementList.push(elDef);
36
20
  }
37
21
  }
38
22
  if (this._resolveStored) {
@@ -10,12 +10,18 @@ export class DefaultInstanceService {
10
10
  //@ts-ignore
11
11
  if (importShim) {
12
12
  //@ts-ignore
13
- importShim(importUri).then(() => {
13
+ importShim(importUri).then((x) => {
14
+ let ctor = customElements.get(definition.tag);
15
+ if (!ctor && definition.className && x[definition.className])
16
+ customElements.define(definition.tag, x[definition.className]);
14
17
  //TODO: refresh all extensions
15
18
  });
16
19
  }
17
20
  else {
18
- import(importUri).then(() => {
21
+ import(importUri).then((x) => {
22
+ let ctor = customElements.get(definition.tag);
23
+ if (!ctor && definition.className && x[definition.className])
24
+ customElements.define(definition.tag, x[definition.className]);
19
25
  //TODO: refresh all extensions
20
26
  });
21
27
  }
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.107",
4
+ "version": "0.0.108",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "author": "",