hamzus-ui 0.0.253 → 0.0.255

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hamzus-ui",
3
- "version": "0.0.253",
3
+ "version": "0.0.255",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "svelte": "index.js",
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import Portal from '../Portal/Portal.svelte';
3
- import { onDestroy, onMount } from 'svelte';
3
+ import { onDestroy, onMount, tick } from 'svelte';
4
4
 
5
5
  // import
6
6
 
@@ -47,17 +47,21 @@
47
47
 
48
48
  handleDisplay();
49
49
  }
50
- function handleDisplay() {
50
+ async function handleDisplay() {
51
51
  if (!calc[direction]) {
52
52
  console.error('Error : direction props not found !');
53
53
  }
54
54
 
55
- if (display) {
56
- return;
57
- }
55
+
56
+ if (!display) {
57
+ toggleDisplay();
58
58
 
59
- [top, left] = calc[direction]();
60
- toggleDisplay();
59
+ await tick();
60
+
61
+ [top, left] = calc[direction]();
62
+ } else {
63
+ toggleDisplay();
64
+ }
61
65
  }
62
66
 
63
67
  function toggleDisplay() {
@@ -1,6 +1,6 @@
1
1
  <script>
2
2
  import Portal from '../Portal/Portal.svelte';
3
- import { onDestroy, onMount } from 'svelte';
3
+ import { onDestroy, onMount, tick } from 'svelte';
4
4
 
5
5
  // import
6
6
 
@@ -35,7 +35,7 @@ import { onDestroy, onMount } from 'svelte';
35
35
  right: ['0px', '-12px']
36
36
  };
37
37
  // function
38
- function handleDisplay(event) {
38
+ async function handleDisplay(event) {
39
39
  if (!calc[direction]) {
40
40
  console.error('Error : direction props not found !');
41
41
  }
@@ -45,10 +45,14 @@ import { onDestroy, onMount } from 'svelte';
45
45
  }
46
46
 
47
47
  if (!display) {
48
- [top, left] = calc[direction]();
49
- }
48
+ toggleDisplay();
49
+
50
+ await tick();
50
51
 
51
- toggleDisplay();
52
+ [top, left] = calc[direction]();
53
+ } else {
54
+ toggleDisplay();
55
+ }
52
56
 
53
57
  if (onOpen !== undefined && typeof onOpen === 'function') {
54
58
  onOpen()