@thi.ng/atom
Advanced tools
Comparing version 5.2.37 to 5.2.38
import type { DeepPath, IEquiv, OptPathVal, Path, Path0, Path1, Path2, Path3, Path4, Path5, Path6, Path7, Path8, PathVal, Predicate, Watch } from "@thi.ng/api"; | ||
import type { IAtom, SwapFn } from "./api.js"; | ||
export declare const defAtom: <T>(value: T, valid?: Predicate<T> | undefined) => Atom<T>; | ||
export declare const defAtom: <T>(value: T, valid?: Predicate<T>) => Atom<T>; | ||
/** | ||
@@ -5,0 +5,0 @@ * Mutable wrapper for an (usually) immutable value. Support for |
# Change Log | ||
- **Last updated**: 2024-03-09T09:18:17Z | ||
- **Last updated**: 2024-03-13T14:04:31Z | ||
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub) | ||
@@ -5,0 +5,0 @@ |
import type { DeepPath, Event, INotify, Listener, OptPathVal, Path, Path0, Path1, Path2, Path3, Path4, Path5, Path6, Path7, Path8, PathVal, Predicate2, Watch } from "@thi.ng/api"; | ||
import { type HistoryEventType, type IAtom, type IHistory, type SwapFn } from "./api.js"; | ||
export declare const defHistory: <T>(state: IAtom<T>, maxLen?: number, changed?: Predicate2<T> | undefined) => History<T>; | ||
export declare const defHistory: <T>(state: IAtom<T>, maxLen?: number, changed?: Predicate2<T>) => History<T>; | ||
/** | ||
@@ -5,0 +5,0 @@ * Undo/redo history stack wrapper for atoms and cursors. Implements |
{ | ||
"name": "@thi.ng/atom", | ||
"version": "5.2.37", | ||
"version": "5.2.38", | ||
"description": "Mutable wrappers for nested immutable values with optional undo/redo history and transaction support", | ||
@@ -39,14 +39,14 @@ "type": "module", | ||
"dependencies": { | ||
"@thi.ng/api": "^8.9.29", | ||
"@thi.ng/equiv": "^2.1.51", | ||
"@thi.ng/errors": "^2.4.20", | ||
"@thi.ng/paths": "^5.1.72", | ||
"@thi.ng/api": "^8.9.30", | ||
"@thi.ng/equiv": "^2.1.52", | ||
"@thi.ng/errors": "^2.5.0", | ||
"@thi.ng/paths": "^5.1.73", | ||
"tslib": "^2.6.2" | ||
}, | ||
"devDependencies": { | ||
"@microsoft/api-extractor": "^7.40.1", | ||
"esbuild": "^0.20.0", | ||
"@microsoft/api-extractor": "^7.42.3", | ||
"esbuild": "^0.20.1", | ||
"rimraf": "^5.0.5", | ||
"typedoc": "^0.25.7", | ||
"typescript": "^5.3.3" | ||
"typedoc": "^0.25.12", | ||
"typescript": "^5.4.2" | ||
}, | ||
@@ -112,3 +112,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "69100942474942f7446ac645d59d91e7dfc352f9\n" | ||
"gitHead": "7f3fcbd6c0462b0ce45afa141fe163d1f297fd51\n" | ||
} |
@@ -87,3 +87,2 @@ import type { DeepPath, Fn, OptPathVal, Path, Path0, Path1, Path2, Path3, Path4, Path5, Path6, Path7, Path8, PathVal, Watch } from "@thi.ng/api"; | ||
* | ||
* @param parent | ||
* @param fn | ||
@@ -90,0 +89,0 @@ */ |
@@ -99,3 +99,2 @@ import { assert } from "@thi.ng/errors/assert"; | ||
* | ||
* @param parent | ||
* @param fn | ||
@@ -102,0 +101,0 @@ */ |
@@ -42,18 +42,21 @@ import type { DeepPath, Fn, OptPathVal, Path, Path0, Path1, Path2, Path3, Path4, Path5, Path6, Path7, Path8, Predicate2 } from "@thi.ng/api"; | ||
* @example | ||
* ```ts | ||
* ```ts tangle:../export/view.ts | ||
* import { defAtom, defView } from "@thi.ng/atom"; | ||
* | ||
* a = defAtom({ a: { b: 1 } }); | ||
* v = defView(a, ["a", "b"], (x) => x * 10); | ||
* const a = defAtom({ a: { b: 1 } }); | ||
* const v = defView(a, ["a", "b"], (x) => x * 10); | ||
* | ||
* v.deref() | ||
* console.log(v.deref()); | ||
* // 10 | ||
* | ||
* // update atom state | ||
* a.resetIn(["a", "b"], 2); | ||
* console.log( | ||
* a.resetIn(["a", "b"], 2) | ||
* ); | ||
* // { a: { b: 2 } } | ||
* | ||
* v.changed() | ||
* console.log(v.changed()); | ||
* // true | ||
* v.deref() | ||
* | ||
* console.log(v.deref()); | ||
* // 20 | ||
@@ -60,0 +63,0 @@ * |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
113436
1247
Updated@thi.ng/api@^8.9.30
Updated@thi.ng/equiv@^2.1.52
Updated@thi.ng/errors@^2.5.0
Updated@thi.ng/paths@^5.1.73