Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
328294c
update library
odama626 Sep 18, 2026
9e37224
account for store batching
odama626 Sep 19, 2026
516c3f5
account for store batching
odama626 Sep 19, 2026
ab4a85f
account for store batching
odama626 Sep 19, 2026
661e8ac
account for store batching
odama626 Sep 19, 2026
0adc348
test: run the suite against solid 2
odama626 Sep 18, 2026
4605a44
test: await the scheduler after every action
odama626 Sep 19, 2026
d9e1f75
docs: write the v2 documentation and run its demos inline
odama626 Sep 19, 2026
6e431e3
build: rebuild the site after the v2 docs landed
odama626 Sep 19, 2026
1cffef6
docs: real state in the submit demo, and shiki highlighting
odama626 Sep 19, 2026
fbbfa27
fix: restore the root field the switcher reads
odama626 Sep 19, 2026
ef60fb6
docs: mdx files are the routes
odama626 Sep 19, 2026
7d181ad
solid version missmatch, submit() returns a boolean for success or fail
odama626 Sep 19, 2026
be19ab9
WIP
odama626 Sep 19, 2026
799a2e1
submit should return true for success
odama626 Sep 19, 2026
4f2b353
test: cover the submit result, and document it
odama626 Sep 19, 2026
c9e6d21
fix: code blocks follow both ways the scheme is chosen
odama626 Sep 19, 2026
dcda2e3
docs: let the kobalte layer style the version switcher
odama626 Sep 19, 2026
12eb728
WIP
odama626 Sep 19, 2026
69fc46c
docs: segmented control for the plan picker, and three more demos
odama626 Sep 19, 2026
8ba1a34
release: 2.0.0, with v2 as the default docs
odama626 Sep 21, 2026
9619e26
test: pin down when the validator accessor is read
odama626 Sep 21, 2026
be638cd
fix to match tests
odama626 Sep 21, 2026
9753700
test: fix the three remaining solid 2 failures
odama626 Sep 21, 2026
8794ffc
ci: continuous releases and docs previews
odama626 Sep 21, 2026
9470044
install
odama626 Sep 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions .github/workflows/docs-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: 📚 Docs Preview

# Publishes each pull request's docs to its own surge.sh domain, comments the
# link on the PR, and tears the site down when the PR closes. Pair it with the
# pkg.pr.new comment from Continuous Releases and a PR has both an installable
# package and the docs that describe it.
#
# Needs one repository secret, SURGE_TOKEN: run `npx surge token` locally.

on:
pull_request:
types: [opened, synchronize, reopened, closed]

permissions:
contents: read
pull-requests: write

concurrency:
group: docs-preview-${{ github.event.pull_request.number }}
cancel-in-progress: true

env:
DOMAIN: sparkstonepdx-solid-validation-pr-${{ github.event.pull_request.number }}.surge.sh

jobs:
deploy:
name: "📚 Deploy docs preview"
# Pull requests from forks get no secrets, so they can't deploy.
if: >-
github.event.action != 'closed' &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v3
with:
# matches packageManager in package.json
version: 12.4.2

- name: Use Node.js 24
uses: actions/setup-node@v4
with:
node-version: 24
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile

# The root build is the library only; the docs build lives in website/
# and builds the library itself first. It writes the newest version and
# the root index into docs/, next to the frozen v1 already committed.
- name: Build
run: pnpm --dir website build

# The site is built for /solid-validation/, the path GitHub Pages serves
# it under, but a surge domain serves from its root. Placing the build
# one directory down keeps every path valid, and a root page forwards.
- name: Stage for surge
run: |
mkdir -p surge/solid-validation
cp -r docs/. surge/solid-validation/
cat > surge/index.html <<'HTML'
<!doctype html>
<meta charset="utf-8" />
<meta http-equiv="refresh" content="0; url=/solid-validation/" />
<a href="/solid-validation/">solid-validation docs</a>
HTML

- name: Deploy to surge.sh
run: pnpm exec surge ./surge "$DOMAIN"
env:
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}

