Svelte Intersection Observer Versions Save

Detect if an element is in the viewport using the Intersection Observer API

v1.0.0

4 months ago

Breaking Changes

  • Drop support for bundled ESM/UMD; code is only distributed as Svelte files
  • Remove IntersectionObserverProps or Entry TypeScript interfaces from IntersectionObserver.svelte.d.ts

Use the Svelte ComponentProps utility to extract component props.

import IntersectionObserver from "svelte-intersection-observer";
import type { ComponentProps } from "svelte";

type Props = ComponentProps<IntersectionObserver>;

Fixes

  • element and root prop types should be null | HTMLElement to support TypeScript strict mode
  • Add exports field to package.json

v0.10.2

4 months ago

Fixes

  • add exports field to package.json to resolve Vite development warnings (8b2f824, branch)

v0.10.1

9 months ago

Fixes

  • fix threshold prop type to be number | number[] (6992399, #70 by @kevinkace)

v0.10.0

2 years ago

Features

  • mark observer for garbage collection after disconnecting (b961e16)

Documentation

  • make prop descriptions consistent with docs (5944a6b)

Refactoring

  • omit redundant null from element and root types as HTMLElement is already nullable (41a3609)

v0.9.2

2 years ago

This is a patch release to refresh the documentation published to NPM/Yarn.

Documentation

  • add let: directive example
  • update component prop descriptions
  • use Svelte syntax highlighting for on:observe, on:intersect examples

v0.9.1

2 years ago

Documentation

  • update the "Once" example to include the "svelte-intersection-observer" import
  • rename example svite to vite

Refactoring

  • inline entry prop typedef
  • remove @event, @slot artifacts used by sveld to generate initial TypeScript definitions

v0.9.0

2 years ago
  • improve TypeScript definitions for dispatched events
    • on:observe: event.detail.isIntersecting is a boolean
    • on:intersect: event.detail.isIntersecting can only be true
<IntersectionObserver
  on:observe={(e) => {
    console.log(e.detail.isIntersecting); // boolean
  }}
  on:intersect={(e) => {
    console.log(e.detail.isIntersecting); // true
  }}
/>

v0.8.0

2 years ago
  • use .svelte.d.ts as the extension for the component TypeScript definition

v0.7.1

2 years ago

This is a patch release to refresh the documentation published to NPM/Yarn.

Documentation

  • add description for basic usage
  • add on:observe example
  • explain difference between on:observe and on:intersect
  • document IntersectionObserverEntry interface
  • re-order prop table so that once and intersecting are more prominent

v0.7.0

3 years ago

Features