Gathering detailed insights and metrics for @substrate-system/email
Gathering detailed insights and metrics for @substrate-system/email
Gathering detailed insights and metrics for @substrate-system/email
Gathering detailed insights and metrics for @substrate-system/email
npm install @substrate-system/email
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
-70.6%
10
Compared to previous day
Last Week
-20.7%
138
Compared to previous week
Last Month
114.9%
881
Compared to previous month
Last Year
0%
1,459
Compared to previous year
2
23
Web component for email inputs.
featuring:
abc@domain.tld
valid
and invalid
events when validity changes1npm i -S @substrate-system/email
This exposes ESM and common JS via package.json exports
field.
1import { email } from '@substrate-system/email'
1const { email } = require('@substrate-system/email')
See ./example, and the demo page.
1import { SubstrateEmail } from '@substrate-system/email' 2import { SubstrateButton } from '@substrate-system/button' 3SubstrateEmail.define() 4SubstrateButton.define() 5const qs = document.querySelector 6 7const input = qs('form substrate-email') 8input?.addEventListener('valid', ev => { 9 console.log('We are valid!', ev) 10 qs('substrate-button')!.disabled = false 11}) 12 13input?.addEventListener('invalid', ev => { 14 console.log('no longer valid....', ev) 15 qs('substrate-button')!.disabled = true 16})
The package.json
exposes css, suitable for vite
or esbuild
:
1import '@substrate-system/email/css'
Or minified:
1import '@substrate-system/email/css/min'
If using a CSS processor, you can import from the CSS files:
1@import url("../node_modules/@substrate-system/email/dist/index.min.css");
1substrate-email { 2 --bgc: #fafafa; 3 --color: black; 4 --focus: #005fcc; 5 --error-color: red; 6}
You can set a name for this custom element with the static method
define
. To use the default name, substrate-email
, just import and
call .define()
.
[!CAUTION]
If you change the name of the web component, it will break the CSS.
1import { SubstrateEmail } from '@substrate-system/email' 2 3// create a web component named `substrate-email` 4SubstrateEmail.define()
Override the tag
property to change the tag name:
1import { SubstrateEmail } from '@substrate-system/email' 2 3// set a custom name 4SubstrateEmail.TAG = 'cool-input' 5 6SubstrateEmail.define()
1<div> 2 <substrate-email></substrate-email> 3</div>
This package exposes minified JS and CSS files too. Copy them to a location that is accessible to your web server, then link to them in HTML.
1cp ./node_modules/@substrate-system/email/dist/index.min.js ./public/substrate-email.min.js 2cp ./node_modules/@substrate-system/email/dist/style.min.css ./public/substrate-email.css
1<head> 2 <link rel="stylesheet" href="./substrate-email.css"> 3</head> 4<body> 5 <!-- ... --> 6 <script type="module" src="./substrate-email.min.js"></script> 7</body>
No vulnerabilities found.