npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@os-design/utils

v1.0.71

Published

Utils and hooks used in os-design.

Downloads

158

Readme

@os-design/utils NPM version BundlePhobia

Utils and hooks used in os-design.

  1. ErrorBoundary – The Error Boundary component. Fully supports Relay (useQueryLoader/loadQuery, useLazyLoadQuery).
  2. isTouchDevice – Detects whether the client device is touch-enabled.
  3. omitEmotionProps – Disables forwarding the specified properties to the element.
  4. useAutoScroll – Auto scrolls if the cursor is near the border of the scrollable element. It works on both mouse and touch devices.
  5. useBodyScroll – Enables or disables scrolling of the body element.
  6. useBrowserLayoutEffect – Mocks the useLayoutEffect on the server side.
  7. useClickOutside – Sets the listener that will be called when the click event occurs outside the target element.
  8. useClosable – Sets the closed state to true after a delay to apply the fade out animation.
  9. useCursorPosition – Returns the position of the cursor. It works on both mouse and touch devices.
  10. useDebounce – The callback function will be called only when N ms has elapsed after the last call attempt.
  11. useDrag – Handles the drag gesture. On touch devices, the event is triggered by a long press. Otherwise, when you click on the element and start dragging it.
  12. useEvent – Sets the listener that will be called whenever the specified event occurs.
  13. useFontSize – Computes the font size of the element.
  14. useForwardedRef – Allows to use the forwardedRef.
  15. useForwardedState – Uses the inner state if the passed value is undefined.
  16. useInterval – The hook to use the setInterval function.
  17. useKeyPress – Sets the listener that will be called whenever the key down event occurs.
  18. useLongPress – Sets the listener that will be called whenever the long press event occurs. It only works on touch devices.
  19. useMemoObject – Reuse the previous version of an object value unless it has changed.
  20. usePreventDefaultEvent – Prevents the default action of the specified event.
  21. usePrevious – Returns the previous value.
  22. useResizeObserver – Sets the listener that will be called whenever the resize event of an element occurs.
  23. useSafeAreaInset – Calculates the safe area inset.
  24. useSize – Returns the width and height of the container. By default, the container is window.
  25. useSwipe – Allows you to implement the swipe gesture in any container. It only works on touch devices.
  26. useThrottle – The callback function will be called no more than once during the N ms, even if it is called many times during that period.
  27. useVh – Sets the --vh css variable.

Installation

Install the package using the following command:

yarn add @os-design/utils

See all the features in the Storybook.