UNPKG

@opentiny/vue-renderless

Version:

An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.

50 lines (49 loc) 1.39 kB
import { __spreadProps, __spreadValues } from "../chunk-G2ADBYYC.js"; import { createShepherd, mounted, beforeUnmount } from "./index"; const api = ["state"]; const renderless = (props, { reactive, onMounted, onBeforeUnmount, watch }, { designConfig }, { Shepherd, offset }) => { const state = reactive({ tour: null, tour1: null, showStep: false, domData: props.domData || null, mainAxis: props.mainAxis, crossAxis: props.crossAxis, alignmentAxis: props.alignmentAxis, popPosition: props.popPosition, modalOverlayOpeningPadding: props.modalOverlayOpeningPadding, modalOverlayOpeningRadius: props.modalOverlayOpeningRadius, arrow: props.arrow, lightClass: props.lightClass, showClose: props.showClose }); let baseApi = { state, createShepherd: createShepherd({ state, props, Shepherd, offset, designConfig }) }; const api2 = __spreadProps(__spreadValues({}, baseApi), { mounted: mounted({ state, api: baseApi }), beforeUnmount: beforeUnmount(state) }); watch( () => props.showStep, (newVal) => { var _a; if (newVal) { api2.createShepherd(); } else { (_a = state == null ? void 0 : state.tour) == null ? void 0 : _a.hide(); } } ); onMounted(api2.mounted); onBeforeUnmount(api2.beforeUnmount); return api2; }; export { api, renderless };