File size: 763 Bytes
aa3b624 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import { initEvents, destroyEvents } from "./events";
import { destroyHighlight, highlight } from "./highlight";
import { destroyStage } from "./stage";
export type DriveStep = {
element?: string | Element;
popover: {
title: string;
description: string;
position: "top" | "bottom" | "left" | "right";
};
};
export function driver() {
function init() {
document.body.classList.add("driver-active");
initEvents();
}
function destroy() {
document.body.classList.remove("driver-active");
destroyEvents();
destroyHighlight();
destroyStage();
}
return {
drive: (steps: DriveStep[]) => console.log(steps),
highlight: (step: DriveStep) => {
init();
highlight(step);
},
destroy,
};
}
|