UNPKG

vevet

Version:

Vevet is a JavaScript library for creative development that simplifies crafting rich interactions like split text animations, carousels, marquees, preloading, and more.

38 lines 1.21 kB
import { body } from '../../../internal/env'; import { cursorStyles } from './styles'; export class SwipeStyles { constructor(_ctx) { this._ctx = _ctx; this._styles = cursorStyles === null || cursorStyles === void 0 ? void 0 : cursorStyles.cloneNode(true); this.setInline(); } /** Applies touch-action and cursor styles */ setInline() { const { props } = this._ctx; const { container, axis, enabled, grabCursor: hasGrabCursor } = props; const { style } = container; const cursor = enabled && hasGrabCursor ? 'grab' : ''; let touchAction = 'none'; if (axis === 'x') { touchAction = 'pan-y'; } else if (axis === 'y') { touchAction = 'pan-x'; } style.cursor = cursor; style.touchAction = touchAction; } /** Appends styles */ append() { const swipe = this._ctx; if (swipe.props.grabCursor && this._styles) { body.append(this._styles); } } /** Remove styles */ remove() { var _a; (_a = this._styles) === null || _a === void 0 ? void 0 : _a.remove(); } } //# sourceMappingURL=index.js.map