Skip to content

Commit

Permalink
feat: lazy box state
Browse files Browse the repository at this point in the history
  • Loading branch information
acrazing committed Nov 2, 2024
1 parent d93bdc2 commit 3f9681e
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@amos/root",
"private": true,
"version": "0.3.0-beta.30",
"version": "0.3.0-beta.31",
"license": "MIT",
"workspaces": [
"packages/*",
Expand Down
2 changes: 1 addition & 1 deletion packages/amos-babel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amos-babel",
"version": "0.3.0-beta.30",
"version": "0.3.0-beta.31",
"private": true,
"files": [],
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/amos-boxes/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amos-boxes",
"version": "0.3.0-beta.30",
"version": "0.3.0-beta.31",
"private": true,
"files": []
}
4 changes: 2 additions & 2 deletions packages/amos-boxes/src/arrayBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { Box, Mutation, ShapeBox } from 'amos-core';
import { removeElement } from 'amos-utils';
import { removeElement, type ValueOrFunc } from 'amos-utils';

export interface ArrayBox<E>
extends Box<readonly E[]>,
Expand Down Expand Up @@ -45,6 +45,6 @@ export const ArrayBox = Box.extends<ArrayBox<any>>({
},
});

export function arrayBox<E>(key: string, initialState: readonly E[] = []): ArrayBox<E> {
export function arrayBox<E>(key: string, initialState: ValueOrFunc<readonly E[]> = []): ArrayBox<E> {
return new ArrayBox(key, initialState);
}
4 changes: 2 additions & 2 deletions packages/amos-boxes/src/objectBox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import { Box, Mutation, Selector } from 'amos-core';
import { resolveFuncValue, shallowEqual } from 'amos-utils';
import { resolveFuncValue, shallowEqual, type ValueOrFunc } from 'amos-utils';

export interface ObjectBox<T extends object> extends Box<Readonly<T>> {
mergeState(state: Partial<T>): Mutation<Readonly<T>>;
Expand All @@ -31,6 +31,6 @@ export const ObjectBox = Box.extends<ObjectBox<any>>({
},
});

export function objectBox<T extends object>(key: string, initialState: T): ObjectBox<T> {
export function objectBox<T extends object>(key: string, initialState: ValueOrFunc<T>): ObjectBox<T> {
return new ObjectBox(key, initialState);
}
2 changes: 1 addition & 1 deletion packages/amos-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amos-core",
"version": "0.3.0-beta.30",
"version": "0.3.0-beta.31",
"private": true,
"files": []
}
2 changes: 1 addition & 1 deletion packages/amos-io/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amos-io",
"version": "0.3.0-beta.30",
"version": "0.3.0-beta.31",
"private": true,
"files": []
}
2 changes: 1 addition & 1 deletion packages/amos-persist/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amos-persist",
"version": "0.3.0-beta.30",
"version": "0.3.0-beta.31",
"private": true,
"files": []
}
2 changes: 1 addition & 1 deletion packages/amos-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amos-react",
"version": "0.3.0-beta.30",
"version": "0.3.0-beta.31",
"private": true,
"files": [],
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/amos-shapes/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amos-shapes",
"version": "0.3.0-beta.30",
"version": "0.3.0-beta.31",
"private": true,
"files": []
}
2 changes: 1 addition & 1 deletion packages/amos-testing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amos-testing",
"version": "0.3.0-beta.30",
"version": "0.3.0-beta.31",
"private": true,
"files": []
}
2 changes: 1 addition & 1 deletion packages/amos-typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amos-typescript",
"version": "0.3.0-beta.30",
"version": "0.3.0-beta.31",
"private": true,
"files": [],
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/amos-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amos-utils",
"version": "0.3.0-beta.30",
"version": "0.3.0-beta.31",
"private": true,
"files": []
}
2 changes: 1 addition & 1 deletion packages/amos/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amos",
"version": "0.3.0-beta.30",
"version": "0.3.0-beta.31",
"description": "An out-of-the-box state management library designed for your large-scale projects.",
"keywords": [
"amos",
Expand Down

0 comments on commit 3f9681e

Please sign in to comment.