@isoftdata/svelte-context-menu 2.0.1 → 2.0.2

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/README.md CHANGED
@@ -4,8 +4,8 @@ A Context/Dropdown menu component, filled with [DropdownItem](DropdownItem.md)s
4
4
 
5
5
  ## Install
6
6
 
7
- ```bash
8
- npm i @isoftdata/svelte-context-menu
7
+ ```sh
8
+ pnpm i @isoftdata/svelte-context-menu
9
9
  ```
10
10
 
11
11
  ## Breaking changes
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
- import type { Snippet } from "svelte"
3
- import { computePosition, flip, type Placement } from "@floating-ui/dom"
2
+ import type { Snippet } from 'svelte'
3
+ import { computePosition, flip, type Placement } from '@floating-ui/dom'
4
4
 
5
5
  interface Props {
6
6
  id?: string
@@ -17,7 +17,7 @@
17
17
  //
18
18
  id = `dropdown-menu-${uniqueId}`,
19
19
  menuItemClickCloses = true,
20
- placement = "bottom-start",
20
+ placement = 'bottom-start',
21
21
  children,
22
22
  open: openCb,
23
23
  close: closeCb,
@@ -26,11 +26,11 @@
26
26
  let show = $state(false)
27
27
  let positionLeft = $state(0)
28
28
  let positionTop = $state(0)
29
- let strategy = $state("absolute")
29
+ let strategy = $state('absolute')
30
30
 
31
31
  let menu: HTMLElement | undefined = $state()
32
32
 
33
- export async function open(event: MouseEvent, targetId: string = "") {
33
+ export async function open(event: MouseEvent, targetId: string = '') {
34
34
  event.stopPropagation()
35
35
  if (menu) {
36
36
  show = true
@@ -71,17 +71,17 @@
71
71
  event.stopPropagation()
72
72
  const target = event.target as HTMLElement
73
73
  console.log(event.key, event.currentTarget, event.target)
74
- if ((event.key === " " || event.key === "Enter") && target.tagName === "BUTTON") {
74
+ if ((event.key === ' ' || event.key === 'Enter') && target.tagName === 'BUTTON') {
75
75
  target.click()
76
- } else if (target === event.currentTarget && event.key === "Tab") {
77
- target.querySelector("button")?.focus()
76
+ } else if (target === event.currentTarget && event.key === 'Tab') {
77
+ target.querySelector('button')?.focus()
78
78
  }
79
79
  }
80
80
  </script>
81
81
 
82
82
  <svelte:window
83
83
  onclick={close}
84
- onkeydown={event => event.key === "Escape" && close()}
84
+ onkeydown={event => event.key === 'Escape' && close()}
85
85
  />
86
86
 
87
87
  <div
@@ -1,5 +1,5 @@
1
- import type { Snippet } from "svelte";
2
- import { type Placement } from "@floating-ui/dom";
1
+ import type { Snippet } from 'svelte';
2
+ import { type Placement } from '@floating-ui/dom';
3
3
  interface Props {
4
4
  id?: string;
5
5
  menuItemClickCloses?: boolean;
@@ -1,7 +1,7 @@
1
1
  <script lang="ts">
2
- import type { ComponentProps, Snippet } from "svelte"
3
- import DropdownItem from "./DropdownItem.svelte"
4
- interface Props extends Omit<ComponentProps<typeof DropdownItem>, "children"> {
2
+ import type { ComponentProps, Snippet } from 'svelte'
3
+ import DropdownItem from './DropdownItem.svelte'
4
+ interface Props extends Omit<ComponentProps<typeof DropdownItem>, 'children'> {
5
5
  checked?: boolean
6
6
  children?: Snippet<[{ checked: boolean }]>
7
7
  }
@@ -16,8 +16,8 @@
16
16
 
17
17
  <DropdownItem
18
18
  icon={{
19
- icon: checked ? "check-square" : "square",
20
- prefix: "far",
19
+ icon: checked ? 'check-square' : 'square',
20
+ prefix: 'far',
21
21
  }}
22
22
  onclick={event => {
23
23
  checked = !checked
@@ -1,6 +1,6 @@
1
- import type { ComponentProps, Snippet } from "svelte";
2
- import DropdownItem from "./DropdownItem.svelte";
3
- interface Props extends Omit<ComponentProps<typeof DropdownItem>, "children"> {
1
+ import type { ComponentProps, Snippet } from 'svelte';
2
+ import DropdownItem from './DropdownItem.svelte';
3
+ interface Props extends Omit<ComponentProps<typeof DropdownItem>, 'children'> {
4
4
  checked?: boolean;
5
5
  children?: Snippet<[{
6
6
  checked: boolean;
@@ -1,10 +1,10 @@
1
1
  <script lang="ts">
2
- import type { ComponentProps, Snippet } from "svelte"
3
- import type { HTMLButtonAttributes } from "svelte/elements"
4
- import Icon, { getIconProps } from "@isoftdata/svelte-icon"
2
+ import type { ComponentProps, Snippet } from 'svelte'
3
+ import type { HTMLButtonAttributes } from 'svelte/elements'
4
+ import Icon, { getIconProps } from '@isoftdata/svelte-icon'
5
5
 
6
6
  interface Props extends Omit<HTMLButtonAttributes, `on:${string}` | `bind:${string}` | `aria-${string}`> {
7
- icon?: ComponentProps<Icon>["icon"] | ComponentProps<Icon>
7
+ icon?: ComponentProps<Icon>['icon'] | ComponentProps<Icon>
8
8
  children?: Snippet
9
9
  }
10
10
 
@@ -22,7 +22,7 @@
22
22
  class="dropdown-item"
23
23
  type="button"
24
24
  {...rest}
25
- >{#if icon}<span class="mr-1"
25
+ >{#if icon}<span class="mr-1 me-1"
26
26
  ><Icon
27
27
  fixedWidth
28
28
  {...iconProps}
@@ -1,8 +1,8 @@
1
- import type { ComponentProps, Snippet } from "svelte";
2
- import type { HTMLButtonAttributes } from "svelte/elements";
3
- import Icon from "@isoftdata/svelte-icon";
1
+ import type { ComponentProps, Snippet } from 'svelte';
2
+ import type { HTMLButtonAttributes } from 'svelte/elements';
3
+ import Icon from '@isoftdata/svelte-icon';
4
4
  interface Props extends Omit<HTMLButtonAttributes, `on:${string}` | `bind:${string}` | `aria-${string}`> {
5
- icon?: ComponentProps<Icon>["icon"] | ComponentProps<Icon>;
5
+ icon?: ComponentProps<Icon>['icon'] | ComponentProps<Icon>;
6
6
  children?: Snippet;
7
7
  }
8
8
  declare const DropdownItem: import("svelte").Component<Props, {}, "">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isoftdata/svelte-context-menu",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",