tide-design-system 2.2.1 → 2.2.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/dist/css/reset.css +1 -0
- package/dist/style.css +1 -1
- package/dist/tide-design-system.cjs +2 -2
- package/dist/tide-design-system.esm.js +75 -73
- package/dist/utilities/viewport.ts +21 -3
- package/package.json +1 -1
- package/src/assets/css/reset.css +1 -0
- package/src/components/TideCarousel.vue +1 -0
- package/src/components/TideDivider.vue +1 -0
- package/src/utilities/viewport.ts +21 -3
|
@@ -6,26 +6,44 @@ import { nextTick } from 'vue';
|
|
|
6
6
|
* HTML dialog elements.
|
|
7
7
|
*/
|
|
8
8
|
export const setScrollLock = async (isLocked: boolean) => {
|
|
9
|
-
|
|
9
|
+
// Cannot be applied to body tag in marketplace repo due to data-css-scope
|
|
10
|
+
// const BODY_LOCK_CLASS = 'body-scroll-lock';
|
|
11
|
+
|
|
10
12
|
const body = document.body;
|
|
11
13
|
|
|
12
14
|
if (isLocked) {
|
|
13
15
|
if (!body.dataset.scrollLockY) {
|
|
14
16
|
const scrollY = window.scrollY;
|
|
17
|
+
|
|
15
18
|
body.dataset.scrollLockY = scrollY.toString();
|
|
16
19
|
body.style.setProperty('--saved-scroll-y', `${scrollY}px`);
|
|
17
|
-
body.
|
|
20
|
+
body.style.setProperty('inset', '0');
|
|
21
|
+
body.style.setProperty('margin-top', `calc(0px - var(--saved-scroll-y, 0px))`);
|
|
22
|
+
body.style.setProperty('overflow-y', 'scroll');
|
|
23
|
+
body.style.setProperty('position', 'fixed');
|
|
24
|
+
|
|
25
|
+
// Cannot be applied to body tag in marketplace repo due to data-css-scope
|
|
26
|
+
// body.classList.add(BODY_LOCK_CLASS);
|
|
18
27
|
}
|
|
19
28
|
} else {
|
|
20
29
|
await nextTick();
|
|
21
30
|
if (!document.querySelector('dialog[open]')) {
|
|
22
31
|
const savedScrollY = parseInt(body.dataset.scrollLockY || '0');
|
|
23
|
-
|
|
32
|
+
|
|
33
|
+
// Cannot be applied to body tag in marketplace repo due to data-css-scope
|
|
34
|
+
// body.classList.remove(BODY_LOCK_CLASS);
|
|
35
|
+
|
|
36
|
+
body.style.removeProperty('inset');
|
|
37
|
+
body.style.removeProperty('marginTop');
|
|
38
|
+
body.style.removeProperty('overflowY');
|
|
39
|
+
body.style.removeProperty('position');
|
|
24
40
|
body.style.removeProperty('--saved-scroll-y');
|
|
41
|
+
|
|
25
42
|
window.scrollTo({
|
|
26
43
|
behavior: 'auto',
|
|
27
44
|
top: savedScrollY,
|
|
28
45
|
});
|
|
46
|
+
|
|
29
47
|
delete body.dataset.scrollLockY;
|
|
30
48
|
}
|
|
31
49
|
}
|
package/package.json
CHANGED
package/src/assets/css/reset.css
CHANGED
|
@@ -6,26 +6,44 @@ import { nextTick } from 'vue';
|
|
|
6
6
|
* HTML dialog elements.
|
|
7
7
|
*/
|
|
8
8
|
export const setScrollLock = async (isLocked: boolean) => {
|
|
9
|
-
|
|
9
|
+
// Cannot be applied to body tag in marketplace repo due to data-css-scope
|
|
10
|
+
// const BODY_LOCK_CLASS = 'body-scroll-lock';
|
|
11
|
+
|
|
10
12
|
const body = document.body;
|
|
11
13
|
|
|
12
14
|
if (isLocked) {
|
|
13
15
|
if (!body.dataset.scrollLockY) {
|
|
14
16
|
const scrollY = window.scrollY;
|
|
17
|
+
|
|
15
18
|
body.dataset.scrollLockY = scrollY.toString();
|
|
16
19
|
body.style.setProperty('--saved-scroll-y', `${scrollY}px`);
|
|
17
|
-
body.
|
|
20
|
+
body.style.setProperty('inset', '0');
|
|
21
|
+
body.style.setProperty('margin-top', `calc(0px - var(--saved-scroll-y, 0px))`);
|
|
22
|
+
body.style.setProperty('overflow-y', 'scroll');
|
|
23
|
+
body.style.setProperty('position', 'fixed');
|
|
24
|
+
|
|
25
|
+
// Cannot be applied to body tag in marketplace repo due to data-css-scope
|
|
26
|
+
// body.classList.add(BODY_LOCK_CLASS);
|
|
18
27
|
}
|
|
19
28
|
} else {
|
|
20
29
|
await nextTick();
|
|
21
30
|
if (!document.querySelector('dialog[open]')) {
|
|
22
31
|
const savedScrollY = parseInt(body.dataset.scrollLockY || '0');
|
|
23
|
-
|
|
32
|
+
|
|
33
|
+
// Cannot be applied to body tag in marketplace repo due to data-css-scope
|
|
34
|
+
// body.classList.remove(BODY_LOCK_CLASS);
|
|
35
|
+
|
|
36
|
+
body.style.removeProperty('inset');
|
|
37
|
+
body.style.removeProperty('marginTop');
|
|
38
|
+
body.style.removeProperty('overflowY');
|
|
39
|
+
body.style.removeProperty('position');
|
|
24
40
|
body.style.removeProperty('--saved-scroll-y');
|
|
41
|
+
|
|
25
42
|
window.scrollTo({
|
|
26
43
|
behavior: 'auto',
|
|
27
44
|
top: savedScrollY,
|
|
28
45
|
});
|
|
46
|
+
|
|
29
47
|
delete body.dataset.scrollLockY;
|
|
30
48
|
}
|
|
31
49
|
}
|