@nemigo/layout 0.2.1 → 0.3.1

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.
@@ -1,6 +1,6 @@
1
1
  <script module lang="ts"></script>
2
2
 
3
- <script lang="ts">import { enterKeyHook, preventStop, preventStopHook } from "@nemigo/helpers/html";
3
+ <script lang="ts">import { preventStop, preventStopHook } from "@nemigo/helpers/html";
4
4
  let {
5
5
  id,
6
6
  label,
@@ -32,13 +32,28 @@ let ariaLabel = $derived(label ?? void 0);
32
32
  {oncontextmenu}
33
33
  onclick={onmousedown === "onclick" ? preventStop : onclick}
34
34
  onkeydown={onkeydown ??
35
- enterKeyHook(
36
- (e) => {
37
- // @ts-expect-error <сужение на уровне типов у компонента>
38
- oncontextmenu && e.metaKey ? oncontextmenu(e) : onClick(e);
39
- },
40
- { condition: () => !load && !disabled }
41
- )}
35
+ ((e) => {
36
+ if (load || disabled) return;
37
+ if (e.key === "Enter") {
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") {
50
+ if (oncontextmenu) {
51
+ preventStop(e);
52
+ // @ts-expect-error <сужение на уровне типов у компонента>
53
+ oncontextmenu(e);
54
+ }
55
+ }
56
+ })}
42
57
  onmousedown={onmousedown === "onclick" ? onclick : (onmousedown ?? undefined)}>
43
58
  {@render children()}
44
59
  </div>
@@ -14,7 +14,7 @@ interface BaseEnterBlockProps {
14
14
  export interface OnKeydownEnterBlockProps extends BaseEnterBlockProps {
15
15
  onclick?: (e: MouseEvent) => void;
16
16
  oncontextmenu?: (e: MouseEvent) => void;
17
- onkeydown: (e: MouseEvent | SvelteKeyboardEvent) => void;
17
+ onkeydown: (e: SvelteKeyboardEvent) => void;
18
18
  }
19
19
  export interface NotKeydownEnterBlockProps extends BaseEnterBlockProps {
20
20
  onclick?: (e: MouseEvent | SvelteKeyboardEvent) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nemigo/layout",
3
- "version": "0.2.1",
3
+ "version": "0.3.1",
4
4
  "private": false,
5
5
  "author": {
6
6
  "name": "Vlad Logvin",