@esportsplus/ui 0.0.18 → 0.0.20
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/index.d.ts +1 -0
- package/build/components/index.js +1 -0
- package/build/components/root/index.d.ts +26 -1
- package/build/components/root/index.js +4 -1
- package/build/components/root/queue.d.ts +4 -0
- package/build/components/root/queue.js +18 -0
- package/build/components/tooltip/index.js +2 -15
- package/package.json +1 -1
- package/src/components/index.ts +1 -0
- package/src/components/root/index.ts +6 -1
- package/src/components/root/queue.ts +28 -0
- package/src/components/tooltip/index.ts +2 -21
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as alert } from './alert';
|
|
2
2
|
export { default as form } from './form';
|
|
3
3
|
export { default as page } from './page';
|
|
4
|
+
export { default as root } from './root';
|
|
4
5
|
export { default as scrollbar } from './scrollbar';
|
|
5
6
|
export { default as state } from './state';
|
|
6
7
|
export { default as tooltip } from './tooltip';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as alert } from './alert';
|
|
2
2
|
export { default as form } from './form';
|
|
3
3
|
export { default as page } from './page';
|
|
4
|
+
export { default as root } from './root';
|
|
4
5
|
export { default as scrollbar } from './scrollbar';
|
|
5
6
|
export { default as state } from './state';
|
|
6
7
|
export { default as tooltip } from './tooltip';
|
|
@@ -1 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
import layout from './layout';
|
|
2
|
+
import queue from './queue';
|
|
3
|
+
declare const _default: {
|
|
4
|
+
layout: (data?: {
|
|
5
|
+
overlay?: {
|
|
6
|
+
class?: string | undefined;
|
|
7
|
+
content?: any;
|
|
8
|
+
} | undefined;
|
|
9
|
+
site?: {
|
|
10
|
+
class?: string | undefined;
|
|
11
|
+
content?: any;
|
|
12
|
+
scrollbar?: {
|
|
13
|
+
style?: string | undefined;
|
|
14
|
+
} | undefined;
|
|
15
|
+
} | undefined;
|
|
16
|
+
}) => {
|
|
17
|
+
content: string;
|
|
18
|
+
type: string;
|
|
19
|
+
values: never[];
|
|
20
|
+
};
|
|
21
|
+
queue: {
|
|
22
|
+
onclick: (fn: VoidFunction) => void;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export default _default;
|
|
26
|
+
export { layout, queue };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import events from '@esportsplus/delegated-events';
|
|
2
|
+
let initialized = false, queue = [];
|
|
3
|
+
const onclick = (fn) => {
|
|
4
|
+
if (!initialized) {
|
|
5
|
+
events.register(document.body, 'click', async () => {
|
|
6
|
+
if (!queue.length) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
let items = queue.splice(0);
|
|
10
|
+
for (let i = 0, n = items.length; i < n; i++) {
|
|
11
|
+
await items[i]();
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
initialized = true;
|
|
15
|
+
}
|
|
16
|
+
queue.push(fn);
|
|
17
|
+
};
|
|
18
|
+
export default { onclick };
|
|
@@ -1,21 +1,8 @@
|
|
|
1
1
|
import { reactive } from '@esportsplus/reactivity';
|
|
2
2
|
import { html } from '@esportsplus/template';
|
|
3
|
-
import
|
|
3
|
+
import { root } from '../../components';
|
|
4
4
|
import menu from './menu';
|
|
5
|
-
let initialized = false, root = [];
|
|
6
5
|
const onclick = ({ active, toggle }) => {
|
|
7
|
-
if (!initialized) {
|
|
8
|
-
events.register(document.body, 'click', () => {
|
|
9
|
-
if (!root.length) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
let deactivate = root.splice(0);
|
|
13
|
-
for (let i = 0, n = deactivate.length; i < n; i++) {
|
|
14
|
-
deactivate[i].active = false;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
initialized = true;
|
|
18
|
-
}
|
|
19
6
|
let state = reactive({
|
|
20
7
|
active: active || false
|
|
21
8
|
});
|
|
@@ -30,7 +17,7 @@ const onclick = ({ active, toggle }) => {
|
|
|
30
17
|
}
|
|
31
18
|
state.active = active;
|
|
32
19
|
if (active) {
|
|
33
|
-
root.
|
|
20
|
+
root.queue.onclick(() => state.active = false);
|
|
34
21
|
}
|
|
35
22
|
}
|
|
36
23
|
});
|
package/package.json
CHANGED
package/src/components/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { default as alert }from './alert';
|
|
2
2
|
export { default as form }from './form';
|
|
3
3
|
export { default as page }from './page';
|
|
4
|
+
export { default as root }from './root';
|
|
4
5
|
export { default as scrollbar }from './scrollbar';
|
|
5
6
|
export { default as state }from './state';
|
|
6
7
|
export { default as tooltip }from './tooltip';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import events from '@esportsplus/delegated-events';
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
let initialized = false,
|
|
5
|
+
queue: VoidFunction[] = [];
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const onclick = (fn: VoidFunction) => {
|
|
9
|
+
if (!initialized) {
|
|
10
|
+
events.register(document.body, 'click', async () => {
|
|
11
|
+
if (!queue.length) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let items = queue.splice(0);
|
|
16
|
+
|
|
17
|
+
for (let i = 0, n = items.length; i < n; i++) {
|
|
18
|
+
await items[i]();
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
initialized = true;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
queue.push(fn);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
export default { onclick };
|
|
@@ -1,29 +1,10 @@
|
|
|
1
1
|
import { reactive } from '@esportsplus/reactivity';
|
|
2
2
|
import { html } from '@esportsplus/template';
|
|
3
|
-
import
|
|
3
|
+
import { root } from '~/components';
|
|
4
4
|
import menu from './menu';
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
let initialized = false,
|
|
8
|
-
root: { active: boolean }[] = [];
|
|
9
|
-
|
|
10
|
-
|
|
11
7
|
const onclick = ({ active, toggle }: { active?: boolean, toggle?: boolean }) => {
|
|
12
|
-
if (!initialized) {
|
|
13
|
-
events.register(document.body, 'click', () => {
|
|
14
|
-
if (!root.length) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
let deactivate = root.splice(0);
|
|
19
|
-
|
|
20
|
-
for (let i = 0, n = deactivate.length; i < n; i++) {
|
|
21
|
-
deactivate[i].active = false;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
initialized = true;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
8
|
let state = reactive({
|
|
28
9
|
active: active || false
|
|
29
10
|
});
|
|
@@ -42,7 +23,7 @@ const onclick = ({ active, toggle }: { active?: boolean, toggle?: boolean }) =>
|
|
|
42
23
|
state.active = active;
|
|
43
24
|
|
|
44
25
|
if (active) {
|
|
45
|
-
root.
|
|
26
|
+
root.queue.onclick(() => state.active = false);
|
|
46
27
|
}
|
|
47
28
|
}
|
|
48
29
|
});
|