Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@simplux/core

MrWolfZ237MIT0.18.0TypeScript support: included

The core package of simplux. Contains everything to manage your application state in a simple way.

immer, redux, selectors, simplux, state, typescript

readme

@simplux/core

This is the core package of simplux. Usually you would expect some kind of API documentation here. However, simplux has a different approach to documentation: recipes. They will show you how simplux can make life simple for you. In addition, due to our use of TypeScript, all API documentation you would want is contained in the code itself.

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

0.18.0 (2022-08-27)

Note: Version bump only for package @simplux/platform

0.18.0-alpha.13 (2022-08-27)

Bug Fixes

  • core: do not memoize selector args when selector throws (a982e61)

Features

  • react: upgrade to react 18 (604c3cc)

0.18.0-alpha.12 (2021-01-02)

Bug Fixes

  • browser-router: fix currentNavigationUrl result if navigations are cancelled or rejected (d10124e)
  • router: fix navigationIsInProgress result if navigations are cancelled or rejected (cd249ae)

0.18.0-alpha.11 (2021-01-01)

Features

  • browser-router: support adding child routes (569bea2)
  • router: add property to onNavigateTo args to indicate whether navigation is to child route (7982240)
  • router: support adding child routes (31ce3b7)

0.18.0-alpha.10 (2020-12-30)

Features

  • browser-router: support array parameters (6564a7a)

0.18.0-alpha.9 (2020-12-30)

Features

  • browser-router: allow onNavigateTo callbacks to cancel the navigation (65c42b5)
  • router: allow onNavigateTo callbacks to cancel the navigation (00e81e1)

Performance Improvements

  • browser-router: memoize calls to href (36e470f)

0.18.0-alpha.8 (2020-12-27)

Features

  • router: notify onNavigateTo if navigation is cancelled (9989b1b)

0.18.0-alpha.7 (2020-12-27)

Features

  • browser-router: handle origin when navigating to URL (67ba0df)
  • router: add route configuration option for intercepting navigation (fa4ca34)
  • router: add selector to check if a navigation is in progress (4c047fa)

0.18.0-alpha.6 (2020-12-26)

Bug Fixes

  • browser-router: fix error during activation (0f721f6)

0.18.0-alpha.5 (2020-12-26)

Bug Fixes

  • browser-router: set url in location module when navigating by ID (bc2e2b6)
  • react: call mocked selectors in useSimplux hook (c575d77)
  • testing: fix signature of mockSelector and add type tests (b5348f8)

Features

  • testing: add function to mock selectors (fded6f7)

0.18.0-alpha.4 (2020-12-26)

Bug Fixes

  • core: do not throw if first argument for mutation is undefined (04ae60a)

0.18.0-alpha.3 (2020-12-26)

Bug Fixes

  • browser-router: update browser location when navigating to route programmatically (5f8bd58)
  • core: fix mutations from module scope getting lost during app initialization (81cc625)

Features

  • browser-router: add selector for checking if any route is active (0f7c644)
  • router: add selector for checking if any route is active (9ff3914)

0.18.0-alpha.2 (2020-12-25)

Bug Fixes

  • core: ensure effect functions have the correct name (4d6051e)
  • core: fix falsy first mutation argument being swallowed (f5a0b70)

Features

  • browser-router: basic implementation for parsing templates and generating href strings (9e3b586)
  • browser-router: listen to browser location changes and push history entries (fb54212)
  • browser-router: navigate to route by URL (9e5a2dd)
  • router: basic router implementation (c226d20)
  • router: make parameters for navigateTo optional if possible (ea00dc5)

0.18.0-alpha.1 (2020-12-23)

Note: Version bump only for package @simplux/platform

0.18.0-alpha.0 (2020-12-23)

Bug Fixes

  • core: allow mutations and selectors to have their own tsdoc comments (48a7a2c)
  • core: ensure effect type only uses function signature of passed effect function (6f03c3e)

Features

  • add export specifications to package definitions to allow direct esm imports (05c11a2)

0.17.0 (2020-12-19)

Features

  • core: remove internal types and functions from public API definitions (c1e5adb)

0.16.1-alpha.0 (2020-12-19)

Note: Version bump only for package @simplux/platform

0.16.0 (2020-12-18)

