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.
svelte-formula
Advanced tools
Formula is a library for Svelte with features for creating Zero Configuration reactive forms and fully data-driven applications.
Out-of-the box it's designed to work with HTML5 forms. Configuring your forms validation is as easy as setting attributes, and doesn't get in the way of things like Accessibility.
npm i svelte-formula
All you need is a element container with the Svelte use directive and form input
fields with their name
property set.
<script>
import { formula } from 'svelte-formula'
const { form, formIsValid, validity, touched } = formula();
// Here we can provide a default value
export let projectname = '';
// You can calculate values for valid UI states
$: projectNameInvalid = $touched?.projectName && validity?.projectName?.invalid
</script>
<div use:form>
<label for="project-name">Project Name</label>
<input type="text" name="projectName" required minlength="8" class:error={projectNameInvalid} bind:value={projectName} />
<span hidden={!projectNameInvalid}>{validity?.projectName?.message}</span>
<button disabled={!$formIsValid}>Update Project Name</button>
</div>
Visit the documentation for more details API instructions.
id
attributes, with an array of results sorted by ID alphabeticallyformula
optionsformula
optionsIcon made by Eucalyp from flaticon.com
[0.7.0] 2021-02-19
defaultValues
option that allows default values to be set on fields - supports single and multi-value properties -
these values are only applied if there is no value already bound to the field.
<script>
import {formula} from 'svelte-formula';
const { form } = formula({
defaultValues: {
textField: 'Initial Value',
numberField: 42,
checkBox: true,
multiValue: ['option1', 'option3']
}
})
</script>
Added isFormReady
store - Formula stores are created immediately when using the formula
method, previously they
were always empty objects filled with keys from parsing the form. This meant early binding would cause an error and
forced the use of ?.
operators in the templates. This store can now be used as {#if $isFormReady}
, reducing the
need for the number of conditionals in templates
initialValues
store that contains the values at form initialisation, this is generated from merging any initial
element values merged with any potential default values
formReset
function that when called will reset the form to the pristine state at setup time
FAQs
Reactive Forms for Svelte
The npm package svelte-formula receives a total of 96 weekly downloads. As such, svelte-formula popularity was classified as not popular.
We found that svelte-formula demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.