@lighten/ltn-element
v0.0.8
Published
Webcomponent ltn-element following open-wc recommendations
Readme
<ltn-element>
This webcomponent follows the open-wc recommendation.
What this library is for
ltn-element is a Lit-based utility library for building custom elements that can:
- organize component trees with explicit scopes (
ROOT,AGGREGATE,COMPOSITE,CHILD), - discover and share services across parent/child and shadow DOM boundaries,
- communicate through lightweight event subscription/dispatch patterns,
- and use consistent leveled logging for diagnostics.
The package exposes four main building blocks:
LtnElement: base class that adds scope, root discovery, and service lookup helpers on top ofLitElement.LtnTrader: hidden service registry/locator element used to register and resolve services by type (and optional name).LtnService: service-oriented base class with subscribe/unsubscribe and custom event dispatch helpers.LtnLogger: logger withERROR,WARN,INFO,DEBUG, andSYSlevels.
In short, this library provides infrastructure for larger Lit component systems where components need structured composition, shared services, and observable behavior.
Installation
npm i ltn-elementUsage
<script type="module">
import 'ltn-element/ltn-element.js';
</script>
<ltn-element></ltn-element>Linting and formatting
To scan the project for linting and formatting errors, run
npm run lintTo automatically fix linting and formatting errors, run
npm run formatTesting with Web Test Runner
To execute a single test run:
npm run testTo run the tests in interactive watch mode run:
npm run test:watchDemoing with Storybook
To run a local instance of Storybook for your component, run
npm run storybookTo build a production version of Storybook, run
npm run storybook:buildTooling configs
For most of the tools, the configuration is in the package.json to reduce the amount of files in your project.
If you customize the configuration a lot, you can consider moving them to individual files.
Local Demo with web-dev-server
npm startTo run a local development server that serves the basic demo located in demo/index.html
