1.1.1 • Published 2 years ago

shadow-overlay v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Shadow Overlay

GZipped: 1.6Kb ES Module module.js 5.99KB CommonJS index.js 6.63KB

Installation

npm i -D shadow-overlay

pnpm i -D shadow-overlay

yarn add -D shadow-overlay

Most basic usage

// index.ts
import 'shadow-overlay'

Markup mode

Element Attributes list

attributetype
opacitynumber
colorAny css valid color unit
marginAny css size unit
guttersAny css size unit
widthAny css size unit
disabledhttps://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled
controllerSimilar to disabled, controller='true' or just controller will work

HTML example

You can use the custom element by using import the main.js file in your <head> The attribute type should be module

<!DOCTYPE html>
<html>
  <head>
    <script
      type="module"
      src="./node_modules/shadow-overlay/dist/module.js"
    ></script>
  </head>
  <body>
    <grid-overlay /> --> custom element 🎉
  </body>
</html>

The custom attribute list above contains all attributes that can be passed to the overlay

<grid-overlay color="red" /> --> I'm a red grid now! ⭕⭕⭕⭕

Scripting mode

Methods

attributetype
startundefined
setOpacitynumber between 0 and 1
setColorany css color
setMarginAny css size unit
setGuttersAny css size unit
setWidthAny css size unit
setControllerboolean

Basic usage

Import the overlay and start the instance

import { overlay } from 'shadow-overlay'
overlay.start()

Methods usage

Start

overlay.start()

Opacity

overlay.setOpacity(0.4)

Color

overlay.setColor('red')
overlay.setColor('ff0000')
overlay.setColor('hsl(0, 100%, 50%)')
overlay.setColor('rgb(255, 0, 0)')

Margin, Gutters

overlay.setMargin('16px')
overlay.setMargin('1em')
overlay.setMargin('1rem')
overlay.setMargin('5ch')
overlay.setMargin('5%')

Width

be careful not to use values that are too small or you risk not being able to see the grid

overlay.setWidth('920px')
overlay.setWidth('50rem')
overlay.setWidth('90ch')
overlay.setWidth('90%')

Controller

overlay.setController(true)
1.1.1

2 years ago

1.0.1

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.0

2 years ago