Astro+Directus(Visual-Editing)+Snipcart Test-Stack
This commit is contained in:
+50
@@ -0,0 +1,50 @@
|
||||
//#region src/lib/types/directus.d.ts
|
||||
/** These types are shared with Directus */
|
||||
/** Keep in sync with Directus */
|
||||
type PrimaryKey = string | number;
|
||||
type EditConfig$1 = {
|
||||
collection: string;
|
||||
item: PrimaryKey | null;
|
||||
fields?: string[];
|
||||
mode?: 'drawer' | 'modal' | 'popover';
|
||||
};
|
||||
type SavedData$1 = {
|
||||
key: string;
|
||||
collection: EditConfig$1['collection'];
|
||||
item: EditConfig$1['item'];
|
||||
payload: Record<string, unknown>;
|
||||
};
|
||||
//#endregion
|
||||
//#region src/lib/types/index.d.ts
|
||||
type EditConfigStrict = EditConfig$1;
|
||||
type EditConfig = Omit<EditConfigStrict, 'fields'> & {
|
||||
fields?: EditConfigStrict['fields'] | string;
|
||||
};
|
||||
type SavedData = SavedData$1;
|
||||
type EditableElementOptions = {
|
||||
customClass?: string | undefined;
|
||||
onSaved?: ((data: Omit<SavedData, 'key'>) => void) | undefined;
|
||||
};
|
||||
//#endregion
|
||||
//#region src/index.d.ts
|
||||
declare function apply({
|
||||
directusUrl,
|
||||
elements,
|
||||
customClass,
|
||||
onSaved
|
||||
}: {
|
||||
directusUrl: string;
|
||||
elements?: HTMLElement | HTMLElement[] | null;
|
||||
} & EditableElementOptions): Promise<{
|
||||
remove(): void;
|
||||
enable(): void;
|
||||
disable(): void;
|
||||
} | undefined>;
|
||||
declare function remove(): void;
|
||||
declare function disable(): {
|
||||
enable(): void;
|
||||
};
|
||||
declare function setAttr(editConfig: EditConfig): string;
|
||||
//#endregion
|
||||
export { apply, disable, remove, setAttr };
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
Reference in New Issue
Block a user