domet 1.0.3 → 1.0.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.
Files changed (3) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +14 -14
  3. package/package.json +1 -1
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 blksmr
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -6,7 +6,7 @@ Lightweight under the hood: a tight scroll loop and hysteresis for stable, flick
6
6
 
7
7
  For the source code, check out the [GitHub](https://github.com/blksmr/domet).
8
8
 
9
- ## Installation ++Requires React 18 or higher++
9
+ ## Installation Requires React 18 or higher
10
10
 
11
11
  ```bash
12
12
  npm install domet
@@ -44,27 +44,27 @@ function Page() {
44
44
 
45
45
  ### Arguments
46
46
 
47
- | Argument | Type | Description |
48
- |----------|------|-------------|
49
- | `sectionIds` | `string[]` | Array of section IDs to track |
50
- | `containerRef` | `RefObject<HTMLElement> \| null` | Scrollable container (defaults to `window`) |
51
- | `options` | `DometOptions` | Configuration options |
47
+ | Prop | Type | Default | Description |
48
+ |------|------|---------|-------------|
49
+ | `sectionIds` | `string[]` | — | Array of section IDs to track |
50
+ | `containerRef` | `RefObject<HTMLElement> \| null` | `null` | Scrollable container (defaults to window) |
51
+ | `options` | `DometOptions` | `{}` | Configuration options |
52
52
 
53
53
  ### Options
54
54
 
55
- | Option | Type | Default | Description |
56
- |--------|------|---------|-------------|
55
+ | Prop | Type | Default | Description |
56
+ |------|------|---------|-------------|
57
57
  | `offset` | `number` | `0` | Trigger offset from top in pixels |
58
58
  | `offsetRatio` | `number` | `0.08` | Viewport ratio for trigger line calculation |
59
59
  | `debounceMs` | `number` | `10` | Throttle delay in milliseconds |
60
60
  | `visibilityThreshold` | `number` | `0.6` | Minimum visibility ratio (0-1) for section to get priority |
61
61
  | `hysteresisMargin` | `number` | `150` | Score margin to prevent rapid section switching |
62
- | `behavior` | `'smooth' \| 'instant' \| 'auto'` | `'auto'` | Scroll behavior. `'auto'` respects `prefers-reduced-motion` |
62
+ | `behavior` | `'smooth' \| 'instant' \| 'auto'` | `'auto'` | Scroll behavior. 'auto' respects prefers-reduced-motion |
63
63
 
64
64
  ### Callbacks
65
65
 
66
- | Callback | Type | Description |
67
- |----------|------|-------------|
66
+ | Prop | Type | Description |
67
+ |------|------|-------------|
68
68
  | `onActiveChange` | `(id: string \| null, prevId: string \| null) => void` | Called when active section changes |
69
69
  | `onSectionEnter` | `(id: string) => void` | Called when a section enters the viewport |
70
70
  | `onSectionLeave` | `(id: string) => void` | Called when a section leaves the viewport |
@@ -73,10 +73,10 @@ function Page() {
73
73
 
74
74
  ### Return Value
75
75
 
76
- | Property | Type | Description |
77
- |----------|------|-------------|
76
+ | Prop | Type | Description |
77
+ |------|------|-------------|
78
78
  | `activeId` | `string \| null` | ID of the currently active section |
79
- | `activeIndex` | `number` | Index of the active section in `sectionIds` (-1 if none) |
79
+ | `activeIndex` | `number` | Index of the active section in sectionIds (-1 if none) |
80
80
  | `scroll` | `ScrollState` | Global scroll state |
81
81
  | `sections` | `Record<string, SectionState>` | Per-section state indexed by ID |
82
82
  | `sectionProps` | `(id: string) => SectionProps` | Props to spread on section elements |
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "domet",
3
3
  "description": "A React hook for scroll tracking with smooth 60fps performance and smart hysteresis",
4
- "version": "1.0.3",
4
+ "version": "1.0.5",
5
5
  "author": "blksmr",
6
6
  "repository": {
7
7
  "type": "git",