Skip to content

Commit

Permalink
✨ feat(component-asset): createUseAssetStore 方法支持导出AssetProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Jun 14, 2023
1 parent af0b2e5 commit d33a8b3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/ComponentAsset/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { UseContextStore, createContext, optionalDevtools } from 'zustand-utils'
import { DevtoolsOptions } from 'zustand/middleware';

import { PublicProEditorStore } from '@/ProEditor/store';
import { ReactNode } from 'react';

export interface AssetStoreOptions<T = any> {
devtools?: boolean | DevtoolsOptions;
Expand Down Expand Up @@ -46,4 +47,11 @@ export type WithoutCallSignature<T> = {
export const createUseAssetStore = <T>(): {
useStore: UseContextStore<StoreApi<T & PublicProEditorStore>>;
useStoreApi: () => WithoutCallSignature<StoreApi<T & PublicProEditorStore>>;
} => ({ useStore, useStoreApi });
AssetProvider: ({
createStore,
children,
}: {
createStore: () => StoreApi<T>;
children: any;
}) => ReactNode;
} => ({ useStore, useStoreApi, AssetProvider: Provider });

0 comments on commit d33a8b3

Please sign in to comment.