1.2.46 • Published 8 months ago

@labir/react-bridge v1.2.46

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

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

1.2.45

8 months ago

1.2.46

8 months ago

1.2.41

8 months ago

1.2.42

8 months ago

1.2.40

9 months ago

1.2.43

8 months ago

1.2.39

9 months ago

1.2.38

9 months ago

1.2.34

9 months ago

1.2.35

9 months ago

1.2.36

9 months ago

1.2.37

9 months ago

1.2.33

9 months ago

1.2.29

9 months ago

1.2.32

9 months ago

1.2.27

10 months ago

1.2.28

10 months ago

1.2.26

10 months ago

1.2.25

10 months ago

1.2.24

10 months ago

1.2.23

11 months ago

1.2.22

11 months ago

1.2.21

11 months ago

1.2.20

11 months ago

1.2.19

11 months ago

1.2.18

12 months ago

1.2.17

12 months ago

1.2.16

12 months ago

1.2.15

12 months ago

1.2.14

12 months ago

1.2.12

12 months ago

1.2.11

12 months ago

1.2.10

12 months ago

1.2.8

12 months ago

1.2.7

1 year ago

1.2.5

1 year ago

1.2.4

1 year ago

1.2.3

1 year ago

1.2.2

1 year ago

1.1.2

1 year ago

1.0.32

1 year ago

1.0.31

1 year ago

1.0.30

1 year ago

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago