@spectrum-web-components/overlay 0.34.1-rc.0 → 0.35.1-rc.15

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.
Files changed (91) hide show
  1. package/README.md +17 -8
  2. package/custom-elements.json +492 -305
  3. package/package.json +14 -13
  4. package/src/AbstractOverlay.d.ts +54 -0
  5. package/src/AbstractOverlay.dev.js +192 -0
  6. package/src/AbstractOverlay.dev.js.map +7 -0
  7. package/src/AbstractOverlay.js +2 -0
  8. package/src/AbstractOverlay.js.map +7 -0
  9. package/src/Overlay.d.ts +135 -19
  10. package/src/Overlay.dev.js +714 -69
  11. package/src/Overlay.dev.js.map +3 -3
  12. package/src/Overlay.js +30 -1
  13. package/src/Overlay.js.map +3 -3
  14. package/src/OverlayDialog.d.ts +3 -7
  15. package/src/OverlayDialog.dev.js +6 -34
  16. package/src/OverlayDialog.dev.js.map +2 -2
  17. package/src/OverlayDialog.js +1 -1
  18. package/src/OverlayDialog.js.map +3 -3
  19. package/src/OverlayNoPopover.d.ts +3 -7
  20. package/src/OverlayNoPopover.dev.js +7 -46
  21. package/src/OverlayNoPopover.dev.js.map +2 -2
  22. package/src/OverlayNoPopover.js +1 -1
  23. package/src/OverlayNoPopover.js.map +3 -3
  24. package/src/OverlayPopover.d.ts +3 -7
  25. package/src/OverlayPopover.dev.js +18 -49
  26. package/src/OverlayPopover.dev.js.map +2 -2
  27. package/src/OverlayPopover.js +1 -1
  28. package/src/OverlayPopover.js.map +3 -3
  29. package/src/OverlayStack.d.ts +9 -2
  30. package/src/OverlayStack.dev.js +16 -3
  31. package/src/OverlayStack.dev.js.map +2 -2
  32. package/src/OverlayStack.js +1 -1
  33. package/src/OverlayStack.js.map +3 -3
  34. package/src/OverlayTrigger.d.ts +6 -14
  35. package/src/OverlayTrigger.dev.js +0 -47
  36. package/src/OverlayTrigger.dev.js.map +2 -2
  37. package/src/OverlayTrigger.js +2 -2
  38. package/src/OverlayTrigger.js.map +3 -3
  39. package/src/PlacementController.d.ts +3 -1
  40. package/src/PlacementController.dev.js +10 -2
  41. package/src/PlacementController.dev.js.map +2 -2
  42. package/src/PlacementController.js +1 -1
  43. package/src/PlacementController.js.map +2 -2
  44. package/src/VirtualTrigger.dev.js +3 -0
  45. package/src/VirtualTrigger.dev.js.map +2 -2
  46. package/src/VirtualTrigger.js +1 -1
  47. package/src/VirtualTrigger.js.map +3 -3
  48. package/src/fullSizePlugin.dev.js.map +2 -2
  49. package/src/fullSizePlugin.js.map +2 -2
  50. package/src/loader.d.ts +1 -2
  51. package/src/overlay-timer.dev.js.map +2 -2
  52. package/src/overlay-timer.js.map +2 -2
  53. package/src/overlay-types.d.ts +18 -27
  54. package/src/overlay-types.dev.js.map +2 -2
  55. package/src/overlay-types.js.map +2 -2
  56. package/src/overlay.css.dev.js +9 -0
  57. package/src/overlay.css.dev.js.map +7 -0
  58. package/src/overlay.css.js +6 -0
  59. package/src/overlay.css.js.map +7 -0
  60. package/src/topLayerOverTransforms.d.ts +2 -23
  61. package/src/topLayerOverTransforms.dev.js +7 -91
  62. package/src/topLayerOverTransforms.dev.js.map +2 -2
  63. package/src/topLayerOverTransforms.js +1 -1
  64. package/src/topLayerOverTransforms.js.map +3 -3
  65. package/stories/overlay-element.stories.js +2 -6
  66. package/stories/overlay-element.stories.js.map +2 -2
  67. package/stories/overlay.stories.js +46 -15
  68. package/stories/overlay.stories.js.map +2 -2
  69. package/test/index.js +1 -1
  70. package/test/index.js.map +1 -1
  71. package/test/overlay-element.test.js +1 -2
  72. package/test/overlay-element.test.js.map +2 -2
  73. package/test/overlay-trigger-hover-click.test.js +1 -1
  74. package/test/overlay-trigger-hover-click.test.js.map +2 -2
  75. package/test/overlay-trigger-hover.test.js +1 -1
  76. package/test/overlay-trigger-hover.test.js.map +2 -2
  77. package/test/overlay-v1.test.js +2 -11
  78. package/test/overlay-v1.test.js.map +2 -2
  79. package/test/{overlay-v2.test.js → overlay.test.js} +42 -8
  80. package/test/overlay.test.js.map +7 -0
  81. package/src/OverlayBase.d.ts +0 -124
  82. package/src/OverlayBase.dev.js +0 -744
  83. package/src/OverlayBase.dev.js.map +0 -7
  84. package/src/OverlayBase.js +0 -31
  85. package/src/OverlayBase.js.map +0 -7
  86. package/src/overlay-base.css.dev.js +0 -9
  87. package/src/overlay-base.css.dev.js.map +0 -7
  88. package/src/overlay-base.css.js +0 -6
  89. package/src/overlay-base.css.js.map +0 -7
  90. package/test/overlay-v2.test.js.map +0 -7
  91. /package/src/{overlay-base.css.d.ts → overlay.css.d.ts} +0 -0
