Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@chialab/dna
Advanced tools
DNA • Progressive Web Components
DNA aims to unleash the true power of Custom Elements through a declarative definition API, with builtin elements extension support and a simpler composition mechanism (yes, it does not use ShadowDOM).
DNA simplifies and encourages the use of customized built-in elements, which inherit methods and properties from standard HTML, preserving usability and accessibility features.
DNA offers @property
and @state
decorators for adding reactivity to a component's class fields, ensuring that any changes are reflected in the component's template. These properties and states can be monitored, synchronized with attributes, and trigger change events.
DNA uses event delegation for listening to events from a component's elements or slotted contents, offering the @listen
decorator to streamline the process. Events can be asynchronous and dispatched from the component's class.
DNA uses Quantum instead of ShadowDOM to render slotted children, simplifying the usage of custom elements inside forms and providing a more flexible management of slotted contents. Unlike ShadowDOM, Quantum also works for built-in elements, allowing you to use even inside buttons.
Usage via unpkg.com as ES6 module:
import { Component, define, html, ... } from 'https://unpkg.com/@chialab/dna?module';
Or install via NPM:
npm i @chialab/dna@alpha
yarn add @chialab/dna@alpha
import { Component, customElement, listen, property } from '@chialab/dna';
@customElement('hello-world')
class HelloWorld extends Component {
// define an observed property
@property() name: string = '';
render() {
return (
<>
<input
name="firstName"
value={this.name}
/>
<h1>Hello {this.name || 'World'}!</h1>
</>
);
}
// delegate an event
@listen('change', 'input[name="firstName"]')
private onChange(event: Event, target: HTMLInputElement) {
this.name = target.value;
}
}
Then use the element in your HTML:
<hello-world></hello-world>
Install the dependencies and run the build
script:
yarn install
yarn build
This will generate the bundles in the dist
folder, as well as the declaration files.
Run the test
script:
yarn test
DNA is released under the MIT license.
4.0.0-alpha.10
@listen
decorator.FAQs
Progressive Web Components
The npm package @chialab/dna receives a total of 147 weekly downloads. As such, @chialab/dna popularity was classified as not popular.
We found that @chialab/dna demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.