Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lucia

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lucia

Tiny JavaScript library for web applications

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
39K
decreased by-4.27%
Maintainers
1
Weekly downloads
 
Created
Source

Lucia · NPM Version GitHub license PRs Welcome

Currently in heavy development (learning project). Do not use in production.

Lucia is a tiny JavaScript library for web applications.

  • Declarative: Lucia makes it painless to create interactive UIs. Design simple views for each state in your application, and Lucia will efficiently update and render just the right components when your data changes. Declarative views make your code more predictable, simpler to understand, and easier to debug.
  • Reactive:
  • Flexible:

Installation

Put this within your <head> tags in html.

<!-- development version, includes helpful console warnings -->
<script src="https://unpkg.com/lucia/dist/lucia.js"></script>
<!-- production version, optimized for size and speed -->
<script src="https://unpkg.com/lucia"></script>

Usage

Declarative Rendering

At the core of Lucia is a system that enables us to declaratively render data to the DOM using straightforward template syntax:

<div id="app">
  <p>{{ hello }}</p>
  <p>{{ hello === 'world' }}</p>
</div>
const app = new Lucia({
  el: '#app',
  data: {
    hello: 'world',
  },
});

// Change data
app.data.hello = 'there';

Conditionals

It’s easy to toggle the presence of an element, too:

<div id="app">
  <button l-if="show">You can't see me</button>
  <button l-if="show === show">Is it equal though?</button>
</div>
const app = new Lucia({
  el: '#app',
  data: {
    show: false,
  },
});

Event Handlers

To let users interact with your app, we can use the l-on directive to attach event listeners that invoke methods on our Lucia instances:

<div id="app">
  <button l-on:click="alert(message)">{{ message }}</button>
</div>
const app = new Lucia({
  el: '#app',
  data: {
    message: 'Hello world!',
  },
});

Attribute Binding

In addition to text interpolation, we can also bind element attributes like this:

<div id="app">
  <h1 l-bind:class="{ hello: show }">Classes are cool</h1>
  <h1 l-bind:style="color">Styles are sassy</h1>
</div>
const app = new Lucia({
  el: '#app',
  data: {
    show: true,
    // You can also reference data vs inputing an object in the directive itself
    color: { color: 'purple' }, 
  },
});

Keywords

FAQs

Package last updated on 03 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc