From 9d0c1e1036151604369b3fcf6e0e6b02c9e79ccc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 10:09:40 -0400 Subject: [PATCH] Version Packages (#5076) Co-authored-by: github-actions[bot] --- .changeset/moody-days-develop.md | 29 ----------------- .changeset/silver-maps-grab.md | 26 --------------- packages/xstate-store/CHANGELOG.md | 52 ++++++++++++++++++++++++++++++ packages/xstate-store/package.json | 2 +- 4 files changed, 53 insertions(+), 56 deletions(-) delete mode 100644 .changeset/moody-days-develop.md delete mode 100644 .changeset/silver-maps-grab.md diff --git a/.changeset/moody-days-develop.md b/.changeset/moody-days-develop.md deleted file mode 100644 index 161e25ed06..0000000000 --- a/.changeset/moody-days-develop.md +++ /dev/null @@ -1,29 +0,0 @@ ---- -'@xstate/store': minor ---- - -There is a new single-argument config API for `createStore(config)`: - -```ts -const store = createStore({ - // Types (optional) - types: { - emitted: {} as { type: 'incremented' } - }, - - // Context - context: { count: 0 }, - - // Transitions - on: { - inc: (context, event: { by: number }, enq) => { - enq.emit({ type: 'incremented' }); - - return { count: context.count + event.by }; - }, - dec: (context, event: { by: number }) => ({ - count: context.count - event.by - }) - } -}); -``` diff --git a/.changeset/silver-maps-grab.md b/.changeset/silver-maps-grab.md deleted file mode 100644 index cd7403efe8..0000000000 --- a/.changeset/silver-maps-grab.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -'@xstate/store': minor ---- - -You can now emit events from a store: - -```ts -import { createStore } from '@xstate/store'; - -const store = createStore({ - context: { - count: 0 - }, - on: { - increment: (context, event, { emit }) => { - emit({ type: 'incremented' }); - return { count: context.count + 1 }; - } - } -}); - -store.on('incremented', () => { - console.log('incremented!'); -}); -``` - diff --git a/packages/xstate-store/CHANGELOG.md b/packages/xstate-store/CHANGELOG.md index 3b43758e8b..26fc9b6603 100644 --- a/packages/xstate-store/CHANGELOG.md +++ b/packages/xstate-store/CHANGELOG.md @@ -1,5 +1,57 @@ # @xstate/store +## 2.4.0 + +### Minor Changes + +- [#5064](https://github.com/statelyai/xstate/pull/5064) [`84aca37d0b02cb9cd5a32c8fd09e487bd8fe2a47`](https://github.com/statelyai/xstate/commit/84aca37d0b02cb9cd5a32c8fd09e487bd8fe2a47) Thanks [@davidkpiano](https://github.com/davidkpiano)! - There is a new single-argument config API for `createStore(config)`: + + ```ts + const store = createStore({ + // Types (optional) + types: { + emitted: {} as { type: 'incremented' } + }, + + // Context + context: { count: 0 }, + + // Transitions + on: { + inc: (context, event: { by: number }, enq) => { + enq.emit({ type: 'incremented' }); + + return { count: context.count + event.by }; + }, + dec: (context, event: { by: number }) => ({ + count: context.count - event.by + }) + } + }); + ``` + +- [#5064](https://github.com/statelyai/xstate/pull/5064) [`84aca37d0b02cb9cd5a32c8fd09e487bd8fe2a47`](https://github.com/statelyai/xstate/commit/84aca37d0b02cb9cd5a32c8fd09e487bd8fe2a47) Thanks [@davidkpiano](https://github.com/davidkpiano)! - You can now emit events from a store: + + ```ts + import { createStore } from '@xstate/store'; + + const store = createStore({ + context: { + count: 0 + }, + on: { + increment: (context, event, { emit }) => { + emit({ type: 'incremented' }); + return { count: context.count + 1 }; + } + } + }); + + store.on('incremented', () => { + console.log('incremented!'); + }); + ``` + ## 2.3.0 ### Minor Changes diff --git a/packages/xstate-store/package.json b/packages/xstate-store/package.json index bbbb951b0c..2627438dd8 100644 --- a/packages/xstate-store/package.json +++ b/packages/xstate-store/package.json @@ -1,6 +1,6 @@ { "name": "@xstate/store", - "version": "2.3.0", + "version": "2.4.0", "description": "Simple stores", "keywords": [ "store",