@nemigo/layout 0.4.0 → 0.5.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.
|
@@ -10,6 +10,7 @@ let {
|
|
|
10
10
|
load,
|
|
11
11
|
onclick: onClick,
|
|
12
12
|
onmousedown,
|
|
13
|
+
onenterdown,
|
|
13
14
|
onkeydown,
|
|
14
15
|
oncontextmenu,
|
|
15
16
|
children
|
|
@@ -31,29 +32,29 @@ let ariaLabel = $derived(label ?? void 0);
|
|
|
31
32
|
{style}
|
|
32
33
|
{oncontextmenu}
|
|
33
34
|
onclick={onmousedown === "onclick" ? preventStop : onclick}
|
|
34
|
-
onkeydown={
|
|
35
|
-
(
|
|
36
|
-
|
|
37
|
-
if (e.
|
|
38
|
-
if (e.altKey) {
|
|
39
|
-
if (oncontextmenu) {
|
|
40
|
-
preventStop(e);
|
|
41
|
-
// @ts-expect-error <сужение на уровне типов у компонента>
|
|
42
|
-
oncontextmenu(e);
|
|
43
|
-
}
|
|
44
|
-
} else {
|
|
45
|
-
preventStop(e);
|
|
46
|
-
// @ts-expect-error <сужение на уровне типов у компонента>
|
|
47
|
-
onClick(e);
|
|
48
|
-
}
|
|
49
|
-
} else if (e.key === "ContextMenu") {
|
|
35
|
+
onkeydown={(e) => {
|
|
36
|
+
if (load || disabled) return;
|
|
37
|
+
if (e.key === "Enter") {
|
|
38
|
+
if (e.altKey) {
|
|
50
39
|
if (oncontextmenu) {
|
|
51
40
|
preventStop(e);
|
|
52
41
|
// @ts-expect-error <сужение на уровне типов у компонента>
|
|
53
42
|
oncontextmenu(e);
|
|
54
43
|
}
|
|
44
|
+
} else {
|
|
45
|
+
// @ts-expect-error <сужение на уровне типов у компонента>
|
|
46
|
+
onenterdown ? onenterdown(e) : onClick(e);
|
|
47
|
+
}
|
|
48
|
+
} else if (e.key === "ContextMenu") {
|
|
49
|
+
if (oncontextmenu) {
|
|
50
|
+
preventStop(e);
|
|
51
|
+
// @ts-expect-error <сужение на уровне типов у компонента>
|
|
52
|
+
oncontextmenu(e);
|
|
55
53
|
}
|
|
56
|
-
}
|
|
54
|
+
} else {
|
|
55
|
+
onkeydown?.(e);
|
|
56
|
+
}
|
|
57
|
+
}}
|
|
57
58
|
onmousedown={onmousedown === "onclick" ? onclick : (onmousedown ?? undefined)}>
|
|
58
59
|
{@render children()}
|
|
59
60
|
</div>
|
|
@@ -9,17 +9,18 @@ interface BaseEnterBlockProps {
|
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
load?: boolean;
|
|
11
11
|
onmousedown?: ((e: MouseEvent) => void) | "onclick";
|
|
12
|
+
onkeydown?: (e: TargetKeyboardEvent) => void;
|
|
12
13
|
children: Snippet;
|
|
13
14
|
}
|
|
14
15
|
export interface OnKeydownEnterBlockProps extends BaseEnterBlockProps {
|
|
15
16
|
onclick?: (e: MouseEvent) => void;
|
|
16
17
|
oncontextmenu?: (e: MouseEvent) => void;
|
|
17
|
-
|
|
18
|
+
onenterdown: (e: TargetKeyboardEvent) => void;
|
|
18
19
|
}
|
|
19
20
|
export interface NotKeydownEnterBlockProps extends BaseEnterBlockProps {
|
|
20
21
|
onclick?: (e: MouseEvent | TargetKeyboardEvent) => void;
|
|
21
22
|
oncontextmenu?: (e: MouseEvent | TargetKeyboardEvent) => void;
|
|
22
|
-
|
|
23
|
+
onenterdown?: undefined;
|
|
23
24
|
}
|
|
24
25
|
export type EnterBlockProps = OnKeydownEnterBlockProps | NotKeydownEnterBlockProps;
|
|
25
26
|
declare const EnterBlock: import("svelte").Component<EnterBlockProps, {}, "">;
|
|
@@ -3,7 +3,7 @@ export const loaderCursorStore = new LoaderStore(true);
|
|
|
3
3
|
</script>
|
|
4
4
|
|
|
5
5
|
<script lang="ts">$effect(() => {
|
|
6
|
-
document.documentElement.style.cursor = loaderCursorStore.
|
|
6
|
+
document.documentElement.style.cursor = loaderCursorStore.state.value ? "wait" : "auto";
|
|
7
7
|
});
|
|
8
8
|
loaderCursorStore.hydrate();
|
|
9
9
|
</script>
|