Bug Fixes

  • core: fix generic effects not working properly (f089ccd)

Features

  • recipes: update recipe for creating testable side effects to use new createEffects function (d678f1c)

0.15.0 (2020-12-18)

Features

  • core: add function for creating multiple named effects at once (042c93a)

0.14.0 (2020-09-30)

Bug Fixes

  • core: handle arrays, sets, and maps properly in utility types "Mutable" and "Immutable" (43c266e)

Features

  • core: make getState and selector return values immutable (5efebfd)
  • recipes: add quickstart counter example (e979c48)
  • recipes: add quickstart react example (58588dc)

0.13.0 (2020-04-13)

Note: Version bump only for package @simplux/platform

0.13.0-alpha.8 (2020-04-12)

Bug Fixes

  • core: properly infer mutation types for immutable state type (ad26a85)

0.13.0-alpha.7 (2020-04-12)

Bug Fixes

  • core: ensure state parameter for mutations is always mutable (3c13ee0)
  • core: throw error if name is not provided when creating module (90087ed)

0.13.0-alpha.6 (2020-04-11)

Note: Version bump only for package @simplux/platform

0.13.0-alpha.5 (2020-04-11)

Features

Note: Version bump only for package @simplux/platform

0.13.0-alpha.4 (2020-04-11)

Note: Version bump only for package @simplux/platform

0.13.0-alpha.3 (2020-04-11)

Note: Version bump only for package @simplux/platform

0.13.0-alpha.2 (2020-04-11)

Note: Version bump only for package @simplux/platform

0.13.0-alpha.1 (2020-04-11)

Note: Version bump only for package @simplux/platform

0.13.0-alpha.0 (2020-04-11)

Features

  • core: remove invariant checks from production bundle (cd66ab3)

0.12.0 (2020-04-05)

Features

  • core: add function isSimpluxModule to check if an object is a simplux module (da621f6)
  • core: add shorthand overload for for createSimpluxModule (baecf36)
  • react: add overload for useSimplux that selects a module's value with an inline selector (0f8d917)
  • react: add overload for useSimplux that selects a module's value without selector (8f7745e)

0.11.0 (2019-12-15)

Features

  • core: memoize selector results (c7e0787)
  • recipes/advanced/communicating-between-modules: add new recipe (57dd921)
  • recipes/react/using-hot-module-reloading: add recipe (13e09a9)
  • recipes/react/using-lazy-loading-code-splitting: add recipe (2a06b58)

0.10.2 (2019-11-25)

Note: Version bump only for package @simplux/platform

0.10.2-alpha.0 (2019-11-25)

Note: Version bump only for package @simplux/platform

0.10.1 (2019-11-25)

Performance Improvements

  • react: in provider only call module subscribers if the module's state has changed (2543897)
  • react: reduce the number of times a component needs to resubscribe to the store (c76aa37)

0.10.0 (2019-11-24)

Note: Version bump only for package @simplux/platform

0.10.0-alpha.2 (2019-11-24)

Note: Version bump only for package @simplux/platform

0.10.0-alpha.1 (2019-11-24)

Note: Version bump only for package @simplux/platform

0.10.0-alpha.0 (2019-11-24)

Bug Fixes

  • core: ensure immer reducer keeps working if invocation of reducer throws (f0e87eb)
  • testing: clear state mocks when clearing all simplux mocks (faf7e11)

Features

  • core: add options argument to subscribeToStateChanges to allow skipping initial invocation (f096b98)
  • preset: add default preset package for simple installation (4b97dd8)
  • preset-angular: add preset package for Angular (70ef486)
  • preset-react: add preset package for React (94b5920)
  • react: memoize selector result in useSimplux (4e7edcc)
  • react: replace createSelectorHook with useSimplux (7ae26b5)
  • testing: return a tuple of handler and clear function from mockMutation and mockEffect (f20382c)

0.9.0 (2019-09-15)

Bug Fixes

  • core: fix erroneous absolute reference (c7988d1)
  • testing: add missing export (0f44b67)
  • testing: properly clear effect mocks when clearing all mocks (1ae4c45)

