Features
- Added
onAnyCallbackFiredto theForesightManager, this function will run when ANY callback function is hit. Read More - Added new
debuggerSettings.showNameTagsto show or hide name tags on startup (trueby default) - Added toggle to hide/show name tags in debugger
- The debugger now shows an icon 👁 for if a registered element is in the viewport and thus being tracked
- The debugger now shows total amount of visible elements and total callback hitcount (split by mouse and tab)
- Added new Static Property
Foresightmanager.instance.getManagerDatathis has:- The current global settings
- Map of registered elements and their associated data
- Map of elements that are currently being observed (aka that are in the viewport)
- Count of total callbacks (split by mouse and tab)
Docs
- All pages in the docs now have a .md page. For example https://foresightjs.com/docs/getting_started/config.md this, next to the llms.txt page, can be used to give context to AI agents about ForesightJS Read More.
- Rewrote Behind the Scenes to reflect the addition of
PositionObserverand removal of the previous events/observers
Changes
- Removed
ResizeObserver, scroll events and resize events. Replaced it withPositionObserver. Read more about why. - Added
IntersectionObserverto only observe elements currently in the viewport. - Registered element's
namewill now be backfilled by ID if there is noname, still defaults to “” if both are missing. - Debug overlays are now being calculated using
transforminstead of setting their bounds for performance. This removes any Cumulative Layout Shift (CLS) while moving the mouse in debug mode - Renamed
ForesightManagerPropstype toForesightManagerSettings - Renamed
UpdateForsightManagerPropstype toUpdateForsightManagerSettings
Deprecations
- Deprecated
resizeScrollThrottleDelaysince scroll and resize events have been removed.resizeScrollThrottleDelaywill be fully removed in V3.0+
Shoutouts
- @Devon-White for creating @signalwire/docusaurus-plugin-llms-txt, helping us create the llms.txt and page specific .md pages.
- @thednp for creating the awesome
PositionObserverlibrary - @kurtextrem for his performance suggestions in #3
- @slorber for showing ForesightJS on x and bluesky to his huge audience