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

@remindgmbh/typescript-lightbox

v3.0.0

Published

Lightbox library

Downloads

4

Readme

REMIND - LIGHTBOX

travis-img codecov-img github-issues-img contrib-welcome-img license-img

Does whatever a lightbox does.


Table of contents


Authors


Installation

Zum Einbinden des TypeScript Moduls muss folgende Abhängigkeit in den Dependencies einer package.json eingetragen werden.

npm i @remindgmbh/typescript-lightbox


Usage

Lightbox

import { Lightbox } from '@remindgmbh/typescript-lightbox'

let lightbox: Lightbox = new Lightbox('<div>Ein Html string</div>');
// Attach html to dochument body
lightbox.attach();
// Change source
lightbox.setSource('<div>Ein anderer HTML string</div>');
// Detach html from dochument body
lightbox.detach();

Output

<div class="remind-lightbox">
	<div class="remind-lightbox__header">
		<div class="remind-lightbox__close-button"></div>
	</div>

	<div class="remind-lightbox__canvas">
		<div class="remind-lightbox__content">
			<!--html string-->
			<div>Ein anderer Html string</div>
		</div>
	</div>

	<div class="remind-lightbox__footer"></div>
</div>

Parameters

| Parameter | Type | Default | Description | | ------------- | ------- | --------------------------------- | ------------------------------------------------------------- | | html | string | '' | Ein Html String der ausgeben wird | | options | object | {classes: {...}, functions: {...}}| Zum Überschreiben von CSS-Classes und Funktion für die Ausgabe|

Functions

| Parameter | Type | | ------------ | ------------------------------------------------------ | | createCanvas | (className: string) => HtmlElement | | createFooter | (className: string) => HtmlElement | | createHeader | (className: string) => HtmlElement | | createCloseButton | (className: string) => HtmlElement | | createContent | (htmlString: string, className: string) => HtmlElement |

CSS Classes

| Parameter|Default| | ----------- | ----------------------------- | | lightbox | remind-lightbox | | canvas | remind-lightbox__canvas | | header | remind-lightbox__header | | footer | remind-lightbox__footer | | content | remind-lightbox__content | | closeButton | remind-lightbox__close-button |

Example

import { Lightbox } from '@remindgmbh/typescript-lightbox'

let lightbox: Lightbox = new Lightbox(
	'<div>Ein Html string</div>',
	{
		classes: {
			footer: 'custom-content-class'
		},
		functions: {
			createContent: (htmlString, className) => {
				let html = document.createElement('span');
				html.classList.add(className);
				html.innerHtml = htmlString;
				return html;
			}
		}
	}
);
// Create html
lightbox.create();
// Attach html to dochument body
lightbox.attach();
// Detach html from dochument body
lightbox.detach();

Output

<div class="remind-lightbox">
	<div class="remind-lightbox__header">
		<div class="remind-lightbox__close-button"></div>
	</div>

	<div class="remind-lightbox__canvas">
		<span class="custom-content-class">
			<!--html string-->
			<div>Ein Html string</div>
		</div>
	</div>

	<div class="remind-lightbox__footer"></div>
</div>

LightboxImage

Parameters

| Parameter | Type | Default | Description | | ------------- | ------- | --------------------------------- | ------------------------------------------------------------- | | item | LightboxItem | {image: '', headline: '', text: ''} | Pfad zur Bild Datei, Überschrift und Text zum Bild | | options | object | {classes: {...}, functions: {...}}| Zum Überschreiben von CSS-Classes und Funktion für die Ausgabe|

Functions

| Parameter | Type | | ------------ | ------------------------------------------------------------------------------------------------------------------- | | ... | ... | | createImage | createImage: (item: LightboxItem, classNameOuter: string, classNameImage: string, classNameHeadline: string, classNameText: string) => HTMLElement |


LightboxGallery

Additional Public Methods

| Method | Description | | ---------------------------------- | -------------------------------------------------------- | | next(): void | Setze das nächste Bild in den sources als aktives Bild | | prev(): void | Setze das vorherige Bild in den sources als aktives Bild | | setItems(items: LightboxItem[]): void | Setze neue Items | | setItem(item: LightboxItem): void | Setze ausgwähltes Item |

Parameters

| Parameter | Type | Default | Description | | ------------- | ------- | --------------------------------- | ------------------------------------------------------------- | | item | LightboxItem | {image: '', headline: '', text: ''} | Pfad zur Bild Datei, Überschrift und Text zum Bild | | items | LightboxItem[] | [] | | | options | object | {showThumbnails: false, showPagination: false, classes: {...}, functions: {...}}| Erweitert um die Optionen zur Anzeige der Thumbnails und der Pagination |

Functions

| Parameter | Type | | ------------ | ------------------------------------------------------------------------------------------------------------------- | | ... | ... | | createThumbnails | (className: string) => HtmlElement | | createThumbnail | (source: string, className: string) => HTMLElement | | createPagination | (index: number, maxIndex: number, className: string, classNameCurrent: string, classNameMax: string) => HTMLElement | | createNext | (className: string) => HtmlElement | | createPrev | (className: string) => HtmlElement |

CSS Classes

| Parameter | Default | | ----------------- | ----------------------------- | | thumbnails | remind-lightbox__thumbnails | | thumbnail | remind-lightbox__thumbnail | | pagination | remind-lightbox__pagination | | paginationCurrent | remind-lightbox__current | | paginationMax | remind-lightbox__max | | next | remind-lightbox__next | | prev | remind-lightbox__prev |

Example

<div class="remind-lightbox">
	<div class="remind-lightbox__header">
		<div class="remind-lightbox__counter">
			<span class="remind-lightbox__current">###index###</span>
			<span class="remind-lightbox__max">###maxIndex###</span>
		</div>
		<div class="remind-lightbox__close-button"></div>
	</div>
	<div class="remind-lightbox__canvas">
        <div class="remind-lightbox__prev"/>
        <div class="remind-lightbox__content">
	    <img class="remind-lightbox__image"	src="###item.image###"/>
            <h2 class="remind-lightbox__headline">###item.headline###</h2>
            <span class="remind-lightbox__text">###item.text###</span>
        </div>
        <div class="remind-lightbox__prev"/>
	</div>
	<div class="remind-lightbox__footer">
		<div class="remind-lightbox__thumbnails">
			<img class="remind-lightbox__thumbnail" src="###item.image###" data="###item###">
			<img class="remind-lightbox__thumbnail" src="###item.image###" data="###item###">
			<img class="remind-lightbox__thumbnail" src="###item.image###" data="###item###">
			<img class="remind-lightbox__thumbnail" src="###item.image###" data="###item###">
			...
		</div>
	</div>
</div>