Features

  • core: prevent accidentally dispatching a mutation from within another mutation (9644645)
  • recipes: add recipe for "performing side effects" (fe62e80)
  • recipes: add recipe for "testing my code that triggers side effects" (23ad484)
  • recipes: add recipe for "testing my side effects" (67002f5)
  • testing: allow mocking effects (4155efe)

0.9.0-alpha.0 (2019-09-15)

Bug Fixes

  • core: prevent functions from being used as mutation arguments (945441e)

Features

  • core: allow creating effects (57c921a)
  • core: allow listening to other module's mutations (f0b5505)

0.8.0 (2019-06-26)

Note: Version bump only for package @simplux/platform

0.8.0-alpha.2 (2019-06-26)

Note: Version bump only for package @simplux/platform

0.8.0-alpha.1 (2019-06-26)

Note: Version bump only for package @simplux/platform

0.8.0-alpha.0 (2019-06-26)

Features

  • core: add selectors functionality to core package (40a820f)

0.7.0 (2019-06-26)

Features

  • recipes: add recipe for "testing my Angular components" (34eb7a5)
  • recipes: add recipe for "using simplux in my Angular application" (5697f84)

0.7.0-alpha.4 (2019-06-25)

Features

  • angular: add method to service base for observing all state changes (a847d68)

0.7.0-alpha.3 (2019-06-25)

Note: Version bump only for package @simplux/platform

0.7.0-alpha.2 (2019-06-25)

Features

  • angular: create package for using simplux in angular applications (00fb2a8)

0.7.0-alpha.1 (2019-06-24)

Bug Fixes

  • core: ensure destructuring subscription does not conflict with type inference (592d8a2)

0.7.0-alpha.0 (2019-06-24)

Features

  • async: create extension package for adding asynchronous tasks to modules (af68996)
  • core: return handler when subscribing to state changes to make testing simpler (257f2df)
  • recipes: add recipe for "reacting to state changes" (b6ac371)
  • testing: add mocking support for async tasks (4a0d417)

0.6.0 (2019-06-23)

Bug Fixes

  • react: fix incorrect signature for handlers in subscriber batching (69f20ab)

Features

  • core: provide previous state as second arg to state change listeners for easier state diffing (5561e63)
  • recipes: add recipe for "creating non-trivial modules" (5b8ba4e)

0.6.0-alpha.3 (2019-06-22)

Bug Fixes

  • core-testing: fix multiple module mutation mocks interfering with each other (b19ba6a)

Features

  • core: add support for mocking module state (d546989)
  • core: add support for writing mutable/immer-style mutations (4cc1af0)
  • core: call subscriber immediately with current module state when subscribing (ed04c47)
  • core-testing: add new function mockModuleState that allows mocking a module's state (7d8fd90)
  • observe: add observe extension package that allows subscribing to module changes with RxJS (f518bfa)
  • recipes: add example for class component to "using simplux in my React application" (5ecc088)
  • recipes: add recipe for "organizing my application state" (0dd07b5)
  • recipes: add text version of "testing my React components that read and change state" (13b9b86)
  • recipes: use explicit mocking functions instead of members in "test components using state" (463685b)

Performance Improvements

  • core: optimize mutation performance by reducing number of string operations during evaluation (9f6fc54)

0.6.0-alpha.2 (2019-06-11)

Features

  • react: add module name as property to selector hook (c6b1897)
  • react-testing: use explicit functions instead of members for mocking selector hook states (bb954f8)

0.6.0-alpha.1 (2019-06-11)

Features

  • core: add a unique type identifier to each mutation (7994d22)
  • recipes: add example for using selector as factory in "testing components using state" (38dea9c)
  • recipes: add example for using selector as factory in "using in React application" (9fb5955)

0.6.0-alpha.0 (2019-06-11)

Features

  • recipes: add code for new react recipe "testing components using state" (a2e8e4e)
  • selectors: allow calling selector as a factory to return a selector that just takes the state (062cd60)

0.5.0 (2019-06-10)

Features

  • react: allow other extensions to add functionality to module selector hook (1184324)
  • react-testing: add new extension package for testing with React (4721323)
  • recipes: add recipe for "testing my code that uses mutations" (5c81615)

0.5.0-alpha.0 (2019-06-10)

Features

  • core-testing: allow controlling how often a mutation will be mocked (aa340e7)

0.4.3-alpha.0 (2019-06-10)

