Comparing version 0.9.0 to 0.10.0
@@ -1,2 +0,2 @@ | ||
/* hydroxide v0.9.0 */ | ||
/* hydroxide v0.10.0 */ | ||
'use strict'; | ||
@@ -535,4 +535,3 @@ | ||
const newValue = transformer(this.value); | ||
if (this.value === newValue) return; // @ts-expect-error | ||
if (this.value === newValue) return; | ||
this.set(newValue); | ||
@@ -539,0 +538,0 @@ } |
@@ -1,2 +0,2 @@ | ||
/* hydroxide v0.9.0 */ | ||
/* hydroxide v0.10.0 */ | ||
function targetKey(obj, path) { | ||
@@ -531,4 +531,3 @@ if (path.length === 1) return [obj, path[0]]; | ||
const newValue = transformer(this.value); | ||
if (this.value === newValue) return; // @ts-expect-error | ||
if (this.value === newValue) return; | ||
this.set(newValue); | ||
@@ -535,0 +534,0 @@ } |
@@ -12,4 +12,4 @@ import { GlobalInfo } from './types/others'; | ||
export type { Context, GlobalInfo, Phase, GenericPath, AnyArrayOp } from './types/others'; | ||
export type { Reactive, ArraySlice, Slice, ReactiveSlice, ReadonlyReactive } from './types/reactive'; | ||
export type { Reactive, Slice, ReadonlyReactive } from './types/reactive'; | ||
export { targetKey } from './utils/targetKey'; | ||
export declare const coreInfo: GlobalInfo; |
@@ -6,4 +6,5 @@ import { Subs, Context, GenericPath } from './others'; | ||
type Transform<T> = (oldValue: T) => T; | ||
export type Do<V> = (transform: V extends true | false ? Transform<boolean> : Transform<V>) => void; | ||
export type Set<V> = (newValue: V extends true | false ? boolean : V) => void; | ||
type Setter<T> = (newValue: T) => void; | ||
export type Do<V> = (transform: Transform<V>) => void; | ||
export type Set<V> = Setter<V>; | ||
export type Clear = () => void; | ||
@@ -19,3 +20,3 @@ export type PushList<V> = (values: ArrayItem<V>[]) => void; | ||
} | ||
export declare type ArraySlice<V> = { | ||
declare type ArrayMethods<V> = { | ||
insert: Methods.Insert<V>; | ||
@@ -29,13 +30,14 @@ insertList: Methods.InsertList<V>; | ||
pop: Methods.Pop; | ||
} & Slice<V>; | ||
}; | ||
declare type Methods<V> = { | ||
set: Methods.Set<V>; | ||
do: Methods.Do<V>; | ||
} & (V extends any[] ? ArrayMethods<V> : {}); | ||
export declare type Slice<V> = { | ||
reactive: Reactive<any>; | ||
path: GenericPath; | ||
set: Methods.Set<V>; | ||
do: Methods.Do<V>; | ||
}; | ||
export declare type ReactiveSlice<V> = V extends Array<any> ? ArraySlice<V> : Slice<V>; | ||
} & Methods<V>; | ||
export declare type Reactive<T> = { | ||
(): T; | ||
<P extends Paths<T>>(...path: P): ReactiveSlice<PathTarget<T, P>>; | ||
<P extends Paths<T>>(...path: P): Slice<PathTarget<T, P>>; | ||
value: T; | ||
@@ -45,3 +47,3 @@ subs: Subs; | ||
mutable: boolean; | ||
} & ReactiveSlice<T>; | ||
} & Methods<T>; | ||
export declare type ReadonlyReactive<T> = { | ||
@@ -53,1 +55,2 @@ (): T; | ||
}; | ||
export {}; |
{ | ||
"name": "hydroxide", | ||
"description": "Next Generation Reactive Framework", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"author": "Manan Tank", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
1308
52135