1.8.0 • Published 2 years ago

lit-popup v1.8.0

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

LitPopup

A customizable lightweight popup plugin with no dependencies.

Why?

I needed full control over popup animation and its lifecycle.

Installation

NPM

Install it from NPM: npm i lit-popup

Usage

Include css from node_modules/lit-popup/dist/css/lit-popup.min.css (or write your own)

<div class="lit-popup" data-lit-popup="popup">
    <div class="lit-popup-container">
        <!-- Layout here -->
    </div>
</div>
import LitPopup from 'lit-popup';

const popup = new LitPopup('name');

API

Hooks (lifecycle callbacks)

HookParametersDescription
onOpen(instance: LitPopup)Runs before opening animation
onOpenComplete(instance: LitPopup)Runs after opening animation
onClose(instance: LitPopup)Runs before closing animation
onCloseComplete(instance: LitPopup)Runs after closing animation
onDestroy(instance: LitPopup)Runs when 'destroy' method is called
openAnimation(instance: LitPopup)A function describing an opening animation. It must return a promise and resolve when animation is done.
closeAnimation(instance: LitPopup)A function describing a closing animation. It must return a promise and resolve when animation is done.

Events

EventParametersDescription
opennoneTriggers before opening animation
open-completenoneTriggers after opening animation
closenoneTriggers before closing animation
close-completenoneTriggers after closing animation
destroynoneTriggers when 'destroy' method is called

Methods

MethodParametersReturnDescription
opennonePromise<void>Opens the modal
closenonePromise<void>Closes the modal
destroynonevoidDestroys the instance, disposes memory
on(eventName: string, listener: Function)voidAdds an event listener to the popup element
one(eventName: string, listener: Function)voidAdds an event listener to the popup element which will be executed only once
off(eventName: string, listener: Function)voidRemoves an event listener from the popup element which will be executed only once
trigger(eventName: string)voidTriggers an event on the popup element

Accessibility

Work on progress

1.8.0

2 years ago

1.7.0

2 years ago

1.6.0

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.4.1

2 years ago

1.4.0

2 years ago

1.3.1

2 years ago

1.3.0

3 years ago

1.2.0

4 years ago

1.2.1

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago

0.2.0

4 years ago

0.1.0

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago