dotvvm-types 4.3.5 → 4.3.6

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/types/index.d.ts +16 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dotvvm-types",
3
- "version": "4.3.5",
3
+ "version": "4.3.6",
4
4
  "description": "MVVM framework for ASP.NET",
5
5
  "types": "./types/index.d.ts",
6
6
  "repository": {
package/types/index.d.ts CHANGED
@@ -212,6 +212,8 @@ declare module "validation/error" {
212
212
  }
213
213
  declare module "state-manager" {
214
214
  import { DotvvmEvent } from "events";
215
+ import { ValidationError } from "validation/error";
216
+ import { errorsSymbol } from "validation/common";
215
217
  export const currentStateSymbol: unique symbol;
216
218
  export const notifySymbol: unique symbol;
217
219
  export const lastSetErrorSymbol: unique symbol;
@@ -268,12 +270,25 @@ declare module "state-manager" {
268
270
  /** @deprecated Use updateState method instead */
269
271
  update: UpdateDispatcher<TViewModel>;
270
272
  }
273
+ class FakeObservableObject<T extends object> implements UpdatableObjectExtensions<T> {
274
+ [currentStateSymbol]: T;
275
+ [errorsSymbol]: Array<ValidationError>;
276
+ [updateSymbol]: UpdateDispatcher<T>;
277
+ [notifySymbol](newValue: T): void;
278
+ [internalPropCache]: {
279
+ [name: string]: (KnockoutObservable<any> & UpdatableObjectExtensions<any>) | null;
280
+ };
281
+ [updatePropertySymbol](propName: keyof DeepReadonly<T>, valUpdate: StateUpdate<any>): void;
282
+ constructor(initialValue: T, getter: () => DeepReadonly<T> | undefined, updater: UpdateDispatcher<T>, typeId: TypeDefinition, typeInfo: ObjectTypeMetadata | DynamicTypeMetadata | undefined, additionalProperties: string[]);
283
+ }
271
284
  export function isDotvvmObservable(obj: any): obj is DotvvmObservable<any>;
285
+ export function isFakeObservableObject(obj: any): obj is FakeObservableObject<any>;
272
286
  /**
273
287
  * Recursively unwraps knockout observables from the object / array hierarchy. When nothing needs to be unwrapped, the original object is returned.
274
288
  * @param allowStateUnwrap Allows accessing [currentStateSymbol], which makes it faster, but doesn't register in the knockout dependency tracker
289
+ * @param preferStateAccess Also allows accessing observable.state, which also doesn't register in the knockout dependency tracker, but returns an realtime updated value directly from dotvvm.state
275
290
  */
276
- export function unmapKnockoutObservables(viewModel: any, allowStateUnwrap?: boolean): any;
291
+ export function unmapKnockoutObservables(viewModel: any, allowStateUnwrap?: boolean, preferStateAccess?: boolean): any;
277
292
  }
278
293
  declare module "serialization/deserialize" {
279
294
  export function deserialize(viewModel: any, target?: any, deserializeAll?: boolean): any;