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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fiscozen/composables

v1.0.4

Published

Design System utility composables

Readme

@fiscozen/composables

For usage documentation, see Storybook Documentation

Development

Setup

pnpm install
pnpm --filter @fiscozen/composables build

Code Organization

src/
  index.ts                        Re-exports everything (composables, types, utils, FzFloating)
  types.ts                        Shared types (FzFloatingPosition, FzRect, FzUseCurrencyOptions, etc.)
  utils/
    index.ts                      Barrel file for utilities
    number/
      index.ts                    Currency format/parse helpers
    position/
      index.ts                    Floating position calculation helpers
  FzFloating.vue                  Component wrapper for useFloating
  composables/
    index.ts                      Barrel file for all composables
    useFloating.ts                Floating element positioning
    useMediaQuery.ts              Reactive CSS media query matching
    useBreakpoints.ts             Responsive breakpoint detection (wraps useMediaQuery)
    useClickOutside.ts            Click-outside detection
    useKeyDown.ts                 Keydown event listener
    useKeyUp.ts                   Keyup event listener
    useCurrency.ts                Currency formatting (deprecated)
  __tests__/
    useFloating.spec.ts           useFloating unit tests
    FzFloating.spec.ts            FzFloating component tests
    number.spec.ts                Currency/number utility tests

Composables

useFloating

Positioning logic for floating/popover elements (tooltips, dropdowns, popovers).

Architecture:

  • Lookup tables: positionCalculators (with opener) and containerPositionCalculators (without opener) provide O(1) position resolution for all 12 explicit positions (top/bottom/left/right + -start/-end variants).
  • Auto-position resolution: resolveAutoPosition delegates to getHighestAvailableSpacePos for auto, auto-vertical, auto-start, auto-end, and their combinations.
  • Boundary corrections: applyBoundaryCorrections clamps the final position within the container bounds, resetting transforms when the element would overflow.
  • Layout shift prevention: The element is set to position: fixed immediately before rect calculations.
  • Reactive repositioning: Uses IntersectionObserver to track visibility changes.

The FzFloating component (src/FzFloating.vue) is the default wrapper that exposes useFloating through a declarative template API.

useMediaQuery

Reactive wrapper around window.matchMedia. Returns a computed Ref<boolean> that updates when the media query match state changes. Lifecycle-aware: adds listener on mount, removes on unmount.

useBreakpoints

Higher-level abstraction over useMediaQuery for responsive design. Accepts a typed breakpoint map (Record<T, '${number}px'>) and returns isGreater(bp), isSmaller(bp), and isInBetween(min, max).

useClickOutside

Detects clicks outside a target element. Accepts a component ref, a callback, and an optional element to scope the listener to (defaults to document). Supports dynamic listener re-attachment via watch when the scoped element changes.

useKeyDown

Attaches a keydown listener to a component ref. Lifecycle-managed (mount/unmount). Throws if component or callback is missing.

useKeyUp

Attaches a keyup listener to a component ref or to document when no component is provided. Argument order differs from useKeyDown: (callback, component?) — the component is optional.

useCurrency

Deprecated. Wraps format and parse from src/utils/number. Consumers should import those functions directly instead.

Testing

Running Tests

pnpm --filter @fiscozen/composables test:unit
pnpm --filter @fiscozen/composables coverage

Test Structure

  • useFloating.spec.ts / FzFloating.spec.ts: Position calculation and component rendering.
  • number.spec.ts: Currency format/parse utilities.

Tests mock window.matchMedia in beforeEach. Coverage target: >90%.

Dependencies

  • @fiscozen/style (workspace) — breakpoint tokens used by useBreakpoints / useMediaQuery

Build

pnpm --filter @fiscozen/composables build

Runs Vite library build. Output goes to dist/.