import { GraphRefs } from "../Graphlink.js"; import { UT_StoreShape } from "../UserTypes.js"; import { AccessorCallPlan } from "./@AccessorCallPlan.js"; import { AccessorOptions } from "./@AccessorMetadata.js"; export declare function WithStore(graphRefs: Partial, store: any, accessorFunc: () => T): T; export type FuncExtensions = { /** Func.Async(...) is shortcut for GetAsync(()=>Func(...)) */ Async: Func extends ((..._: infer Args) => infer ReturnTypeX) ? (..._: Args) => Promise : never; /** First tries to call the wrapper-accessor directly/without-await. If the result is non-null, returns that synchronously; else, calls Func.Async(...) and returns its promise. */ /** Func.Wait(thing) is shortcut for GetWait(()=>Func(thing)) */ Wait: Func; CatchBail: Func extends ((..._: infer Args) => infer ReturnTypeX) ? (bailResultOrGetter: T, ..._: Args) => NonNullable | (T extends (() => any) ? ReturnType : T) : never; }; type AccessInnerFunc_Basic = Function; type AccessInnerFunc_CtxUsed = (this: AccessorCallPlan, ...args: any[]) => any; type Options_Ctx0 = Partial> & { ctx?: null | undefined | 0; }; type Options_Ctx1 = Partial> & { ctx: 1; }; export interface CreateAccessor_Shape { (accessor: Func): Func & FuncExtensions; (options: Options_Ctx0, accessor: Func): Func & FuncExtensions; (name: string, accessor: Func): Func & FuncExtensions; (name: string, options: Options_Ctx0, accessor: Func): Func & FuncExtensions; (options: Options_Ctx1, accessor: Func): OmitThisParameter & FuncExtensions; (name: string, options: Options_Ctx1, accessor: Func): OmitThisParameter & FuncExtensions; } /** Probably temp. Usage: export const CreateAccessor_Typed = Create_CreateAccessor_Typed(); export const GetPerson = CreateAccessor_Typed({}, ...); */ export declare function Create_CreateAccessor_Typed(): CreateAccessor_Shape; /** Wrap a function with CreateAccessor if it's under the "Store/" path, and one of the following: 1) It accesses the store directly (ie. store.main.page). (thus, "WithStore(testStoreContents, ()=>GetThingFromStore())" works, without hacky overriding of project-wide "store" export) 2) It involves "heavy" processing, such that it's worth caching that processing. (rather than use computedFn directly, just standardize on CreateAccessor) 3) It involves a transformation of data into a new wrapper (ie. breaking reference equality), such that it's worth caching the processing. (to not trigger unnecessary child-ui re-renders) */ export declare const CreateAccessor: CreateAccessor_Shape; export {};