PHPackages                             frontpack/lucy.js - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. frontpack/lucy.js

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

frontpack/lucy.js
=================

Helpers for vanilla JavaScript.

v0.1.6(4y ago)08031BSD-3-ClauseJavaScript

Since Jun 1Pushed 4y ago1 watchersCompare

[ Source](https://github.com/frontpack/lucy.js)[ Packagist](https://packagist.org/packages/frontpack/lucy.js)[ RSS](/packages/frontpack-lucyjs/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (8)Used By (1)

Lucy.js
=======

[](#lucyjs)

Helpers for vanilla JavaScript.

[![Buy me a coffee](https://camo.githubusercontent.com/6016f6f11f8d00a9d3cccff14441a50c0326363529ee3b7f22a4615a34745ff7/68747470733a2f2f6275796d65636f666665652e696e746d2e6f72672f696d672f627574746f6e2d70617970616c2d77686974652e706e67)](https://www.paypal.me/janpecha/5eur)

Installation
------------

[](#installation)

[Download a latest package](https://github.com/frontpack/lucy.js/releases) or use [Composer](http://getcomposer.org/):

```
composer require frontpack/lucy.js

```

DOM &amp; events
----------------

[](#dom--events)

Include `src/dom.js`.

```
LucyDom.getById(document, 'element-id');
LucyDom.findAll(document, 'selector'); // returns elements collection
LucyDom.find(document, 'selector'); // returns one element
LucyDom.getClosest(element, 'selector');
LucyDom.each(document, 'selector', function (element, info) {
	console.log(info.index);
	console.log(info.isFirst);
	console.log(info.isLast);
});

LucyDom.hasClass(element, 'class-name');
LucyDom.addClass(element, 'class-name');
LucyDom.removeClass(element, 'class-name');
LucyDom.toggleClass(element, 'class-name');
```

**Element events**

```
LucyDom.onEvent(eventTarget, 'eventName', handler);

// for example
LucyDom.onEvent(myElement, 'click', function (event) {
	console.log('Clicked!');
	console.log(this); // this === myElement
});
```

**Delegated events**

```
LucyDom.onChildEvent(eventTarget, 'child selector', 'eventName', handler);

// for example
LucyDom.onChildEvent(myElement, 'a.ajax', 'click', function (event) {
	console.log('AJAX click');
	console.log(this); // this === child
});
```

BEM
---

[](#bem)

Include `src/bem.js`.

```
var bem = new LucyBem(document);

// blocks
bem.eachBlock('block', function (block, info) {
	block.hasModifier('xyz');
	block.addModifier('xyz');
	block.removeModifier('xyz');
	block.toggleModifier('xyz');

	console.log(info.index);
	console.log(info.isFirst);
	console.log(info.isLast);
});

// events
bem.onElementEvent('block', 'element', 'click', function (element, event) {
	element.hasModifier('xyz');
	element.addModifier('xyz');
	element.removeModifier('xyz');
	element.toggleModifier('xyz');
});
```

Modal
-----

[](#modal)

Include `src/modal.js`.

```
var myModal = new LucyModal('My Title', function (modal) {
	console.log('Modal opened!');
	modal.title.textContent = 'Hello Title!';
	modal.body.innerHTML = 'Modal content';
	modal.closeButton.setAttribute('title', 'Close this');

}, function (modal) {
	console.log('Modal closed!');
});
```

---

License: [New BSD License](license.md)
Author: Jan Pecha,

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~41 days

Recently: every ~15 days

Total

7

Last Release

1563d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5c980b1511b4a0350442dc23d89c99d4d9a2411b7e765d52c133ccacf616968b?d=identicon)[janpecha](/maintainers/janpecha)

---

Top Contributors

[![janpecha](https://avatars.githubusercontent.com/u/637719?v=4)](https://github.com/janpecha "janpecha (11 commits)")

### Embed Badge

![Health badge](/badges/frontpack-lucyjs/health.svg)

```
[![Health](https://phpackages.com/badges/frontpack-lucyjs/health.svg)](https://phpackages.com/packages/frontpack-lucyjs)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
