intelliwaketssveltekitv25 0.1.61 → 0.1.62

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.
@@ -15,7 +15,7 @@
15
15
  hidden = false,
16
16
  displayCheckInverse = false,
17
17
  class: clazz = '',
18
- onCheck = () => {
18
+ oncheck = () => {
19
19
  },
20
20
  children
21
21
  }: {
@@ -31,7 +31,7 @@
31
31
  hidden?: boolean
32
32
  displayCheckInverse?: boolean
33
33
  class?: string
34
- onCheck?: (val: boolean) => void,
34
+ oncheck?: (val: boolean) => void,
35
35
  children?: Snippet
36
36
  } = $props()
37
37
 
@@ -51,17 +51,30 @@
51
51
 
52
52
  let useValue = $derived(getValue(checked))
53
53
 
54
- $effect(() => {
54
+ function doCheck() {
55
55
  if (!disabled && !readonly) {
56
+ checked = !checked
56
57
  tick().then(() => {
57
- onCheck(checked)
58
+ oncheck(checked)
58
59
  if (inputControl) {
59
60
  inputControl.dispatchEvent(new Event('change', { bubbles: true, cancelable: true }))
60
61
  inputControl.dispatchEvent(new Event('input', { bubbles: true, cancelable: true }))
61
62
  }
62
63
  })
63
64
  }
64
- })
65
+ }
66
+
67
+ // $effect(() => {
68
+ // if (!disabled && !readonly) {
69
+ // tick().then(() => {
70
+ // oncheck(checked)
71
+ // if (inputControl) {
72
+ // inputControl.dispatchEvent(new Event('change', { bubbles: true, cancelable: true }))
73
+ // inputControl.dispatchEvent(new Event('input', { bubbles: true, cancelable: true }))
74
+ // }
75
+ // })
76
+ // }
77
+ // })
65
78
 
66
79
  let displayChecked = $derived(displayCheckInverse ? !checked : checked)
67
80
 
@@ -73,10 +86,10 @@
73
86
  use:useActions={use}
74
87
  class='[&_*]:cursor-pointer mt-1 select-none focus:ring-0 focus:outline-none group {clazz ?? ""}'
75
88
  role='button'
76
- onclick={() => checked = !checked}
89
+ onclick={() => doCheck()}
77
90
  onkeydown={e => {
78
91
  if (e.key === ' ') {
79
- checked = !checked
92
+ doCheck()
80
93
  }
81
94
  }}
82
95
  tabindex={-1}>
@@ -13,7 +13,7 @@ type $$ComponentProps = {
13
13
  hidden?: boolean;
14
14
  displayCheckInverse?: boolean;
15
15
  class?: string;
16
- onCheck?: (val: boolean) => void;
16
+ oncheck?: (val: boolean) => void;
17
17
  children?: Snippet;
18
18
  };
19
19
  declare const Switch: import("svelte").Component<$$ComponentProps, {}, "checked">;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelliwaketssveltekitv25",
3
- "version": "0.1.61",
3
+ "version": "0.1.62",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",