0.4.2 (2019-06-10)

0.4.1 (2019-06-10)

Bug Fixes

  • core: ignore "accidental" mutation args that are HTML events (6776d7a)
  • core-testing: add missing API exports (af4bbd8)

0.4.0 (2019-06-09)

Bug Fixes

  • recipes: add missing dependency for "composing mutations" (5279cbd)

Features

  • core: allow to specify order when registering module extension which allows composition (d352c95)
  • core-testing: add new extension package "core-testing" (05c194e)
  • recipes: add recipe for "composing selectors" (b7ef2f6)
  • recipes: add recipe for "debugging with Redux DevTools" (d5fbe1f)
  • recipes: add recipe for "using simplux in my React application" (cb2818d)
  • recipes: improve "debugging with Redux DevTools" recipe (0de089b)

0.3.0 (2019-06-09)

Features

  • recipes: add recipe for "composing mutations" (46cdb4b)

0.3.0-alpha.4 (2019-06-09)

Bug Fixes

  • core: ensure module state is set in redux store when module is created (cd53ac9)
  • immer: ensure composing mutations works correctly (ecff6a0)
  • recipes: add missing dependency to "simplifying state changes" recipe (8931146)
  • recipes: fix "testing derived state" not working correctly in code sandbox (97fc902)

Features

  • core: freeze state during mutations in development mode (6fc9786)
  • recipes: add recipe for "simplifying state changes" (7c77384)
  • recipes: add recipe for "testing derived state" (61418c3)
  • recipes: add recipe for "using simplux in my application that already uses Redux" (eb9e1f7)

0.3.0-alpha.3 (2019-06-08)

Features

  • recipes: add text version of "computing derived state" recipe (8866d53)
  • recipes: make "testing state changes" recipe simpler and add text version (d3b7029)
  • selectors: ensure compatibility with TypeScript 3.3 (e920de9)

0.3.0-alpha.2 (2019-06-05)

Bug Fixes

  • core: ensure mutation type inference works with TypeScript 3.3.3 (4da619a)

Features

  • core: automatically create redux store for simple scenarios (0d2ac13)
  • recipes: add text version of "getting started" recipe (24f21dc)
  • recipes: simplify "getting started" recipe (aed2ca4)

0.3.0-alpha.1 (2019-06-02)

Bug Fixes

  • core: ensure mutation functions have the correct name (91ace5a)
  • selectors: ensure selector functions have the correct name (a352bda)

0.3.0-alpha.0 (2019-06-02)

Bug Fixes

  • immer: add missing exports to public API (87d406a)
  • react: add missing exports to public API (08226e9)
  • selectors: add missing exports to public API (d8c3513)

Features

  • react: use react batching to notify module selector hooks (d83dc43)

0.2.3-alpha.0 (2019-06-02)

0.2.2 (2019-06-02)

0.2.1 (2019-06-02)

0.2.0 (2019-06-02)

Bug Fixes

  • core: add missing export (4a04651)

Features

  • core: allow calling mutation as action creator (86325a7)
  • core: allow subscribing to module state changes (510a0b2)
  • core: pass module core to extensions (2604030)
  • core: require external redux store to be provided (3586d98)
  • recipes: add getting-started recipe (4a7ec45)
  • selectors: throw when existing selector is declared again (8e81a71)

0.6.0-alpha.3 (2019-06-22)

Bug Fixes

  • core-testing: fix multiple module mutation mocks interfering with each other (b19ba6a)

Features

  • core: add support for mocking module state (d546989)
  • core: add support for writing mutable/immer-style mutations (4cc1af0)
  • core: call subscriber immediately with current module state when subscribing (ed04c47)
  • core-testing: add new function mockModuleState that allows mocking a module's state (7d8fd90)
  • observe: add observe extension package that allows subscribing to module changes with RxJS (f518bfa)
  • recipes: add example for class component to "using simplux in my React application" (5ecc088)
  • recipes: add recipe for "organizing my application state" (0dd07b5)
  • recipes: add text version of "testing my React components that read and change state" (13b9b86)
  • recipes: use explicit mocking functions instead of members in "test components using state" (463685b)

Performance Improvements

  • core: optimize mutation performance by reducing number of string operations during evaluation (9f6fc54)

