react-hooks-global-states 15.0.7 → 15.0.9

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.
@@ -2,7 +2,7 @@ import React, { type PropsWithChildren, Context as ReactContext } from 'react';
2
2
  import { GlobalStore } from './GlobalStore';
3
3
  import type { BaseMetadata, GlobalStoreCallbacks as GlobalStoreCallbacksBase, UseHookOptions, AnyFunction, StoreTools, ReadonlyStateApi, SelectHook, ObservableFragment, StateApi, UnsubscribeCallback } from './types';
4
4
  import { AnyActions } from 'createGlobalState';
5
- type GlobalStoreContextCallbacks<State, StateMutator, Metadata extends BaseMetadata> = {
5
+ export type GlobalStoreContextCallbacks<State, StateMutator, Metadata extends BaseMetadata> = {
6
6
  /**
7
7
  * @description Optional callback invoked after the context is created,
8
8
  */
@@ -146,7 +146,7 @@ export type ContextProvider<State, StateMutator, Metadata extends BaseMetadata>
146
146
  /**
147
147
  * @description Represents a hook that returns a readonly state.
148
148
  */
149
- interface ReadonlyContextHook<State, StateMutator, Metadata extends BaseMetadata> extends ReadonlyContextPublicApi<State, StateMutator, Metadata> {
149
+ export interface ReadonlyContextHook<State, StateMutator, Metadata extends BaseMetadata> extends ReadonlyContextPublicApi<State, StateMutator, Metadata> {
150
150
  /**
151
151
  * @description Returns the full state.
152
152
  */
@@ -317,7 +317,7 @@ export type ReadonlyContextPublicApi<State, StateMutator, Metadata extends BaseM
317
317
  */
318
318
  api: () => ReadonlyStateApi<State, StateMutator, Metadata>;
319
319
  };
320
- interface CreateContext {
320
+ export interface CreateContext {
321
321
  /**
322
322
  * @description Creates a highly granular React context with its associated provider and state hook.
323
323
  * @param value Initial state value or initializer function.
@@ -23,7 +23,7 @@ import type { ActionCollectionConfig, ActionCollectionResult, StateHook, BaseMet
23
23
  * ```
24
24
  */
25
25
  export type AnyActions = Record<string, (...args: any[]) => any>;
26
- interface CreateGlobalState {
26
+ export interface CreateGlobalState {
27
27
  /**
28
28
  * Creates a global state hook.
29
29
  * @param state initial state value
package/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export type { StateApi, ObservableFragment, MetadataSetter, StateChanges, StoreTools, ActionCollectionResult, GlobalStoreCallbacks, UseHookOptions, UnsubscribeCallback, SubscribeCallbackConfig, SubscribeCallback, BaseMetadata, MetadataGetter, SelectorCallback, SubscriberParameters, SubscriptionCallback, StateHook, ActionCollectionConfig, } from './types';
1
+ export type { AnyFunction, ReadonlyHook, SelectHook, StateApi, ReadonlyStateApi, ObservableFragment, StateHook, MetadataSetter, StateChanges, StoreTools, ActionCollectionConfig, ActionCollectionResult, GlobalStoreCallbacks, UseHookOptions, UnsubscribeCallback, SubscribeCallbackConfig, SubscribeCallback, SubscribeToState, BaseMetadata, MetadataGetter, SelectorCallback, SubscriberParameters, SubscriptionCallback, } from './types';
2
2
  export { GlobalStore } from './GlobalStore';
3
- export { createGlobalState, type InferActionsType, type InferStateApi, AnyActions, } from './createGlobalState';
3
+ export { createGlobalState, type CreateGlobalState, type InferActionsType, type InferStateApi, type AnyActions, } from './createGlobalState';
4
4
  export { shallowCompare } from './shallowCompare';
5
- export { uniqueId, type BrandedId } from './uniqueId';
5
+ export { uniqueId, type BrandedId, type UniqueId } from './uniqueId';
6
6
  export { throwWrongKeyOnActionCollectionConfig } from './throwWrongKeyOnActionCollectionConfig';
7
7
  export { isRecord } from './isRecord';
8
- export { type ContextProvider, type ContextHook, type InferContextApi, createContext } from './createContext';
8
+ export { createContext, type CreateContext, type ContextHook, type ReadonlyContextHook, type ContextProvider, type ContextProviderExtensions, type ContextStoreTools, type ContextStoreToolsExtensions, type ContextPublicApi, type ReadonlyContextPublicApi, type ContextActionCollectionConfig, type ContextActionCollectionResult, type GlobalStoreContextCallbacks, type InferContextApi, } from './createContext';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-hooks-global-states",
3
- "version": "15.0.7",
3
+ "version": "15.0.9",
4
4
  "description": "This is a package to easily handling global-state across your react-components using hooks.",
5
5
  "main": "./bundle.js",
6
6
  "types": "./index.d.ts",
@@ -143,8 +143,8 @@
143
143
  },
144
144
  "peerDependencies": {
145
145
  "json-storage-formatter": "^3.0.2",
146
- "react": "^18.0.0",
147
- "react-dom": "^18.0.0"
146
+ "react": ">=18.0.0",
147
+ "react-dom": ">=18.0.0"
148
148
  },
149
149
  "peerDependenciesMeta": {
150
150
  "react": {
package/uniqueId.d.ts CHANGED
@@ -5,7 +5,7 @@ export declare const __brand: unique symbol;
5
5
  export type BrandedId<T extends string | undefined> = `${T extends string ? T : ''}${string}` & {
6
6
  [__brand]: T;
7
7
  };
8
- interface UniqueId {
8
+ export interface UniqueId {
9
9
  /**
10
10
  * Generates a unique identifier string, optionally prefixed.
11
11
  *