@antv/l7-component 2.9.21 → 2.9.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/es/control/BaseControl.js +5 -26
  2. package/es/control/layer.js +13 -28
  3. package/es/control/logo.js +3 -4
  4. package/es/control/scale.js +6 -11
  5. package/es/control/zoom.js +3 -12
  6. package/es/css/l7.css +502 -0
  7. package/es/images/layers.png +0 -0
  8. package/es/images/layers.svg +1 -0
  9. package/es/images/logo.png +0 -0
  10. package/es/index.js +10 -10
  11. package/es/interface.js +1 -2
  12. package/es/marker-layer.js +27 -27
  13. package/es/marker.js +21 -27
  14. package/es/popup.js +16 -34
  15. package/es/utils/anchor.js +1 -2
  16. package/lib/control/BaseControl.js +100 -163
  17. package/lib/control/layer.js +248 -347
  18. package/lib/control/logo.js +52 -77
  19. package/lib/control/scale.js +112 -165
  20. package/lib/control/zoom.js +95 -143
  21. package/lib/css/l7.css +502 -0
  22. package/lib/images/layers.png +0 -0
  23. package/lib/images/layers.svg +1 -0
  24. package/lib/images/logo.png +0 -0
  25. package/lib/index.js +53 -135
  26. package/lib/interface.js +17 -2
  27. package/lib/marker-layer.js +224 -330
  28. package/lib/marker.js +271 -404
  29. package/lib/popup.js +201 -309
  30. package/lib/utils/anchor.js +54 -37
  31. package/package.json +9 -9
  32. package/es/control/BaseControl.js.map +0 -1
  33. package/es/control/layer.js.map +0 -1
  34. package/es/control/logo.js.map +0 -1
  35. package/es/control/scale.js.map +0 -1
  36. package/es/control/zoom.js.map +0 -1
  37. package/es/index.js.map +0 -1
  38. package/es/interface.js.map +0 -1
  39. package/es/marker-layer.js.map +0 -1
  40. package/es/marker.js.map +0 -1
  41. package/es/popup.js.map +0 -1
  42. package/es/utils/anchor.js.map +0 -1
  43. package/lib/control/BaseControl.js.map +0 -1
  44. package/lib/control/layer.js.map +0 -1
  45. package/lib/control/logo.js.map +0 -1
  46. package/lib/control/scale.js.map +0 -1
  47. package/lib/control/zoom.js.map +0 -1
  48. package/lib/index.js.map +0 -1
  49. package/lib/interface.js.map +0 -1
  50. package/lib/marker-layer.js.map +0 -1
  51. package/lib/marker.js.map +0 -1
  52. package/lib/popup.js.map +0 -1
  53. package/lib/utils/anchor.js.map +0 -1
package/lib/popup.js CHANGED
@@ -1,324 +1,216 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/popup.ts
20
+ var popup_exports = {};
21
+ __export(popup_exports, {
22
+ default: () => Popup
7
23
  });
