@vaadin/overlay 24.9.0-alpha2 → 24.9.0-beta2

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": "@vaadin/overlay",
3
- "version": "24.9.0-alpha2",
3
+ "version": "24.9.0-beta2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,18 +36,18 @@
36
36
  "dependencies": {
37
37
  "@open-wc/dedupe-mixin": "^1.3.0",
38
38
  "@polymer/polymer": "^3.0.0",
39
- "@vaadin/a11y-base": "24.9.0-alpha2",
40
- "@vaadin/component-base": "24.9.0-alpha2",
41
- "@vaadin/vaadin-lumo-styles": "24.9.0-alpha2",
42
- "@vaadin/vaadin-material-styles": "24.9.0-alpha2",
43
- "@vaadin/vaadin-themable-mixin": "24.9.0-alpha2",
39
+ "@vaadin/a11y-base": "24.9.0-beta2",
40
+ "@vaadin/component-base": "24.9.0-beta2",
41
+ "@vaadin/vaadin-lumo-styles": "24.9.0-beta2",
42
+ "@vaadin/vaadin-material-styles": "24.9.0-beta2",
43
+ "@vaadin/vaadin-themable-mixin": "24.9.0-beta2",
44
44
  "lit": "^3.0.0"
45
45
  },
46
46
  "devDependencies": {
47
- "@vaadin/chai-plugins": "24.9.0-alpha2",
48
- "@vaadin/test-runner-commands": "24.9.0-alpha2",
47
+ "@vaadin/chai-plugins": "24.9.0-beta2",
48
+ "@vaadin/test-runner-commands": "24.9.0-beta2",
49
49
  "@vaadin/testing-helpers": "^1.1.0",
50
50
  "sinon": "^18.0.0"
51
51
  },
52
- "gitHead": "dd99dece1b54942ab0e421892b089e506822c5f5"
52
+ "gitHead": "cf8def153fcf724b305f9ad823dc9af27e31ad07"
53
53
  }
@@ -16,10 +16,12 @@
16
16
  */
17
17
  export function observeMove(element, callback) {
18
18
  let io = null;
19
+ let timeout;
19
20
 
20
21
  const root = document.documentElement;
21
22
 
22
23
  function cleanup() {
24
+ timeout && clearTimeout(timeout);
23
25
  io && io.disconnect();
24
26
  io = null;
25
27
  }
@@ -52,27 +54,22 @@ export function observeMove(element, callback) {
52
54
  let isFirstUpdate = true;
53
55
 
54
56
  function handleObserve(entries) {
55
- let ratio = entries[0].intersectionRatio;
57
+ const ratio = entries[0].intersectionRatio;
56
58
 
57
59
  if (ratio !== threshold) {
58
60
  if (!isFirstUpdate) {
59
61
  return refresh();
60
62
  }
61
63
 
62
- // It's possible for the watched element to not be at perfect 1.0 visibility when we create
63
- // the IntersectionObserver. This has a couple of causes:
64
- // - elements being on partial pixels
65
- // - elements being hidden offscreen (e.g., <html> has `overflow: hidden`)
66
- // - delays: if your DOM change occurs due to e.g., page resize, you can see elements
67
- // behind their actual position
68
- //
69
- // In all of these cases, refresh but with this lower ratio of threshold. When the element
70
- // moves beneath _that_ new value, the user will get notified.
71
- if (ratio === 0.0) {
72
- ratio = 0.0000001; // Just needs to be non-zero
64
+ if (!ratio) {
65
+ // If the reference is clipped, the ratio is 0. Throttle the refresh
66
+ // to prevent an infinite loop of updates.
67
+ timeout = setTimeout(() => {
68
+ refresh(false, 1e-7);
69
+ }, 1000);
70
+ } else {
71
+ refresh(false, ratio);
73
72
  }
74
-
75
- refresh(false, ratio);
76
73
  }
77
74
 
78
75
  isFirstUpdate = false;
@@ -98,10 +98,10 @@ export type OverlayEventMap = HTMLElementEventMap & OverlayCustomEventMap;
98
98
  *
99
99
  * The following state attributes are available for styling:
100
100
  *
101
- * Attribute | Description | Part
102
- * ---|---|---
103
- * `opening` | Applied just after the overlay is attached to the DOM. You can apply a CSS @keyframe animation for this state. | `:host`
104
- * `closing` | Applied just before the overlay is detached from the DOM. You can apply a CSS @keyframe animation for this state. | `:host`
101
+ * Attribute | Description
102
+ * ----------|------------
103
+ * `opening` | Applied just after the overlay is opened. You can apply a CSS animation for this state.
104
+ * `closing` | Applied just before the overlay is closed. You can apply a CSS animation for this state.
105
105
  *
106
106
  * The following custom CSS properties are available for styling:
107
107
  *
@@ -51,10 +51,10 @@ registerStyles('vaadin-overlay', overlayStyles, { moduleId: 'vaadin-overlay-styl
51
51
  *
52
52
  * The following state attributes are available for styling:
53
53
  *
54
- * Attribute | Description | Part
55
- * ---|---|---
56
- * `opening` | Applied just after the overlay is attached to the DOM. You can apply a CSS @keyframe animation for this state. | `:host`
57
- * `closing` | Applied just before the overlay is detached from the DOM. You can apply a CSS @keyframe animation for this state. | `:host`
54
+ * Attribute | Description
55
+ * ----------|------------
56
+ * `opening` | Applied just after the overlay is opened. You can apply a CSS animation for this state.
57
+ * `closing` | Applied just before the overlay is closed. You can apply a CSS animation for this state.
58
58
  *
59
59
  * The following custom CSS properties are available for styling:
60
60
  *