diff --git a/.changeset/discriminated-ui-state.md b/.changeset/discriminated-ui-state.md deleted file mode 100644 index e3e70a3..0000000 --- a/.changeset/discriminated-ui-state.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@bearstudio/ui-state": minor ---- - -Make `getUiState` a discriminated union of `set()` results. `is()` narrows, `match` data is per-status, and `exhaustive()` is a type error to call while statuses remain. diff --git a/.changeset/is-array.md b/.changeset/is-array.md deleted file mode 100644 index 7fab93d..0000000 --- a/.changeset/is-array.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@bearstudio/ui-state": minor ---- - -Allow `is()` to take an array of statuses, like `when` and `match`. It still narrows the discriminated union to the listed variants. diff --git a/.changeset/status-matching.md b/.changeset/status-matching.md deleted file mode 100644 index 1072a12..0000000 --- a/.changeset/status-matching.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@bearstudio/ui-state": minor ---- - -Allow `getUiState` to take a status string so `.match().exhaustive()` works without a `set()` callback. A wide `string` is a type error, since it cannot be matched exhaustively. diff --git a/.changeset/ts7-oxlint-oxfmt.md b/.changeset/ts7-oxlint-oxfmt.md deleted file mode 100644 index 7d3392a..0000000 --- a/.changeset/ts7-oxlint-oxfmt.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@bearstudio/ui-state": patch ---- - -Upgrade TypeScript to 7.0.2 and replace ESLint/Prettier with oxlint/oxfmt. No public API changes. diff --git a/packages/ui-state/CHANGELOG.md b/packages/ui-state/CHANGELOG.md index e6431b4..0e22cfb 100644 --- a/packages/ui-state/CHANGELOG.md +++ b/packages/ui-state/CHANGELOG.md @@ -1,5 +1,21 @@ # @bearstudio/ui-state +## 2.0.0 + +### Major Changes + +- Make `getUiState` a discriminated union of `set()` results. `is()` narrows, `match` data is per-status, and `exhaustive()` is a type error to call while statuses remain. Callers of 1.1.0 that read `state` without narrowing will fail typecheck. + +### Minor Changes + +- Allow `is()` to take an array of statuses, like `when` and `match`. It still narrows the discriminated union to the listed variants. +- Allow `getUiState` to take a status string so `.match().exhaustive()` works without a `set()` callback. A wide `string` is a type error, since it cannot be matched exhaustively. + +### Patch Changes + +- Upgrade TypeScript to 7.0.2 and replace ESLint/Prettier with oxlint/oxfmt. No public API changes. +- Point published `exports.types` at `./dist/index.d.ts`. `.npmignore` strips `src/`, so the previous `./src/index.ts` path 404'd for consumers under bundler/NodeNext. + ## 1.1.0 ### Minor Changes diff --git a/packages/ui-state/package.json b/packages/ui-state/package.json index a3394b2..31a13a3 100644 --- a/packages/ui-state/package.json +++ b/packages/ui-state/package.json @@ -1,6 +1,6 @@ { "name": "@bearstudio/ui-state", - "version": "1.1.0", + "version": "2.0.0", "description": "A lightweight utility library to easily manage UI display states such as loading, error or any custom-defined state", "keywords": [ "pattern", @@ -25,11 +25,21 @@ "exports": { ".": { "types": "./src/index.ts", + "import": "./dist/index.js", + "require": "./dist/index.cjs", "default": "./dist/index.js" } }, "publishConfig": { - "access": "public" + "access": "public", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "require": "./dist/index.cjs", + "default": "./dist/index.js" + } + } }, "scripts": { "dev": "tsup src/index.ts --format esm,cjs --watch",