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

@labir/react-bridge

v1.2.46

Published

A react bridge for @labir/core. Contains hooks and context, but not the components.

Downloads

90

Readme

React binding to @labir/core

Documentation and examples at https://labir.vercel.app.

This package provides fundamental integration of @labir/core in React:

  • context and hooks for @labir/core classes
  • hooks for creation of buttons, dropdowns & modals that will controll the @labir/core internal state
  • three specific UI components for thermal imaging: Histogram, ThermalRange ThermalInastance

See @labir/core documentation to understand its concept.

Foundation of a final UI

This package creates the main logic and bindings to the @labir/core. But the final UI needs to be implemented in a particular SCSS framework. We have the following implamentations:

  • @labir/tailwind - TailwindCSS & NextUI
  • @labir/emotion - @emotion/react

Components in those packages use hooks from @labir/react-bridge to handle the logic, but the styling is done individually.

Only three specific components are provided by this package (see below). Their styling is inline and absolutely isolated from any other CSS that might appear on the page.

Context

All componenst need to be nested by <ThermalProvider /> which creates the global instance of ThermalManager. All hooks and components work internally with this ThermalManager object.

Hooks

Core structure

  • useThermalManager - get the global instance of ThermalManager
  • useThermalRegistry( registryId, options ) - create or get an instance of ThermalRegistry

Properties that might be manipulated from React

  • useThermalManagerPaletteDrive - color palette
  • useThermalRegistryOpacityDrive - IR / VISIBLE ratio
  • useThermalRegistryRangeDrive - adjustable temperature range
  • useThermalGroupCursorPositionDrive - cursor synchronisation

States of which React needs to know

  • useThermalRegistryHistogramState exposes the current histogram
  • useThermalRegistryLoadingState exposes current loading state
  • useThermalRegistryMinmaxState exposes the min & max temperature of a registry
  • useThermalGroupMinmaxState exposes the min & max temperature of a group

Listing

  • useThermalRegistryGroupsState groups in a registry
  • useThermalGroupInstancesState file instances in a group

Components

Thermal imaging does not mean just 'displaying thermal images'. This functionality is handled by @labir/core. A fully equipped app needs other functionality - which needs to be implemented in components.

Thermal imaging components

Components specific to thermal imaging are provided by this package:

  • ThermalFile - displays a thermal file
  • Histogram - displays a histogram
  • ThermalRange - displays adjustable temperature scale

Styling of these component is framework agnostic, using inline CSS.

Hooks for buttons, dropdowns and modals

Standard UI components such as buttons, modals & dropdowns need to be implemented in a particular (S)CSS framework. For this purpose, here are hooks that handles the underlying functionality:

  • Inputs controlling IR / VISIBLE ratio: useOpacityInput
  • Dropdowns or button lists controlling the palette: useThermalManagerPaletteDrive
  • Inputs controlling histogram resolution: useHistogramResolutionInput
  • Button for automatic temperature range: useRangeButtonAuto
  • Button for reseting temperature range: useRangeButtonFull
  • Drop in components: useThermalDropin

This package contains core bindings to the @labir/core package.

Complex scenarios

There are hooks simplifying the most common use cases:

useSingleFileRegistry

  • Intended for display of one single image
  • Handles its loading
  • Creates an isolated registry for this particular file

Utility hooks

useThermalObjectPurpose - creates unique ID for individual components