@telperion/elements 1.0.0

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 (86) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +102 -0
  3. package/bundle.js +164 -0
  4. package/bundle.mjs +2630 -0
  5. package/drag-drop/drag-element.cjs +438 -0
  6. package/drag-drop/drag-element.d.ts +120 -0
  7. package/drag-drop/drag-element.js +437 -0
  8. package/drag-drop/drag-element.js.map +1 -0
  9. package/drag-drop/drag-handle-element.cjs +35 -0
  10. package/drag-drop/drag-handle-element.d.ts +12 -0
  11. package/drag-drop/drag-handle-element.js +34 -0
  12. package/drag-drop/drag-handle-element.js.map +1 -0
  13. package/drag-drop/dropzone-element.cjs +117 -0
  14. package/drag-drop/dropzone-element.d.ts +17 -0
  15. package/drag-drop/dropzone-element.js +116 -0
  16. package/drag-drop/dropzone-element.js.map +1 -0
  17. package/drag-drop/index.cjs +11 -0
  18. package/drag-drop/index.d.ts +22 -0
  19. package/drag-drop/index.js +6 -0
  20. package/drag-drop/index.js.map +1 -0
  21. package/drag-drop/private-props.cjs +6 -0
  22. package/drag-drop/private-props.d.ts +3 -0
  23. package/drag-drop/private-props.js +5 -0
  24. package/drag-drop/private-props.js.map +1 -0
  25. package/drag-drop/tha-drag-event.cjs +34 -0
  26. package/drag-drop/tha-drag-event.d.ts +19 -0
  27. package/drag-drop/tha-drag-event.js +32 -0
  28. package/drag-drop/tha-drag-event.js.map +1 -0
  29. package/icon/icon-element.cjs +114 -0
  30. package/icon/icon-element.d.ts +40 -0
  31. package/icon/icon-element.js +113 -0
  32. package/icon/icon-element.js.map +1 -0
  33. package/icon/index.cjs +5 -0
  34. package/icon/index.d.ts +1 -0
  35. package/icon/index.js +3 -0
  36. package/icon/index.js.map +1 -0
  37. package/icon/material-symbols.css +22 -0
  38. package/index.cjs +11 -0
  39. package/index.d.ts +6 -0
  40. package/index.js +10 -0
  41. package/index.js.map +1 -0
  42. package/package.json +127 -0
  43. package/router/history-managed.cjs +97 -0
  44. package/router/history-managed.d.ts +76 -0
  45. package/router/history-managed.js +95 -0
  46. package/router/history-managed.js.map +1 -0
  47. package/router/history.cjs +65 -0
  48. package/router/history.d.ts +48 -0
  49. package/router/history.js +63 -0
  50. package/router/history.js.map +1 -0
  51. package/router/index.cjs +15 -0
  52. package/router/index.d.ts +6 -0
  53. package/router/index.js +8 -0
  54. package/router/index.js.map +1 -0
  55. package/router/signal-watcher-lit-element.cjs +11 -0
  56. package/router/signal-watcher-lit-element.d.ts +25 -0
  57. package/router/signal-watcher-lit-element.js +10 -0
  58. package/router/signal-watcher-lit-element.js.map +1 -0
  59. package/router/tha-route.cjs +125 -0
  60. package/router/tha-route.d.ts +90 -0
  61. package/router/tha-route.js +124 -0
  62. package/router/tha-route.js.map +1 -0
  63. package/router/tha-router-config.cjs +241 -0
  64. package/router/tha-router-config.d.ts +223 -0
  65. package/router/tha-router-config.js +240 -0
  66. package/router/tha-router-config.js.map +1 -0
  67. package/router/tha-router-link.cjs +209 -0
  68. package/router/tha-router-link.d.ts +95 -0
  69. package/router/tha-router-link.js +208 -0
  70. package/router/tha-router-link.js.map +1 -0
  71. package/router/tha-router-outlet.cjs +215 -0
  72. package/router/tha-router-outlet.d.ts +112 -0
  73. package/router/tha-router-outlet.js +214 -0
  74. package/router/tha-router-outlet.js.map +1 -0
  75. package/router/tha-router-param.cjs +278 -0
  76. package/router/tha-router-param.d.ts +226 -0
  77. package/router/tha-router-param.js +277 -0
  78. package/router/tha-router-param.js.map +1 -0
  79. package/router/tha-router.cjs +163 -0
  80. package/router/tha-router.d.ts +69 -0
  81. package/router/tha-router.js +162 -0
  82. package/router/tha-router.js.map +1 -0
  83. package/tha-url-output.cjs +79 -0
  84. package/tha-url-output.d.ts +41 -0
  85. package/tha-url-output.js +78 -0
  86. package/tha-url-output.js.map +1 -0
