@esportsplus/ui 0.32.3 → 0.32.5

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.
@@ -14,7 +14,7 @@ const OMIT = [
14
14
  'scrollbar-container-content',
15
15
  'tooltip-content',
16
16
  ];
17
- let field = null, sb = scrollbar.bind({
17
+ let previous = null, sb = scrollbar.bind({
18
18
  attributes: {
19
19
  class: 'tooltip-content',
20
20
  'scrollbar-container-content': {
@@ -22,17 +22,23 @@ let field = null, sb = scrollbar.bind({
22
22
  }
23
23
  }
24
24
  });
25
- function set(state, value) {
26
- state.active = value;
27
- if (state.active) {
28
- root.onclick.push(() => state.active = false);
29
- if (field) {
30
- field.active = false;
25
+ function set(current, value) {
26
+ current.active = value;
27
+ if (value) {
28
+ if (previous) {
29
+ previous.active = false;
31
30
  }
32
- field = state;
31
+ previous = current;
32
+ root.onclick.push(() => {
33
+ if (previous !== current) {
34
+ return;
35
+ }
36
+ previous = null;
37
+ current.active = false;
38
+ });
33
39
  }
34
- else if (field === state) {
35
- field = null;
40
+ else if (previous === current) {
41
+ previous = null;
36
42
  }
37
43
  }
38
44
  const select = template.factory(function (attributes, content) {
package/package.json CHANGED
@@ -48,7 +48,7 @@
48
48
  "private": false,
49
49
  "sideEffects": false,
50
50
  "type": "module",
51
- "version": "0.32.3",
51
+ "version": "0.32.5",
52
52
  "scripts": {
53
53
  "build": "run-s build:vite build:ts",
54
54
  "build:ts": "tsc && tsc-alias",
@@ -40,7 +40,7 @@ type A = {
40
40
  ) & Attributes & Attr;
41
41
 
42
42
 
43
- let field: { active: boolean } | null = null,
43
+ let previous: { active: boolean } | null = null,
44
44
  sb = scrollbar.bind({
45
45
  attributes: {
46
46
  class: 'tooltip-content',
@@ -50,20 +50,26 @@ let field: { active: boolean } | null = null,
50
50
  }
51
51
  });
52
52
 
53
- function set(state: { active: boolean }, value: boolean) {
54
- state.active = value;
53
+ function set(current: { active: boolean }, value: boolean) {
54
+ current.active = value;
55
55
 
56
- if (state.active) {
57
- root.onclick.push(() => state.active = false);
58
-
59
- if (field) {
60
- field.active = false;
56
+ if (value) {
57
+ if (previous) {
58
+ previous.active = false;
61
59
  }
62
60
 
63
- field = state;
61
+ previous = current;
62
+ root.onclick.push(() => {
63
+ if (previous !== current) {
64
+ return;
65
+ }
66
+
67
+ previous = null;
68
+ current.active = false;
69
+ });
64
70
  }
65
- else if (field === state) {
66
- field = null;
71
+ else if (previous === current) {
72
+ previous = null;
67
73
  }
68
74
  }
69
75