@geajs/ui 0.2.3 → 0.2.9
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.
- package/dist/accordion.d.mts +2 -2
- package/dist/accordion.mjs +92 -122
- package/dist/accordion.mjs.map +1 -1
- package/dist/alert.d.mts +3 -3
- package/dist/alert.mjs +45 -107
- package/dist/alert.mjs.map +1 -1
- package/dist/avatar.d.mts +2 -2
- package/dist/avatar.mjs +38 -62
- package/dist/avatar.mjs.map +1 -1
- package/dist/badge.d.mts +1 -1
- package/dist/badge.mjs +18 -43
- package/dist/badge.mjs.map +1 -1
- package/dist/bind.mjs +130 -0
- package/dist/bind.mjs.map +1 -0
- package/dist/button.d.mts +3 -2
- package/dist/button.mjs +30 -85
- package/dist/button.mjs.map +1 -1
- package/dist/card.d.mts +6 -6
- package/dist/card.mjs +82 -194
- package/dist/card.mjs.map +1 -1
- package/dist/checkbox.d.mts +2 -2
- package/dist/checkbox.mjs +30 -31
- package/dist/checkbox.mjs.map +1 -1
- package/dist/clipboard.d.mts +2 -2
- package/dist/clipboard.mjs +49 -55
- package/dist/clipboard.mjs.map +1 -1
- package/dist/collapsible.d.mts +2 -2
- package/dist/collapsible.mjs +18 -45
- package/dist/collapsible.mjs.map +1 -1
- package/dist/combobox.d.mts +2 -2
- package/dist/combobox.mjs +322 -261
- package/dist/combobox.mjs.map +1 -1
- package/dist/compiled-component.mjs +119 -0
- package/dist/compiled-component.mjs.map +1 -0
- package/dist/compiled-reactive-component.mjs +337 -0
- package/dist/compiled-reactive-component.mjs.map +1 -0
- package/dist/component-id.mjs +10 -0
- package/dist/component-id.mjs.map +1 -0
- package/dist/conditional-truthy.mjs +48 -0
- package/dist/conditional-truthy.mjs.map +1 -0
- package/dist/conditional.mjs +54 -0
- package/dist/conditional.mjs.map +1 -0
- package/dist/delegate-event.mjs +53 -0
- package/dist/delegate-event.mjs.map +1 -0
- package/dist/dialog.d.mts +4 -3
- package/dist/dialog.mjs +57 -70
- package/dist/dialog.mjs.map +1 -1
- package/dist/dirty-symbols.mjs +7 -0
- package/dist/dirty-symbols.mjs.map +1 -0
- package/dist/disposer.mjs +46 -0
- package/dist/disposer.mjs.map +1 -0
- package/dist/dnd-manager.d.mts +9 -1
- package/dist/dnd-manager.mjs +67 -29
- package/dist/dnd-manager.mjs.map +1 -1
- package/dist/drag-drop-context.d.mts +1 -1
- package/dist/drag-drop-context.mjs +17 -33
- package/dist/drag-drop-context.mjs.map +1 -1
- package/dist/draggable.d.mts +1 -1
- package/dist/draggable.mjs +2 -91
- package/dist/draggable2.mjs +321 -0
- package/dist/draggable2.mjs.map +1 -0
- package/dist/droppable.d.mts +1 -1
- package/dist/droppable.mjs +20 -44
- package/dist/droppable.mjs.map +1 -1
- package/dist/file-upload.d.mts +2 -2
- package/dist/file-upload.mjs +337 -122
- package/dist/file-upload.mjs.map +1 -1
- package/dist/hover-card.d.mts +2 -2
- package/dist/hover-card.mjs +24 -59
- package/dist/hover-card.mjs.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/input.d.mts +1 -1
- package/dist/input.mjs +1 -93
- package/dist/input2.mjs +56 -0
- package/dist/input2.mjs.map +1 -0
- package/dist/internal-symbols.mjs +9 -0
- package/dist/internal-symbols.mjs.map +1 -0
- package/dist/item-obs.mjs +68 -0
- package/dist/item-obs.mjs.map +1 -0
- package/dist/keyed-list-symbols.mjs +6 -0
- package/dist/keyed-list-symbols.mjs.map +1 -0
- package/dist/keyed-list.mjs +487 -0
- package/dist/keyed-list.mjs.map +1 -0
- package/dist/label.d.mts +1 -1
- package/dist/label.mjs +20 -45
- package/dist/label.mjs.map +1 -1
- package/dist/menu.d.mts +2 -2
- package/dist/menu.mjs +87 -41
- package/dist/menu.mjs.map +1 -1
- package/dist/number-input.d.mts +2 -2
- package/dist/number-input.mjs +28 -32
- package/dist/number-input.mjs.map +1 -1
- package/dist/pagination.d.mts +2 -2
- package/dist/pagination.mjs +12 -35
- package/dist/pagination.mjs.map +1 -1
- package/dist/patch.mjs +21 -0
- package/dist/patch.mjs.map +1 -0
- package/dist/pin-input.d.mts +2 -2
- package/dist/pin-input.mjs +88 -87
- package/dist/pin-input.mjs.map +1 -1
- package/dist/popover.d.mts +2 -2
- package/dist/popover.mjs +45 -67
- package/dist/popover.mjs.map +1 -1
- package/dist/progress.d.mts +2 -2
- package/dist/progress.mjs +37 -43
- package/dist/progress.mjs.map +1 -1
- package/dist/radio-group.d.mts +2 -2
- package/dist/radio-group.mjs +99 -140
- package/dist/radio-group.mjs.map +1 -1
- package/dist/rating-group.d.mts +2 -2
- package/dist/rating-group.mjs +91 -99
- package/dist/rating-group.mjs.map +1 -1
- package/dist/reactive-attr.mjs +13 -0
- package/dist/reactive-attr.mjs.map +1 -0
- package/dist/reactive-bool.mjs +13 -0
- package/dist/reactive-bool.mjs.map +1 -0
- package/dist/reactive-class-name.mjs +15 -0
- package/dist/reactive-class-name.mjs.map +1 -0
- package/dist/reactive-class.mjs +53 -0
- package/dist/reactive-class.mjs.map +1 -0
- package/dist/reactive-style.mjs +21 -0
- package/dist/reactive-style.mjs.map +1 -0
- package/dist/reactive-text.mjs +62 -0
- package/dist/reactive-text.mjs.map +1 -0
- package/dist/select.d.mts +2 -2
- package/dist/select.mjs +106 -186
- package/dist/select.mjs.map +1 -1
- package/dist/separator.d.mts +1 -1
- package/dist/separator.mjs +19 -45
- package/dist/separator.mjs.map +1 -1
- package/dist/skeleton.d.mts +1 -1
- package/dist/skeleton.mjs +11 -35
- package/dist/skeleton.mjs.map +1 -1
- package/dist/slider.d.mts +2 -2
- package/dist/slider.mjs +31 -32
- package/dist/slider.mjs.map +1 -1
- package/dist/switch.d.mts +2 -2
- package/dist/switch.mjs +30 -31
- package/dist/switch.mjs.map +1 -1
- package/dist/tabs.d.mts +7 -2
- package/dist/tabs.mjs +180 -147
- package/dist/tabs.mjs.map +1 -1
- package/dist/tags-input.d.mts +2 -2
- package/dist/tags-input.mjs +102 -188
- package/dist/tags-input.mjs.map +1 -1
- package/dist/textarea.d.mts +1 -1
- package/dist/textarea.mjs +32 -75
- package/dist/textarea.mjs.map +1 -1
- package/dist/theme.css +4 -5
- package/dist/toast.d.mts +1 -1
- package/dist/toast.mjs +14 -34
- package/dist/toast.mjs.map +1 -1
- package/dist/toggle-group.d.mts +2 -2
- package/dist/toggle-group.mjs +78 -85
- package/dist/toggle-group.mjs.map +1 -1
- package/dist/tooltip.d.mts +2 -2
- package/dist/tooltip.mjs +23 -43
- package/dist/tooltip.mjs.map +1 -1
- package/dist/tree-view.d.mts +2 -2
- package/dist/tree-view.mjs +32 -50
- package/dist/tree-view.mjs.map +1 -1
- package/dist/types.d.mts +9 -0
- package/dist/zag-component.d.mts +25 -3
- package/dist/zag-component.mjs +63 -16
- package/dist/zag-component.mjs.map +1 -1
- package/package.json +5 -5
- package/dist/cn.mjs +0 -10
- package/dist/cn.mjs.map +0 -1
- package/dist/draggable.mjs.map +0 -1
- package/dist/input.mjs.map +0 -1
package/dist/dnd-manager.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GEA_DOM_COMPONENT, GEA_PARENT_COMPONENT, GEA_PROXY_GET_RAW_TARGET
|
|
1
|
+
import { GEA_DOM_COMPONENT, GEA_PARENT_COMPONENT, GEA_PROXY_GET_RAW_TARGET } from "@geajs/core";
|
|
2
2
|
//#region src/components/dnd-manager.ts
|
|
3
3
|
const DRAG_THRESHOLD_SQ = 25;
|
|
4
4
|
const DRAGGABLE_SEL = "[data-draggable-id]";
|
|
@@ -6,6 +6,25 @@ const DROPPABLE_SEL = "[data-droppable-id]";
|
|
|
6
6
|
function _rawComp(comp) {
|
|
7
7
|
return comp?.[GEA_PROXY_GET_RAW_TARGET] ?? comp;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Walk up from `el` until its parent is `container`. Used to find the
|
|
11
|
+
* right position within a droppable's direct children when draggable
|
|
12
|
+
* elements are wrapped in one or more intermediate elements (e.g. the
|
|
13
|
+
* `<span style="display:contents">` component-boundary wrapper that Gea
|
|
14
|
+
* emits around child-Component roots inside a keyed-list).
|
|
15
|
+
*
|
|
16
|
+
* Returns the direct-child-of-`container` ancestor of `el`, or `el`
|
|
17
|
+
* itself if `el` is already a direct child. Returns `null` if `el`
|
|
18
|
+
* isn't inside `container` at all.
|
|
19
|
+
*/
|
|
20
|
+
function _directChildOf(container, el) {
|
|
21
|
+
let n = el;
|
|
22
|
+
while (n && n.parentElement !== container) {
|
|
23
|
+
n = n.parentElement;
|
|
24
|
+
if (!n) return null;
|
|
25
|
+
}
|
|
26
|
+
return n;
|
|
27
|
+
}
|
|
9
28
|
var DndManager = class {
|
|
10
29
|
constructor() {
|
|
11
30
|
this.droppables = /* @__PURE__ */ new Map();
|
|
@@ -16,6 +35,7 @@ var DndManager = class {
|
|
|
16
35
|
this._sourceDroppableId = "";
|
|
17
36
|
this._sourceIndex = 0;
|
|
18
37
|
this._sourceEl = null;
|
|
38
|
+
this._sourceWrapper = null;
|
|
19
39
|
this._sourceHeight = 0;
|
|
20
40
|
this._sourceRect = null;
|
|
21
41
|
this._savedCssText = "";
|
|
@@ -67,7 +87,7 @@ var DndManager = class {
|
|
|
67
87
|
const droppableEl = el.closest(DROPPABLE_SEL);
|
|
68
88
|
if (!droppableEl) return;
|
|
69
89
|
const droppableId = droppableEl.dataset.droppableId;
|
|
70
|
-
const sourceIndex = Array.from(droppableEl.querySelectorAll(
|
|
90
|
+
const sourceIndex = Array.from(droppableEl.querySelectorAll(DRAGGABLE_SEL)).indexOf(el);
|
|
71
91
|
if (sourceIndex === -1) return;
|
|
72
92
|
this._dragging = true;
|
|
73
93
|
this._started = false;
|
|
@@ -118,8 +138,12 @@ var DndManager = class {
|
|
|
118
138
|
placeholder.style.height = rect.height + "px";
|
|
119
139
|
placeholder.style.marginBottom = elMargin;
|
|
120
140
|
placeholder.style.transition = "none";
|
|
121
|
-
|
|
141
|
+
const sourceContainer = this.droppables.get(this._sourceDroppableId) || el.closest(DROPPABLE_SEL);
|
|
142
|
+
this._sourceWrapper = sourceContainer ? _directChildOf(sourceContainer, el) : el;
|
|
143
|
+
const wrapper = this._sourceWrapper || el;
|
|
144
|
+
wrapper.parentElement.insertBefore(placeholder, wrapper);
|
|
122
145
|
document.body.appendChild(el);
|
|
146
|
+
el.classList.add("gea-dnd-clone", "gea-dragging");
|
|
123
147
|
Object.assign(el.style, {
|
|
124
148
|
position: "fixed",
|
|
125
149
|
top: "0px",
|
|
@@ -154,7 +178,7 @@ var DndManager = class {
|
|
|
154
178
|
this._currentDroppableId = null;
|
|
155
179
|
return;
|
|
156
180
|
}
|
|
157
|
-
const items = Array.from(foundEl.querySelectorAll(
|
|
181
|
+
const items = Array.from(foundEl.querySelectorAll(DRAGGABLE_SEL));
|
|
158
182
|
const threshold = clientY >= this._lastClientY ? 0 : 1;
|
|
159
183
|
let insertIndex = items.length;
|
|
160
184
|
for (let i = 0; i < items.length; i++) {
|
|
@@ -167,7 +191,8 @@ var DndManager = class {
|
|
|
167
191
|
this._currentDroppableId = foundId;
|
|
168
192
|
this._currentIndex = insertIndex;
|
|
169
193
|
if (!this._placeholder) return;
|
|
170
|
-
const
|
|
194
|
+
const refItem = items[insertIndex] || null;
|
|
195
|
+
const refNode = refItem ? _directChildOf(foundEl, refItem) : null;
|
|
171
196
|
if (this._placeholder.parentElement !== foundEl || this._placeholder.nextElementSibling !== refNode) {
|
|
172
197
|
if (this._placeholder.parentElement) {
|
|
173
198
|
const ghost = document.createElement("div");
|
|
@@ -199,8 +224,17 @@ var DndManager = class {
|
|
|
199
224
|
this._dragging = false;
|
|
200
225
|
return;
|
|
201
226
|
}
|
|
227
|
+
const result = {
|
|
228
|
+
draggableId: this._draggedId,
|
|
229
|
+
source: {
|
|
230
|
+
droppableId: this._sourceDroppableId,
|
|
231
|
+
index: this._sourceIndex
|
|
232
|
+
},
|
|
233
|
+
destination: null
|
|
234
|
+
};
|
|
202
235
|
this._animateReturn().then(() => {
|
|
203
236
|
this._returnToSource();
|
|
237
|
+
this._onDragEnd?.(result);
|
|
204
238
|
this._cleanup();
|
|
205
239
|
});
|
|
206
240
|
}
|
|
@@ -215,27 +249,27 @@ var DndManager = class {
|
|
|
215
249
|
index: this._currentIndex
|
|
216
250
|
} : null;
|
|
217
251
|
const samePosition = destination && destination.droppableId === this._sourceDroppableId && destination.index === this._sourceIndex;
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
this.
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
} else this._animateReturn().then(() => {
|
|
252
|
+
const result = {
|
|
253
|
+
draggableId: this._draggedId,
|
|
254
|
+
source: {
|
|
255
|
+
droppableId: this._sourceDroppableId,
|
|
256
|
+
index: this._sourceIndex
|
|
257
|
+
},
|
|
258
|
+
destination: destination && !samePosition ? destination : null
|
|
259
|
+
};
|
|
260
|
+
if (destination && this._placeholder && !samePosition) this._animateDrop().then(() => {
|
|
261
|
+
this._restoreElStyles();
|
|
262
|
+
const wrapper = this._sourceWrapper;
|
|
263
|
+
if (this._sourceEl?.parentElement === document.body) this._sourceEl.remove();
|
|
264
|
+
if (wrapper && wrapper !== this._sourceEl && this._sourceEl && !wrapper.contains(this._sourceEl)) wrapper.appendChild(this._sourceEl);
|
|
265
|
+
if (this._placeholder?.parentElement) this._placeholder.remove();
|
|
266
|
+
this._placeholder = null;
|
|
267
|
+
this._onDragEnd?.(result);
|
|
268
|
+
this._cleanup();
|
|
269
|
+
});
|
|
270
|
+
else this._animateReturn().then(() => {
|
|
238
271
|
this._returnToSource();
|
|
272
|
+
this._onDragEnd?.(result);
|
|
239
273
|
this._cleanup();
|
|
240
274
|
});
|
|
241
275
|
}
|
|
@@ -251,16 +285,20 @@ var DndManager = class {
|
|
|
251
285
|
_restoreElStyles() {
|
|
252
286
|
if (!this._sourceEl) return;
|
|
253
287
|
this._sourceEl.style.cssText = this._savedCssText;
|
|
288
|
+
this._sourceEl.classList.remove("gea-dnd-clone", "gea-dragging");
|
|
254
289
|
}
|
|
255
290
|
_returnToSource() {
|
|
256
291
|
if (!this._sourceEl) return;
|
|
257
292
|
this._restoreElStyles();
|
|
258
|
-
|
|
293
|
+
const wrapper = this._sourceWrapper || this._sourceEl;
|
|
294
|
+
if (wrapper !== this._sourceEl && !wrapper.contains(this._sourceEl)) wrapper.appendChild(this._sourceEl);
|
|
295
|
+
if (this._placeholder?.parentElement) this._placeholder.parentElement.insertBefore(wrapper, this._placeholder);
|
|
259
296
|
else {
|
|
260
297
|
const container = this.droppables.get(this._sourceDroppableId);
|
|
261
298
|
if (container) {
|
|
262
|
-
const items = Array.from(container.querySelectorAll(
|
|
263
|
-
|
|
299
|
+
const items = Array.from(container.querySelectorAll(DRAGGABLE_SEL));
|
|
300
|
+
const ref = items[this._sourceIndex] ? _directChildOf(container, items[this._sourceIndex]) : null;
|
|
301
|
+
container.insertBefore(wrapper, ref);
|
|
264
302
|
}
|
|
265
303
|
}
|
|
266
304
|
}
|
|
@@ -269,7 +307,7 @@ var DndManager = class {
|
|
|
269
307
|
if (!sourceEl) return;
|
|
270
308
|
const destContainer = this.droppables.get(destination.droppableId);
|
|
271
309
|
if (!destContainer) return;
|
|
272
|
-
const refNode = Array.from(destContainer.querySelectorAll(
|
|
310
|
+
const refNode = Array.from(destContainer.querySelectorAll(DRAGGABLE_SEL))[destination.index] || null;
|
|
273
311
|
destContainer.insertBefore(sourceEl, refNode);
|
|
274
312
|
const draggedComp = this._getComponentFromElement(sourceEl);
|
|
275
313
|
if (!draggedComp) return;
|
package/dist/dnd-manager.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dnd-manager.mjs","names":[],"sources":["../src/components/dnd-manager.ts"],"sourcesContent":["import {\n GEA_DOM_COMPONENT,\n GEA_PARENT_COMPONENT,\n GEA_PROXY_GET_RAW_TARGET,\n stashComponentForTransfer,\n} from '@geajs/core'\n\nexport interface DragResult {\n draggableId: string\n source: { droppableId: string; index: number }\n destination: { droppableId: string; index: number }\n}\n\nconst DRAG_THRESHOLD_SQ = 25\nconst DRAGGABLE_SEL = '[data-draggable-id]'\nconst DROPPABLE_SEL = '[data-droppable-id]'\n\nfunction _rawComp(comp: any): any {\n return comp?.[GEA_PROXY_GET_RAW_TARGET] ?? comp\n}\n\nclass DndManager {\n droppables = new Map<string, HTMLElement>()\n\n private _onDragEnd: ((result: DragResult) => void) | null = null\n get onDragEnd() {\n return this._onDragEnd\n }\n set onDragEnd(fn: ((result: DragResult) => void) | null) {\n this._onDragEnd = fn\n if (fn) this._ensureDocListener()\n }\n\n private _dragging = false\n private _started = false\n private _draggedId = ''\n private _sourceDroppableId = ''\n private _sourceIndex = 0\n private _sourceEl: HTMLElement | null = null\n private _sourceHeight = 0\n private _sourceRect: DOMRect | null = null\n private _savedCssText = ''\n private _placeholder: HTMLElement | null = null\n private _startX = 0\n private _startY = 0\n private _offsetX = 0\n private _offsetY = 0\n private _currentDroppableId: string | null = null\n private _currentIndex = 0\n private _lastClientY = 0\n private _cleanedUp = false\n\n private _boundMove = this._onPointerMove.bind(this)\n private _boundUp = this._onPointerUp.bind(this)\n private _boundKeyDown = this._onKeyDown.bind(this)\n private _boundDocDown = this._onDocumentPointerDown.bind(this)\n private _docListenerAttached = false\n\n get isDragging() {\n return this._started\n }\n\n private _ensureDocListener() {\n if (this._docListenerAttached || typeof document === 'undefined') return\n document.addEventListener('pointerdown', this._boundDocDown, true)\n this._docListenerAttached = true\n }\n\n private _onDocumentPointerDown(e: PointerEvent) {\n const el = (e.target as HTMLElement).closest?.(DRAGGABLE_SEL) as HTMLElement\n if (!el) return\n this.startTracking(e, el.dataset.draggableId!, el)\n }\n\n registerDroppable(id: string, el: HTMLElement) {\n this.droppables.set(id, el)\n this._ensureDocListener()\n }\n\n unregisterDroppable(id: string) {\n this.droppables.delete(id)\n }\n\n startTracking(e: PointerEvent, draggableId: string, el: HTMLElement) {\n if (this._dragging || e.button !== 0) return\n this._ensureDocListener()\n\n const droppableEl = el.closest(DROPPABLE_SEL) as HTMLElement\n if (!droppableEl) return\n\n const droppableId = droppableEl.dataset.droppableId!\n const siblings = Array.from(droppableEl.querySelectorAll(`:scope > ${DRAGGABLE_SEL}`))\n const sourceIndex = siblings.indexOf(el)\n if (sourceIndex === -1) return\n\n this._dragging = true\n this._started = false\n this._cleanedUp = false\n this._draggedId = draggableId\n this._sourceDroppableId = droppableId\n this._sourceIndex = sourceIndex\n this._sourceEl = el\n\n const rect = el.getBoundingClientRect()\n this._sourceHeight = rect.height\n this._sourceRect = rect\n this._startX = e.clientX\n this._startY = e.clientY\n this._lastClientY = e.clientY\n this._offsetX = e.clientX - rect.left\n this._offsetY = e.clientY - rect.top\n\n document.addEventListener('pointermove', this._boundMove)\n document.addEventListener('pointerup', this._boundUp)\n document.addEventListener('keydown', this._boundKeyDown)\n e.preventDefault()\n }\n\n private _onPointerMove(e: PointerEvent) {\n if (!this._dragging) return\n\n if (!this._started) {\n const dx = e.clientX - this._startX\n const dy = e.clientY - this._startY\n if (dx * dx + dy * dy < DRAG_THRESHOLD_SQ) return\n this._initDrag()\n this._updateTarget(e.clientX, e.clientY)\n return\n }\n\n this._sourceEl!.style.transform = `translate(${e.clientX - this._offsetX}px, ${e.clientY - this._offsetY}px)`\n this._updateTarget(e.clientX, e.clientY)\n this._lastClientY = e.clientY\n }\n\n private _initDrag() {\n this._started = true\n const el = this._sourceEl!\n const rect = this._sourceRect!\n\n document.querySelectorAll(DROPPABLE_SEL).forEach((dropEl) => {\n const id = (dropEl as HTMLElement).dataset.droppableId!\n if (!this.droppables.has(id)) {\n this.droppables.set(id, dropEl as HTMLElement)\n }\n })\n\n const elMargin = getComputedStyle(el).marginBottom\n this._savedCssText = el.style.cssText\n\n const placeholder = document.createElement('div')\n placeholder.className = 'gea-dnd-placeholder'\n placeholder.style.height = rect.height + 'px'\n placeholder.style.marginBottom = elMargin\n placeholder.style.transition = 'none'\n el.parentElement!.insertBefore(placeholder, el)\n\n document.body.appendChild(el)\n Object.assign(el.style, {\n position: 'fixed',\n top: '0px',\n left: '0',\n width: rect.width + 'px',\n height: rect.height + 'px',\n transform: `translate(${rect.left}px, ${rect.top}px)`,\n // rotate: '0deg',\n // transition: 'rotate 0.15s ease, box-shadow 0.15s ease',\n pointerEvents: 'none',\n zIndex: '99999',\n margin: '0',\n willChange: 'transform',\n boxShadow: 'none',\n })\n el.offsetHeight\n // el.style.rotate = '3deg'\n el.style.boxShadow = '5px 10px 30px 0px rgba(9, 30, 66, 0.15)'\n\n this._placeholder = placeholder\n\n this._currentDroppableId = this._sourceDroppableId\n this._currentIndex = this._sourceIndex\n }\n\n private _updateTarget(clientX: number, clientY: number) {\n let foundId: string | null = null\n let foundEl: HTMLElement | null = null\n\n for (const [id, el] of this.droppables) {\n const r = el.getBoundingClientRect()\n if (clientX >= r.left && clientX <= r.right && clientY >= r.top && clientY <= r.bottom) {\n foundId = id\n foundEl = el\n break\n }\n }\n\n if (!foundEl || foundId === null) {\n this._currentDroppableId = null\n return\n }\n\n const items = Array.from(foundEl.querySelectorAll(`:scope > ${DRAGGABLE_SEL}`))\n const movingDown = clientY >= this._lastClientY\n const threshold = movingDown ? 0 : 1\n let insertIndex = items.length\n for (let i = 0; i < items.length; i++) {\n const r = items[i].getBoundingClientRect()\n if (clientY < r.top + r.height * threshold) {\n insertIndex = i\n break\n }\n }\n\n this._currentDroppableId = foundId\n this._currentIndex = insertIndex\n\n if (!this._placeholder) return\n\n const refNode = (items[insertIndex] as HTMLElement) || null\n if (this._placeholder.parentElement !== foundEl || this._placeholder.nextElementSibling !== refNode) {\n if (this._placeholder.parentElement) {\n const ghost = document.createElement('div')\n ghost.style.height = this._sourceHeight + 'px'\n ghost.style.marginBottom = this._placeholder.style.marginBottom\n ghost.style.transition = 'height 0.2s cubic-bezier(0.2, 0, 0, 1)'\n ghost.style.overflow = 'hidden'\n this._placeholder.parentElement.insertBefore(ghost, this._placeholder)\n ghost.offsetHeight\n ghost.style.height = '0px'\n ghost.style.marginBottom = '0px'\n ghost.addEventListener('transitionend', () => ghost.remove(), { once: true })\n setTimeout(() => ghost.remove(), 250)\n }\n\n this._placeholder.style.transition = 'none'\n this._placeholder.style.height = '0px'\n foundEl.insertBefore(this._placeholder, refNode)\n this._placeholder.offsetHeight\n this._placeholder.style.transition = 'height 0.2s cubic-bezier(0.2, 0, 0, 1)'\n this._placeholder.style.height = this._sourceHeight + 'px'\n }\n }\n\n private _onKeyDown(e: KeyboardEvent) {\n if (e.key === 'Escape' && this._dragging) {\n this._cancelDrag()\n }\n }\n\n private _cancelDrag() {\n this._removeGlobalListeners()\n if (!this._started) {\n this._dragging = false\n return\n }\n\n this._animateReturn().then(() => {\n this._returnToSource()\n this._cleanup()\n })\n }\n\n private _onPointerUp(_e: PointerEvent) {\n this._removeGlobalListeners()\n\n if (!this._started) {\n this._dragging = false\n return\n }\n\n const destination =\n this._currentDroppableId !== null ? { droppableId: this._currentDroppableId, index: this._currentIndex } : null\n\n const samePosition =\n destination && destination.droppableId === this._sourceDroppableId && destination.index === this._sourceIndex\n\n if (destination && this._placeholder && !samePosition) {\n const result: DragResult = {\n draggableId: this._draggedId,\n source: { droppableId: this._sourceDroppableId, index: this._sourceIndex },\n destination,\n }\n this._animateDrop().then(() => {\n this._restoreElStyles()\n // Stash the component for cross-list transfer so the destination's\n // reconciliation can adopt it (DOM subtree intact) instead of\n // disposing + recreating it from scratch.\n const draggedComp = this._getComponentFromElement(this._sourceEl)\n if (draggedComp) {\n stashComponentForTransfer(draggedComp)\n }\n if (this._placeholder?.parentElement) {\n this._placeholder.remove()\n }\n this._placeholder = null\n if (this._sourceEl?.parentElement === document.body) {\n this._sourceEl.remove()\n }\n this._onDragEnd?.(result)\n this._cleanup()\n })\n } else {\n this._animateReturn().then(() => {\n this._returnToSource()\n this._cleanup()\n })\n }\n }\n\n private _getComponentFromElement(el: HTMLElement | null): any {\n let current: HTMLElement | null = el\n while (current) {\n const comp = (current as any)[GEA_DOM_COMPONENT]\n if (comp) return comp\n current = current.parentElement\n }\n return null\n }\n\n private _restoreElStyles() {\n if (!this._sourceEl) return\n this._sourceEl.style.cssText = this._savedCssText\n }\n\n private _returnToSource() {\n if (!this._sourceEl) return\n this._restoreElStyles()\n if (this._placeholder?.parentElement) {\n this._placeholder.parentElement.insertBefore(this._sourceEl, this._placeholder)\n } else {\n const container = this.droppables.get(this._sourceDroppableId)\n if (container) {\n const items = Array.from(container.querySelectorAll(`:scope > ${DRAGGABLE_SEL}`))\n container.insertBefore(this._sourceEl, items[this._sourceIndex] || null)\n }\n }\n }\n\n private _performTransfer(destination: { droppableId: string; index: number }) {\n const sourceEl = this._sourceEl\n if (!sourceEl) return\n\n const destContainer = this.droppables.get(destination.droppableId)\n if (!destContainer) return\n\n const destItems = Array.from(destContainer.querySelectorAll(`:scope > ${DRAGGABLE_SEL}`))\n const refNode = (destItems[destination.index] as HTMLElement) || null\n destContainer.insertBefore(sourceEl, refNode)\n\n const draggedComp = this._getComponentFromElement(sourceEl)\n if (!draggedComp) return\n\n const rawDragged = _rawComp(draggedComp)\n const sourceParent = rawDragged[GEA_PARENT_COMPONENT]\n if (!sourceParent) return\n\n const srcArr = this._findCompiledArray(sourceParent, draggedComp)\n if (!srcArr) return\n\n const destParent = this._getComponentFromElement(destContainer)\n if (!destParent) return\n\n srcArr.arr.splice(srcArr.index, 1)\n const destArr = destParent[srcArr.key]\n if (Array.isArray(destArr)) {\n destArr.splice(destination.index, 0, draggedComp)\n }\n\n // Update the parent component pointer on the raw instance (symbol-keyed, not string prop).\n rawDragged[GEA_PARENT_COMPONENT] = destParent\n }\n\n private _findCompiledArray(parent: any, child: any): { key: symbol; arr: any[]; index: number } | null {\n // Component array lists are stored under geaListItemsSymbol(arrayPropName) symbol keys.\n // Walk the symbol keys of the parent to find which list contains the child.\n for (const sym of Object.getOwnPropertySymbols(parent)) {\n const desc = sym.description ?? ''\n if (!desc.startsWith('gea.listItems.')) continue\n const arr = parent[sym]\n if (!Array.isArray(arr)) continue\n const idx = arr.indexOf(child)\n if (idx !== -1) return { key: sym, arr, index: idx }\n }\n return null\n }\n\n private _animateDrop(): Promise<void> {\n return new Promise((resolve) => {\n if (!this._sourceEl || !this._placeholder) return resolve()\n const phRect = this._placeholder.getBoundingClientRect()\n this._sourceEl.style.transition =\n 'transform 0.2s cubic-bezier(0.2, 0, 0, 1), rotate 0.2s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s cubic-bezier(0.2, 0, 0, 1)'\n this._sourceEl.style.transform = `translate(${phRect.left}px, ${phRect.top}px)`\n this._sourceEl.style.rotate = '0deg'\n this._sourceEl.style.boxShadow = 'none'\n let done = false\n const finish = () => {\n if (done) return\n done = true\n resolve()\n }\n this._sourceEl.addEventListener('transitionend', finish, { once: true })\n setTimeout(finish, 250)\n })\n }\n\n private _animateReturn(): Promise<void> {\n return new Promise((resolve) => {\n if (!this._sourceEl || !this._sourceRect) return resolve()\n let targetX = this._sourceRect.left\n let targetY = this._sourceRect.top\n if (this._placeholder?.parentElement) {\n const phRect = this._placeholder.getBoundingClientRect()\n targetX = phRect.left\n targetY = phRect.top\n }\n this._sourceEl.style.transition =\n 'transform 0.2s cubic-bezier(0.2, 0, 0, 1), rotate 0.2s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s cubic-bezier(0.2, 0, 0, 1)'\n this._sourceEl.style.transform = `translate(${targetX}px, ${targetY}px)`\n this._sourceEl.style.rotate = '0deg'\n this._sourceEl.style.boxShadow = 'none'\n let done = false\n const finish = () => {\n if (done) return\n done = true\n resolve()\n }\n this._sourceEl.addEventListener('transitionend', finish, { once: true })\n setTimeout(finish, 250)\n })\n }\n\n private _removeGlobalListeners() {\n document.removeEventListener('pointermove', this._boundMove)\n document.removeEventListener('pointerup', this._boundUp)\n document.removeEventListener('keydown', this._boundKeyDown)\n }\n\n private _cleanup() {\n if (this._cleanedUp) return\n this._cleanedUp = true\n\n this._placeholder?.remove()\n this._placeholder = null\n this._sourceEl = null\n this._sourceRect = null\n\n this._dragging = false\n this._started = false\n this._draggedId = ''\n this._currentDroppableId = null\n }\n\n destroy() {\n this._removeGlobalListeners()\n if (this._dragging) {\n if (this._sourceEl) this._returnToSource()\n this._cleanup()\n }\n if (this._docListenerAttached && typeof document !== 'undefined') {\n document.removeEventListener('pointerdown', this._boundDocDown, true)\n this._docListenerAttached = false\n }\n this.droppables.clear()\n this.onDragEnd = null\n }\n}\n\nexport const dndManager = new DndManager()\n"],"mappings":";;AAaA,MAAM,oBAAoB;AAC1B,MAAM,gBAAgB;AACtB,MAAM,gBAAgB;AAEtB,SAAS,SAAS,MAAgB;AAChC,QAAO,OAAO,6BAA6B;;AAG7C,IAAM,aAAN,MAAiB;;oCACF,IAAI,KAA0B;oBAEiB;mBASxC;kBACD;oBACE;4BACQ;sBACN;mBACiB;uBAChB;qBACc;uBACd;sBACmB;iBACzB;iBACA;kBACC;kBACA;6BAC0B;uBACrB;sBACD;oBACF;oBAEA,KAAK,eAAe,KAAK,KAAK;kBAChC,KAAK,aAAa,KAAK,KAAK;uBACvB,KAAK,WAAW,KAAK,KAAK;uBAC1B,KAAK,uBAAuB,KAAK,KAAK;8BAC/B;;CA/B/B,IAAI,YAAY;AACd,SAAO,KAAK;;CAEd,IAAI,UAAU,IAA2C;AACvD,OAAK,aAAa;AAClB,MAAI,GAAI,MAAK,oBAAoB;;CA4BnC,IAAI,aAAa;AACf,SAAO,KAAK;;CAGd,qBAA6B;AAC3B,MAAI,KAAK,wBAAwB,OAAO,aAAa,YAAa;AAClE,WAAS,iBAAiB,eAAe,KAAK,eAAe,KAAK;AAClE,OAAK,uBAAuB;;CAG9B,uBAA+B,GAAiB;EAC9C,MAAM,KAAM,EAAE,OAAuB,UAAU,cAAc;AAC7D,MAAI,CAAC,GAAI;AACT,OAAK,cAAc,GAAG,GAAG,QAAQ,aAAc,GAAG;;CAGpD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AiC;AAC/B,WAAS,oBAAoB,eAAe,KAAK,WAAW;AAC5D,WAAS,oBAAoB,aAAa,KAAK,SAAS;AACxD,WAAS,oBAAoB,WAAW,KAAK,cAAc;;CAG7D,WAAmB;AACjB,MAAI,KAAK,WAAY;AACrB,OAAK,aAAa;AAElB,OAAK,cAAc,QAAQ;AAC3B,OAAK,eAAe;AACpB,OAAK,YAAY;AACjB,OAAK,cAAc;AAEnB,OAAK,YAAY;AACjB,OAAK,WAAW;AAChB,OAAK,aAAa;AAClB,OAAK,sBAAsB;;CAG7B,UAAU;AACR,OAAK,wBAAwB;AAC7B,MAAI,KAAK,WAAW;AAClB,OAAI,KAAK,UAAW,MAAK,iBAAiB;AAC1C,QAAK,UAAU;;AAEjB,MAAI,KAAK,wBAAwB,OAAO,aAAa,aAAa;AAChE,YAAS,oBAAoB,eAAe,KAAK,eAAe,KAAK;AACrE,QAAK,uBAAuB;;AAE9B,OAAK,WAAW,OAAO;AACvB,OAAK,YAAY;;;AAIrB,MAAa,aAAa,IAAI,YAAY"}
|
|
1
|
+
{"version":3,"file":"dnd-manager.mjs","names":[],"sources":["../src/components/dnd-manager.ts"],"sourcesContent":["import { GEA_DOM_COMPONENT, GEA_PARENT_COMPONENT, GEA_PROXY_GET_RAW_TARGET } from '@geajs/core'\n\nexport interface DragResult {\n draggableId: string\n source: { droppableId: string; index: number }\n /** `null` when dropped outside any droppable or returned to same position. */\n destination: { droppableId: string; index: number } | null\n}\n\nconst DRAG_THRESHOLD_SQ = 25\nconst DRAGGABLE_SEL = '[data-draggable-id]'\nconst DROPPABLE_SEL = '[data-droppable-id]'\n\nfunction _rawComp(comp: any): any {\n return comp?.[GEA_PROXY_GET_RAW_TARGET] ?? comp\n}\n\n/**\n * Walk up from `el` until its parent is `container`. Used to find the\n * right position within a droppable's direct children when draggable\n * elements are wrapped in one or more intermediate elements (e.g. the\n * `<span style=\"display:contents\">` component-boundary wrapper that Gea\n * emits around child-Component roots inside a keyed-list).\n *\n * Returns the direct-child-of-`container` ancestor of `el`, or `el`\n * itself if `el` is already a direct child. Returns `null` if `el`\n * isn't inside `container` at all.\n */\nfunction _directChildOf(container: HTMLElement, el: HTMLElement | null): HTMLElement | null {\n let n: HTMLElement | null = el\n while (n && n.parentElement !== container) {\n n = n.parentElement\n if (!n) return null\n }\n return n\n}\n\nclass DndManager {\n droppables = new Map<string, HTMLElement>()\n\n private _onDragEnd: ((result: DragResult) => void) | null = null\n get onDragEnd() {\n return this._onDragEnd\n }\n set onDragEnd(fn: ((result: DragResult) => void) | null) {\n this._onDragEnd = fn\n if (fn) this._ensureDocListener()\n }\n\n private _dragging = false\n private _started = false\n private _draggedId = ''\n private _sourceDroppableId = ''\n private _sourceIndex = 0\n private _sourceEl: HTMLElement | null = null\n /**\n * If the source draggable is nested inside a component-boundary wrapper\n * (e.g. a `<span style=\"display:contents\">` inside the droppable), this\n * holds that wrapper — the actual direct child of the droppable that we\n * move/return. When there is no wrapper, this equals `_sourceEl`.\n */\n private _sourceWrapper: HTMLElement | null = null\n private _sourceHeight = 0\n private _sourceRect: DOMRect | null = null\n private _savedCssText = ''\n private _placeholder: HTMLElement | null = null\n private _startX = 0\n private _startY = 0\n private _offsetX = 0\n private _offsetY = 0\n private _currentDroppableId: string | null = null\n private _currentIndex = 0\n private _lastClientY = 0\n private _cleanedUp = false\n\n private _boundMove = this._onPointerMove.bind(this)\n private _boundUp = this._onPointerUp.bind(this)\n private _boundKeyDown = this._onKeyDown.bind(this)\n private _boundDocDown = this._onDocumentPointerDown.bind(this)\n private _docListenerAttached = false\n\n get isDragging() {\n return this._started\n }\n\n private _ensureDocListener() {\n if (this._docListenerAttached || typeof document === 'undefined') return\n document.addEventListener('pointerdown', this._boundDocDown, true)\n this._docListenerAttached = true\n }\n\n private _onDocumentPointerDown(e: PointerEvent) {\n const el = (e.target as HTMLElement).closest?.(DRAGGABLE_SEL) as HTMLElement\n if (!el) return\n this.startTracking(e, el.dataset.draggableId!, el)\n }\n\n registerDroppable(id: string, el: HTMLElement) {\n this.droppables.set(id, el)\n this._ensureDocListener()\n }\n\n unregisterDroppable(id: string) {\n this.droppables.delete(id)\n }\n\n startTracking(e: PointerEvent, draggableId: string, el: HTMLElement) {\n if (this._dragging || e.button !== 0) return\n this._ensureDocListener()\n\n const droppableEl = el.closest(DROPPABLE_SEL) as HTMLElement\n if (!droppableEl) return\n\n const droppableId = droppableEl.dataset.droppableId!\n // Descendant lookup (not `:scope > ...`) because keyedList wraps each\n // item in a `display:contents` span; direct-child lookup misses them.\n const siblings = Array.from(droppableEl.querySelectorAll(DRAGGABLE_SEL))\n const sourceIndex = siblings.indexOf(el)\n if (sourceIndex === -1) return\n\n this._dragging = true\n this._started = false\n this._cleanedUp = false\n this._draggedId = draggableId\n this._sourceDroppableId = droppableId\n this._sourceIndex = sourceIndex\n this._sourceEl = el\n\n const rect = el.getBoundingClientRect()\n this._sourceHeight = rect.height\n this._sourceRect = rect\n this._startX = e.clientX\n this._startY = e.clientY\n this._lastClientY = e.clientY\n this._offsetX = e.clientX - rect.left\n this._offsetY = e.clientY - rect.top\n\n document.addEventListener('pointermove', this._boundMove)\n document.addEventListener('pointerup', this._boundUp)\n document.addEventListener('keydown', this._boundKeyDown)\n e.preventDefault()\n }\n\n private _onPointerMove(e: PointerEvent) {\n if (!this._dragging) return\n\n if (!this._started) {\n const dx = e.clientX - this._startX\n const dy = e.clientY - this._startY\n if (dx * dx + dy * dy < DRAG_THRESHOLD_SQ) return\n this._initDrag()\n this._updateTarget(e.clientX, e.clientY)\n return\n }\n\n this._sourceEl!.style.transform = `translate(${e.clientX - this._offsetX}px, ${e.clientY - this._offsetY}px)`\n this._updateTarget(e.clientX, e.clientY)\n this._lastClientY = e.clientY\n }\n\n private _initDrag() {\n this._started = true\n const el = this._sourceEl!\n const rect = this._sourceRect!\n\n document.querySelectorAll(DROPPABLE_SEL).forEach((dropEl) => {\n const id = (dropEl as HTMLElement).dataset.droppableId!\n if (!this.droppables.has(id)) {\n this.droppables.set(id, dropEl as HTMLElement)\n }\n })\n\n const elMargin = getComputedStyle(el).marginBottom\n this._savedCssText = el.style.cssText\n\n const placeholder = document.createElement('div')\n placeholder.className = 'gea-dnd-placeholder'\n placeholder.style.height = rect.height + 'px'\n placeholder.style.marginBottom = elMargin\n placeholder.style.transition = 'none'\n // Resolve the wrapper: if the draggable is nested inside a component-\n // boundary span (display:contents) between the droppable container and\n // the card, track that wrapper as the DOM unit we actually move/return.\n // All `insertBefore` calls in `_updateTarget` / `_returnToSource` run at\n // container-level and need direct-child nodes, not grandchildren.\n const sourceContainer = this.droppables.get(this._sourceDroppableId) || (el.closest(DROPPABLE_SEL) as HTMLElement)\n this._sourceWrapper = sourceContainer ? _directChildOf(sourceContainer, el) : el\n const wrapper = this._sourceWrapper || el\n wrapper.parentElement!.insertBefore(placeholder, wrapper)\n\n document.body.appendChild(el)\n el.classList.add('gea-dnd-clone', 'gea-dragging')\n Object.assign(el.style, {\n position: 'fixed',\n top: '0px',\n left: '0',\n width: rect.width + 'px',\n height: rect.height + 'px',\n transform: `translate(${rect.left}px, ${rect.top}px)`,\n // rotate: '0deg',\n // transition: 'rotate 0.15s ease, box-shadow 0.15s ease',\n pointerEvents: 'none',\n zIndex: '99999',\n margin: '0',\n willChange: 'transform',\n boxShadow: 'none',\n })\n el.offsetHeight\n // el.style.rotate = '3deg'\n el.style.boxShadow = '5px 10px 30px 0px rgba(9, 30, 66, 0.15)'\n\n this._placeholder = placeholder\n\n this._currentDroppableId = this._sourceDroppableId\n this._currentIndex = this._sourceIndex\n }\n\n private _updateTarget(clientX: number, clientY: number) {\n let foundId: string | null = null\n let foundEl: HTMLElement | null = null\n\n for (const [id, el] of this.droppables) {\n const r = el.getBoundingClientRect()\n if (clientX >= r.left && clientX <= r.right && clientY >= r.top && clientY <= r.bottom) {\n foundId = id\n foundEl = el\n break\n }\n }\n\n if (!foundEl || foundId === null) {\n this._currentDroppableId = null\n return\n }\n\n const items = Array.from(foundEl.querySelectorAll(DRAGGABLE_SEL))\n const movingDown = clientY >= this._lastClientY\n const threshold = movingDown ? 0 : 1\n let insertIndex = items.length\n for (let i = 0; i < items.length; i++) {\n const r = items[i].getBoundingClientRect()\n if (clientY < r.top + r.height * threshold) {\n insertIndex = i\n break\n }\n }\n\n this._currentDroppableId = foundId\n this._currentIndex = insertIndex\n\n if (!this._placeholder) return\n\n // Resolve to direct-child of foundEl. When draggable cards are wrapped\n // in component-boundary spans (display:contents), `items[i]` is the card\n // element (grandchild of container); `insertBefore(ph, card)` with ph's\n // new parent = container would throw NotFoundError. Walk up to find the\n // direct child of foundEl — that's the wrapper span — and use it as the\n // reference node for placeholder insertion.\n const refItem = (items[insertIndex] as HTMLElement) || null\n const refNode = refItem ? _directChildOf(foundEl, refItem) : null\n if (this._placeholder.parentElement !== foundEl || this._placeholder.nextElementSibling !== refNode) {\n if (this._placeholder.parentElement) {\n const ghost = document.createElement('div')\n ghost.style.height = this._sourceHeight + 'px'\n ghost.style.marginBottom = this._placeholder.style.marginBottom\n ghost.style.transition = 'height 0.2s cubic-bezier(0.2, 0, 0, 1)'\n ghost.style.overflow = 'hidden'\n this._placeholder.parentElement.insertBefore(ghost, this._placeholder)\n ghost.offsetHeight\n ghost.style.height = '0px'\n ghost.style.marginBottom = '0px'\n ghost.addEventListener('transitionend', () => ghost.remove(), { once: true })\n setTimeout(() => ghost.remove(), 250)\n }\n\n this._placeholder.style.transition = 'none'\n this._placeholder.style.height = '0px'\n foundEl.insertBefore(this._placeholder, refNode)\n this._placeholder.offsetHeight\n this._placeholder.style.transition = 'height 0.2s cubic-bezier(0.2, 0, 0, 1)'\n this._placeholder.style.height = this._sourceHeight + 'px'\n }\n }\n\n private _onKeyDown(e: KeyboardEvent) {\n if (e.key === 'Escape' && this._dragging) {\n this._cancelDrag()\n }\n }\n\n private _cancelDrag() {\n this._removeGlobalListeners()\n if (!this._started) {\n this._dragging = false\n return\n }\n\n const result: DragResult = {\n draggableId: this._draggedId,\n source: { droppableId: this._sourceDroppableId, index: this._sourceIndex },\n destination: null,\n }\n this._animateReturn().then(() => {\n this._returnToSource()\n this._onDragEnd?.(result)\n this._cleanup()\n })\n }\n\n private _onPointerUp(_e: PointerEvent) {\n this._removeGlobalListeners()\n\n if (!this._started) {\n this._dragging = false\n return\n }\n\n const destination =\n this._currentDroppableId !== null ? { droppableId: this._currentDroppableId, index: this._currentIndex } : null\n\n const samePosition =\n destination && destination.droppableId === this._sourceDroppableId && destination.index === this._sourceIndex\n\n const result: DragResult = {\n draggableId: this._draggedId,\n source: { droppableId: this._sourceDroppableId, index: this._sourceIndex },\n destination: destination && !samePosition ? destination : null,\n }\n if (destination && this._placeholder && !samePosition) {\n this._animateDrop().then(() => {\n this._restoreElStyles()\n // Put the source card back inside its component-boundary wrapper so\n // the wrapper isn't orphaned after the drop. The keyed-list runtime\n // handles the cross-list DOM preservation automatically via the\n // deferred-dispose / rescue-by-key mechanism in `removeEntry` /\n // `createEntry` — no explicit transfer API needed here.\n const wrapper = this._sourceWrapper\n if (this._sourceEl?.parentElement === document.body) {\n this._sourceEl.remove()\n }\n if (wrapper && wrapper !== this._sourceEl && this._sourceEl && !wrapper.contains(this._sourceEl)) {\n wrapper.appendChild(this._sourceEl)\n }\n if (this._placeholder?.parentElement) {\n this._placeholder.remove()\n }\n this._placeholder = null\n this._onDragEnd?.(result)\n this._cleanup()\n })\n } else {\n this._animateReturn().then(() => {\n this._returnToSource()\n this._onDragEnd?.(result)\n this._cleanup()\n })\n }\n }\n\n private _getComponentFromElement(el: HTMLElement | null): any {\n let current: HTMLElement | null = el\n while (current) {\n const comp = (current as any)[GEA_DOM_COMPONENT]\n if (comp) return comp\n current = current.parentElement\n }\n return null\n }\n\n private _restoreElStyles() {\n if (!this._sourceEl) return\n this._sourceEl.style.cssText = this._savedCssText\n this._sourceEl.classList.remove('gea-dnd-clone', 'gea-dragging')\n }\n\n private _returnToSource() {\n if (!this._sourceEl) return\n this._restoreElStyles()\n // Return the component-boundary WRAPPER (if any) to the placeholder's\n // position, then put the source card back inside the wrapper. Without\n // this step the wrapper span stays empty in the DOM and the card becomes\n // a direct child of the droppable — breaking the keyed-list's internal\n // DOM model (entries[i].element's parent would change).\n const wrapper = this._sourceWrapper || this._sourceEl\n if (wrapper !== this._sourceEl && !wrapper.contains(this._sourceEl)) {\n wrapper.appendChild(this._sourceEl)\n }\n if (this._placeholder?.parentElement) {\n this._placeholder.parentElement.insertBefore(wrapper, this._placeholder)\n } else {\n const container = this.droppables.get(this._sourceDroppableId)\n if (container) {\n const items = Array.from(container.querySelectorAll(DRAGGABLE_SEL))\n const ref = items[this._sourceIndex] ? _directChildOf(container, items[this._sourceIndex] as HTMLElement) : null\n container.insertBefore(wrapper, ref)\n }\n }\n }\n\n private _performTransfer(destination: { droppableId: string; index: number }) {\n const sourceEl = this._sourceEl\n if (!sourceEl) return\n\n const destContainer = this.droppables.get(destination.droppableId)\n if (!destContainer) return\n\n const destItems = Array.from(destContainer.querySelectorAll(DRAGGABLE_SEL))\n const refNode = (destItems[destination.index] as HTMLElement) || null\n destContainer.insertBefore(sourceEl, refNode)\n\n const draggedComp = this._getComponentFromElement(sourceEl)\n if (!draggedComp) return\n\n const rawDragged = _rawComp(draggedComp)\n const sourceParent = rawDragged[GEA_PARENT_COMPONENT]\n if (!sourceParent) return\n\n const srcArr = this._findCompiledArray(sourceParent, draggedComp)\n if (!srcArr) return\n\n const destParent = this._getComponentFromElement(destContainer)\n if (!destParent) return\n\n srcArr.arr.splice(srcArr.index, 1)\n const destArr = destParent[srcArr.key]\n if (Array.isArray(destArr)) {\n destArr.splice(destination.index, 0, draggedComp)\n }\n\n // Update the parent component pointer on the raw instance (symbol-keyed, not string prop).\n rawDragged[GEA_PARENT_COMPONENT] = destParent\n }\n\n private _findCompiledArray(parent: any, child: any): { key: symbol; arr: any[]; index: number } | null {\n // Component array lists are stored under geaListItemsSymbol(arrayPropName) symbol keys.\n // Walk the symbol keys of the parent to find which list contains the child.\n for (const sym of Object.getOwnPropertySymbols(parent)) {\n const desc = sym.description ?? ''\n if (!desc.startsWith('gea.listItems.')) continue\n const arr = parent[sym]\n if (!Array.isArray(arr)) continue\n const idx = arr.indexOf(child)\n if (idx !== -1) return { key: sym, arr, index: idx }\n }\n return null\n }\n\n private _animateDrop(): Promise<void> {\n return new Promise((resolve) => {\n if (!this._sourceEl || !this._placeholder) return resolve()\n const phRect = this._placeholder.getBoundingClientRect()\n this._sourceEl.style.transition =\n 'transform 0.2s cubic-bezier(0.2, 0, 0, 1), rotate 0.2s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s cubic-bezier(0.2, 0, 0, 1)'\n this._sourceEl.style.transform = `translate(${phRect.left}px, ${phRect.top}px)`\n this._sourceEl.style.rotate = '0deg'\n this._sourceEl.style.boxShadow = 'none'\n let done = false\n const finish = () => {\n if (done) return\n done = true\n resolve()\n }\n this._sourceEl.addEventListener('transitionend', finish, { once: true })\n setTimeout(finish, 250)\n })\n }\n\n private _animateReturn(): Promise<void> {\n return new Promise((resolve) => {\n if (!this._sourceEl || !this._sourceRect) return resolve()\n let targetX = this._sourceRect.left\n let targetY = this._sourceRect.top\n if (this._placeholder?.parentElement) {\n const phRect = this._placeholder.getBoundingClientRect()\n targetX = phRect.left\n targetY = phRect.top\n }\n this._sourceEl.style.transition =\n 'transform 0.2s cubic-bezier(0.2, 0, 0, 1), rotate 0.2s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.2s cubic-bezier(0.2, 0, 0, 1)'\n this._sourceEl.style.transform = `translate(${targetX}px, ${targetY}px)`\n this._sourceEl.style.rotate = '0deg'\n this._sourceEl.style.boxShadow = 'none'\n let done = false\n const finish = () => {\n if (done) return\n done = true\n resolve()\n }\n this._sourceEl.addEventListener('transitionend', finish, { once: true })\n setTimeout(finish, 250)\n })\n }\n\n private _removeGlobalListeners() {\n document.removeEventListener('pointermove', this._boundMove)\n document.removeEventListener('pointerup', this._boundUp)\n document.removeEventListener('keydown', this._boundKeyDown)\n }\n\n private _cleanup() {\n if (this._cleanedUp) return\n this._cleanedUp = true\n\n this._placeholder?.remove()\n this._placeholder = null\n this._sourceEl = null\n this._sourceRect = null\n\n this._dragging = false\n this._started = false\n this._draggedId = ''\n this._currentDroppableId = null\n }\n\n destroy() {\n this._removeGlobalListeners()\n if (this._dragging) {\n if (this._sourceEl) this._returnToSource()\n this._cleanup()\n }\n if (this._docListenerAttached && typeof document !== 'undefined') {\n document.removeEventListener('pointerdown', this._boundDocDown, true)\n this._docListenerAttached = false\n }\n this.droppables.clear()\n this.onDragEnd = null\n }\n}\n\nexport const dndManager = new DndManager()\n"],"mappings":";;AASA,MAAM,oBAAoB;AAC1B,MAAM,gBAAgB;AACtB,MAAM,gBAAgB;AAEtB,SAAS,SAAS,MAAgB;AAChC,QAAO,OAAO,6BAA6B;;;;;;;;;;;;;AAc7C,SAAS,eAAe,WAAwB,IAA4C;CAC1F,IAAI,IAAwB;AAC5B,QAAO,KAAK,EAAE,kBAAkB,WAAW;AACzC,MAAI,EAAE;AACN,MAAI,CAAC,EAAG,QAAO;;AAEjB,QAAO;;AAGT,IAAM,aAAN,MAAiB;;oCACF,IAAI,KAA0B;oBAEiB;mBASxC;kBACD;oBACE;4BACQ;sBACN;mBACiB;wBAOK;uBACrB;qBACc;uBACd;sBACmB;iBACzB;iBACA;kBACC;kBACA;6BAC0B;uBACrB;sBACD;oBACF;oBAEA,KAAK,eAAe,KAAK,KAAK;kBAChC,KAAK,aAAa,KAAK,KAAK;uBACvB,KAAK,WAAW,KAAK,KAAK;uBAC1B,KAAK,uBAAuB,KAAK,KAAK;8BAC/B;;CAtC/B,IAAI,YAAY;AACd,SAAO,KAAK;;CAEd,IAAI,UAAU,IAA2C;AACvD,OAAK,aAAa;AAClB,MAAI,GAAI,MAAK,oBAAoB;;CAmCnC,IAAI,aAAa;AACf,SAAO,KAAK;;CAGd,qBAA6B;AAC3B,MAAI,KAAK,wBAAwB,OAAO,aAAa,YAAa;AAClE,WAAS,iBAAiB,eAAe,KAAK,eAAe,KAAK;AAClE,OAAK,uBAAuB;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,WAAW;AAClB,OAAI,KAAK,UAAW,MAAK,iBAAiB;AAC1C,QAAK,UAAU;;AAEjB,MAAI,KAAK,wBAAwB,OAAO,aAAa,aAAa;AAChE,YAAS,oBAAoB,eAAe,KAAK,eAAe,KAAK;AACrE,QAAK,uBAAuB;;AAE9B,OAAK,WAAW,OAAO;AACvB,OAAK,YAAY;;;AAIrB,MAAa,aAAa,IAAI,YAAY"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
import { o as GEA_CREATE_TEMPLATE } from "./bind.mjs";
|
|
2
|
+
import { t as CompiledReactiveComponent } from "./compiled-reactive-component.mjs";
|
|
3
|
+
import { t as reactiveText } from "./reactive-text.mjs";
|
|
4
|
+
import { t as reactiveClassName } from "./reactive-class-name.mjs";
|
|
1
5
|
import { dndManager } from "./dnd-manager.mjs";
|
|
2
|
-
import { Component, GEA_ELEMENT, GEA_INSTANTIATE_CHILD_COMPONENTS, GEA_MOUNT_COMPILED_CHILD_COMPONENTS, GEA_ON_PROP_CHANGE, GEA_PATCH_NODE } from "@geajs/core";
|
|
3
6
|
//#region src/components/drag-drop-context.tsx
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
function _tpl0_create() {
|
|
8
|
+
const e = document.createElement("div");
|
|
9
|
+
e.textContent = "0";
|
|
10
|
+
return e;
|
|
11
|
+
}
|
|
12
|
+
var DragDropContext = class extends CompiledReactiveComponent {
|
|
8
13
|
created() {
|
|
9
14
|
dndManager.onDragEnd = (result) => {
|
|
10
15
|
this.props.onDragEnd?.(result);
|
|
@@ -14,34 +19,13 @@ var DragDropContext = class extends Component {
|
|
|
14
19
|
dndManager.destroy();
|
|
15
20
|
super.dispose();
|
|
16
21
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const __boundValue = `gea-dnd-context ${value || ""}`;
|
|
25
|
-
if (__el) {
|
|
26
|
-
const __newClass = String(__boundValue ?? "").trim().replace(/\s+/g, " ");
|
|
27
|
-
if (__el.className !== __newClass) __el.className = __newClass;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
if (key === "children") {
|
|
31
|
-
const __el = this[GEA_ELEMENT];
|
|
32
|
-
if (__el) {
|
|
33
|
-
const __tw = document.createElement("template");
|
|
34
|
-
__tw.innerHTML = value;
|
|
35
|
-
const __newEl = __tw.content.firstElementChild;
|
|
36
|
-
const __existEl = __el.firstElementChild;
|
|
37
|
-
if (__newEl && __existEl && __tw.content.childNodes.length === 1) this.constructor[GEA_PATCH_NODE](__existEl, __newEl, true);
|
|
38
|
-
else if (__el.innerHTML !== value) {
|
|
39
|
-
__el.innerHTML = value;
|
|
40
|
-
this[GEA_INSTANTIATE_CHILD_COMPONENTS]();
|
|
41
|
-
if (this.parentComponent) this.parentComponent[GEA_MOUNT_COMPILED_CHILD_COMPONENTS]();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
22
|
+
[GEA_CREATE_TEMPLATE](d) {
|
|
23
|
+
const root = _tpl0_create();
|
|
24
|
+
const el0 = root;
|
|
25
|
+
const marker1 = root.firstChild;
|
|
26
|
+
reactiveClassName(el0, d, this, () => `gea-dnd-context ${this.props.class || ""}`);
|
|
27
|
+
reactiveText(marker1, d, this, () => this.props.children);
|
|
28
|
+
return root;
|
|
45
29
|
}
|
|
46
30
|
};
|
|
47
31
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drag-drop-context.mjs","names":["
|
|
1
|
+
{"version":3,"file":"drag-drop-context.mjs","names":["GEA_CREATE_TEMPLATE","reactiveClassName","reactiveText","CompiledReactiveComponent","Component","dndManager","DragResult","_tpl0_create","e","document","createElement","textContent","DragDropContext","created","onDragEnd","result","props","dispose","destroy","d","root","el0","marker1","firstChild","class","t1","children"],"sources":["../src/components/drag-drop-context.tsx"],"sourcesContent":["import { Component } from '@geajs/core'\nimport { dndManager } from './dnd-manager'\nimport type { DragResult } from './dnd-manager'\n\nexport default class DragDropContext extends Component {\n created() {\n dndManager.onDragEnd = (result: DragResult) => {\n ;(this.props as any).onDragEnd?.(result)\n }\n }\n\n dispose() {\n dndManager.destroy()\n super.dispose()\n }\n\n template(props: any) {\n return <div class={`gea-dnd-context ${props.class || ''}`}>{props.children}</div>\n }\n}\n"],"mappings":";;;;;;AAIA,SAASO,eAAe;CACtB,MAAMC,IAAIC,SAASC,cAAc,MAAM;AACvCF,GAAEG,cAAc;AAChB,QAAOH;;AAET,IAAqBI,kBAArB,cAA6CT,0BAA0B;CACrEU,UAAU;AACRR,aAAWS,aAAaC,WAAuB;AAE5C,QAAKC,MAAcF,YAAYC,OAAO;;;CAG3CE,UAAU;AACRZ,aAAWa,SAAS;AACpB,QAAMD,SAAS;;CAEjB,CAACjB,qBAAqBmB,GAAG;EACvB,MAAMC,OAAOb,cAAc;EAC3B,MAAMc,MAAMD;EACZ,MAAME,UAAUF,KAAKG;AACrBtB,oBAAkBoB,KAAKF,GAAG,YAAY,mBAAmB,KAAKH,MAAMQ,SAAS,KAAK;AAElFtB,eAAauB,SAAIN,GAAG,YAAY,KAAKH,MAAMU,SAAS;AACpD,SAAON"}
|
package/dist/draggable.d.mts
CHANGED
package/dist/draggable.mjs
CHANGED
|
@@ -1,92 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
//#region src/components/draggable.tsx
|
|
4
|
-
var Draggable = class extends Component {
|
|
5
|
-
constructor(..._args) {
|
|
6
|
-
super(..._args);
|
|
7
|
-
this._didDrag = false;
|
|
8
|
-
}
|
|
9
|
-
static {
|
|
10
|
-
this.__geaTagName = "gea-draggable";
|
|
11
|
-
}
|
|
12
|
-
_onPointerDown(e) {
|
|
13
|
-
const el = e.currentTarget.closest(".gea-draggable");
|
|
14
|
-
if (!el) return;
|
|
15
|
-
this._didDrag = false;
|
|
16
|
-
dndManager.startTracking(e, this.props.draggableId, el);
|
|
17
|
-
}
|
|
18
|
-
template(props) {
|
|
19
|
-
return `<div id="${this.id}" class="${`gea-draggable ${props.class || ""}`.trim()}"${props.draggableId == null || props.draggableId === false ? "" : ` data-draggable-id="${props.draggableId}"`}${props.index == null || props.index === false ? "" : ` data-index="${props.index}"`}>${props.children}</div>`;
|
|
20
|
-
}
|
|
21
|
-
get events() {
|
|
22
|
-
if (this.__evts && this[GEA_ELEMENT]) return this.__evts;
|
|
23
|
-
const __id = this.id;
|
|
24
|
-
const __geaEvtsResult = {
|
|
25
|
-
pointerdown: { [`#${__id}`]: this.__event_pointerdown_0 },
|
|
26
|
-
click: { [`#${__id}`]: this.__event_click_1 }
|
|
27
|
-
};
|
|
28
|
-
if (this[GEA_ELEMENT]) this.__evts = __geaEvtsResult;
|
|
29
|
-
return __geaEvtsResult;
|
|
30
|
-
}
|
|
31
|
-
__event_pointerdown_0(e, targetComponent) {
|
|
32
|
-
this._onPointerDown(e);
|
|
33
|
-
}
|
|
34
|
-
__event_click_1(e, targetComponent) {
|
|
35
|
-
if (dndManager.isDragging) {
|
|
36
|
-
e.preventDefault();
|
|
37
|
-
e.stopPropagation();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
[GEA_ON_PROP_CHANGE](key, value) {
|
|
41
|
-
if (key === "class") {
|
|
42
|
-
const __el = this[GEA_ELEMENT];
|
|
43
|
-
this.props;
|
|
44
|
-
const __boundValue = `gea-draggable ${value || ""}`;
|
|
45
|
-
if (__el) {
|
|
46
|
-
const __newClass = String(__boundValue ?? "").trim().replace(/\s+/g, " ");
|
|
47
|
-
if (__el.className !== __newClass) __el.className = __newClass;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (key === "draggableId") {
|
|
51
|
-
const __el = this[GEA_ELEMENT];
|
|
52
|
-
if (__el) {
|
|
53
|
-
var __av = value;
|
|
54
|
-
if (__av == null || __av === false) __el.removeAttribute("data-draggable-id");
|
|
55
|
-
else {
|
|
56
|
-
const __newAttr = String(__av);
|
|
57
|
-
if (__el.getAttribute("data-draggable-id") !== __newAttr) __el.setAttribute("data-draggable-id", __newAttr);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (key === "index") {
|
|
62
|
-
const __el = this[GEA_ELEMENT];
|
|
63
|
-
if (__el) {
|
|
64
|
-
var __av = value;
|
|
65
|
-
if (__av == null || __av === false) __el.removeAttribute("data-index");
|
|
66
|
-
else {
|
|
67
|
-
const __newAttr = String(__av);
|
|
68
|
-
if (__el.getAttribute("data-index") !== __newAttr) __el.setAttribute("data-index", __newAttr);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
if (key === "children") {
|
|
73
|
-
const __el = this[GEA_ELEMENT];
|
|
74
|
-
if (__el) {
|
|
75
|
-
const __tw = document.createElement("template");
|
|
76
|
-
__tw.innerHTML = value;
|
|
77
|
-
const __newEl = __tw.content.firstElementChild;
|
|
78
|
-
const __existEl = __el.firstElementChild;
|
|
79
|
-
if (__newEl && __existEl && __tw.content.childNodes.length === 1) this.constructor[GEA_PATCH_NODE](__existEl, __newEl, true);
|
|
80
|
-
else if (__el.innerHTML !== value) {
|
|
81
|
-
__el.innerHTML = value;
|
|
82
|
-
this[GEA_INSTANTIATE_CHILD_COMPONENTS]();
|
|
83
|
-
if (this.parentComponent) this.parentComponent[GEA_MOUNT_COMPILED_CHILD_COMPONENTS]();
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
//#endregion
|
|
1
|
+
import { t as Draggable } from "./draggable2.mjs";
|
|
2
|
+
import "./dnd-manager.mjs";
|
|
90
3
|
export { Draggable as default };
|
|
91
|
-
|
|
92
|
-
//# sourceMappingURL=draggable.mjs.map
|