lapikit 0.7.4 → 0.7.5
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,5 +1,11 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
lockScroll,
|
|
4
|
+
splitAriaAttrs,
|
|
5
|
+
unlockScroll,
|
|
6
|
+
useComponentAttrs,
|
|
7
|
+
useElevation
|
|
8
|
+
} from '../../utils';
|
|
3
9
|
import type { DialogProps } from './dialog.types.js';
|
|
4
10
|
|
|
5
11
|
let {
|
|
@@ -48,12 +54,12 @@
|
|
|
48
54
|
if (!open && ref.open) {
|
|
49
55
|
ref.close();
|
|
50
56
|
}
|
|
57
|
+
});
|
|
51
58
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
};
|
|
59
|
+
$effect(() => {
|
|
60
|
+
if (!open) return;
|
|
61
|
+
lockScroll();
|
|
62
|
+
return unlockScroll;
|
|
57
63
|
});
|
|
58
64
|
|
|
59
65
|
function handleClose() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { lockScroll, unlockScroll } from '../../utils';
|
|
2
2
|
import { writable } from 'svelte/store';
|
|
3
3
|
// presets
|
|
4
4
|
const refModal = false;
|
|
@@ -10,17 +10,17 @@ export function setOpenModal(state) {
|
|
|
10
10
|
}
|
|
11
11
|
export const pushModal = (id) => {
|
|
12
12
|
modalStack.update((stack) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return values;
|
|
13
|
+
if (stack.includes(id))
|
|
14
|
+
return stack;
|
|
15
|
+
lockScroll();
|
|
16
|
+
return [...stack, id];
|
|
18
17
|
});
|
|
19
18
|
};
|
|
20
19
|
export const popModal = (id) => {
|
|
21
20
|
modalStack.update((stack) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
if (!stack.includes(id))
|
|
22
|
+
return stack;
|
|
23
|
+
unlockScroll();
|
|
24
|
+
return stack.filter((m) => m !== id);
|
|
25
25
|
});
|
|
26
26
|
};
|
package/dist/escaping.js
CHANGED
|
@@ -93,7 +93,6 @@ export const decodeSourceMap = (content, componentInfo) => {
|
|
|
93
93
|
// class: / style: are refused by Svelte on a component: they become s-class_ / s-style_ props
|
|
94
94
|
parts.push(`<${info.name}${rewriteDirectives(content.slice(nameEnd, tagEnd + 1))}`);
|
|
95
95
|
changed = true;
|
|
96
|
-
changed = true;
|
|
97
96
|
}
|
|
98
97
|
else {
|
|
99
98
|
parts.push(content.slice(nextLt, tagEnd + 1));
|
package/dist/utils/outside.d.ts
CHANGED
|
@@ -3,4 +3,6 @@ export declare function clickOutside(node: HTMLElement, options: ClickOutsideOpt
|
|
|
3
3
|
update(newOptions: ClickOutsideOptions): void;
|
|
4
4
|
destroy(): void;
|
|
5
5
|
};
|
|
6
|
-
|
|
6
|
+
/** Blocks the scroll of the page; each call needs its own unlockScroll() */
|
|
7
|
+
export declare function lockScroll(): void;
|
|
8
|
+
export declare function unlockScroll(): void;
|
package/dist/utils/outside.js
CHANGED
|
@@ -32,8 +32,20 @@ export function clickOutside(node, options) {
|
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
let scrollLocks = 0;
|
|
36
|
+
let previousOverflow = '';
|
|
37
|
+
/** Blocks the scroll of the page; each call needs its own unlockScroll() */
|
|
38
|
+
export function lockScroll() {
|
|
39
|
+
if (typeof document === 'undefined')
|
|
40
|
+
return;
|
|
41
|
+
if (scrollLocks++ === 0) {
|
|
42
|
+
previousOverflow = document.body.style.overflow;
|
|
43
|
+
document.body.style.overflow = 'hidden';
|
|
38
44
|
}
|
|
39
45
|
}
|
|
46
|
+
export function unlockScroll() {
|
|
47
|
+
if (typeof document === 'undefined' || scrollLocks === 0)
|
|
48
|
+
return;
|
|
49
|
+
if (--scrollLocks === 0)
|
|
50
|
+
document.body.style.overflow = previousOverflow;
|
|
51
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lapikit",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -80,6 +80,9 @@
|
|
|
80
80
|
"default": "./dist/hooks/actions.js"
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
|
+
"dependencies": {
|
|
84
|
+
"esm-env": "^1.2.2"
|
|
85
|
+
},
|
|
83
86
|
"peerDependencies": {
|
|
84
87
|
"svelte": "^5.20.0"
|
|
85
88
|
},
|