package/README.md CHANGED
@@ -27,7 +27,7 @@ import {
27
27
 
28
28
  ## Example
29
29
 
30
- Leveraging the `trigger` attribut to pass an ID reference to another element with in the same DOM tree that will be the element from which the overlay is positioned when open. Add an interaction type `click`, `hover`, or `longpress` to the `trigger` attribute, separated from the ID reference by an `@` symbol and the overlay will bind itself to the referenced element via the DOM events associated with that interaction. The `<sp-button>` below has an id of `trigger`, so when the `<sp-overlay>` is provided the `trigger` attribute with the value `trigger@click` it associated itself to the `<sp-button>` and toggles its open state when that button is clicked.
30
+ By leveraging the `trigger` attribute to pass an ID reference to another element with in the same DOM tree, your overlay will be positioned in relation to this element. When the ID reference is followed by an `@` symbol and interaction type, like `click`, `hover`, or `longpress`, the overlay will bind itself to the referenced element via the DOM events associated with that interaction. For example, the `<sp-button>` below has an id of `trigger`, and the `<sp-overlay>` is provided the `trigger` attribute with the value `trigger@click`. This creates an association between the overlay and the `<sp-button>` that opens the overlay when the button is clicked.
31
31
 
32
32
  ```html
33
33
  <sp-button id="trigger">Overlay Trigger</sp-button>
@@ -142,7 +142,7 @@ Leveraging the `trigger` attribut to pass an ID reference to another element wit
142
142
 
143
143
  ## API
144
144
 
145
- ```html
145
+ ```ts
146
146
  <sp-overlay
147
147
  ?open=${boolean}
148
148
  ?delayed=${boolean}
@@ -156,9 +156,18 @@ Leveraging the `trigger` attribut to pass an ID reference to another element wit
156
156
  ></sp-overlay>
157
157
  ```
158
158
 
159
+ # Events
160
+
161
+ When fully open the `<sp-overlay>` element will dispatch the `sp-opened` event, and when fully closed the `sp-closed` event will be dispatched. "Fully" in this context means that all CSS transitions that have dispatched `transitionrun` events on the direct children of the `<sp-overlay>` element have successfully dispatched their `transitionend` event. Keep in mind the following:
162
+
163
+ - `transition*` events bubble; this means that while transition events on light DOM content of those direct children will be heard, those events will not be taken into account
164
+ - `transition*` events are not composed; this means that transition events on shadow DOM content of the direct children will not propagate to a level in the DOM where they can be heard
165
+
166
+ This means that in both cases, if the transition is meant to be a part of the opening or closing of the overlay in question you will need to redispatch the `transitionrun` and `transitionend` events from that transition from the closest direct child of the `<sp-overlay>`.
167
+
159
168
  ## Styling
160
169
 
161
- `<sp-overlay>` element will use the `<dialog>` element or `popover` attribute to project your content onto the top-layer of the browser, but that content will still exist right where you placed it to start. That means that you can style your overlay content with whatever techniques you are already leveraging to style the content in said interaction that does not get overlaid. This means standard CSS selectors, CSS Custom Properties, and CSS Parts applied in your parent context will always apply to your overlaid content.
170
+ `<sp-overlay>` element will use the `<dialog>` element or `popover` attribute to project your content onto the top-layer of the browser, without being moved in the DOM tree. That means that you can style your overlay content with whatever techniques you are already leveraging to style the content that doesn't get overlaid. This means standard CSS selectors, CSS Custom Properties, and CSS Parts applied in your parent context will always apply to your overlaid content.
162
171
 
163
172
  ## Fallback support
164
173
 
@@ -166,7 +175,7 @@ While the [`<dialog>` element](https://developer.mozilla.org/en-US/docs/Web/HTML
166
175
 
167
176
  ### Complex layered
168
177
 
169
- When an overlay is placed within a page with complex layering, the content therein can fall behind other content in the `z-index` stack. The following example is somewhat contrived but, imagine a toolbar next to a properties panel. If the toolbar has a lower `z-index` and the properties panel, any overlaid content (tooltips, etc.) within that toolbar will display underneath any content in the properties panel with which it may share pixels.
178
+ When an overlay is placed within a page with complex layering, the content therein can fall behind other content in the `z-index` stack. The following example is somewhat contrived but, imagine a toolbar next to a properties panel. If the toolbar has a lower `z-index` than the properties panel, any overlaid content (tooltips, etc.) within that toolbar will display underneath any content in the properties panel with which it may share pixels.
170
179
 
171
180
  ```html
172
181
  <div class="complex-layered-demo">
@@ -198,11 +207,11 @@ When an overlay is placed within a page with complex layering, the content there
198
207
  </style>
199
208
  ```
200
209
 
201
- Properly managed `z-index` values will support working around this issue while browsers work to adopt the `popover` attribute. In this demo, you can easily achieve the same output but sharing one `z-index` between the various pieces of content, removing `z-index` values altogether, or raising the `.complex-layered-holder` element to a higher `z-index` than the `.complex-layered-blocker` element.
210
+ Properly managed `z-index` values will support working around this issue while browsers work to adopt the `popover` attribute. In this demo, you can achieve the same output by sharing one `z-index` between the various pieces of content, removing `z-index` values altogether, or raising the `.complex-layered-holder` element to a higher `z-index` than the `.complex-layered-blocker` element.
202
211
 
203
212
  ### Contained
204
213
 
205
- [CSS Containment](https://developer.mozilla.org/en-US/docs/Web/CSS/contain) allows a developer direct control over how the internals of one element affects the paint and layout of the internals of other elements on the same page. While leveraging some of its values can offer performance gains, they can interrupt the delivery of your overlaid content.
214
+ [CSS Containment](https://developer.mozilla.org/en-US/docs/Web/CSS/contain) gives a developer direct control over how the internals of one element affect the paint and layout of the internals of other elements on the same page. While leveraging some of its values can offer performance gains, they can interrupt the delivery of your overlaid content.
206
215
 
207
216
  ```html
208
217
  <div class="contained-demo">
@@ -220,7 +229,7 @@ Properly managed `z-index` values will support working around this issue while b
220
229
  </style>
221
230
  ```
222
231
 
223
- You could just _remove_ the `contain` rule. But, if you are not OK with simply removing the `contain` value, you still have options. In the case that you would like to continue to leverage `contain` is to place "contained" content separately from your overlaid content, like so:
232
+ You could just _remove_ the `contain` rule. But, if you are not OK with simply removing the `contain` value, you still have options. If you would like to continue to leverage `contain`, you can place your "contained" content separately from your overlaid content, like so:
224
233
 
225
234
  ```html
226
235
  <div class="contained-demo">
@@ -240,7 +249,7 @@ You could just _remove_ the `contain` rule. But, if you are not OK with simply r
240
249
 
241
250
  ### Clip pathed
242
251
 
243
- While not offering the same performance opportunities as `contain`, `clip-path` can also restrict how content in an element is surfaced at paint time. When overlaid content should display outside of the `clip-path`, without the `popover` attribute that content could be _clipped_.
252
+ `clip-path` can also restrict how content in an element is surfaced at paint time. When overlaid content should display outside of the `clip-path`, without the `popover` attribute, that content could be _clipped_.
244
253
 
245
254
  ```html
246
255
  <div class="clip-pathed-demo">