compute-scroll-into-view 2.0.0 → 2.0.1

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 (2) hide show
  1. package/README.md +13 -13
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -22,13 +22,13 @@ Scrolling SVG elements are supported, as well as Shadow DOM elements. The [Visua
22
22
  - [boundary](#boundary)
23
23
  - [skipOverflowHiddenElements](#skipoverflowhiddenelements)
24
24
 
25
- ## Install
25
+ # Install
26
26
 
27
27
  ```bash
28
28
  npm i compute-scroll-into-view
29
29
  ```
30
30
 
31
- You can also use it from an CDN:
31
+ You can also use it from a CDN:
32
32
 
33
33
  ```js
34
34
  const { default: compute } = await import(
@@ -36,7 +36,7 @@ const { default: compute } = await import(
36
36
  )
37
37
  ```
38
38
 
39
- ## Usage
39
+ # Usage
40
40
 
41
41
  ```js
42
42
  import compute from 'compute-scroll-into-view'
@@ -66,28 +66,28 @@ actions.forEach(({ el, top, left }) => {
66
66
  })
67
67
  ```
68
68
 
69
- ## API
69
+ # API
70
70
 
71
- ### compute(target, options)
71
+ ## compute(target, options)
72
72
 
73
- ### options
73
+ ## options
74
74
 
75
75
  Type: `Object`
76
76
 
77
- #### [block](https://scroll-into-view.dev/#scroll-alignment)
77
+ ### [block](https://scroll-into-view.dev/#scroll-alignment)
78
78
 
79
79
  Type: `'start' | 'center' | 'end' | 'nearest'`<br> Default: `'center'`
80
80
 
81
81
  Control the logical scroll position on the y-axis. The spec states that the `block` direction is related to the [writing-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode), but this is not implemented yet in this library.
82
82
  This means that `block: 'start'` aligns to the top edge and `block: 'end'` to the bottom.
83
83
 
84
- #### [inline](https://scroll-into-view.dev/#scroll-alignment)
84
+ ### [inline](https://scroll-into-view.dev/#scroll-alignment)
85
85
 
86
86
  Type: `'start' | 'center' | 'end' | 'nearest'`<br> Default: `'nearest'`
87
87
 
88
88
  Like `block` this is affected by the [writing-mode](https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode). In left-to-right pages `inline: 'start'` will align to the left edge. In right-to-left it should be flipped. This will be supported in a future release.
89
89
 
90
- #### [scrollMode](https://scroll-into-view.dev/#scrolling-if-needed)
90
+ ### [scrollMode](https://scroll-into-view.dev/#scrolling-if-needed)
91
91
 
92
92
  Type: `'always' | 'if-needed'`<br> Default: `'always'`
93
93
 
@@ -96,7 +96,7 @@ This is a proposed addition to the spec that you can track here: https://github.
96
96
  This library will be updated to reflect any changes to the spec and will provide a migration path.
97
97
  To be backwards compatible with `Element.scrollIntoViewIfNeeded` if something is not 100% visible it will count as "needs scrolling". If you need a different visibility ratio your best option would be to implement an [Intersection Observer](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API).
98
98
 
99
- #### [boundary](https://scroll-into-view.dev/#limit-propagation)
99
+ ### [boundary](https://scroll-into-view.dev/#limit-propagation)
100
100
 
101
101
  Type: `Element | Function`
102
102
 
@@ -122,7 +122,7 @@ const actions = compute(target, {
122
122
  })
123
123
  ```
124
124
 
125
- #### skipOverflowHiddenElements
125
+ ### skipOverflowHiddenElements
126
126
 
127
127
  Type: `Boolean`<br> Default: `false`
128
128
 
@@ -130,6 +130,6 @@ By default the [spec](https://drafts.csswg.org/cssom-view/#scrolling-box) states
130
130
 
131
131
  This package follows the convention [adopted by Firefox](https://hg.mozilla.org/integration/fx-team/rev/c48c3ec05012#l7.18) of setting a boolean option to _not_ scroll all nodes with `overflow: hidden` set.
132
132
 
133
- [gzip-badge]: https://img.badgesize.io/https:/unpkg.com/compute-scroll-into-view/dist/index.js?label=gzip%20size&compression=gzip&style=flat-square
134
- [size-badge]: https://img.badgesize.io/https:/unpkg.com/compute-scroll-into-view/dist/index.js?label=size&style=flat-square
133
+ [gzip-badge]: https://img.shields.io/bundlephobia/minzip/compute-scroll-into-view?label=gzip%20size&style=flat-square
134
+ [size-badge]: https://img.shields.io/bundlephobia/min/compute-scroll-into-view?label=size&style=flat-square
135
135
  [unpkg-dist]: https://unpkg.com/compute-scroll-into-view/dist/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compute-scroll-into-view",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "The engine that powers scroll-into-view-if-needed",
5
5
  "keywords": [
6
6
  "if-needed",