Scan your whole stack
From OX Research Newsroom
Are you using @samline/forms?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v4.0.1
@samline/forms was last scanned on 26 Nov 2026 at version 4.0.1. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 4.0.1 LATEST | 26 Nov 2026 | No rules fired |
| 4.0.0 | 26 Nov 2026 | No rules fired |
| 2.11.1 | 14 Nov 2026 | No rules fired |
| 2.11.0 | 13 Nov 2026 | Not shown |
| 2.10.0 | 13 Nov 2026 | Not shown |
Findings for v4.0.1. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 4.0.1; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
Validation, reactive state, serialization and auto-submit for native HTML forms, with a typed, framework-free API for JavaScript and TypeScript.
Demo · Examples · Documentation · Changelog
npm install @samline/forms
pnpm add @samline/forms
bun add @samline/forms
Requires Node 20+ when bundling; the runtime targets ES2020 browsers. Formatting needs the optional peer @samline/formatter (npm install @samline/formatter); validation, state and serialization do not. No runtime stylesheet is required; the application owns form styling.
Keep a native form with named fields. novalidate lets the controller's rules replace the browser's bubbles.
<form id="signup" novalidate>
<label for="email">Email</label>
<input id="email" name="email" type="email" autocomplete="email" aria-describedby="email-error" />
<p id="email-error" data-error-for="email" aria-live="polite"></p>
<button type="submit">Sign up</button>
</form>
import { form } from '@samline/forms'
const signup = form('signup', {
autoValidate: false,
validators: {
email: {
required: { value: true, message: 'Enter your email.' },
pattern: { value: /^[^\s@]+@[^\s@]+\.[^\s@]+$/, message: 'Use a valid email.' },
},
},
})
signup.subscribe(state => {
document.querySelector('#email-error').textContent = state.errors.email?.[0] ?? ''
})
signup.onSubmit(async (_element, _data, formData) => {
await fetch('/api/signup', { method: 'POST', body: formData })
signup.reset()
})
// When the form goes away (route change, component unmount):
// signup.destroy()
Invalid submits are always prevented and focus moves to the first invalid field. Valid submits reach every onSubmit() handler with a plain object, a fresh FormData and a state snapshot.
The standalone build defines window.Forms and already includes @samline/formatter. Pin the version.
<script src="https://cdn.jsdelivr.net/npm/@samline/forms@4.0.1/dist/browser/forms.global.js"></script>
<script>
const signup = window.Forms.form('signup', {
validators: { email: { required: true, pattern: /^[^\s@]+@[^\s@]+\.[^\s@]+$/ } },
})
</script>
window.Forms has form, newForm({ id, options }), destroyForm(id) and the available registry. See Browser global and CDN.
required, minLength, maxLength, pattern, numeric, min, max, sameAs, dependsOn, per-row each and custom validators that read every value.aria-invalid and css-error, filled ones css-filled; a failed submit focuses the first invalid control in document order.subscribe() for the whole form, observe()/watch() for one field.onSubmit(), autoSubmit() with debounce, setErrors() for server responses, prefill() from the URL and reset().name[] inputs and controls linked with form="id", including fields added later.format(), formatAll() and the formats option format phones, cards, dates, times and amounts while a hidden field submits the raw value.validateValues() and validateFieldValue() run the same rules on the server; parseFormData() serializes any form.One controller owns one form's listeners, MutationObserver and auto-submit timer. Create it once the form exists and call destroy() when it goes away. addCleanup() ties your own teardown to the same lifetime. After destroy(), writes and new registrations are no-ops.
| API | Purpose |
|---|---|
form(target, options?) |
Create a controller for an id, HTMLFormElement or { current }. |
createFormController(target, options?) |
The same factory under its descriptive name. |
browser |
{ form, newForm, destroyForm, available } registry singleton. |
parseFormData(form, submitter?) |
Serialize a form into { data, formData }. |
validateValues(values, schema) |
Validate a plain values object against a ValidationSchema. |
validateFieldValue(field, value, rules, values) |
Validate one value. |
@samline/forms/browser |
The registry as a module namespace; also sets globalThis.Forms. |
@samline/forms/browser/global |
The standalone IIFE that defines window.Forms. |
| Entrypoint | When to use |
|---|---|
@samline/forms |
Controller factory, pure validation/serialization helpers and types for ESM or CommonJS. |
@samline/forms/browser |
Module registry that also installs globalThis.Forms. |
@samline/forms/browser/global |
Standalone script with window.Forms and the bundled formatter. |
| Group | Methods |
|---|---|
| Submission | onSubmit, autoSubmit, disableAutoSubmit |
| Validation | validate, revalidate, setErrors, clearErrors |
| State | subscribe, observe, watch, unwatch, getState |
| Values | setValue, setOptions, getValue, getField, getData, prefill, reset |
| Formatting | format, formatAll |
| Lifecycle | element, f, options, append, addCleanup, destroy |
Manual errors set with setErrors() on an editable field block submission by default and stay on the field and in getState().errors after each attempt, until the user edits the field. Manual errors that match no editable control, such as a form-level non_field_errors, never block and are dropped at the next submit attempt.
validators, autoValidate (default true), autoSubmit, clearErrorsOnSubmit (default false), clearManualErrorsOnChange (default true), attributes (default { filled: 'css-filled', error: 'css-error' }) and formats. Every option is described in Configuration options; every type is exported, see the TypeScript reference.
Read the documentation for the full guides and API contracts, and explore working examples with complete and separate source files for both loading modes.
| Guide | What it covers |
|---|---|
| Get started | Installation, the first form, CDN use and cleanup. |
| Examples | Twelve live forms with their code. |
| Validation and errors | Every rule, cross-field checks and accessible messages. |
| State and submission | Subscribers, async submits, auto-submit, prefill and reset. |
| Formatting fields | The optional formatter and the hidden raw mirror. |
| Framework integrations | React, Vue, Svelte, Astro, Shopify and WordPress. |
| API reference | Every method, grouped by task, with one page per method. |
Read CHANGELOG.md or the published changelog for release history and explicitly marked breaking and behavior changes. Review the notes before upgrading.
2.8.0 removes no API. Review these behavior fixes before upgrading: prefill() writes repeated query keys as arrays and auto-submits once; native reset buttons now clear errors and attributes; reset() calls watchers; failed submits focus the first invalid control in document order and automatic submits never move focus; methods called after destroy() no longer change the form; rejected async submit handlers are logged. The Markdown docs/ folder is no longer published to npm; the documentation lives on the website. The optional @samline/formatter peer now requires ^2.1.0, which the standalone script bundles. Read the 2.8.0 notes.
The Forms skill describes 2.8 integration: loading modes, validation rules and accessible messages, state and submission, formatting and host ownership. Pass it to an agent or install it using a skills-compatible tool. Verify the installed package version before applying its guidance.
The maintained repository source and website download are the same file.
Download SKILL.md into a forms/ folder in your agent's supported skill directory. For agents that discover project skills from .agents/skills/:
mkdir -p .agents/skills/forms
curl --fail --location https://samline.github.io/forms/skills/forms/SKILL.md \
--output .agents/skills/forms/SKILL.md
When working from this repository, copy skills/forms/SKILL.md instead. Keep the filename SKILL.md; discovery paths and invocation syntax depend on the agent.
MIT — LICENSE.md.
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.