@@ -0,0 +1,438 @@
1
+ "use strict";
2
+ var _a;
3
+ var DragElement_1;
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.DragElement = void 0;
6
+ const tslib_1 = require("tslib");
7
+ const defer_1 = require("@telperion/js-utils/function/defer");
8
+ const lit_1 = require("lit");
9
+ const decorators_js_1 = require("lit/decorators.js");
10
+ const private_props_1 = require("./private-props");
11
+ const tha_drag_event_1 = require("./tha-drag-event");
12
+ let DragElement = class DragElement extends lit_1.LitElement {
13
+ constructor() {
14
+ super(...arguments);
15
+ /**
16
+ * A record of drag-related data attributes.
17
+ */
18
+ this.dragData = {};
19
+ /**
20
+ * Pre-drag data used to store the initial state of the element before dragging starts.
21
+ */
22
+ this.preDragData = {
23
+ boundingRect: null,
24
+ dragStartEvent: null,
25
+ styles: {
26
+ pointerEvents: ''
27
+ }
28
+ };
29
+ /**
30
+ * A weak reference to the currently accepted drop zone.
31
+ * This is used to track which drop zone the element is currently accepted in.
32
+ */
33
+ this.#acceptedDropzone = null;
34
+ /**
35
+ * A weak reference to the clone of the element created during dragging.
36
+ * This is used to manage the clone's lifecycle and properties.
37
+ */
38
+ this.#clone = null;
39
+ /**
40
+ * A set of drag handles associated with the element.
41
+ */
42
+ this.#handles = new Set();
43
+ /**
44
+ * The dragging strategy to use for the element.
45
+ * This determines how the element is dragged (e.g., move or copy).
46
+ */
47
+ this.draggingStrategy = 'move';
48
+ /**
49
+ * Indicates whether the element is currently being dragged.
50
+ */
51
+ this.dragging = false;
52
+ /**
53
+ * Indicates whether the drag operation has ended.
54
+ * This is used to manage the state of the element after dragging.
55
+ */
56
+ this.dragend = false;
57
+ /**
58
+ * The ID of the drop zone the element is currently over.
59
+ */
60
+ this.draggedOver = null;
61
+ /**
62
+ * Indicates whether the element has been accepted by a drop zone.
63
+ * This is used to manage the state of the element during drag-and-drop operations.
64
+ */
65
+ this.dropAccepted = false;
66
+ /**
67
+ * Handles the drag start event.
68
+ * @param event The drag event.
69
+ */
70
+ this.#handleDragStart = (event) => {
71
+ if (!this.#shouldHandleEvent(event))
72
+ return event.preventDefault();
73
+ // Stop propagation to prevent parent draggable elements from interfering.
74
+ event.stopPropagation();
75
+ // Modify base event properties to prevent default behavior and set up drag image.
76
+ event.dataTransfer?.setDragImage(DragElement_1.TRANSPARENT_IMAGE, 0, 0);
77
+ event.dataTransfer.effectAllowed = this.draggingStrategy;
78
+ document.addEventListener('dragover', this.#preventDragOver);
79
+ // Prepare pre-drag data and styles.
80
+ this.#preparePreDragData(event);
81
+ this.#prepareDraggingStyles();
82
+ (0, defer_1.defer)().then(() => {
83
+ this.style.pointerEvents = 'none';
84
+ this.dragging = true;
85
+ if (this.replaceClone) {
86
+ const clone = this.#createClone();
87
+ this.#clone = new WeakRef(clone);
88
+ this.parentElement.insertBefore(clone, this.nextSibling);
89
+ }
90
+ this.dispatchEvent(new tha_drag_event_1.ThaDragEvent('thadragstart', { dragTarget: new WeakRef(this) }, event));
91
+ });
92
+ };
93
+ /**
94
+ * Handles the drag end event.
95
+ * @param event The drag event.
96
+ */
97
+ this.#handleDragEnd = (event) => {
98
+ document.removeEventListener('dragover', this.#preventDragOver);
99
+ this.dragend = true;
100
+ const hasTransition = getComputedStyle(this).transitionDuration.match(/\d*\.?\d+/g)?.map(Number).some(num => num > 0);
101
+ const clear = () => {
102
+ if (this.replaceClone)
103
+ this.clone?.remove();
104
+ this.style.pointerEvents = this.preDragData.styles.pointerEvents;
105
+ ['--tha-width', '--tha-height', '--tha-left', '--tha-top', '--tha-x', '--tha-y', '--tha-cx', '--tha-cy'].forEach(prop => {
106
+ this.style.removeProperty(prop);
107
+ });
108
+ ['width', 'height', 'left', 'right', 'top', 'bottom'].forEach(prop => {
109
+ this.style.removeProperty(`--tha-target-${prop}`);
110
+ });
111
+ const acceptedDropzone = this.#acceptedDropzone;
112
+ const dropAccepted = this.dropAccepted;
113
+ this.dragging = false;
114
+ this.dragend = false;
115
+ this.draggedOver = null;
116
+ this.dropAccepted = false;
117
+ this.#acceptedDropzone = null;
118
+ if (dropAccepted && acceptedDropzone) {
119
+ acceptedDropzone.deref()?.dispatchEvent(new tha_drag_event_1.ThaDragEvent('thadropend', { dragTarget: new WeakRef(this), dropzoneTarget: acceptedDropzone }, event));
120
+ }
121
+ this.dispatchEvent(new tha_drag_event_1.ThaDragEvent('thadragend', { dragTarget: new WeakRef(this) }, event));
122
+ };
123
+ if (hasTransition)
124
+ this.addEventListener('transitionend', clear, { once: true });
125
+ else
126
+ clear();
127
+ };
128
+ /**
129
+ * Handles the drag event.
130
+ * This updates the position of the element during dragging.
131
+ * @param event The drag event.
132
+ */
133
+ this.#handleDrag = (event) => {
134
+ const { x, y } = event;
135
+ this.style.setProperty('--tha-cx', `${x}px`);
136
+ this.style.setProperty('--tha-cy', `${y}px`);
137
+ };
138
+ /**
139
+ * Handles the drop zone enter event.
140
+ * This updates the draggedOver property to indicate which drop zone the element is currently over.
141
+ * @param event The ThaDragEvent for the drop zone enter.
142
+ */
143
+ this.#handleDropZoneEnter = (event) => {
144
+ this.draggedOver = event.dropzoneTarget?.deref()?.name ?? '';
145
+ };
146
+ /**
147
+ * Handles the drop zone leave event.
148
+ * This clears the draggedOver property when the element leaves a drop zone.
149
+ * @param event The ThaDragEvent for the drop zone leave.
150
+ */
151
+ this.#handleDropZoneLeave = () => {
152
+ this.draggedOver = null;
153
+ };
154
+ }
155
+ static { DragElement_1 = this; }
156
+ /**
157
+ * An observer for monitoring changes to drag-related attributes.
158
+ */
159
+ static { this.DRAG_DATA_OBSERVER = new MutationObserver(records => {
160
+ for (const { attributeName, target } of records) {
161
+ if (!attributeName?.startsWith('data-drag-'))
162
+ continue;
163
+ const element = target;
164
+ element.dragData[attributeName.replace('data-drag-', '')] = element.getAttribute(attributeName);
165
+ }
166
+ }); }
167
+ static { this.styles = (0, lit_1.css) `
168
+ :host {
169
+ --tha-diff-x: calc(var(--tha-cx) - var(--tha-x));
170
+ --tha-diff-y: calc(var(--tha-cy) - var(--tha-y));
171
+ }
172
+
173
+ :host([draggingstrategy="move"]),
174
+ :host([draggingstrategy="copyMove"]) {
175
+ transition-duration: .2s;
176
+ transition-timing-function: ease-out;
177
+ transition-property: none;
178
+ }
179
+
180
+ :host([draggingstrategy="move"][dragging]),
181
+ :host([draggingstrategy="copyMove"][dragging]) {
182
+ position: fixed;
183
+ width: var(--tha-width);
184
+ height: var(--tha-height);
185
+ left: calc(var(--tha-left) + var(--tha-diff-x) + var(--tha-offset-x));
186
+ top: calc(var(--tha-top) + var(--tha-diff-y) + var(--tha-offset-y));
187
+ transform-origin: calc(var(--tha-x) - var(--tha-left)) calc(var(--tha-y) - var(--tha-top));
188
+ z-index: 100;
189
+ }
190
+
191
+ :host([draggingstrategy="move"][dragend]),
192
+ :host([draggingstrategy="copyMove"][dragend]) {
193
+ left: var(--tha-left);
194
+ top: var(--tha-top);
195
+ transition-property: all;
196
+ }
197
+
198
+ :host([draggingstrategy="move"][dragend][dropaccepted]),
199
+ :host([draggingstrategy="copyMove"][dragend][dropaccepted]) {
200
+ left: var(--tha-target-left);
201
+ top: var(--tha-target-top);
202
+ width: var(--tha-target-width);
203
+ height: var(--tha-target-height);
204
+ }
205
+ `; }
206
+ static {
207
+ this.TRANSPARENT_IMAGE = new Image(1, 1);
208
+ this.TRANSPARENT_IMAGE.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==';
209
+ const style = this.GLOBAL_STYLE = document.createElement('style');
210
+ style.innerHTML = `
211
+ @property --tha-offset-x {
212
+ syntax: '<length>';
213
+ initial-value: 0px;
214
+ inherits: true;
215
+ }
216
+
217
+ @property --tha-offset-y {
218
+ syntax: '<length>';
219
+ initial-value: 0px;
220
+ inherits: true;
221
+ }
222
+ `;
223
+ document.head.appendChild(style);
224
+ }
225
+ /**
226
+ * A weak reference to the currently accepted drop zone.
227
+ * This is used to track which drop zone the element is currently accepted in.
228
+ */
229
+ #acceptedDropzone;
230
+ /**
231
+ * A weak reference to the clone of the element created during dragging.
232
+ * This is used to manage the clone's lifecycle and properties.
233
+ */
234
+ #clone;
235
+ /**
236
+ * A set of drag handles associated with the element.
237
+ */
238
+ #handles;
239
+ /**
240
+ * Returns the clone of the element if it exists.
241
+ * This is used to access the clone during drag operations.
242
+ */
243
+ get clone() { return this.#clone.deref(); }
244
+ connectedCallback() {
245
+ super.connectedCallback();
246
+ // Set the draggable attribute to true to enable dragging.
247
+ this.draggable = true;
248
+ // Set up the drag data attributes observer to monitor changes to drag-related attributes.
249
+ this.#setUpDragDataAttrs();
250
+ // Add event listeners for drag events.
251
+ this.addEventListener('dragstart', this.#handleDragStart);
252
+ this.addEventListener('dragend', this.#handleDragEnd);
253
+ this.addEventListener('drag', this.#handleDrag);
254
+ this.addEventListener('thadropzoneenter', this.#handleDropZoneEnter);
255
+ this.addEventListener('thadropzoneleave', this.#handleDropZoneLeave);
256
+ }
257
+ disconnectedCallback() {
258
+ super.disconnectedCallback();
259
+ // Clean up the drag data attributes observer.
260
+ this.removeEventListener('dragstart', this.#handleDragStart);
261
+ this.removeEventListener('dragend', this.#handleDragEnd);
262
+ this.removeEventListener('drag', this.#handleDrag);
263
+ this.removeEventListener('thadropzoneenter', this.#handleDropZoneEnter);
264
+ this.removeEventListener('thadropzoneleave', this.#handleDropZoneLeave);
265
+ }
266
+ render() {
267
+ return (0, lit_1.html) `<slot></slot>`;
268
+ }
269
+ /**
270
+ * Accepts a drop zone and an optional rectangle for the drop area.
271
+ * @param dropzone The drop zone element being accepted.
272
+ * @param rect The bounding rectangle of the drop area.
273
+ * @returns
274
+ */
275
+ [private_props_1.ACCEPT_DROP_PROP](dropzone, rect) {
276
+ this.dropAccepted = true;
277
+ this.#acceptedDropzone = dropzone;
278
+ if (!rect)
279
+ return;
280
+ const { width, height, left, right, top, bottom } = rect;
281
+ for (const prop in { width, height, left, right, top, bottom }) {
282
+ this.style.setProperty(`--tha-target-${prop}`, `${rect[prop]}px`);
283
+ }
284
+ }
285
+ /**
286
+ * Registers a drag handle element.
287
+ * @param handle The drag handle element to register.
288
+ */
289
+ [private_props_1.REGISTER_HANDLE_PROP](handle) {
290
+ this.#handles.add(handle);
291
+ }
292
+ /**
293
+ * Unregisters a drag handle element.
294
+ * @param handle The drag handle element to unregister.
295
+ */
296
+ [private_props_1.UNREGISTER_HANDLE_PROP](handle) {
297
+ this.#handles.delete(handle);
298
+ }
299
+ /**
300
+ * Sets up the drag data attributes observer to monitor changes to drag-related attributes.
301
+ * This allows the element to transfer custom data during drag-and-drop operations.
302
+ */
303
+ #setUpDragDataAttrs() {
304
+ DragElement_1.DRAG_DATA_OBSERVER.observe(this, { attributes: true });
305
+ for (const { name, value } of Object.values(this.attributes).filter(attr => attr.name.startsWith('data-drag-'))) {
306
+ this.dragData[name.replace('data-drag-', '')] = value;
307
+ }
308
+ }
309
+ /**
310
+ * Handles the drag start event.
311
+ * @param event The drag event.
312
+ */
313
+ #handleDragStart;
314
+ /**
315
+ * Handles the drag end event.
316
+ * @param event The drag event.
317
+ */
318
+ #handleDragEnd;
319
+ /**
320
+ * Handles the drag event.
321
+ * This updates the position of the element during dragging.
322
+ * @param event The drag event.
323
+ */
324
+ #handleDrag;
325
+ /**
326
+ * Handles the drop zone enter event.
327
+ * This updates the draggedOver property to indicate which drop zone the element is currently over.
328
+ * @param event The ThaDragEvent for the drop zone enter.
329
+ */
330
+ #handleDropZoneEnter;
331
+ /**
332
+ * Handles the drop zone leave event.
333
+ * This clears the draggedOver property when the element leaves a drop zone.
334
+ * @param event The ThaDragEvent for the drop zone leave.
335
+ */
336
+ #handleDropZoneLeave;
337
+ /**
338
+ * Creates a clone of the element for dragging.
339
+ * This clone is used to visually represent the element during drag operations.
340
+ * @returns The cloned element.
341
+ */
342
+ #createClone() {
343
+ const container = document.createElement('tha-drag-clone');
344
+ Object.values(this.attributes)
345
+ .filter(attr => !['dragging', 'replaceclone', 'draggable'].includes(attr.name))
346
+ .forEach(attr => {
347
+ container.attributes.setNamedItem(attr.cloneNode());
348
+ });
349
+ this.childNodes.forEach(node => {
350
+ container.appendChild(node.cloneNode(true));
351
+ });
352
+ return container;
353
+ }
354
+ /**
355
+ * Prepares the pre-drag data, including the bounding rectangle and styles.
356
+ * This data is used to restore the element's state after dragging.
357
+ * @param event The drag event.
358
+ */
359
+ #preparePreDragData(event) {
360
+ this.preDragData.boundingRect = this.getBoundingClientRect();
361
+ this.preDragData.dragStartEvent = event;
362
+ this.preDragData.styles.pointerEvents = this.style.pointerEvents;
363
+ }
364
+ /**
365
+ * Prepares the styles for dragging, including the position and size of the element.
366
+ * This is used to update the element's position during drag operations.
367
+ */
368
+ #prepareDraggingStyles() {
369
+ const { boundingRect: { width, height, left, top }, dragStartEvent: { x, y } } = this.preDragData;
370
+ const props = { width, height, left, top, x, y };
371
+ for (const prop in props) {
372
+ this.style.setProperty(`--tha-${prop}`, `${props[prop]}px`);
373
+ }
374
+ }
375
+ /**
376
+ * Prevents the default dragover behavior to allow custom drag-and-drop handling.
377
+ * @param event The drag event.
378
+ */
379
+ #preventDragOver(event) {
380
+ event.preventDefault();
381
+ }
382
+ /**
383
+ * Checks if the element should handle the drag event based on the target.
384
+ * If there are no handles, it returns true to allow the event.
385
+ * If there are handles, it checks if the event target is one of the handles.
386
+ * @param event The drag event.
387
+ * @returns True if the element should handle the event, false otherwise.
388
+ */
389
+ #shouldHandleEvent(event) {
390
+ if (this.disabled)
391
+ return false;
392
+ if (!this.#handles.size)
393
+ return true;
394
+ if (this.#handles.has(event.target))
395
+ return true;
396
+ return false;
397
+ }
398
+ };
399
+ exports.DragElement = DragElement;
400
+ tslib_1.__decorate([
401
+ (0, decorators_js_1.property)({ type: String }),
402
+ tslib_1.__metadata("design:type", String)
403
+ ], DragElement.prototype, "name", void 0);
404
+ tslib_1.__decorate([
405
+ (0, decorators_js_1.property)({ type: String, reflect: true }),
406
+ tslib_1.__metadata("design:type", String)
407
+ ], DragElement.prototype, "draggingStrategy", void 0);
408
+ tslib_1.__decorate([
409
+ (0, decorators_js_1.property)({ type: String }),
410
+ tslib_1.__metadata("design:type", String)
411
+ ], DragElement.prototype, "dragGroup", void 0);
412
+ tslib_1.__decorate([
413
+ (0, decorators_js_1.property)({ type: Boolean }),
414
+ tslib_1.__metadata("design:type", Boolean)
415
+ ], DragElement.prototype, "replaceClone", void 0);
416
+ tslib_1.__decorate([
417
+ (0, decorators_js_1.property)({ type: Boolean, reflect: true }),
418
+ tslib_1.__metadata("design:type", Object)
419
+ ], DragElement.prototype, "dragging", void 0);
420
+ tslib_1.__decorate([
421
+ (0, decorators_js_1.property)({ type: Boolean, reflect: true }),
422
+ tslib_1.__metadata("design:type", Object)
423
+ ], DragElement.prototype, "dragend", void 0);
424
+ tslib_1.__decorate([
425
+ (0, decorators_js_1.property)({ type: String, reflect: true }),
426
+ tslib_1.__metadata("design:type", Object)
427
+ ], DragElement.prototype, "draggedOver", void 0);
428
+ tslib_1.__decorate([
429
+ (0, decorators_js_1.property)({ type: Boolean, reflect: true }),
430
+ tslib_1.__metadata("design:type", Object)
431
+ ], DragElement.prototype, "dropAccepted", void 0);
432
+ tslib_1.__decorate([
433
+ (0, decorators_js_1.property)({ type: Boolean, reflect: true }),
434
+ tslib_1.__metadata("design:type", Boolean)
435
+ ], DragElement.prototype, "disabled", void 0);
436
+ exports.DragElement = DragElement = DragElement_1 = tslib_1.__decorate([
437
+ (0, decorators_js_1.customElement)('tha-drag')
438
+ ], DragElement);
@@ -0,0 +1,120 @@
1
+ import { LitElement, type CSSResultGroup, type TemplateResult } from "lit";
2
+ import type { DropZoneElement } from "./dropzone-element";
3
+ import { ACCEPT_DROP_PROP, REGISTER_HANDLE_PROP, UNREGISTER_HANDLE_PROP } from "./private-props";
4
+ import type { DragHandleElement } from "./drag-handle-element";
5
+ declare global {
6
+ interface HTMLElementTagNameMap {
7
+ /**
8
+ * A draggable element that can be used to initiate drag-and-drop operations.
9
+ * It can contain child elements and supports drag handles.
10
+ * The `replaceclone` attribute indicates whether the element should be replaced with a clone during
11
+ * the drag operation.
12
+ * The `draggingstrategy` attribute defines the drag behavior, such as 'move' or 'copyMove'.
13
+ *
14
+ */
15
+ "tha-drag": DragElement;
16
+ }
17
+ }
18
+ export declare class DragElement extends LitElement {
19
+ #private;
20
+ /**
21
+ * A transparent image used as a drag image to prevent flickering during drag operations.
22
+ * This image is used when the drag image is not set explicitly.
23
+ * It is a 1x1 pixel transparent PNG.
24
+ */
25
+ private static TRANSPARENT_IMAGE;
26
+ /**
27
+ * A global style element used to define custom properties for drag-and-drop.
28
+ */
29
+ private static GLOBAL_STYLE;
30
+ /**
31
+ * An observer for monitoring changes to drag-related attributes.
32
+ */
33
+ private static DRAG_DATA_OBSERVER;
34
+ static styles: CSSResultGroup;
35
+ /**
36
+ * A record of drag-related data attributes.
37
+ */
38
+ readonly dragData: Record<string, string>;
39
+ /**
40
+ * Pre-drag data used to store the initial state of the element before dragging starts.
41
+ */
42
+ readonly preDragData: {
43
+ boundingRect: DOMRect;
44
+ dragStartEvent: DragEvent;
45
+ styles: {
46
+ pointerEvents: string;
47
+ };
48
+ };
49
+ /**
50
+ * Returns the clone of the element if it exists.
51
+ * This is used to access the clone during drag operations.
52
+ */
53
+ get clone(): HTMLElement | undefined;
54
+ /**
55
+ * The name of the element, used for identification in drag-and-drop operations.
56
+ * This helps the dropzones to accept or reject the drag based on the name.
57
+ */
58
+ name: string;
59
+ /**
60
+ * The dragging strategy to use for the element.
61
+ * This determines how the element is dragged (e.g., move or copy).
62
+ */
63
+ draggingStrategy: 'move' | 'copyMove';
64
+ /**
65
+ * The group name for the drag element.
66
+ * This is used to group elements together for drag-and-drop operations.
67
+ * Elements with the same group name can interact with each other during drag-and-drop.
68
+ *
69
+ * !!! Not implemented yet !!!
70
+ */
71
+ dragGroup: string;
72
+ /**
73
+ * Indicates whether the element should replace its clone during drag operations.
74
+ * If true , the original element is replaced with a clone during dragging.
75
+ */
76
+ replaceClone: boolean;
77
+ /**
78
+ * Indicates whether the element is currently being dragged.
79
+ */
80
+ dragging: boolean;
81
+ /**
82
+ * Indicates whether the drag operation has ended.
83
+ * This is used to manage the state of the element after dragging.
84
+ */
85
+ dragend: boolean;
86
+ /**
87
+ * The ID of the drop zone the element is currently over.
88
+ */
89
+ draggedOver: string | null;
90
+ /**
91
+ * Indicates whether the element has been accepted by a drop zone.
92
+ * This is used to manage the state of the element during drag-and-drop operations.
93
+ */
94
+ dropAccepted: boolean;
95
+ /**
96
+ * Indicates whether the drag element is disabled.
97
+ * When disabled, the element cannot be dragged.
98
+ */
99
+ disabled: boolean;
100
+ connectedCallback(): void;
101
+ disconnectedCallback(): void;
102
+ protected render(): TemplateResult;
103
+ /**
104
+ * Accepts a drop zone and an optional rectangle for the drop area.
105
+ * @param dropzone The drop zone element being accepted.
106
+ * @param rect The bounding rectangle of the drop area.
107
+ * @returns
108
+ */
109
+ [ACCEPT_DROP_PROP](dropzone: WeakRef<DropZoneElement>, rect?: DOMRect): void;
110
+ /**
111
+ * Registers a drag handle element.
112
+ * @param handle The drag handle element to register.
113
+ */
114
+ [REGISTER_HANDLE_PROP](handle: DragHandleElement): void;
115
+ /**
116
+ * Unregisters a drag handle element.
117
+ * @param handle The drag handle element to unregister.
118
+ */
119
+ [UNREGISTER_HANDLE_PROP](handle: DragHandleElement): void;
120
+ }