@htmlplus/element 2.6.0 → 2.7.0

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.
@@ -13,7 +13,12 @@ export function Element() {
13
13
  const tag = getTag(constructor);
14
14
  if (customElements.get(tag))
15
15
  return;
16
- class Plus extends HTMLElement {
16
+ customElements.define(tag, proxy(constructor));
17
+ };
18
+ }
19
+ const proxy = (constructor) => {
20
+ var _a;
21
+ return _a = class Plus extends HTMLElement {
17
22
  constructor() {
18
23
  super();
19
24
  this.attachShadow({
@@ -54,11 +59,10 @@ export function Element() {
54
59
  disconnectedCallback() {
55
60
  call(this[CONSTANTS.API_INSTANCE], CONSTANTS.LIFECYCLE_DISCONNECTED);
56
61
  }
57
- }
62
+ },
58
63
  // TODO
59
- Plus.formAssociated = constructor['formAssociated'];
64
+ _a.formAssociated = constructor['formAssociated'],
60
65
  // TODO
61
- Plus.observedAttributes = constructor['observedAttributes'];
62
- customElements.define(tag, Plus);
63
- };
64
- }
66
+ _a.observedAttributes = constructor['observedAttributes'],
67
+ _a;
68
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htmlplus/element",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "author": "Masood Abdolian <m.abdolian@gmail.com>",
@@ -280,7 +280,9 @@ export const customElement = (options) => {
280
280
  if (options.typings) {
281
281
  visitor(ast, {
282
282
  Program(path) {
283
- const attributes = context.classProperties.map((property) => {
283
+ const attributes = context
284
+ .classProperties.filter((property) => !t.isClassMethod(property))
285
+ .map((property) => {
284
286
  const key = property.key;
285
287
  const typeAnnotation = property.typeAnnotation;
286
288
  return Object.assign(t.tSPropertySignature(t.stringLiteral(kebabCase(key.name)), typeAnnotation), {
@@ -310,8 +312,13 @@ export const customElement = (options) => {
310
312
  });
311
313
  const properties = context.classProperties.map((property) => {
312
314
  const key = property.key;
313
- const typeAnnotation = property.typeAnnotation;
314
- return Object.assign(t.tSPropertySignature(t.identifier(key.name), typeAnnotation), {
315
+ // TODO
316
+ const readonly = property.readonly || !!property['returnType'];
317
+ // TODO
318
+ const typeAnnotation = (property.typeAnnotation ||
319
+ property['returnType']);
320
+ return Object.assign(t.tsPropertySignature(t.identifier(key.name), typeAnnotation), {
321
+ readonly,
315
322
  optional: property.optional,
316
323
  leadingComments: t.cloneNode(property, true).leadingComments
317
324
  });