diff --git a/.changeset/README.md b/.changeset/README.md index 0df73d6..f08f492 100644 --- a/.changeset/README.md +++ b/.changeset/README.md @@ -1,3 +1,35 @@ # Changesets Run `pnpm changeset` for every user-facing change. + +## Writing changelog entries + +Changeset descriptions are published directly on the documentation website. Write them for library users rather than repository maintainers. + +- Lead with the user-visible outcome and name the affected API when useful. +- Keep the entry short and specific. One to three brief paragraphs is usually enough. +- Use separate paragraphs when they make the outcome, motivation, or migration clearer. +- Use inline code for API names, types, and short expressions. +- Include at most one small fenced TypeScript example when an API is added or its usage changes meaningfully. +- For a breaking change, state what changed and show the replacement or migration directly. +- Omit commit hashes, pull request numbers, implementation history, test details, and internal refactoring unless they affect users. + +A typical API entry looks like: + +````md +Add `Machine.example` for describing the user-visible behavior. + +Use it when a short explanation would not make the new calling pattern clear: + +```ts +const value = Machine.example(input) +``` +```` + +Prefer a shorter entry without an example for fixes and internal improvements: + +```md +Fix resumed machines so nested history is restored before raised events are processed. + +This preserves the same observable transition order as a freshly started machine. +``` diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d018710..b0bb2f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,6 +62,7 @@ jobs: example: needs: discover-examples + if: needs.discover-examples.outputs.required == 'true' strategy: fail-fast: false matrix: diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 39d1129..3a931de 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -22,6 +22,8 @@ jobs: pages: read steps: - uses: actions/checkout@v7 + with: + fetch-depth: 0 - uses: pnpm/action-setup@v6 - uses: actions/setup-node@v7 with: diff --git a/AGENTS.md b/AGENTS.md index 830348d..50e60c0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -49,5 +49,5 @@ Every package directly below `examples/` must have a `check` script and a commit ## Pull request conventions -- Add or update a changeset for changes under `src/` or changes to `package.json`. +- Add or update a changeset for changes under `src/` or changes to `package.json`, following the changelog-writing guide in `.changeset/README.md`. - Fill in the pull request template, including the validation performed and the changeset decision. diff --git a/CHANGELOG.md b/CHANGELOG.md index 262f7e1..37d23c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,31 @@ ### Minor Changes -- b192484: Allow state query helpers to inspect extracted snapshot subtrees, and add - equality-aware `AtomMachine.selectSnapshot` and `selectSnapshotChild` - combinators. +- b192484: Allow `Machine.defineStates` query helpers to inspect an extracted + snapshot subtree. Paths remain absolute and type-safe, but `get`, + `getSnapshot`, and `matches` can now continue from a snapshot selected + earlier instead of requiring the complete root snapshot. + + ```ts + const readySnapshot = States.getSnapshot(snapshot, "Ready") + + if (Option.isSome(readySnapshot)) { + States.get(readySnapshot.value, "Ready.editor") + States.matches(readySnapshot.value, "Ready.editor.Editing") + } + + const editorSnapshotAtom = AtomMachine.selectSnapshot( + machineAtom, + "Ready.editor" + ) + ``` + + Add equality-aware `AtomMachine.selectSnapshot` and + `AtomMachine.selectSnapshotChild` combinators for reactive consumers that + need the complete logical snapshot subtree instead of only its state value. + The selected atoms retain nested topology, suppress structurally equal + updates, and produce `Option.none()` while the path or invoked child is + inactive. ## 0.6.1 diff --git a/scripts/api-reference-site/api-reference-site.test.mjs b/scripts/api-reference-site/api-reference-site.test.mjs index 21576af..172b79d 100644 --- a/scripts/api-reference-site/api-reference-site.test.mjs +++ b/scripts/api-reference-site/api-reference-site.test.mjs @@ -7,9 +7,13 @@ import { normalizeBasePath, normalizeGitHubStars, normalizeOrigin, + parseChangelog, + parseChangeset, + renderChangelogPage, renderIndexPage, renderLayout, renderMarkdown, + renderModulePage, renderRobots, renderSitemap, siteManifest, @@ -30,6 +34,22 @@ test("renders documentation prose while escaping source HTML", () => { assert.doesNotMatch(renderMarkdown(""), /