@htmlplus/element 2.8.0 → 2.9.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.
@@ -66,10 +66,17 @@ export function Consumer(namespace) {
66
66
  };
67
67
  // TODO
68
68
  appendToMethod(target, CONSTANTS.LIFECYCLE_CONNECTED, function () {
69
+ // TODO
70
+ if (SUB && this[SUB])
71
+ return;
72
+ // TODO
73
+ let connected;
69
74
  const options = {
70
75
  bubbles: true
71
76
  };
72
77
  options.detail = (parent, state) => {
78
+ // TODO
79
+ connected = true;
73
80
  update(this, state);
74
81
  const cleanup = () => {
75
82
  off(parent, `${prefix}:update`, onUpdate);
@@ -83,6 +90,8 @@ export function Consumer(namespace) {
83
90
  cleanups(this).set(prefix, cleanup);
84
91
  };
85
92
  dispatch(this, `${prefix}:presence`, options);
93
+ // TODO: When the `Provider` element is activated after the `Consumer` element.
94
+ !connected && setTimeout(() => dispatch(this, `${prefix}:presence`, options));
86
95
  });
87
96
  appendToMethod(target, CONSTANTS.LIFECYCLE_UPDATE, function (states) {
88
97
  var _a;
@@ -28,7 +28,6 @@ const proxy = (constructor) => {
28
28
  });
29
29
  const instance = (this[CONSTANTS.API_INSTANCE] = new constructor());
30
30
  instance[CONSTANTS.API_HOST] = () => this;
31
- // TODO
32
31
  call(instance, CONSTANTS.LIFECYCLE_CONSTRUCTED);
33
32
  }
34
33
  adoptedCallback() {
@@ -36,7 +35,7 @@ const proxy = (constructor) => {
36
35
  }
37
36
  attributeChangedCallback(key, prev, next) {
38
37
  var _a;
39
- // ensures the integrity of readonly properties to prevent potential errors.
38
+ // Ensures the integrity of readonly properties to prevent potential errors.
40
39
  try {
41
40
  const attribute = (_a = constructor[CONSTANTS.MAPPER]) === null || _a === void 0 ? void 0 : _a[key];
42
41
  const property = attribute || camelCase(key);
@@ -63,9 +62,7 @@ const proxy = (constructor) => {
63
62
  call(this[CONSTANTS.API_INSTANCE], CONSTANTS.LIFECYCLE_DISCONNECTED);
64
63
  }
65
64
  },
66
- // TODO
67
65
  _a.formAssociated = constructor['formAssociated'],
68
- // TODO
69
66
  _a.observedAttributes = constructor['observedAttributes'],
70
67
  _a;
71
68
  };
@@ -17,6 +17,11 @@ export function Event(options = {}) {
17
17
  (_a = options.bubbles) !== null && _a !== void 0 ? _a : (options.bubbles = false);
18
18
  let type = String(key);
19
19
  switch (framework) {
20
+ // TODO: Experimental
21
+ case 'blazor':
22
+ options.bubbles = true;
23
+ type = pascalCase(type);
24
+ break;
20
25
  case 'qwik':
21
26
  case 'solid':
22
27
  type = pascalCase(type).toLowerCase();
@@ -11,8 +11,10 @@ export const getFramework = (target) => {
11
11
  return 'vue';
12
12
  const keys = Object.keys(element);
13
13
  const has = (input) => keys.some((key) => key.startsWith(input));
14
- if (has('__zone_symbol__'))
15
- return 'angular';
14
+ if (has('_blazor'))
15
+ return 'blazor';
16
16
  if (has('__react'))
17
17
  return 'react';
18
+ if (has('__zone_symbol__'))
19
+ return 'angular';
18
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htmlplus/element",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "author": "Masood Abdolian <m.abdolian@gmail.com>",