@txstate-mws/svelte-components 1.6.3 → 1.6.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.
- package/dist/actions/glue.js +15 -11
- package/package.json +1 -1
package/dist/actions/glue.js
CHANGED
|
@@ -27,6 +27,8 @@ export function glue(el, { target, align = 'auto', cover = false, gap = 0, adjus
|
|
|
27
27
|
const tmpRect = fixedParent.getBoundingClientRect();
|
|
28
28
|
fixedRect = { left: tmpRect.left, right: window.innerWidth - tmpRect.right, top: tmpRect.top, bottom: window.innerHeight - tmpRect.bottom };
|
|
29
29
|
}
|
|
30
|
+
if (!target)
|
|
31
|
+
return;
|
|
30
32
|
const tmpRect = target.getBoundingClientRect();
|
|
31
33
|
const rect = { left: tmpRect.left - fixedRect.left, right: window.innerWidth - tmpRect.right - fixedRect.right, top: tmpRect.top - fixedRect.top, bottom: window.innerHeight - tmpRect.bottom - fixedRect.bottom, width: tmpRect.width, height: tmpRect.height };
|
|
32
34
|
if (equal(rect, lastrect))
|
|
@@ -42,8 +44,8 @@ export function glue(el, { target, align = 'auto', cover = false, gap = 0, adjus
|
|
|
42
44
|
requestAnimationFrame(() => {
|
|
43
45
|
el.style.top = `${rect.top + (cover ? 0 : targetHeight) + gap}px`;
|
|
44
46
|
el.style.left = `${rect.left}px`;
|
|
45
|
-
el.style.bottom
|
|
46
|
-
el.style.right
|
|
47
|
+
el.style.removeProperty('bottom');
|
|
48
|
+
el.style.removeProperty('right');
|
|
47
49
|
adjustParentHeight();
|
|
48
50
|
});
|
|
49
51
|
valign = 'bottom';
|
|
@@ -52,8 +54,8 @@ export function glue(el, { target, align = 'auto', cover = false, gap = 0, adjus
|
|
|
52
54
|
else if (autoalign === 'bottomright') {
|
|
53
55
|
requestAnimationFrame(() => {
|
|
54
56
|
el.style.top = `${rect.top + (cover ? 0 : targetHeight) + gap}px`;
|
|
55
|
-
el.style.left
|
|
56
|
-
el.style.bottom
|
|
57
|
+
el.style.removeProperty('left');
|
|
58
|
+
el.style.removeProperty('bottom');
|
|
57
59
|
el.style.right = `${rect.right}px`;
|
|
58
60
|
adjustParentHeight();
|
|
59
61
|
});
|
|
@@ -62,10 +64,10 @@ export function glue(el, { target, align = 'auto', cover = false, gap = 0, adjus
|
|
|
62
64
|
}
|
|
63
65
|
else if (autoalign === 'topleft') {
|
|
64
66
|
requestAnimationFrame(() => {
|
|
65
|
-
el.style.top
|
|
67
|
+
el.style.removeProperty('top');
|
|
66
68
|
el.style.left = `${rect.left}px`;
|
|
67
69
|
el.style.bottom = `${rect.bottom + (cover ? 0 : targetHeight) + gap}px`;
|
|
68
|
-
el.style.right
|
|
70
|
+
el.style.removeProperty('right');
|
|
69
71
|
adjustParentHeight();
|
|
70
72
|
});
|
|
71
73
|
valign = 'top';
|
|
@@ -73,8 +75,8 @@ export function glue(el, { target, align = 'auto', cover = false, gap = 0, adjus
|
|
|
73
75
|
}
|
|
74
76
|
else if (autoalign === 'topright') {
|
|
75
77
|
requestAnimationFrame(() => {
|
|
76
|
-
el.style.top
|
|
77
|
-
el.style.left
|
|
78
|
+
el.style.removeProperty('top');
|
|
79
|
+
el.style.removeProperty('left');
|
|
78
80
|
el.style.bottom = `${rect.bottom + (cover ? 0 : targetHeight) + gap}px`;
|
|
79
81
|
el.style.right = `${rect.right}px`;
|
|
80
82
|
adjustParentHeight();
|
|
@@ -100,8 +102,10 @@ export function glue(el, { target, align = 'auto', cover = false, gap = 0, adjus
|
|
|
100
102
|
target = utarget;
|
|
101
103
|
if (!target)
|
|
102
104
|
el.style.removeProperty('position');
|
|
103
|
-
else
|
|
105
|
+
else {
|
|
104
106
|
el.style.position = 'fixed';
|
|
107
|
+
reposition();
|
|
108
|
+
}
|
|
105
109
|
}
|
|
106
110
|
},
|
|
107
111
|
destroy() {
|
|
@@ -126,9 +130,9 @@ function isFixedContainer(el) {
|
|
|
126
130
|
return true; // A filter value other than none
|
|
127
131
|
if (['layout', 'paint', 'strict', 'content'].includes(css.getPropertyValue('contain')))
|
|
128
132
|
return true; // A contain value of layout, paint, strict or content (e.g. contain: paint;)
|
|
129
|
-
if (css.getPropertyValue('container-type') !== 'normal')
|
|
133
|
+
if ('container-type' in css && css.getPropertyValue('container-type') !== 'normal')
|
|
130
134
|
return true; // A container-type value other than normal
|
|
131
|
-
if (css.getPropertyValue('backdrop-filter') !== 'none')
|
|
135
|
+
if ('backdrop-filter' in css && css.getPropertyValue('backdrop-filter') !== 'none')
|
|
132
136
|
return true; // A backdrop-filter other than none (e.g. backdrop-filter: blur(10px);)
|
|
133
137
|
return false;
|
|
134
138
|
}
|