tinacms
Version:
> The Fastest Way to Edit Next.js Content
34 lines (33 loc) • 1.09 kB
TypeScript
export declare function useTina<T extends object>(props: {
query: string;
variables: object;
data: T;
}): {
data: T;
isClient: boolean;
};
export declare function useEditState(): {
edit: boolean;
};
/**
* Grab the field name for the given attribute
* to signal to Tina which DOM element the field
* is working with.
*/
export declare const tinaField: <T extends object & {
_content_source?: {
queryId: string;
path: (number | string)[];
};
}>(object: T, property?: Exclude<keyof NonNullable<T>, "__typename" | "_sys">, index?: number) => string;
export declare const addMetadata: <T extends object>(id: string, object: T & {
type?: string;
_content_source?: unknown;
}, path: (string | number)[]) => T;
/**
* This is a pretty rudimentary approach to hashing the query and variables to
* ensure we treat multiple queries on the page uniquely. It's possible
* that we would have collisions, and I'm not sure of the likeliness but seems
* like it'd be rare.
*/
export declare const hashFromQuery: (input: string) => string;