phase2 / outline

Tooling infrastructure for modern web component development.
https://outline.phase2tech.com
MIT License
128 stars 27 forks source link

feat: efficient resize-controller #377

Closed shaal closed 1 year ago

shaal commented 1 year ago

Testing

This controller is used on Tufts in multiple components on every page - https://tuftsmedicine.prod.acquia-sites.com/

Description

The new resize controller includes multiple improvements over previous attempts

This resize-controller has been extensively tested by the Tufts project and is currently being used by it.

Component width is being tracked by the Browser API's resize observer

Debounce during resize to reduce amount of events

Only when component width moves over from one breakpoint range to another, component update is called.

During component render, only current breakpoint range variable is read (no function is being called)

Provides the ability to separate the element tracking width from the element that will be updated (useful when we need to synchronize all items in a container to switch together at the same breakpoint).

Fixes # (issue)

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Checklist

changeset-bot[bot] commented 1 year ago

⚠️ No Changeset found

Latest commit: 0de70ff2cda0a5b9e42d660d90d7c7dfcaae7ab4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

netlify[bot] commented 1 year ago

Deploy Preview for outlinejs ready!

Name Link
Latest commit 0de70ff2cda0a5b9e42d660d90d7c7dfcaae7ab4
Latest deploy log https://app.netlify.com/sites/outlinejs/deploys/644fea108073ad0008afe380
Deploy Preview https://deploy-preview-377--outlinejs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

shaal commented 1 year ago

This PR is adding resize-controller as a package - https://github.com/phase2/outline/pull/393