@esportsplus/ui 0.2.9 → 0.2.10
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.
- package/build/components/accordion/index.d.ts +11 -9
- package/build/components/accordion/index.js +4 -6
- package/build/components/tooltip/index.d.ts +1 -11
- package/build/components/tooltip/index.js +6 -2
- package/package.json +3 -3
- package/src/components/accordion/index.ts +9 -8
- package/src/components/tooltip/index.ts +6 -2
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
+
type Accordion = HTMLElement & {
|
|
3
|
+
[key: symbol]: {
|
|
4
|
+
active: boolean | number;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
1
7
|
declare const _default: () => {
|
|
2
8
|
attributes: {
|
|
3
9
|
class: () => false | 0 | "--active";
|
|
4
|
-
onrender: (element:
|
|
5
|
-
style: (element:
|
|
6
|
-
};
|
|
7
|
-
state: {
|
|
8
|
-
active: boolean | number;
|
|
9
|
-
dispose: () => void;
|
|
10
|
-
nodes: {
|
|
11
|
-
active: import("@esportsplus/reactivity").Signal<number> | import("@esportsplus/reactivity").Signal<false> | import("@esportsplus/reactivity").Signal<true>;
|
|
12
|
-
};
|
|
10
|
+
onrender: (element: Accordion) => void;
|
|
11
|
+
style: (element: Accordion) => string | false | 0;
|
|
13
12
|
};
|
|
13
|
+
state: ReturnType<typeof reactive<{
|
|
14
|
+
active: boolean;
|
|
15
|
+
}>>;
|
|
14
16
|
};
|
|
15
17
|
export default _default;
|
|
@@ -13,15 +13,13 @@ export default () => {
|
|
|
13
13
|
element[key] = state;
|
|
14
14
|
},
|
|
15
15
|
style: (element) => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
parent[key].active = (+parent[key].active) + 1;
|
|
20
|
-
}
|
|
16
|
+
let parent = element.closest('accordion');
|
|
17
|
+
if (parent && key in parent) {
|
|
18
|
+
parent[key].active = (+parent[key].active) + 1;
|
|
21
19
|
}
|
|
22
20
|
return state.active && `--max-height: ${element.scrollHeight}`;
|
|
23
21
|
}
|
|
24
22
|
},
|
|
25
|
-
state
|
|
23
|
+
state: state
|
|
26
24
|
};
|
|
27
25
|
};
|
|
@@ -9,10 +9,6 @@ declare const _default: {
|
|
|
9
9
|
};
|
|
10
10
|
state: {
|
|
11
11
|
active: boolean;
|
|
12
|
-
dispose: () => void;
|
|
13
|
-
nodes: {
|
|
14
|
-
active: import("@esportsplus/reactivity").Signal<false> | import("@esportsplus/reactivity").Signal<true>;
|
|
15
|
-
};
|
|
16
12
|
};
|
|
17
13
|
};
|
|
18
14
|
onhover: (active?: boolean) => {
|
|
@@ -21,13 +17,7 @@ declare const _default: {
|
|
|
21
17
|
onmouseover: () => void;
|
|
22
18
|
onmouseout: () => void;
|
|
23
19
|
};
|
|
24
|
-
|
|
25
|
-
active: boolean;
|
|
26
|
-
dispose: () => void;
|
|
27
|
-
nodes: {
|
|
28
|
-
active: import("@esportsplus/reactivity").Signal<false> | import("@esportsplus/reactivity").Signal<true>;
|
|
29
|
-
};
|
|
30
|
-
};
|
|
20
|
+
toggle: () => void;
|
|
31
21
|
};
|
|
32
22
|
};
|
|
33
23
|
export default _default;
|
|
@@ -13,7 +13,9 @@ async function frame() {
|
|
|
13
13
|
running = false;
|
|
14
14
|
}
|
|
15
15
|
const onclick = (data = {}) => {
|
|
16
|
-
let state = reactive({
|
|
16
|
+
let state = reactive({
|
|
17
|
+
active: data.active || false
|
|
18
|
+
});
|
|
17
19
|
return {
|
|
18
20
|
attributes: {
|
|
19
21
|
class: () => {
|
|
@@ -53,7 +55,9 @@ const onhover = (active = false) => {
|
|
|
53
55
|
state.active = false;
|
|
54
56
|
}
|
|
55
57
|
},
|
|
56
|
-
|
|
58
|
+
toggle: () => {
|
|
59
|
+
state.active = !state.active;
|
|
60
|
+
}
|
|
57
61
|
};
|
|
58
62
|
};
|
|
59
63
|
export default { onclick, onhover };
|
package/package.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"author": "ICJR",
|
|
3
3
|
"dependencies": {
|
|
4
4
|
"@esportsplus/action": "^0.0.50",
|
|
5
|
-
"@esportsplus/reactivity": "^0.
|
|
6
|
-
"@esportsplus/template": "^0.
|
|
5
|
+
"@esportsplus/reactivity": "^0.2.3",
|
|
6
|
+
"@esportsplus/template": "^0.4.0"
|
|
7
7
|
},
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@esportsplus/webpack": "^0.4.11",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
},
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"types": "build/index.d.ts",
|
|
24
|
-
"version": "0.2.
|
|
24
|
+
"version": "0.2.10"
|
|
25
25
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { reactive } from '@esportsplus/reactivity';
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
type Accordion = HTMLElement & { [key: symbol]: { active: boolean | number } };
|
|
5
|
+
|
|
6
|
+
|
|
4
7
|
let key = Symbol();
|
|
5
8
|
|
|
6
9
|
|
|
@@ -14,21 +17,19 @@ export default () => {
|
|
|
14
17
|
class: () => {
|
|
15
18
|
return state.active && '--active';
|
|
16
19
|
},
|
|
17
|
-
onrender: (element:
|
|
20
|
+
onrender: (element: Accordion) => {
|
|
18
21
|
element[key] = state;
|
|
19
22
|
},
|
|
20
|
-
style: (element:
|
|
21
|
-
|
|
22
|
-
let parent = element.closest('accordion') as (HTMLElement & { [k: typeof key]: typeof state }) | null;
|
|
23
|
+
style: (element: Accordion) => {
|
|
24
|
+
let parent = element.closest('accordion') as Accordion | null;
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
26
|
+
if (parent && key in parent) {
|
|
27
|
+
parent[key].active = (+parent[key].active) + 1;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
return state.active && `--max-height: ${element.scrollHeight}`;
|
|
30
31
|
}
|
|
31
32
|
},
|
|
32
|
-
state
|
|
33
|
+
state: state as ReturnType<typeof reactive<{ active: boolean }>>
|
|
33
34
|
};
|
|
34
35
|
}
|
|
@@ -25,7 +25,9 @@ async function frame() {
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
const onclick = (data: { active?: boolean, toggle?: boolean } = {}) => {
|
|
28
|
-
let state = reactive({
|
|
28
|
+
let state = reactive({
|
|
29
|
+
active: data.active || false
|
|
30
|
+
});
|
|
29
31
|
|
|
30
32
|
return {
|
|
31
33
|
attributes: {
|
|
@@ -73,7 +75,9 @@ const onhover = (active: boolean = false) => {
|
|
|
73
75
|
state.active = false;
|
|
74
76
|
}
|
|
75
77
|
},
|
|
76
|
-
|
|
78
|
+
toggle: () => {
|
|
79
|
+
state.active = !state.active;
|
|
80
|
+
}
|
|
77
81
|
};
|
|
78
82
|
};
|
|
79
83
|
|