@openmrs/esm-state 4.0.0-pre.0 → 4.0.0-pre.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +12 -12
- package/.turbo/turbo-lint.log +2 -2
- package/.turbo/turbo-test.log +1 -1
- package/.turbo/turbo-typescript.log +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/openmrs-esm-state.js +0 -0
- package/dist/openmrs-esm-state.js.map +0 -0
- package/dist/public.d.ts +1 -0
- package/dist/state.d.ts +31 -0
- package/dist/updateStore.d.ts +24 -0
- package/package.json +2 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
1
|
+
[33m@openmrs/esm-state:build: [0mcache hit, replaying output [2m57a7666620734323[0m
|
|
2
|
+
[33m@openmrs/esm-state:build: [0m$ webpack --mode=production
|
|
3
|
+
[33m@openmrs/esm-state:build: [0masset openmrs-esm-state.js 2.93 KiB [emitted] [minimized] (name: main) 1 related asset
|
|
4
|
+
[33m@openmrs/esm-state:build: [0mruntime modules 1.76 KiB 6 modules
|
|
5
|
+
[33m@openmrs/esm-state:build: [0morphan modules 2.79 KiB [orphan] 2 modules
|
|
6
|
+
[33m@openmrs/esm-state:build: [0mcacheable modules 6.09 KiB
|
|
7
|
+
[33m@openmrs/esm-state:build: [0m modules by path ../../../node_modules/systemjs-webpack-interop/auto-public-path/*.js 935 bytes
|
|
8
|
+
[33m@openmrs/esm-state:build: [0m ../../../node_modules/systemjs-webpack-interop/auto-public-path/1.js 89 bytes [built] [code generated]
|
|
9
|
+
[33m@openmrs/esm-state:build: [0m ../../../node_modules/systemjs-webpack-interop/auto-public-path/auto-public-path.js 846 bytes [built] [code generated]
|
|
10
|
+
[33m@openmrs/esm-state:build: [0m ./src/index.ts + 2 modules 2.82 KiB [built] [code generated]
|
|
11
|
+
[33m@openmrs/esm-state:build: [0m ../../../node_modules/systemjs-webpack-interop/public-path.js 2.36 KiB [built] [code generated]
|
|
12
|
+
[33m@openmrs/esm-state:build: [0mwebpack 5.70.0 compiled successfully in 22154 ms
|
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
1
|
+
[32m@openmrs/esm-state:lint: [0mcache hit, replaying output [2m231f323f52cd31f2[0m
|
|
2
|
+
[32m@openmrs/esm-state:lint: [0m$ eslint src --ext ts,tsx
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
[34m@openmrs/esm-state:test: [0mcache hit, replaying output [
|
|
1
|
+
[34m@openmrs/esm-state:test: [0mcache hit, replaying output [2m1a0fe2f472126d43[0m
|
|
2
2
|
[34m@openmrs/esm-state:test: [0m$ jest --config jest.config.js --passWithNoTests
|
|
3
3
|
[34m@openmrs/esm-state:test: [0mNo tests found, exiting with code 0
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
1
|
+
[33m@openmrs/esm-state:typescript: [0mcache hit, replaying output [2m12cd9d27a4089ea5[0m
|
|
2
|
+
[33m@openmrs/esm-state:typescript: [0m$ tsc
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./state";
|
|
File without changes
|
|
File without changes
|
package/dist/public.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AppState, createGlobalStore, getGlobalStore, getAppState, subscribeTo, } from "./state";
|
package/dist/state.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** @module @category Store */
|
|
2
|
+
import { Store } from "unistore";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a Unistore [store](https://github.com/developit/unistore#store).
|
|
5
|
+
*
|
|
6
|
+
* @param name A name by which the store can be looked up later.
|
|
7
|
+
* Must be unique across the entire application.
|
|
8
|
+
* @param initialState An object which will be the initial state of the store.
|
|
9
|
+
* @returns The newly created store.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createGlobalStore<TState>(name: string, initialState: TState): Store<TState>;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the existing [store](https://github.com/developit/unistore#store) named `name`,
|
|
14
|
+
* or creates a new store named `name` if none exists.
|
|
15
|
+
*
|
|
16
|
+
* @param name The name of the store to look up.
|
|
17
|
+
* @param fallbackState The initial value of the new store if no store named `name` exists.
|
|
18
|
+
* @returns The found or newly created store.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getGlobalStore<TState = any>(name: string, fallbackState?: TState): Store<TState>;
|
|
21
|
+
export interface AppState {
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export declare function createAppState(initialState: AppState): Store<AppState>;
|
|
27
|
+
/**
|
|
28
|
+
* @returns The [store](https://github.com/developit/unistore#store) named `app`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getAppState(): Store<AppState>;
|
|
31
|
+
export declare function subscribeTo<T, U>(store: Store<T>, select: (state: T) => U, handle: (subState: U) => void): import("unistore").Unsubscribe;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Store } from "unistore";
|
|
2
|
+
/**
|
|
3
|
+
* Convenience method to update a store's state with respect to its previous state.
|
|
4
|
+
*
|
|
5
|
+
* #### Examples
|
|
6
|
+
*
|
|
7
|
+
* ```js
|
|
8
|
+
* myStore.setState({ foo: 0, bar: 10 });
|
|
9
|
+
* myStore.subscribe(s => { console.log(s); });
|
|
10
|
+
* updateStore(myStore, s => ({ ...s, foo: 1 }));
|
|
11
|
+
* // console: { foo: 1, bar: 10 }
|
|
12
|
+
*
|
|
13
|
+
* updateStore(myStore, s => ({ ...s, foo: 2 }), ['bar']);
|
|
14
|
+
* // => { foo: 1, bar: 10 }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param store A Unistore store obtained with [[createGlobalStore]] or [[getGlobalStore]]
|
|
18
|
+
* @param updater A function operating on the store's state
|
|
19
|
+
* @param checkDeepEqualAtPath If undefined, the store is updated as long as the new
|
|
20
|
+
* state object does not referentially equal the old state object. If provided,
|
|
21
|
+
* it should be a path for accessing the value of the state that should be compared
|
|
22
|
+
* for deep equality before setting the state.
|
|
23
|
+
*/
|
|
24
|
+
export declare function updateStore<T>(store: Store<T>, updater: (state: T) => T, checkDeepEqualAtPath?: Array<string>): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-state",
|
|
3
|
-
"version": "4.0.0-pre.
|
|
3
|
+
"version": "4.0.0-pre.1",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "Frontend stores & state management for OpenMRS",
|
|
6
6
|
"browser": "dist/openmrs-esm-state.js",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"unistore": "^3.5.2"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "9f58b801f07526083a9edc1cc5a1e58660d71eb0"
|
|
42
42
|
}
|