@esportsplus/ui 0.18.0 → 0.19.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.
- package/.github/dependabot.yml +2 -0
- package/.github/workflows/bump.yml +2 -0
- package/.github/workflows/dependabot.yml +12 -0
- package/.github/workflows/publish.yml +2 -0
- package/build/components/accordion/index.d.ts +5 -15
- package/build/components/accordion/index.js +28 -20
- package/build/components/counter/index.d.ts +2 -2
- package/build/components/counter/index.js +10 -10
- package/build/components/ellipsis/index.d.ts +1 -1
- package/build/components/field/checkbox.d.ts +9 -339
- package/build/components/field/checkbox.js +24 -21
- package/build/components/field/description.d.ts +3 -3
- package/build/components/field/error.d.ts +3 -2
- package/build/components/field/index.d.ts +1912 -0
- package/build/components/field/index.js +9 -0
- package/build/components/field/input.d.ts +18 -348
- package/build/components/field/input.js +33 -23
- package/build/components/field/select.d.ts +119 -226
- package/build/components/field/select.js +81 -69
- package/build/components/field/title.d.ts +114 -107
- package/build/components/field/title.js +15 -8
- package/build/components/form/action.d.ts +21 -6
- package/build/components/form/action.js +20 -9
- package/build/components/form/index.d.ts +130 -2
- package/build/components/frame/index.d.ts +3 -112
- package/build/components/frame/index.js +4 -6
- package/build/components/highlight/index.d.ts +5 -7
- package/build/components/highlight/index.js +23 -15
- package/build/components/icon/index.d.ts +3 -3
- package/build/components/index.d.ts +2 -2
- package/build/components/index.js +2 -2
- package/build/components/loader/index.d.ts +3 -3
- package/build/components/loader/index.js +13 -16
- package/build/components/loading/index.d.ts +1 -1
- package/build/components/overlay/index.d.ts +3 -112
- package/build/components/overlay/index.js +4 -6
- package/build/components/page/index.d.ts +0 -12
- package/build/components/page/index.js +0 -10
- package/build/components/root/onclick.js +4 -6
- package/build/components/scrollbar/index.d.ts +8 -112
- package/build/components/scrollbar/index.js +25 -20
- package/build/components/sidebar/index.d.ts +3 -112
- package/build/components/sidebar/index.js +4 -6
- package/build/components/site/index.d.ts +3 -112
- package/build/components/site/index.js +5 -8
- package/build/components/template/index.d.ts +8 -4
- package/build/components/template/index.js +5 -4
- package/build/components/tooltip/index.d.ts +235 -332
- package/build/components/tooltip/index.js +3 -106
- package/build/components/tooltip/menu.d.ts +20 -0
- package/build/components/tooltip/menu.js +28 -0
- package/build/components/tooltip/onclick.d.ts +124 -0
- package/build/components/tooltip/onclick.js +67 -0
- package/build/components/tooltip/onhover.d.ts +7 -0
- package/build/components/tooltip/onhover.js +25 -0
- package/build/components/typewriter/index.d.ts +4 -6
- package/build/components/typewriter/index.js +34 -33
- package/package.json +10 -9
- package/src/components/accordion/index.ts +41 -26
- package/src/components/counter/index.ts +15 -13
- package/src/components/field/checkbox.ts +31 -30
- package/src/components/field/description.ts +2 -2
- package/src/components/field/error.ts +2 -2
- package/src/components/field/index.ts +8 -3
- package/src/components/field/input.ts +41 -33
- package/src/components/field/select.ts +123 -108
- package/src/components/field/title.ts +18 -8
- package/src/components/form/action.ts +75 -47
- package/src/components/frame/index.ts +4 -9
- package/src/components/highlight/index.ts +53 -39
- package/src/components/icon/index.ts +3 -3
- package/src/components/index.ts +2 -2
- package/src/components/loader/index.ts +15 -17
- package/src/components/overlay/index.ts +4 -9
- package/src/components/page/index.ts +1 -17
- package/src/components/root/onclick.ts +6 -7
- package/src/components/scrollbar/index.ts +34 -23
- package/src/components/sidebar/index.ts +4 -9
- package/src/components/site/index.ts +5 -13
- package/src/components/template/index.ts +18 -10
- package/src/components/tooltip/index.ts +4 -156
- package/src/components/tooltip/menu.ts +52 -0
- package/src/components/tooltip/onclick.ts +97 -0
- package/src/components/tooltip/onhover.ts +35 -0
- package/src/components/typewriter/index.ts +44 -41
- package/build/components/footer/index.d.ts +0 -22
- package/build/components/footer/index.js +0 -61
- package/build/components/footer/scss/index.scss +0 -2
- package/build/components/form/types.d.ts +0 -10
- package/build/components/form/types.js +0 -1
- package/src/components/footer/index.ts +0 -74
- package/src/components/footer/scss/index.scss +0 -26
- package/src/components/form/types.ts +0 -14
|
@@ -1,108 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { root } from '@esportsplus/ui';
|
|
5
|
-
import template from '../../components/template/index.js';
|
|
1
|
+
import menu from './menu.js';
|
|
2
|
+
import onclick from './onclick.js';
|
|
3
|
+
import onhover from './onhover.js';
|
|
6
4
|
import './scss/index.scss';
|
|
7
|
-
let parent = null, queue = [], running = false, scheduled = false;
|
|
8
|
-
function frame() {
|
|
9
|
-
if (running) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
running = true;
|
|
13
|
-
let item, keep;
|
|
14
|
-
while (item = queue.pop()) {
|
|
15
|
-
if (parent === item.tooltip) {
|
|
16
|
-
keep = item;
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
|
-
item.fn();
|
|
20
|
-
}
|
|
21
|
-
if (keep) {
|
|
22
|
-
queue.push(keep);
|
|
23
|
-
}
|
|
24
|
-
running = false;
|
|
25
|
-
}
|
|
26
|
-
const menu = template.factory((attributes, content) => onclick(omit(attributes, ['options', 'option', 'tooltip-content']), html `
|
|
27
|
-
${content}
|
|
28
|
-
|
|
29
|
-
<div
|
|
30
|
-
class='tooltip-content ${`tooltip-content--${attributes['tooltip-content']?.direction || 'nw'}`}'
|
|
31
|
-
${omit(attributes['tooltip-content'], ['direction'])}
|
|
32
|
-
>
|
|
33
|
-
${attributes.options.map((option) => html `
|
|
34
|
-
<div
|
|
35
|
-
class='link --width-full'
|
|
36
|
-
${omit(option, ['content'])}
|
|
37
|
-
${attributes.option}
|
|
38
|
-
>
|
|
39
|
-
${option.content}
|
|
40
|
-
</div>
|
|
41
|
-
`)}
|
|
42
|
-
</div>
|
|
43
|
-
`));
|
|
44
|
-
const onclick = template.factory((attributes, content) => {
|
|
45
|
-
let state = attributes.state || reactive({ active: false });
|
|
46
|
-
attributes.class = toArray(attributes.class);
|
|
47
|
-
attributes.class.push(() => {
|
|
48
|
-
return state.active && '--active';
|
|
49
|
-
});
|
|
50
|
-
attributes.onclick = function (e) {
|
|
51
|
-
let active = true, node = e.target;
|
|
52
|
-
if (this === node || (attributes.toggle && this.contains(node))) {
|
|
53
|
-
active = !state.active;
|
|
54
|
-
}
|
|
55
|
-
if (parent !== this && !parent?.contains(this)) {
|
|
56
|
-
parent = this.parentElement?.closest('.tooltip');
|
|
57
|
-
}
|
|
58
|
-
frame();
|
|
59
|
-
if (parent === this) {
|
|
60
|
-
parent = null;
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
state.active = active;
|
|
64
|
-
if (active) {
|
|
65
|
-
queue.push({
|
|
66
|
-
fn: () => state.active = false,
|
|
67
|
-
tooltip: this
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
if (!scheduled) {
|
|
71
|
-
root.onclick.push(() => {
|
|
72
|
-
frame();
|
|
73
|
-
scheduled = false;
|
|
74
|
-
});
|
|
75
|
-
scheduled = true;
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
return html `
|
|
79
|
-
<div
|
|
80
|
-
class='tooltip'
|
|
81
|
-
${omit(attributes, ['state', 'toggle'])}
|
|
82
|
-
>
|
|
83
|
-
${content}
|
|
84
|
-
</div>
|
|
85
|
-
`;
|
|
86
|
-
});
|
|
87
|
-
const onhover = template.factory((attributes, content) => {
|
|
88
|
-
let state = attributes.state || reactive({ active: false });
|
|
89
|
-
attributes.class = toArray(attributes.class);
|
|
90
|
-
attributes.class.push(() => {
|
|
91
|
-
return state.active && '--active';
|
|
92
|
-
});
|
|
93
|
-
attributes.onmouseover = () => {
|
|
94
|
-
state.active = true;
|
|
95
|
-
};
|
|
96
|
-
attributes.onmouseout = () => {
|
|
97
|
-
state.active = false;
|
|
98
|
-
};
|
|
99
|
-
return html `
|
|
100
|
-
<div
|
|
101
|
-
class='tooltip'
|
|
102
|
-
${omit(attributes, ['active', 'state', 'toggle'])}
|
|
103
|
-
>
|
|
104
|
-
${content}
|
|
105
|
-
</div>
|
|
106
|
-
`;
|
|
107
|
-
});
|
|
108
5
|
export default { menu, onclick, onhover };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Attributes, type Renderable } from '@esportsplus/template';
|
|
2
|
+
type A = Attributes & {
|
|
3
|
+
options: (Attributes & {
|
|
4
|
+
content: Renderable<unknown>;
|
|
5
|
+
})[];
|
|
6
|
+
option?: Attributes;
|
|
7
|
+
state?: {
|
|
8
|
+
active: boolean;
|
|
9
|
+
};
|
|
10
|
+
toggle?: boolean;
|
|
11
|
+
'tooltip-content': Attributes & {
|
|
12
|
+
direction?: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
declare const _default: {
|
|
16
|
+
(): Renderable<unknown>;
|
|
17
|
+
(content: Renderable<unknown>): Renderable<unknown>;
|
|
18
|
+
(attributes: A, content: Renderable<unknown>): Renderable<unknown>;
|
|
19
|
+
};
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { html } from '@esportsplus/template';
|
|
2
|
+
import { omit } from '@esportsplus/utilities';
|
|
3
|
+
import template from '../../components/template/index.js';
|
|
4
|
+
import onclick from './onclick.js';
|
|
5
|
+
const OMIT = ['options', 'option', 'state', 'toggle', 'tooltip-content'];
|
|
6
|
+
const OMIT_OPTION = ['content'];
|
|
7
|
+
const OMIT_TOOLTIP_CONTENT = ['direction'];
|
|
8
|
+
export default template.factory((attributes, content) => {
|
|
9
|
+
let options = attributes.options, option = attributes.option, tooltipContent = attributes?.['tooltip-content'], tooltipContentDirection = tooltipContent?.direction || 'nw';
|
|
10
|
+
return onclick(omit(attributes, OMIT), html `
|
|
11
|
+
${content}
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
class='tooltip-content ${`tooltip-content--${tooltipContentDirection}`}'
|
|
15
|
+
${tooltipContent && omit(tooltipContent, OMIT_TOOLTIP_CONTENT)}
|
|
16
|
+
>
|
|
17
|
+
${options.map((o) => html `
|
|
18
|
+
<div
|
|
19
|
+
class='link --width-full'
|
|
20
|
+
${omit(o, OMIT_OPTION)}
|
|
21
|
+
${option}
|
|
22
|
+
>
|
|
23
|
+
${o.content}
|
|
24
|
+
</div>
|
|
25
|
+
`)}
|
|
26
|
+
</div>
|
|
27
|
+
`);
|
|
28
|
+
});
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
(): import("@esportsplus/template").Renderable<unknown>;
|
|
3
|
+
(content: import("@esportsplus/template").Renderable<unknown>): import("@esportsplus/template").Renderable<unknown>;
|
|
4
|
+
(attributes: {
|
|
5
|
+
class?: ((string | number | bigint | boolean | null | undefined) | import("@esportsplus/template/build/types").Effect<(string | number | bigint | boolean | null | undefined) | (string | number | bigint | boolean | null | undefined)[]>) | ((string | number | bigint | boolean | null | undefined) | import("@esportsplus/template/build/types").Effect<(string | number | bigint | boolean | null | undefined) | (string | number | bigint | boolean | null | undefined)[]>)[];
|
|
6
|
+
style?: ((string | number | bigint | boolean | null | undefined) | import("@esportsplus/template/build/types").Effect<(string | number | bigint | boolean | null | undefined) | (string | number | bigint | boolean | null | undefined)[]>) | ((string | number | bigint | boolean | null | undefined) | import("@esportsplus/template/build/types").Effect<(string | number | bigint | boolean | null | undefined) | (string | number | bigint | boolean | null | undefined)[]>)[];
|
|
7
|
+
} & {
|
|
8
|
+
onabort?: ((this: import("@esportsplus/template").Element, event: UIEvent) => void) | undefined;
|
|
9
|
+
onanimationcancel?: ((this: import("@esportsplus/template").Element, event: AnimationEvent) => void) | undefined;
|
|
10
|
+
onanimationend?: ((this: import("@esportsplus/template").Element, event: AnimationEvent) => void) | undefined;
|
|
11
|
+
onanimationiteration?: ((this: import("@esportsplus/template").Element, event: AnimationEvent) => void) | undefined;
|
|
12
|
+
onanimationstart?: ((this: import("@esportsplus/template").Element, event: AnimationEvent) => void) | undefined;
|
|
13
|
+
onauxclick?: ((this: import("@esportsplus/template").Element, event: MouseEvent) => void) | undefined;
|
|
14
|
+
onbeforeinput?: ((this: import("@esportsplus/template").Element, event: InputEvent) => void) | undefined;
|
|
15
|
+
onbeforetoggle?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
16
|
+
onblur?: ((this: import("@esportsplus/template").Element, event: FocusEvent) => void) | undefined;
|
|
17
|
+
oncancel?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
18
|
+
oncanplay?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
19
|
+
oncanplaythrough?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
20
|
+
onchange?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
21
|
+
onclick?: ((this: import("@esportsplus/template").Element, event: MouseEvent) => void) | undefined;
|
|
22
|
+
onclose?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
23
|
+
oncompositionend?: ((this: import("@esportsplus/template").Element, event: CompositionEvent) => void) | undefined;
|
|
24
|
+
oncompositionstart?: ((this: import("@esportsplus/template").Element, event: CompositionEvent) => void) | undefined;
|
|
25
|
+
oncompositionupdate?: ((this: import("@esportsplus/template").Element, event: CompositionEvent) => void) | undefined;
|
|
26
|
+
oncontextlost?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
27
|
+
oncontextmenu?: ((this: import("@esportsplus/template").Element, event: MouseEvent) => void) | undefined;
|
|
28
|
+
oncontextrestored?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
29
|
+
oncopy?: ((this: import("@esportsplus/template").Element, event: ClipboardEvent) => void) | undefined;
|
|
30
|
+
oncuechange?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
31
|
+
oncut?: ((this: import("@esportsplus/template").Element, event: ClipboardEvent) => void) | undefined;
|
|
32
|
+
ondblclick?: ((this: import("@esportsplus/template").Element, event: MouseEvent) => void) | undefined;
|
|
33
|
+
ondrag?: ((this: import("@esportsplus/template").Element, event: DragEvent) => void) | undefined;
|
|
34
|
+
ondragend?: ((this: import("@esportsplus/template").Element, event: DragEvent) => void) | undefined;
|
|
35
|
+
ondragenter?: ((this: import("@esportsplus/template").Element, event: DragEvent) => void) | undefined;
|
|
36
|
+
ondragleave?: ((this: import("@esportsplus/template").Element, event: DragEvent) => void) | undefined;
|
|
37
|
+
ondragover?: ((this: import("@esportsplus/template").Element, event: DragEvent) => void) | undefined;
|
|
38
|
+
ondragstart?: ((this: import("@esportsplus/template").Element, event: DragEvent) => void) | undefined;
|
|
39
|
+
ondrop?: ((this: import("@esportsplus/template").Element, event: DragEvent) => void) | undefined;
|
|
40
|
+
ondurationchange?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
41
|
+
onemptied?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
42
|
+
onended?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
43
|
+
onerror?: ((this: import("@esportsplus/template").Element, event: ErrorEvent) => void) | undefined;
|
|
44
|
+
onfocus?: ((this: import("@esportsplus/template").Element, event: FocusEvent) => void) | undefined;
|
|
45
|
+
onfocusin?: ((this: import("@esportsplus/template").Element, event: FocusEvent) => void) | undefined;
|
|
46
|
+
onfocusout?: ((this: import("@esportsplus/template").Element, event: FocusEvent) => void) | undefined;
|
|
47
|
+
onformdata?: ((this: import("@esportsplus/template").Element, event: FormDataEvent) => void) | undefined;
|
|
48
|
+
ongotpointercapture?: ((this: import("@esportsplus/template").Element, event: PointerEvent) => void) | undefined;
|
|
49
|
+
oninput?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
50
|
+
oninvalid?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
51
|
+
onkeydown?: ((this: import("@esportsplus/template").Element, event: KeyboardEvent) => void) | undefined;
|
|
52
|
+
onkeypress?: ((this: import("@esportsplus/template").Element, event: KeyboardEvent) => void) | undefined;
|
|
53
|
+
onkeyup?: ((this: import("@esportsplus/template").Element, event: KeyboardEvent) => void) | undefined;
|
|
54
|
+
onload?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
55
|
+
onloadeddata?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
56
|
+
onloadedmetadata?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
57
|
+
onloadstart?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
58
|
+
onlostpointercapture?: ((this: import("@esportsplus/template").Element, event: PointerEvent) => void) | undefined;
|
|
59
|
+
onmousedown?: ((this: import("@esportsplus/template").Element, event: MouseEvent) => void) | undefined;
|
|
60
|
+
onmouseenter?: ((this: import("@esportsplus/template").Element, event: MouseEvent) => void) | undefined;
|
|
61
|
+
onmouseleave?: ((this: import("@esportsplus/template").Element, event: MouseEvent) => void) | undefined;
|
|
62
|
+
onmousemove?: ((this: import("@esportsplus/template").Element, event: MouseEvent) => void) | undefined;
|
|
63
|
+
onmouseout?: ((this: import("@esportsplus/template").Element, event: MouseEvent) => void) | undefined;
|
|
64
|
+
onmouseover?: ((this: import("@esportsplus/template").Element, event: MouseEvent) => void) | undefined;
|
|
65
|
+
onmouseup?: ((this: import("@esportsplus/template").Element, event: MouseEvent) => void) | undefined;
|
|
66
|
+
onpaste?: ((this: import("@esportsplus/template").Element, event: ClipboardEvent) => void) | undefined;
|
|
67
|
+
onpause?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
68
|
+
onplay?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
69
|
+
onplaying?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
70
|
+
onpointercancel?: ((this: import("@esportsplus/template").Element, event: PointerEvent) => void) | undefined;
|
|
71
|
+
onpointerdown?: ((this: import("@esportsplus/template").Element, event: PointerEvent) => void) | undefined;
|
|
72
|
+
onpointerenter?: ((this: import("@esportsplus/template").Element, event: PointerEvent) => void) | undefined;
|
|
73
|
+
onpointerleave?: ((this: import("@esportsplus/template").Element, event: PointerEvent) => void) | undefined;
|
|
74
|
+
onpointermove?: ((this: import("@esportsplus/template").Element, event: PointerEvent) => void) | undefined;
|
|
75
|
+
onpointerout?: ((this: import("@esportsplus/template").Element, event: PointerEvent) => void) | undefined;
|
|
76
|
+
onpointerover?: ((this: import("@esportsplus/template").Element, event: PointerEvent) => void) | undefined;
|
|
77
|
+
onpointerup?: ((this: import("@esportsplus/template").Element, event: PointerEvent) => void) | undefined;
|
|
78
|
+
onprogress?: ((this: import("@esportsplus/template").Element, event: ProgressEvent<EventTarget>) => void) | undefined;
|
|
79
|
+
onratechange?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
80
|
+
onreset?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
81
|
+
onresize?: ((this: import("@esportsplus/template").Element, event: UIEvent) => void) | undefined;
|
|
82
|
+
onscroll?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
83
|
+
onscrollend?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
84
|
+
onsecuritypolicyviolation?: ((this: import("@esportsplus/template").Element, event: SecurityPolicyViolationEvent) => void) | undefined;
|
|
85
|
+
onseeked?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
86
|
+
onseeking?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
87
|
+
onselect?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
88
|
+
onselectionchange?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
89
|
+
onselectstart?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
90
|
+
onslotchange?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
91
|
+
onstalled?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
92
|
+
onsubmit?: ((this: import("@esportsplus/template").Element, event: SubmitEvent) => void) | undefined;
|
|
93
|
+
onsuspend?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
94
|
+
ontimeupdate?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
95
|
+
ontoggle?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
96
|
+
ontouchcancel?: ((this: import("@esportsplus/template").Element, event: TouchEvent) => void) | undefined;
|
|
97
|
+
ontouchend?: ((this: import("@esportsplus/template").Element, event: TouchEvent) => void) | undefined;
|
|
98
|
+
ontouchmove?: ((this: import("@esportsplus/template").Element, event: TouchEvent) => void) | undefined;
|
|
99
|
+
ontouchstart?: ((this: import("@esportsplus/template").Element, event: TouchEvent) => void) | undefined;
|
|
100
|
+
ontransitioncancel?: ((this: import("@esportsplus/template").Element, event: TransitionEvent) => void) | undefined;
|
|
101
|
+
ontransitionend?: ((this: import("@esportsplus/template").Element, event: TransitionEvent) => void) | undefined;
|
|
102
|
+
ontransitionrun?: ((this: import("@esportsplus/template").Element, event: TransitionEvent) => void) | undefined;
|
|
103
|
+
ontransitionstart?: ((this: import("@esportsplus/template").Element, event: TransitionEvent) => void) | undefined;
|
|
104
|
+
onvolumechange?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
105
|
+
onwaiting?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
106
|
+
onwebkitanimationend?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
107
|
+
onwebkitanimationiteration?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
108
|
+
onwebkitanimationstart?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
109
|
+
onwebkittransitionend?: ((this: import("@esportsplus/template").Element, event: Event) => void) | undefined;
|
|
110
|
+
onwheel?: ((this: import("@esportsplus/template").Element, event: WheelEvent) => void) | undefined;
|
|
111
|
+
} & {
|
|
112
|
+
[key: `aria-${string}`]: string | number | boolean | undefined;
|
|
113
|
+
[key: `data-${string}`]: string | undefined;
|
|
114
|
+
onconnect?: (element: import("@esportsplus/template").Element) => void;
|
|
115
|
+
ondisconnect?: (element: import("@esportsplus/template").Element) => void;
|
|
116
|
+
onrender?: (element: import("@esportsplus/template").Element) => void;
|
|
117
|
+
} & Record<PropertyKey, unknown> & {
|
|
118
|
+
state?: {
|
|
119
|
+
active: boolean;
|
|
120
|
+
};
|
|
121
|
+
toggle?: boolean;
|
|
122
|
+
}, content: import("@esportsplus/template").Renderable<unknown>): import("@esportsplus/template").Renderable<unknown>;
|
|
123
|
+
};
|
|
124
|
+
export default _default;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
+
import { html } from '@esportsplus/template';
|
|
3
|
+
import { omit } from '@esportsplus/utilities';
|
|
4
|
+
import { root } from '@esportsplus/ui';
|
|
5
|
+
import template from '../../components/template/index.js';
|
|
6
|
+
const OMIT = ['state', 'toggle'];
|
|
7
|
+
let parent = null, queue = [], running = false, scheduled = false;
|
|
8
|
+
function frame() {
|
|
9
|
+
if (running) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
running = true;
|
|
13
|
+
let item, keep;
|
|
14
|
+
while (item = queue.pop()) {
|
|
15
|
+
if (parent === item.tooltip) {
|
|
16
|
+
keep = item;
|
|
17
|
+
continue;
|
|
18
|
+
}
|
|
19
|
+
item.fn();
|
|
20
|
+
}
|
|
21
|
+
if (keep) {
|
|
22
|
+
queue.push(keep);
|
|
23
|
+
}
|
|
24
|
+
running = false;
|
|
25
|
+
}
|
|
26
|
+
export default template.factory((attributes, content) => {
|
|
27
|
+
let state = attributes.state || reactive({ active: false }), toggle = attributes.toggle || false;
|
|
28
|
+
return html `
|
|
29
|
+
<div
|
|
30
|
+
class='tooltip'
|
|
31
|
+
${omit(attributes, OMIT)}
|
|
32
|
+
${{
|
|
33
|
+
class: () => state.active && '--active',
|
|
34
|
+
onclick: function (e) {
|
|
35
|
+
let active = true, node = e.target;
|
|
36
|
+
if (this === node || (toggle && this.contains(node))) {
|
|
37
|
+
active = !state.active;
|
|
38
|
+
}
|
|
39
|
+
if (parent !== this && !parent?.contains(this)) {
|
|
40
|
+
parent = this.parentElement?.closest('.tooltip');
|
|
41
|
+
}
|
|
42
|
+
frame();
|
|
43
|
+
if (parent === this) {
|
|
44
|
+
parent = null;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
state.active = active;
|
|
48
|
+
if (active) {
|
|
49
|
+
queue.push({
|
|
50
|
+
fn: () => state.active = false,
|
|
51
|
+
tooltip: this
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if (!scheduled) {
|
|
55
|
+
root.onclick.push(() => {
|
|
56
|
+
frame();
|
|
57
|
+
scheduled = false;
|
|
58
|
+
});
|
|
59
|
+
scheduled = true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
${content}
|
|
65
|
+
</div>
|
|
66
|
+
`;
|
|
67
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Attributes } from '@esportsplus/template';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
(): import("@esportsplus/template").Renderable<unknown>;
|
|
4
|
+
(content: import("@esportsplus/template").Renderable<unknown>): import("@esportsplus/template").Renderable<unknown>;
|
|
5
|
+
(attributes: Attributes, content: import("@esportsplus/template").Renderable<unknown>): import("@esportsplus/template").Renderable<unknown>;
|
|
6
|
+
};
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
+
import { html } from '@esportsplus/template';
|
|
3
|
+
import { omit } from '@esportsplus/utilities';
|
|
4
|
+
import template from '../../components/template/index.js';
|
|
5
|
+
const OMIT = ['state'];
|
|
6
|
+
export default template.factory((attributes, content) => {
|
|
7
|
+
let state = attributes.state || reactive({ active: false });
|
|
8
|
+
return html `
|
|
9
|
+
<div
|
|
10
|
+
class='tooltip'
|
|
11
|
+
${omit(attributes, OMIT)}
|
|
12
|
+
${{
|
|
13
|
+
class: () => state.active && '--active',
|
|
14
|
+
onmouseover: () => {
|
|
15
|
+
state.active = true;
|
|
16
|
+
},
|
|
17
|
+
onmouseout: () => {
|
|
18
|
+
state.active = false;
|
|
19
|
+
}
|
|
20
|
+
}}
|
|
21
|
+
>
|
|
22
|
+
${content}
|
|
23
|
+
</div>
|
|
24
|
+
`;
|
|
25
|
+
});
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import './scss/index.scss';
|
|
2
|
-
declare const _default:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
html: () => string | import("@esportsplus/template/build/types").RenderableTemplate;
|
|
2
|
+
declare const _default: {
|
|
3
|
+
(): import("@esportsplus/template").Renderable<unknown>;
|
|
4
|
+
(content: string[]): import("@esportsplus/template").Renderable<unknown>;
|
|
5
|
+
(attributes: import("@esportsplus/template").Attributes, content: string[]): import("@esportsplus/template").Renderable<unknown>;
|
|
8
6
|
};
|
|
9
7
|
export default _default;
|
|
@@ -1,42 +1,43 @@
|
|
|
1
1
|
import { html } from '@esportsplus/template';
|
|
2
2
|
import { reactive } from '@esportsplus/reactivity';
|
|
3
|
+
import template from '../../components/template/index.js';
|
|
3
4
|
import './scss/index.scss';
|
|
4
5
|
const EMPTY_NODE = html ` `;
|
|
5
|
-
export default (content)
|
|
6
|
+
export default template.factory(function (_, content) {
|
|
6
7
|
let state = reactive({ text: '' });
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
character++;
|
|
23
|
-
}
|
|
8
|
+
return html `
|
|
9
|
+
<div class='typewriter' ${{
|
|
10
|
+
onconnect: () => {
|
|
11
|
+
let character = 0, i = 0, isWriting = true, write = content[i];
|
|
12
|
+
function play() {
|
|
13
|
+
setTimeout(() => {
|
|
14
|
+
state.text = write.slice(0, character);
|
|
15
|
+
if (isWriting) {
|
|
16
|
+
if (character > write.length) {
|
|
17
|
+
isWriting = false;
|
|
18
|
+
setTimeout(play, 2000);
|
|
19
|
+
return;
|
|
24
20
|
}
|
|
25
21
|
else {
|
|
26
|
-
|
|
27
|
-
isWriting = true;
|
|
28
|
-
write = content[++i] || content[i = 0];
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
character--;
|
|
32
|
-
}
|
|
22
|
+
character++;
|
|
33
23
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
if (character === 0) {
|
|
27
|
+
isWriting = true;
|
|
28
|
+
write = content[++i] || content[i = 0];
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
character--;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
play();
|
|
35
|
+
}, isWriting ? 64 : 32);
|
|
38
36
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
}
|
|
37
|
+
play();
|
|
38
|
+
}
|
|
39
|
+
}}>
|
|
40
|
+
${() => state.text || EMPTY_NODE}
|
|
41
|
+
</div>
|
|
42
|
+
`;
|
|
43
|
+
});
|
package/package.json
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "ICJR",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"@esportsplus/action": "^0.0.
|
|
5
|
-
"@esportsplus/
|
|
6
|
-
"@esportsplus/
|
|
7
|
-
"@esportsplus/
|
|
4
|
+
"@esportsplus/action": "^0.0.58",
|
|
5
|
+
"@esportsplus/queue": "^0.1.0",
|
|
6
|
+
"@esportsplus/reactivity": "^0.16.7",
|
|
7
|
+
"@esportsplus/template": "^0.19.5",
|
|
8
|
+
"@esportsplus/utilities": "^0.22.1",
|
|
8
9
|
"modern-normalize": "^3.0.1"
|
|
9
10
|
},
|
|
10
11
|
"devDependencies": {
|
|
11
|
-
"@esportsplus/typescript": "^0.9.
|
|
12
|
-
"@types/node": "^24.
|
|
12
|
+
"@esportsplus/typescript": "^0.9.2",
|
|
13
|
+
"@types/node": "^24.3.0",
|
|
13
14
|
"autoprefixer": "^10.4.21",
|
|
14
15
|
"glob": "^11.0.3",
|
|
15
16
|
"lightningcss": "^1.30.1",
|
|
16
17
|
"npm-run-all": "^4.1.5",
|
|
17
|
-
"sass": "^1.
|
|
18
|
-
"vite": "^7.
|
|
18
|
+
"sass": "^1.90.0",
|
|
19
|
+
"vite": "^7.1.2"
|
|
19
20
|
},
|
|
20
21
|
"exports": {
|
|
21
22
|
"./css-utilities": {
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
"private": false,
|
|
48
49
|
"sideEffects": false,
|
|
49
50
|
"type": "module",
|
|
50
|
-
"version": "0.
|
|
51
|
+
"version": "0.19.0",
|
|
51
52
|
"scripts": {
|
|
52
53
|
"build": "run-s build:vite build:ts",
|
|
53
54
|
"build:ts": "tsc && tsc-alias",
|
|
@@ -1,36 +1,51 @@
|
|
|
1
1
|
import { reactive } from '@esportsplus/reactivity';
|
|
2
|
+
import { html, Attributes } from '@esportsplus/template';
|
|
3
|
+
import { omit } from '@esportsplus/utilities';
|
|
4
|
+
import template from '~/components/template';
|
|
2
5
|
import './scss/index.scss';
|
|
3
6
|
|
|
4
7
|
|
|
8
|
+
type A = Attributes & { state?: { active: boolean | number } };
|
|
9
|
+
|
|
5
10
|
type Accordion = HTMLElement & { [key: symbol]: { active: boolean | number } };
|
|
6
11
|
|
|
7
12
|
|
|
13
|
+
const OMIT = ['state'];
|
|
14
|
+
|
|
15
|
+
|
|
8
16
|
let key = Symbol();
|
|
9
17
|
|
|
10
18
|
|
|
11
|
-
export default (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
19
|
+
export default template.factory(
|
|
20
|
+
function(attributes: A, content) {
|
|
21
|
+
let ref: Accordion,
|
|
22
|
+
state = attributes.state || reactive({
|
|
23
|
+
active: 0
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return html`
|
|
27
|
+
<div
|
|
28
|
+
${omit(attributes, OMIT)}
|
|
29
|
+
${{
|
|
30
|
+
class: () => {
|
|
31
|
+
return state.active && '--active';
|
|
32
|
+
},
|
|
33
|
+
onrender: (element) => {
|
|
34
|
+
( ref = element as Accordion )[key] = state;
|
|
35
|
+
},
|
|
36
|
+
style: () => {
|
|
37
|
+
let parent = ref.closest<Accordion>('accordion');
|
|
38
|
+
|
|
39
|
+
if (parent && key in parent) {
|
|
40
|
+
parent[key].active = (+parent[key].active) + 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return state.active && `--max-height: ${ref.scrollHeight}`;
|
|
44
|
+
}
|
|
45
|
+
}}
|
|
46
|
+
>
|
|
47
|
+
${content}
|
|
48
|
+
</div>
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
51
|
+
);
|