8
- exports.default = void 0;
9
-
10
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
-
12
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
-
14
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
15
-
16
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
17
-
18
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
19
-
20
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
21
-
22
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
23
-
24
- var _l7Core = require("@antv/l7-core");
25
-
26
- var _l7Utils = require("@antv/l7-utils");
27
-
28
- var _eventemitter = require("eventemitter3");
29
-
30
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
31
-
32
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
33
-
34
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
35
-
36
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
37
-
38
- var Popup = function (_EventEmitter) {
39
- (0, _inherits2.default)(Popup, _EventEmitter);
40
-
41
- var _super = _createSuper(Popup);
42
-
43
- function Popup(cfg) {
44
- var _this;
45
-
46
- (0, _classCallCheck2.default)(this, Popup);
47
- _this = _super.call(this);
48
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "popupOption", void 0);
49
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "mapsService", void 0);
50
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "sceneSerive", void 0);
51
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "lngLat", void 0);
52
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "content", void 0);
53
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "closeButton", void 0);
54
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "timeoutInstance", void 0);
55
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "container", void 0);
56
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "tip", void 0);
57
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "scene", void 0);
58
- _this.popupOption = _objectSpread(_objectSpread({}, _this.getdefault()), cfg);
59
- (0, _l7Utils.bindAll)(['update', 'onClickClose', 'remove'], (0, _assertThisInitialized2.default)(_this));
60
- return _this;
24
+ module.exports = __toCommonJS(popup_exports);
25
+ var import_l7_core = require("@antv/l7-core");
26
+ var import_l7_utils = require("@antv/l7-utils");
27
+ var import_eventemitter3 = require("eventemitter3");
28
+ var Popup = class extends import_eventemitter3.EventEmitter {
29
+ constructor(cfg) {
30
+ super();
31
+ this.popupOption = {
32
+ ...this.getdefault(),
33
+ ...cfg
34
+ };
35
+ (0, import_l7_utils.bindAll)(["update", "onClickClose", "remove"], this);
61
36
  }
62
-
63
- (0, _createClass2.default)(Popup, [{
64
- key: "addTo",
65
- value: function addTo(scene) {
66
- var _this2 = this;
67
-
68
- this.mapsService = scene.get(_l7Core.TYPES.IMapService);
69
- this.sceneSerive = scene.get(_l7Core.TYPES.ISceneService);
70
- this.mapsService.on('camerachange', this.update);
71
- this.mapsService.on('viewchange', this.update);
72
- this.scene = scene;
73
- this.update();
74
-
75
- if (this.popupOption.closeOnClick) {
76
- this.timeoutInstance = setTimeout(function () {
77
- _this2.mapsService.on('click', _this2.onClickClose);
78
- }, 30);
79
- }
80
-
81
- this.emit('open');
82
- return this;
83
- }
84
- }, {
85
- key: "close",
86
- value: function close() {
87
- this.remove();
88
- }
89
- }, {
90
- key: "open",
91
- value: function open() {
92
- this.addTo(this.scene);
93
- }
94
- }, {
95
- key: "setHTML",
96
- value: function setHTML(html) {
97
- var frag = window.document.createDocumentFragment();
98
- var temp = window.document.createElement('body');
99
- var child;
100
- temp.innerHTML = html;
101
-
102
- while (true) {
103
- child = temp.firstChild;
104
-
105
- if (!child) {
106
- break;
107
- }
108
-
109
- frag.appendChild(child);
110
- }
111
-
112
- return this.setDOMContent(frag);
113
- }
114
- }, {
115
- key: "setLnglat",
116
- value: function setLnglat(lngLat) {
117
- this.lngLat = lngLat;
118
-
119
- if (Array.isArray(lngLat)) {
120
- this.lngLat = {
121
- lng: lngLat[0],
122
- lat: lngLat[1]
123
- };
124
- }
125
-
126
- if (this.mapsService) {
127
- this.mapsService.on('camerachange', this.update);
128
- this.mapsService.on('viewchange', this.update);
129
- }
130
-
131
- this.update();
132
- return this;
133
- }
134
- }, {
135
- key: "getLnglat",
136
- value: function getLnglat() {
137
- return this.lngLat;
138
- }
139
- }, {
140
- key: "setText",
141
- value: function setText(text) {
142
- return this.setDOMContent(window.document.createTextNode(text));
143
- }
144
- }, {
145
- key: "setMaxWidth",
146
- value: function setMaxWidth(maxWidth) {
147
- this.popupOption.maxWidth = maxWidth;
148
- this.update();
149
- return this;
37
+ addTo(scene) {
38
+ this.mapsService = scene.get(import_l7_core.TYPES.IMapService);
39
+ this.sceneSerive = scene.get(import_l7_core.TYPES.ISceneService);
40
+ this.mapsService.on("camerachange", this.update);
41
+ this.mapsService.on("viewchange", this.update);
42
+ this.scene = scene;
43
+ this.update();
44
+ if (this.popupOption.closeOnClick) {
45
+ this.timeoutInstance = setTimeout(() => {
46
+ this.mapsService.on("click", this.onClickClose);
47
+ }, 30);
48
+ }
49
+ this.emit("open");
50
+ return this;
51
+ }
52
+ close() {
53
+ this.remove();
54
+ }
55
+ open() {
56
+ this.addTo(this.scene);
57
+ }
58
+ setHTML(html) {
59
+ const frag = window.document.createDocumentFragment();
60
+ const temp = window.document.createElement("body");
61
+ let child;
62
+ temp.innerHTML = html;
63
+ while (true) {
64
+ child = temp.firstChild;
65
+ if (!child) {
66
+ break;
67
+ }
68
+ frag.appendChild(child);
69
+ }
70
+ return this.setDOMContent(frag);
71
+ }
72
+ setLnglat(lngLat) {
73
+ this.lngLat = lngLat;
74
+ if (Array.isArray(lngLat)) {
75
+ this.lngLat = {
76
+ lng: lngLat[0],
77
+ lat: lngLat[1]
78
+ };
150
79
  }
151
- }, {
152
- key: "setDOMContent",
153
- value: function setDOMContent(htmlNode) {
154
- this.createContent();
155
- this.content.appendChild(htmlNode);
156
- this.update();
157
- return this;
80
+ if (this.mapsService) {
81
+ this.mapsService.on("camerachange", this.update);
82
+ this.mapsService.on("viewchange", this.update);
158
83
  }
159
- }, {
160
- key: "remove",
161
- value: function remove() {
162
- if (this.content) {
163
- this.removeDom(this.content);
164
- }
165
-
166
- if (this.container) {
167
- this.removeDom(this.container);
168
- delete this.container;
169
- }
170
-
171
- if (this.mapsService) {
172
- this.mapsService.off('camerachange', this.update);
173
- this.mapsService.off('viewchange', this.update);
174
- this.mapsService.off('click', this.onClickClose);
175
- delete this.mapsService;
176
- }
177
-
178
- clearTimeout(this.timeoutInstance);
179
- this.emit('close');
180
- return this;
181
- }
182
- }, {
183
- key: "isOpen",
184
- value: function isOpen() {
185
- return !!this.mapsService;
84
+ this.update();
85
+ return this;
86
+ }
87
+ getLnglat() {
88
+ return this.lngLat;
89
+ }
90
+ setText(text) {
91
+ return this.setDOMContent(window.document.createTextNode(text));
92
+ }
93
+ setMaxWidth(maxWidth) {
94
+ this.popupOption.maxWidth = maxWidth;
95
+ this.update();
96
+ return this;
97
+ }
98
+ setDOMContent(htmlNode) {
99
+ this.createContent();
100
+ this.content.appendChild(htmlNode);
101
+ this.update();
102
+ return this;
103
+ }
104
+ remove() {
105
+ if (this.content) {
106
+ this.removeDom(this.content);
107
+ }
108
+ if (this.container) {
109
+ this.removeDom(this.container);
110
+ delete this.container;
111
+ }
112
+ if (this.mapsService) {
113
+ this.mapsService.off("camerachange", this.update);
114
+ this.mapsService.off("viewchange", this.update);
115
+ this.mapsService.off("click", this.onClickClose);
116
+ delete this.mapsService;
117
+ }
118
+ clearTimeout(this.timeoutInstance);
119
+ this.emit("close");
120
+ return this;
121
+ }
122
+ isOpen() {
123
+ return !!this.mapsService;
124
+ }
125
+ createContent() {
126
+ if (this.content) {
127
+ import_l7_utils.DOM.remove(this.content);
186
128
  }
187
- }, {
188
- key: "createContent",
189
- value: function createContent() {
190
- if (this.content) {
191
- _l7Utils.DOM.remove(this.content);
192
- }
193
-
194
- this.content = _l7Utils.DOM.create('div', 'l7-popup-content', this.container);
195
-
196
- if (this.popupOption.closeButton) {
197
- this.closeButton = _l7Utils.DOM.create('button', 'l7-popup-close-button', this.content);
198
-
199
- if (this.popupOption.closeButtonOffsets) {
200
- this.closeButton.style.right = this.popupOption.closeButtonOffsets[0] + 'px';
201
- this.closeButton.style.top = this.popupOption.closeButtonOffsets[1] + 'px';
202
- }
203
-
204
- this.closeButton.setAttribute('aria-label', 'Close popup');
205
- this.closeButton.innerHTML = '&#215;';
206
- this.closeButton.addEventListener('click', this.onClickClose);
129
+ this.content = import_l7_utils.DOM.create("div", "l7-popup-content", this.container);
130
+ if (this.popupOption.closeButton) {
131
+ this.closeButton = import_l7_utils.DOM.create("button", "l7-popup-close-button", this.content);
132
+ if (this.popupOption.closeButtonOffsets) {
133
+ this.closeButton.style.right = this.popupOption.closeButtonOffsets[0] + "px";
134
+ this.closeButton.style.top = this.popupOption.closeButtonOffsets[1] + "px";
207
135
  }
136
+ this.closeButton.setAttribute("aria-label", "Close popup");
137
+ this.closeButton.innerHTML = "&#215;";
138
+ this.closeButton.addEventListener("click", this.onClickClose);
208
139
  }
209
- }, {
210
- key: "creatDom",
211
- value: function creatDom(tagName, className, container) {
212
- var el = window.document.createElement(tagName);
213
-
214
- if (className !== undefined) {
215
- el.className = className;
216
- }
217
-
218
- if (container) {
219
- container.appendChild(el);
220
- }
221
-
222
- return el;
140
+ }
141
+ creatDom(tagName, className, container) {
142
+ const el = window.document.createElement(tagName);
143
+ if (className !== void 0) {
144
+ el.className = className;
223
145
  }
224
- }, {
225
- key: "removeDom",
226
- value: function removeDom(node) {
227
- if (node.parentNode) {
228
- node.parentNode.removeChild(node);
229
- }
146
+ if (container) {
147
+ container.appendChild(el);
230
148
  }
231
- }, {
232
- key: "getdefault",
233
- value: function getdefault() {
234
- return {
235
- closeButton: true,
236
- closeOnClick: true,
237
- maxWidth: '240px',
238
- offsets: [0, 0],
239
- anchor: _l7Utils.anchorType.BOTTOM,
240
- className: '',
241
- stopPropagation: true
242
- };
149
+ return el;
150
+ }
151
+ removeDom(node) {
152
+ if (node.parentNode) {
153
+ node.parentNode.removeChild(node);
243
154
  }
244
- }, {
245
- key: "onClickClose",
246
- value: function onClickClose(e) {
247
- if (e.stopPropagation) {
248
- e.stopPropagation();
249
- }
250
-
251
- this.remove();
155
+ }
156
+ getdefault() {
157
+ return {
158
+ closeButton: true,
159
+ closeOnClick: true,
160
+ maxWidth: "240px",
161
+ offsets: [0, 0],
162
+ anchor: import_l7_utils.anchorType.BOTTOM,
163
+ className: "",
164
+ stopPropagation: true
165
+ };
166
+ }
167
+ onClickClose(e) {
168
+ if (e.stopPropagation) {
169
+ e.stopPropagation();
252
170
  }
253
- }, {
254
- key: "update",
255
- value: function update() {
256
- var _this3 = this;
257
-
258
- var hasPosition = this.lngLat;
259
- var _this$popupOption = this.popupOption,
260
- className = _this$popupOption.className,
261
- maxWidth = _this$popupOption.maxWidth,
262
- anchor = _this$popupOption.anchor;
263
-
264
- if (!this.mapsService || !hasPosition || !this.content) {
265
- return;
266
- }
267
-
268
- var popupContainer = this.mapsService.getMarkerContainer();
269
-
270
- if (!this.container && popupContainer) {
271
- this.container = this.creatDom('div', 'l7-popup', popupContainer);
272
- this.tip = this.creatDom('div', 'l7-popup-tip', this.container);
273
- this.container.appendChild(this.content);
274
-
275
- if (className) {
276
- className.split(' ').forEach(function (name) {
277
- return _this3.container.classList.add(name);
278
- });
279
- }
280
-
281
- var stopPropagation = this.popupOption.stopPropagation;
282
-
283
- if (stopPropagation) {
284
- ['mousemove', 'mousedown', 'mouseup', 'click', 'dblclick'].forEach(function (type) {
285
- _this3.container.addEventListener(type, function (e) {
286
- e.stopPropagation();
287
- });
171
+ this.remove();
172
+ }
173
+ update() {
174
+ const hasPosition = this.lngLat;
175
+ const { className, maxWidth, anchor } = this.popupOption;
176
+ if (!this.mapsService || !hasPosition || !this.content) {
177
+ return;
178
+ }
179
+ const popupContainer = this.mapsService.getMarkerContainer();
180
+ if (!this.container && popupContainer) {
181
+ this.container = this.creatDom("div", "l7-popup", popupContainer);
182
+ this.tip = this.creatDom("div", "l7-popup-tip", this.container);
183
+ this.container.appendChild(this.content);
184
+ if (className) {
185
+ className.split(" ").forEach((name) => this.container.classList.add(name));
186
+ }
187
+ const { stopPropagation } = this.popupOption;
188
+ if (stopPropagation) {
189
+ ["mousemove", "mousedown", "mouseup", "click", "dblclick"].forEach((type) => {
190
+ this.container.addEventListener(type, (e) => {
191
+ e.stopPropagation();
288
192
  });
289
- }
290
-
291
- this.container.style.whiteSpace = 'nowrap';
292
- }
293
-
294
- if (maxWidth && this.container.style.maxWidth !== maxWidth) {
295
- this.container.style.maxWidth = maxWidth;
193
+ });
296
194
  }
297
-
298
- this.updatePosition();
299
-
300
- _l7Utils.DOM.setTransform(this.container, "".concat(_l7Utils.anchorTranslate[anchor]));
301
-
302
- (0, _l7Utils.applyAnchorClass)(this.container, anchor, 'popup');
195
+ this.container.style.whiteSpace = "nowrap";
303
196
  }
304
- }, {
305
- key: "updatePosition",
306
- value: function updatePosition() {
307
- if (!this.mapsService) {
308
- return;
309
- }
310
-
311
- var _this$lngLat = this.lngLat,
312
- lng = _this$lngLat.lng,
313
- lat = _this$lngLat.lat;
314
- var offsets = this.popupOption.offsets;
315
- var pos = this.mapsService.lngLatToContainer([lng, lat]);
316
- this.container.style.left = pos.x + offsets[0] + 'px';
317
- this.container.style.top = pos.y - offsets[1] + 'px';
197
+ if (maxWidth && this.container.style.maxWidth !== maxWidth) {
198
+ this.container.style.maxWidth = maxWidth;
318
199
  }
319
- }]);
320
- return Popup;
321
- }(_eventemitter.EventEmitter);
322
-
323
- exports.default = Popup;
324
- //# sourceMappingURL=popup.js.map
200
+ this.updatePosition();
201
+ import_l7_utils.DOM.setTransform(this.container, `${import_l7_utils.anchorTranslate[anchor]}`);
202
+ (0, import_l7_utils.applyAnchorClass)(this.container, anchor, "popup");
203
+ }
204
+ updatePosition() {
205
+ if (!this.mapsService) {
206
+ return;
207
+ }
208
+ const { lng, lat } = this.lngLat;
209
+ const { offsets } = this.popupOption;
210
+ const pos = this.mapsService.lngLatToContainer([lng, lat]);
211
+ this.container.style.left = pos.x + offsets[0] + "px";
212
+ this.container.style.top = pos.y - offsets[1] + "px";
213
+ }
214
+ };
215
+ // Annotate the CommonJS export names for ESM import in node:
216
+ 0 && (module.exports = {});
@@ -1,46 +1,63 @@
1
- "use strict";
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
2
18
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
19
+ // src/utils/anchor.ts
20
+ var anchor_exports = {};
21
+ __export(anchor_exports, {
22
+ anchorTranslate: () => anchorTranslate,
23
+ anchorType: () => anchorType,
24
+ applyAnchorClass: () => applyAnchorClass
5
25
  });
6
- exports.anchorType = exports.anchorTranslate = void 0;
7
- exports.applyAnchorClass = applyAnchorClass;
8
- var anchorType;
9
- exports.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
-
26
+ module.exports = __toCommonJS(anchor_exports);
27
+ var anchorType = /* @__PURE__ */ ((anchorType2) => {
28
+ anchorType2["CENTER"] = "center";
29
+ anchorType2["TOP"] = "top";
30
+ anchorType2["TOP-LEFT"] = "top-left";
31
+ anchorType2["TOP-RIGHT"] = "top-right";
32
+ anchorType2["BOTTOM"] = "bottom";
33
+ anchorType2["BOTTOM-LEFT"] = "bottom-left";
34
+ anchorType2["LEFT"] = "left";
35
+ anchorType2["RIGHT"] = "right";
36
+ return anchorType2;
37
+ })(anchorType || {});
22
38
  var 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%)'
39
+ center: "translate(-50%,-50%)",
40
+ top: "translate(-50%,0)",
41
+ "top-left": "translate(0,0)",
42
+ "top-right": "translate(-100%,0)",
43
+ bottom: "translate(-50%,-100%)",
44
+ "bottom-left": "translate(0,-100%)",
45
+ "bottom-right": "translate(-100%,-100%)",
46
+ left: "translate(0,-50%)",
47
+ right: "translate(-100%,-50%)"
32
48
  };
33
- exports.anchorTranslate = anchorTranslate;
34
-
35
49
  function applyAnchorClass(element, anchor, prefix) {
36
- var classList = element.classList;
37
-
38
- for (var key in anchorTranslate) {
50
+ const classList = element.classList;
51
+ for (const key in anchorTranslate) {
39
52
  if (anchorTranslate.hasOwnProperty(key)) {
40
- classList.remove("l7-".concat(prefix, "-anchor-").concat(key));
53
+ classList.remove(`l7-${prefix}-anchor-${key}`);
41
54
  }
42
55
  }
43
-
44
- classList.add("l7-".concat(prefix, "-anchor-").concat(anchor));
56
+ classList.add(`l7-${prefix}-anchor-${anchor}`);
45
57
  }
46
- //# sourceMappingURL=anchor.js.map
58
+ // Annotate the CommonJS export names for ESM import in node:
59
+ 0 && (module.exports = {
60
+ anchorTranslate,
61
+ anchorType,
62
+ applyAnchorClass
63
+ });