@superutils/store 0.1.19 → 0.1.20
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.
- package/README.md +5 -5
- package/dist/browser/index.min.js.map +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +2 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -378,7 +378,8 @@ function createObjectStore(options, context) {
|
|
|
378
378
|
initialValue: !(0, import_core3.isObj)(options == null ? void 0 : options.initialValue, true) ? options == null ? void 0 : options.initialValue : (0, import_core3.objToMap)(options.initialValue)
|
|
379
379
|
};
|
|
380
380
|
const store = createStore_default(
|
|
381
|
-
|
|
381
|
+
options,
|
|
382
|
+
context
|
|
382
383
|
);
|
|
383
384
|
store.type = "object";
|
|
384
385
|
const setAll = store.setAll.bind(store);
|
package/dist/index.d.cts
CHANGED
|
@@ -102,7 +102,7 @@ type Store_Stringify<Data, ThisArg> = (this: ThisArg, data: Data) => string | un
|
|
|
102
102
|
type Store_ToJSON<K, V> = (replacer?: null | ((key: K, value: V) => unknown), spacing?: string | number, data?: Map<K, V>) => string;
|
|
103
103
|
|
|
104
104
|
/** Store properties accepted in {@link Store_Options} */
|
|
105
|
-
type Store_OptionKeys = 'cacheDisabled' | '
|
|
105
|
+
type Store_OptionKeys = 'cacheDisabled' | 'name' | 'onChange' | 'onError' | 'parse' | 'spaces' | 'storage' | 'stringify' | 'validate';
|
|
106
106
|
/**
|
|
107
107
|
* Configuration options for initializing {@link IStore} instances.
|
|
108
108
|
*
|
|
@@ -127,10 +127,10 @@ type Store_Options<Key = unknown, Value = unknown, CacheDisabled extends boolean
|
|
|
127
127
|
* Default: `undefined`
|
|
128
128
|
*/
|
|
129
129
|
initialValue?: Map<Key, Value>;
|
|
130
|
-
} & Pick<
|
|
130
|
+
} & Partial<Pick<IStore<Key, Value, CacheDisabled>, Store_OptionKeys> & (CacheDisabled extends false ? Pick<IStore<Key, Value, CacheDisabled>, 'delay' | 'delayOptions'> : {
|
|
131
131
|
delay?: never;
|
|
132
132
|
delayOptions?: never;
|
|
133
|
-
})
|
|
133
|
+
})>;
|
|
134
134
|
/**
|
|
135
135
|
* Represents a generic, reactive, and persistent Map-like data store.
|
|
136
136
|
*
|
|
@@ -483,10 +483,10 @@ type ObjectStore_Options<T extends object = Record<PropertyKey, unknown>, CacheD
|
|
|
483
483
|
* Default: `undefined`
|
|
484
484
|
*/
|
|
485
485
|
initialValue?: T;
|
|
486
|
-
} & Pick<
|
|
486
|
+
} & Partial<Pick<IObjectStore<T, CacheDisabled>, Store_OptionKeys> & (CacheDisabled extends false ? Pick<IObjectStore<T, CacheDisabled>, 'delay' | 'delayOptions'> : {
|
|
487
487
|
delay?: never;
|
|
488
488
|
delayOptions?: never;
|
|
489
|
-
})
|
|
489
|
+
})>;
|
|
490
490
|
|
|
491
491
|
declare module './IStore' {
|
|
492
492
|
interface IStore<Key, Value, CD extends boolean = false> {
|
|
@@ -824,7 +824,7 @@ declare const OPTIONAL_STORE_PROPS: readonly ["delayOptions", "name", "onChange"
|
|
|
824
824
|
* )
|
|
825
825
|
*```
|
|
826
826
|
*/
|
|
827
|
-
declare function createStore<Context extends object | ((store: IStore<Key, Value, CacheDisabled>) => object), Key, Value, CacheDisabled extends boolean
|
|
827
|
+
declare function createStore<Context extends object | ((store: IStore<Key, Value, CacheDisabled>) => object), Key, Value, CacheDisabled extends boolean>(options: undefined | null | Store_Options<Key, Value, CacheDisabled>, context: Context & ContextValidate<Context, IStore<Key, Value, CacheDisabled>>): IStore<Key, Value, CacheDisabled> & ContextReturn<Context>;
|
|
828
828
|
declare function createStore<Key, Value, CacheDisabled extends boolean = false>(options?: Store_Options<Key, Value, CacheDisabled>): IStore<Key, Value, CacheDisabled>;
|
|
829
829
|
|
|
830
830
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -102,7 +102,7 @@ type Store_Stringify<Data, ThisArg> = (this: ThisArg, data: Data) => string | un
|
|
|
102
102
|
type Store_ToJSON<K, V> = (replacer?: null | ((key: K, value: V) => unknown), spacing?: string | number, data?: Map<K, V>) => string;
|
|
103
103
|
|
|
104
104
|
/** Store properties accepted in {@link Store_Options} */
|
|
105
|
-
type Store_OptionKeys = 'cacheDisabled' | '
|
|
105
|
+
type Store_OptionKeys = 'cacheDisabled' | 'name' | 'onChange' | 'onError' | 'parse' | 'spaces' | 'storage' | 'stringify' | 'validate';
|
|
106
106
|
/**
|
|
107
107
|
* Configuration options for initializing {@link IStore} instances.
|
|
108
108
|
*
|
|
@@ -127,10 +127,10 @@ type Store_Options<Key = unknown, Value = unknown, CacheDisabled extends boolean
|
|
|
127
127
|
* Default: `undefined`
|
|
128
128
|
*/
|
|
129
129
|
initialValue?: Map<Key, Value>;
|
|
130
|
-
} & Pick<
|
|
130
|
+
} & Partial<Pick<IStore<Key, Value, CacheDisabled>, Store_OptionKeys> & (CacheDisabled extends false ? Pick<IStore<Key, Value, CacheDisabled>, 'delay' | 'delayOptions'> : {
|
|
131
131
|
delay?: never;
|
|
132
132
|
delayOptions?: never;
|
|
133
|
-
})
|
|
133
|
+
})>;
|
|
134
134
|
/**
|
|
135
135
|
* Represents a generic, reactive, and persistent Map-like data store.
|
|
136
136
|
*
|
|
@@ -483,10 +483,10 @@ type ObjectStore_Options<T extends object = Record<PropertyKey, unknown>, CacheD
|
|
|
483
483
|
* Default: `undefined`
|
|
484
484
|
*/
|
|
485
485
|
initialValue?: T;
|
|
486
|
-
} & Pick<
|
|
486
|
+
} & Partial<Pick<IObjectStore<T, CacheDisabled>, Store_OptionKeys> & (CacheDisabled extends false ? Pick<IObjectStore<T, CacheDisabled>, 'delay' | 'delayOptions'> : {
|
|
487
487
|
delay?: never;
|
|
488
488
|
delayOptions?: never;
|
|
489
|
-
})
|
|
489
|
+
})>;
|
|
490
490
|
|
|
491
491
|
declare module './IStore' {
|
|
492
492
|
interface IStore<Key, Value, CD extends boolean = false> {
|
|
@@ -824,7 +824,7 @@ declare const OPTIONAL_STORE_PROPS: readonly ["delayOptions", "name", "onChange"
|
|
|
824
824
|
* )
|
|
825
825
|
*```
|
|
826
826
|
*/
|
|
827
|
-
declare function createStore<Context extends object | ((store: IStore<Key, Value, CacheDisabled>) => object), Key, Value, CacheDisabled extends boolean
|
|
827
|
+
declare function createStore<Context extends object | ((store: IStore<Key, Value, CacheDisabled>) => object), Key, Value, CacheDisabled extends boolean>(options: undefined | null | Store_Options<Key, Value, CacheDisabled>, context: Context & ContextValidate<Context, IStore<Key, Value, CacheDisabled>>): IStore<Key, Value, CacheDisabled> & ContextReturn<Context>;
|
|
828
828
|
declare function createStore<Key, Value, CacheDisabled extends boolean = false>(options?: Store_Options<Key, Value, CacheDisabled>): IStore<Key, Value, CacheDisabled>;
|
|
829
829
|
|
|
830
830
|
/**
|
package/dist/index.js
CHANGED
|
@@ -363,7 +363,8 @@ function createObjectStore(options, context) {
|
|
|
363
363
|
initialValue: !isObj2(options == null ? void 0 : options.initialValue, true) ? options == null ? void 0 : options.initialValue : objToMap(options.initialValue)
|
|
364
364
|
};
|
|
365
365
|
const store = createStore_default(
|
|
366
|
-
|
|
366
|
+
options,
|
|
367
|
+
context
|
|
367
368
|
);
|
|
368
369
|
store.type = "object";
|
|
369
370
|
const setAll = store.setAll.bind(store);
|
package/package.json
CHANGED