Rerouted (regenerated, verified). Same repository and tag, but GitHub now builds the zip with different bytes, so it no longer matches the SHA-1 package.elm-lang.org recorded. The Lamdera package server serves a copy recovered from https://github.com/rl-king/elm-inview.
What we checked: Tag 2.0.0 is still on github.com/rl-king/elm-inview; its commit b3b7905f4365 is from 2020-06-22 19:39 UTC, before the version was published (2020-06-22 19:47 UTC); every file Elm uses matches a copy in a Lamdera package cache from 2021-02-13, from before the change; elm.json is byte-identical to package.elm-lang.org's; the exposed modules match docs.json; the zip's SHA-1 is not the published one (GitHub's zip no longer comes out byte for byte the same), so the contents were checked instead.
The Lamdera compiler uses this copy and prints a one-line notice saying so. elm itself fails to download this version.
Details · package.elm-lang.org's zip: https://github.com/rl-king/elm-inview/zipball/2.0.0/
Get information on an element position relative to the current viewport.
Similar to Browser.Dom.Viewport with the addition of maxX and maxY.
You can use maxX and maxY to check if an element has ever been in the viewport before.
Similar to Browser.Dom.Element without scene and viewport.
Takes a list of element ids you want to track and attempts to find them on the current page.
A message type for the state to update.
Update viewport size and element positions.
Update current viewport x and y offset.
Subscribe to browser resize events to recalculate element positions.
Track element positions after you've initialized the state.
Use this when the page content moves around after initialization, like for example when images load and stuff gets pushed down.
True if the element with the given id is in the current viewport.
note: The result is a Maybe because the element might not be on the page at all.
True if the element with the given id is in or above the current viewport.
note: The result is a Maybe because the element might not be on the page at all.
True if the element with the given id is in the current viewport but with an offset. A positive offset will make the viewport smaller and vice versa.
note: The result is a Maybe because the element might not be on the page at all.
True if the element with the given id is in or above the current viewport but an offset. A positive offset will make the viewport smaller and vice versa.
note: The result is a Maybe because the element might not be on the page at all.
Write your own check function.
For example isInOrAboveViewWithMargin is implemented like:
isInOrAboveViewWithMargin : String -> Margin -> State -> Maybe Bool
isInOrAboveViewWithMargin id margin state =
let
calc { viewport } element =
(viewport.y - margin.bottom + viewport.height > element.y)
&& (viewport.x - margin.right + viewport.width > element.x)
in
custom (\a b -> Maybe.map (calc a) b) id statenote: Element is a Maybe because the element might not be on the page at all.
Keeps track of viewport position, viewport dimensions and element positions.