0.6.0-alpha.2 (2019-06-11)

Features

  • react: add module name as property to selector hook (c6b1897)
  • react-testing: use explicit functions instead of members for mocking selector hook states (bb954f8)

0.6.0-alpha.1 (2019-06-11)

Features

  • core: add a unique type identifier to each mutation (7994d22)
  • recipes: add example for using selector as factory in "testing components using state" (38dea9c)
  • recipes: add example for using selector as factory in "using in React application" (9fb5955)

0.6.0-alpha.0 (2019-06-11)

Features

  • recipes: add code for new react recipe "testing components using state" (a2e8e4e)
  • selectors: allow calling selector as a factory to return a selector that just takes the state (062cd60)

0.5.0 (2019-06-10)

Features

  • react: allow other extensions to add functionality to module selector hook (1184324)
  • react-testing: add new extension package for testing with React (4721323)
  • recipes: add recipe for "testing my code that uses mutations" (5c81615)

0.5.0-alpha.0 (2019-06-10)

Features

  • core-testing: allow controlling how often a mutation will be mocked (aa340e7)

0.4.3-alpha.0 (2019-06-10)

Note: Version bump only for package @simplux/platform

0.4.2 (2019-06-10)

Note: Version bump only for package @simplux/platform

0.4.1 (2019-06-10)

Bug Fixes

  • core: ignore "accidental" mutation args that are HTML events (6776d7a)
  • core-testing: add missing API exports (af4bbd8)

0.4.0 (2019-06-09)

Bug Fixes

  • recipes: add missing dependency for "composing mutations" (5279cbd)

Features

  • core: allow to specify order when registering module extension which allows composition (d352c95)
  • core-testing: add new extension package "core-testing" (05c194e)
  • recipes: add recipe for "composing selectors" (b7ef2f6)
  • recipes: add recipe for "debugging with Redux DevTools" (d5fbe1f)
  • recipes: add recipe for "using simplux in my React application" (cb2818d)
  • recipes: improve "debugging with Redux DevTools" recipe (0de089b)

0.3.0 (2019-06-09)

Features

  • recipes: add recipe for "composing mutations" (46cdb4b)

0.3.0-alpha.4 (2019-06-09)

Bug Fixes

  • core: ensure module state is set in redux store when module is created (cd53ac9)
  • immer: ensure composing mutations works correctly (ecff6a0)
  • recipes: add missing dependency to "simplifying state changes" recipe (8931146)
  • recipes: fix "testing derived state" not working correctly in code sandbox (97fc902)

Features

  • core: freeze state during mutations in development mode (6fc9786)
  • recipes: add recipe for "simplifying state changes" (7c77384)
  • recipes: add recipe for "testing derived state" (61418c3)
  • recipes: add recipe for "using simplux in my application that already uses Redux" (eb9e1f7)

0.3.0-alpha.3 (2019-06-08)

Features

  • recipes: add text version of "computing derived state" recipe (8866d53)
  • recipes: make "testing state changes" recipe simpler and add text version (d3b7029)
  • selectors: ensure compatibility with TypeScript 3.3 (e920de9)

0.3.0-alpha.2 (2019-06-05)

Bug Fixes

  • core: ensure mutation type inference works with TypeScript 3.3.3 (4da619a)

Features

  • core: automatically create redux store for simple scenarios (0d2ac13)
  • recipes: add text version of "getting started" recipe (24f21dc)
  • recipes: simplify "getting started" recipe (aed2ca4)

0.3.0-alpha.1 (2019-06-02)

Bug Fixes

  • core: ensure mutation functions have the correct name (91ace5a)
  • selectors: ensure selector functions have the correct name (a352bda)

0.3.0-alpha.0 (2019-06-02)

Bug Fixes

  • immer: add missing exports to public API (87d406a)
  • react: add missing exports to public API (08226e9)
  • selectors: add missing exports to public API (d8c3513)

Features

  • react: use react batching to notify module selector hooks (d83dc43)

0.2.3-alpha.0 (2019-06-02)

Note: Version bump only for package @simplux/platform

0.2.2 (2019-06-02)

Note: Version bump only for package @simplux/platform

0.2.1 (2019-06-02)

Note: Version bump only for package @simplux/platform