cogsbox-state 0.5.248 → 0.5.249

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.
@@ -11,13 +11,12 @@ export type VirtualViewOptions = {
11
11
  overscan?: number;
12
12
  stickToBottom?: boolean;
13
13
  };
14
- export type VirtualViewResult<T> = {
14
+ export type VirtualStateObjectResult<T extends any[]> = {
15
15
  /**
16
- * A view object with a `stateMap` method to render the virtualized items.
16
+ * A new, fully-functional StateObject that represents the virtualized slice.
17
+ * You can use `.get()`, `.stateMap()`, `.insert()`, `.cut()` etc. on this object.
17
18
  */
18
- virtualView: {
19
- stateMap: (callbackfn: (value: T, setter: StateObject<T>, index: number) => React.ReactNode) => React.ReactNode[];
20
- };
19
+ virtualState: StateObject<T>;
21
20
  /**
22
21
  * Props to be spread onto your DOM elements to enable virtualization.
23
22
  */
@@ -83,7 +82,7 @@ export type ArrayEndType<TShape extends unknown> = {
83
82
  cutByValue: (value: string | number | boolean) => void;
84
83
  toggleByValue: (value: string | number | boolean) => void;
85
84
  stateSort: (compareFn: (a: InferArrayElement<TShape>, b: InferArrayElement<TShape>) => number) => ArrayEndType<TShape>;
86
- useVirtualView: (options: VirtualViewOptions) => VirtualViewResult<InferArrayElement<TShape>>;
85
+ useVirtualView: (options: VirtualViewOptions) => VirtualStateObjectResult<InferArrayElement<TShape>[]>;
87
86
  stateMapNoRender: (callbackfn: (value: InferArrayElement<TShape>, setter: StateObject<InferArrayElement<TShape>>, index: number, array: TShape, arraySetter: StateObject<TShape>) => void) => any;
88
87
  stateMap: (callbackfn: (value: InferArrayElement<TShape>, setter: StateObject<InferArrayElement<TShape>>, index: number, array: TShape, arraySetter: StateObject<TShape>) => void) => any;
89
88
  $stateMap: (callbackfn: (value: InferArrayElement<TShape>, setter: StateObject<InferArrayElement<TShape>>, index: number, array: TShape, arraySetter: StateObject<TShape>) => void) => any;