Gathering detailed insights and metrics for react-layer-handles
Gathering detailed insights and metrics for react-layer-handles
Gathering detailed insights and metrics for react-layer-handles
Gathering detailed insights and metrics for react-layer-handles
A simple utility that allows you to add handles to your React components.
npm install react-layer-handles
Typescript
Module System
Min. Node Version
67.3
Supply Chain
93.7
Quality
74.9
Maintenance
100
Vulnerability
100
License
JavaScript (91%)
HTML (4.54%)
CSS (4.45%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
9 Commits
1 Forks
1 Watchers
41 Branches
1 Contributors
Updated on Feb 09, 2020
Latest Version
0.0.5
Package Id
react-layer-handles@0.0.5
Unpacked Size
93.13 kB
Size
16.84 kB
File Count
8
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
3
30
react-layer-handles
is a simple utility that allows you to add handles to your React components. It is meant to provide just the basic functionality of showing handles and to be extended with the userLayerHandles
hook to provide more features.
1yarn add react-layer-handles
1import { LayerHandlesProvider, useLayerHandles } from "react-layer-handles";
1export const App = () => { 2 return ( 3 <LayerHandlesProvider 4 // default props show here 5 dataAttribute="data-layer-id" 6 handleOffsetX={8} 7 handleOffsetY={8} 8 handleWidth={8} 9 handleHeight={8} 10 handleBorderRadius={12} 11 > 12 <div className="App"> 13 <Text layerId="01234" /> 14 </div> 15 </LayerHandlesProvider> 16 ); 17};
1// just to show the component can have layer handles 2// attached no matter where it is positioned. 3const TEXT_LAYER_STYLE = { 4 position: "absolute", 5 top: 222, 6 left: 222, 7 background: "rgba(0,0,0,0.1)" 8}; 9 10const Text = props => { 11 // subscribe to the store. 12 const layers = useLayerHandles(); 13 const isSelected = layers.isSelected(props.layerId); 14 15 // toggle layerHandles on when this component is clicked. 16 const onClick = () => { 17 if (!isSelected) { 18 layers.setSelectedLayerId(props.layerId); 19 } 20 }; 21 22 // react-layer-handles uses the data-layer-id attribute by default. 23 // be sure to give this attribute to your elements or it will not work. 24 return ( 25 <p onClick={onClick} data-layer-id={props.layerId} style={TEXT_LAYER_STYLE}> 26 Foo bar baz. 27 </p> 28 ); 29};
Type: string
Required: false
Default: 'data-layer-id'
Used to select elements from the DOM to create handles around.
Type: number
Required: false
Default: 8
Pushes the handles away from the content they are related to. For example, with the default value of 8
, the top left handle will be 8px above and 8px left of the top/left coordinates of the content it is attached to. The bottom right handle will be pushed to the right 8px and down 8px from the bottom right corner of the content it is attached to.
Type: number
Required: false
Default: 8
Controls the width of the topLeft, topRight, bottomRight, and bottomLeft corner handles.
Type: number
Required: false
Default: 8
Controls the height of the topLeft, topRight, bottomRight, and bottomLeft corner handles.
Type: number
Required: false
Default: 1
Controls the thickness of the top, right, bottom, and left handles.
The useLayerHandles
hook gives you access to the main store that powers react-layer-handles
. The following descriptions are what values/methods you can access when using this hook.
Type: string
The id of the currently selected layer. If there is no selected layer, undefined
.
Type: function(id: string): undefined
A method to set the currently selected layer id. Returns nothing.
Type: function(id: string): boolean
A method to check if a specific id is currently selected. Returns a boolean
, true or false.
Type: Object
The currently selected element's getBoundingRectClient
values with some additional values as helpers. (top
, left
, right
, bottom
, height
, width
, etc.)
Type: ref
A React ref
for the top handle. Can be used to add event listeners, etc.
Type: ref
A React ref
for the right handle. Can be used to add event listeners, etc.
Type: ref
A React ref
for the bottom handle. Can be used to add event listeners, etc.
Type: ref
A React ref
for the left handle. Can be used to add event listeners, etc.
Type: ref
A React ref
for the top right handle. Can be used to add event listeners, etc.
Type: ref
A React ref
for the top left handle. Can be used to add event listeners, etc.
Type: ref
A React ref
for the bottom right handle. Can be used to add event listeners, etc.
Type: ref
A React ref
for the bottom left handle. Can be used to add event listeners, etc.
Each handle has a shared className, _reactLayerHandle
that can be used to style the handles yourself. In addition to this shared className, the following classNames are given to the corresponding handles and can also be manipulated with global CSS or JS.
_topLeftReactLayerHandle
_topRightReactLayerHandle
_bottomRightReactLayerHandle
_bottomLeftReactLayerHandle
_topReactLayerHandle
_rightReactLayerHandle
_bottomReactLayerHandle
_leftReactLayerHandle
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/9 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
security policy file not detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
108 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More