UNPKG

1.34 kBJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.applyAnchorClass = applyAnchorClass;
7exports.anchorTranslate = exports.anchorType = void 0;
8var anchorType;
9exports.anchorType = anchorType;
10
11(function (anchorType) {
12 anchorType["CENTER"] = "center";
13 anchorType["TOP"] = "top";
14 anchorType["TOP-LEFT"] = "top-left";
15 anchorType["TOP-RIGHT"] = "top-right";
16 anchorType["BOTTOM"] = "bottom";
17 anchorType["BOTTOM-LEFT"] = "bottom-left";
18 anchorType["LEFT"] = "left";
19 anchorType["RIGHT"] = "right";
20})(anchorType || (exports.anchorType = anchorType = {}));
21
22var anchorTranslate = {
23 center: 'translate(-50%,-50%)',
24 top: 'translate(-50%,0)',
25 'top-left': 'translate(0,0)',
26 'top-right': 'translate(-100%,0)',
27 bottom: 'translate(-50%,-100%)',
28 'bottom-left': 'translate(0,-100%)',
29 'bottom-right': 'translate(-100%,-100%)',
30 left: 'translate(0,-50%)',
31 right: 'translate(-100%,-50%)'
32};
33exports.anchorTranslate = anchorTranslate;
34
35function applyAnchorClass(element, anchor, prefix) {
36 var classList = element.classList;
37
38 for (var _key in anchorTranslate) {
39 if (anchorTranslate.hasOwnProperty(_key)) {
40 classList.remove("l7-".concat(prefix, "-anchor-").concat(_key));
41 }
42 }
43
44 classList.add("l7-".concat(prefix, "-anchor-").concat(anchor));
45}
46//# sourceMappingURL=anchor.js.map
\No newline at end of file