- name: Comment the preview link
uses: actions/github-script@v7
with:
script: |
const marker = '<!-- docs-preview -->';
const body = `${marker}\n📚 Docs preview: https://${process.env.DOMAIN}/solid-validation/\n\nBuilt from ${context.payload.pull_request.head.sha.slice(0, 7)}.`;
const { owner, repo } = context.repo;
const issue_number = context.payload.pull_request.number;
const comments = await github.paginate(github.rest.issues.listComments, { owner, repo, issue_number });
const existing = comments.find(c => c.body?.startsWith(marker));
if (existing) await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body });
else await github.rest.issues.createComment({ owner, repo, issue_number, body });

teardown:
name: "🧹 Tear down docs preview"
if: >-
github.event.action == 'closed' &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v3
with:
version: 12.4.2

- name: Use Node.js 24
uses: actions/setup-node@v4
with:
node-version: 24
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Tear down surge.sh site
run: pnpm exec surge teardown "$DOMAIN"
env:
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}

- name: Mark the comment as removed
uses: actions/github-script@v7
with:
script: |
const marker = '<!-- docs-preview -->';
const { owner, repo } = context.repo;
const issue_number = context.payload.pull_request.number;
const comments = await github.paginate(github.rest.issues.listComments, { owner, repo, issue_number });
const existing = comments.find(c => c.body?.startsWith(marker));
if (existing) {
await github.rest.issues.updateComment({
owner, repo, comment_id: existing.id,
body: `${marker}\n📚 Docs preview removed: the pull request was closed.`,
});
}
48 changes: 48 additions & 0 deletions .github/workflows/pkg-pr-new.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: ⚡️ Continuous Releases

on:
push:
branches:
- main
merge_group:
pull_request:

jobs:
cr:
name: "⚡️ Continuous Releases"

strategy:
fail-fast: false

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v3
with:
# matches packageManager in package.json
version: 12.4.2

- name: Use Node.js 24
uses: actions/setup-node@v4
with:
node-version: 24
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile

# Unlike the css repo, this library has a test suite, so a build that
# fails it is not published as an installable preview.
- name: Test
run: pnpm test

- name: Build
run: pnpm run build

# pkg.pr.new asks that CI runs it from the lockfile rather than through
# dlx, so the version is pinned with everything else. Run from the root,
# it publishes the library only: the docs sites are private.
- name: Release
run: pnpm exec pkg-pr-new publish --compact
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ coverage

# The built site is committed: github pages serves the repo's /docs folder.
!/docs

# Staging directory for surge.sh docs previews, built in CI.
surge
32 changes: 32 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,38 @@ All notable changes to `@sparkstone/solid-validation` will be documented in this
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.0]

Targets Solid 2. **Projects on Solid 1 should stay on 1.x**: this release will
not run there, and 1.6.1 remains supported for Solid 1. The v1 documentation
stays published alongside the v2 docs.

The [migration guide](https://sparkstonepdx.github.io/solid-validation/v2/migrating/)
covers each change below with before and after code.

### Changed
- **Directives are replaced by ref factories.** Solid 2 has no `use:`
directives. `use:validate` becomes `ref={validate()}` and
`use:formSubmit={onSubmit}` becomes `ref={formSubmit(onSubmit)}`.
- **`validate` takes an accessor** returning the validator array:
`ref={validate(() => [minLength(3)])}`.
- **`submit()` returns `Promise<boolean>`**: `true` when the submission went
through, `false` when validation refused or the callback returned errors. It
returned `void` before, so a caller could not tell whether it ran.
- **Cleared errors delete their key** instead of setting it to `undefined`, so
`Object.keys(errors)` lists only fields that are currently failing.
- **Errors arrive on the next flush.** Solid 2 batches store writes, so an error
is no longer in the store in the same tick as the event that caused it.
Rendering is unaffected; imperative reads and tests should wait.
- Peer dependencies are now `solid-js` and `@solidjs/web`, both `^2.0.0-rc.9`.

### Removed
- **`validateRef`.** It existed because a directive could not be passed as a
prop. `validate` returns an ordinary ref callback, so it covers that case:
`ref={props.validate(() => [...])}`.

---

## [1.6.1]

### Changed
Expand Down
13 changes: 0 additions & 13 deletions docs/assets/MarkdownPage-UBS0bX0L.js

This file was deleted.

1 change: 1 addition & 0 deletions docs/assets/SubmitDemo-P88BpRrn.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading