@geajs/ui 0.1.4 → 0.2.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.
- package/README.md +14 -19
- package/dist/accordion.d.mts +34 -0
- package/dist/accordion.mjs +167 -0
- package/dist/accordion.mjs.map +1 -0
- package/dist/alert.d.mts +15 -0
- package/dist/alert.mjs +101 -0
- package/dist/alert.mjs.map +1 -0
- package/dist/avatar.d.mts +26 -0
- package/dist/avatar.mjs +97 -0
- package/dist/avatar.mjs.map +1 -0
- package/dist/badge.d.mts +9 -0
- package/dist/badge.mjs +49 -0
- package/dist/badge.mjs.map +1 -0
- package/dist/button.d.mts +21 -0
- package/dist/button.mjs +96 -0
- package/dist/button.mjs.map +1 -0
- package/dist/card.d.mts +24 -0
- package/dist/card.mjs +169 -0
- package/dist/card.mjs.map +1 -0
- package/dist/checkbox.d.mts +37 -0
- package/dist/checkbox.mjs +80 -0
- package/dist/checkbox.mjs.map +1 -0
- package/dist/clipboard.d.mts +33 -0
- package/dist/clipboard.mjs +100 -0
- package/dist/clipboard.mjs.map +1 -0
- package/dist/cn.mjs +10 -0
- package/dist/cn.mjs.map +1 -0
- package/dist/collapsible.d.mts +29 -0
- package/dist/collapsible.mjs +77 -0
- package/dist/collapsible.mjs.map +1 -0
- package/dist/combobox.d.mts +67 -0
- package/dist/combobox.mjs +375 -0
- package/dist/combobox.mjs.map +1 -0
- package/dist/dialog.d.mts +57 -0
- package/dist/dialog.mjs +139 -0
- package/dist/dialog.mjs.map +1 -0
- package/dist/dnd-manager.d.mts +67 -0
- package/dist/dnd-manager.mjs +387 -0
- package/dist/dnd-manager.mjs.map +1 -0
- package/dist/drag-drop-context.d.mts +11 -0
- package/dist/drag-drop-context.mjs +43 -0
- package/dist/drag-drop-context.mjs.map +1 -0
- package/dist/draggable.d.mts +11 -0
- package/dist/draggable.mjs +72 -0
- package/dist/draggable.mjs.map +1 -0
- package/dist/droppable.d.mts +14 -0
- package/dist/droppable.mjs +66 -0
- package/dist/droppable.mjs.map +1 -0
- package/dist/file-upload.d.mts +38 -0
- package/dist/file-upload.mjs +170 -0
- package/dist/file-upload.mjs.map +1 -0
- package/dist/hover-card.d.mts +33 -0
- package/dist/hover-card.mjs +92 -0
- package/dist/hover-card.mjs.map +1 -0
- package/dist/index.d.mts +41 -1068
- package/dist/index.mjs +41 -4332
- package/dist/input.d.mts +9 -0
- package/dist/input.mjs +82 -0
- package/dist/input.mjs.map +1 -0
- package/dist/label.d.mts +9 -0
- package/dist/label.mjs +42 -0
- package/dist/label.mjs.map +1 -0
- package/dist/menu.d.mts +36 -0
- package/dist/menu.mjs +88 -0
- package/dist/menu.mjs.map +1 -0
- package/dist/number-input.d.mts +46 -0
- package/dist/number-input.mjs +89 -0
- package/dist/number-input.mjs.map +1 -0
- package/dist/pagination.d.mts +37 -0
- package/dist/pagination.mjs +97 -0
- package/dist/pagination.mjs.map +1 -0
- package/dist/pin-input.d.mts +45 -0
- package/dist/pin-input.mjs +147 -0
- package/dist/pin-input.mjs.map +1 -0
- package/dist/popover.d.mts +39 -0
- package/dist/popover.mjs +109 -0
- package/dist/popover.mjs.map +1 -0
- package/dist/progress.d.mts +34 -0
- package/dist/progress.mjs +86 -0
- package/dist/progress.mjs.map +1 -0
- package/dist/radio-group.d.mts +37 -0
- package/dist/radio-group.mjs +184 -0
- package/dist/radio-group.mjs.map +1 -0
- package/dist/rating-group.d.mts +38 -0
- package/dist/rating-group.mjs +171 -0
- package/dist/rating-group.mjs.map +1 -0
- package/dist/select.d.mts +54 -0
- package/dist/select.mjs +277 -0
- package/dist/select.mjs.map +1 -0
- package/dist/separator.d.mts +9 -0
- package/dist/separator.mjs +49 -0
- package/dist/separator.mjs.map +1 -0
- package/dist/skeleton.d.mts +9 -0
- package/dist/skeleton.mjs +43 -0
- package/dist/skeleton.mjs.map +1 -0
- package/dist/slider.d.mts +44 -0
- package/dist/slider.mjs +117 -0
- package/dist/slider.mjs.map +1 -0
- package/dist/switch.d.mts +37 -0
- package/dist/switch.mjs +80 -0
- package/dist/switch.mjs.map +1 -0
- package/dist/tabs.d.mts +36 -0
- package/dist/tabs.mjs +197 -0
- package/dist/tabs.mjs.map +1 -0
- package/dist/tags-input.d.mts +48 -0
- package/dist/tags-input.mjs +267 -0
- package/dist/tags-input.mjs.map +1 -0
- package/dist/textarea.d.mts +9 -0
- package/dist/textarea.mjs +73 -0
- package/dist/textarea.mjs.map +1 -0
- package/dist/toast.d.mts +33 -0
- package/dist/toast.mjs +213 -0
- package/dist/toast.mjs.map +1 -0
- package/dist/toggle-group.d.mts +32 -0
- package/dist/toggle-group.mjs +124 -0
- package/dist/toggle-group.mjs.map +1 -0
- package/dist/tooltip.d.mts +39 -0
- package/dist/tooltip.mjs +85 -0
- package/dist/tooltip.mjs.map +1 -0
- package/dist/tree-view.d.mts +35 -0
- package/dist/tree-view.mjs +94 -0
- package/dist/tree-view.mjs.map +1 -0
- package/dist/zag-component.d.mts +40 -0
- package/dist/zag-component.mjs +135 -0
- package/dist/zag-component.mjs.map +1 -0
- package/package.json +8 -8
- package/dist/index.mjs.map +0 -1
package/dist/dialog.mjs
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { t as ZagComponent } from "./zag-component.mjs";
|
|
2
|
+
import { Component, GEA_CTOR_TAG_NAME, GEA_ELEMENT, GEA_PATCH_COND, GEA_REGISTER_COND, geaCondValueSymbol, geaEscapeHtml } from "@geajs/core";
|
|
3
|
+
import { normalizeProps } from "@zag-js/vanilla";
|
|
4
|
+
import * as dialog from "@zag-js/dialog";
|
|
5
|
+
//#region src/components/dialog.tsx
|
|
6
|
+
var Dialog = class extends ZagComponent {
|
|
7
|
+
static {
|
|
8
|
+
this[GEA_CTOR_TAG_NAME] = "gea-dialog";
|
|
9
|
+
}
|
|
10
|
+
constructor(...args) {
|
|
11
|
+
super(...args);
|
|
12
|
+
this.props;
|
|
13
|
+
this[geaCondValueSymbol(0)] = !!this.props.title;
|
|
14
|
+
this[geaCondValueSymbol(1)] = !!this.props.description;
|
|
15
|
+
this[geaCondValueSymbol(2)] = !!this.props.triggerLabel;
|
|
16
|
+
this[GEA_REGISTER_COND](0, "c0", () => {
|
|
17
|
+
this.props;
|
|
18
|
+
return this.props.title;
|
|
19
|
+
}, () => {
|
|
20
|
+
this.props;
|
|
21
|
+
return `<h2 data-part="title" class="dialog-title text-lg font-semibold mb-2">${geaEscapeHtml(String(this.props.title))}</h2>`;
|
|
22
|
+
}, null);
|
|
23
|
+
this[GEA_REGISTER_COND](1, "c1", () => {
|
|
24
|
+
this.props;
|
|
25
|
+
return this.props.description;
|
|
26
|
+
}, () => {
|
|
27
|
+
this.props;
|
|
28
|
+
return `<p data-part="description" class="dialog-description text-sm text-gray-500 mb-4">${geaEscapeHtml(String(this.props.description))}</p>`;
|
|
29
|
+
}, null);
|
|
30
|
+
this[GEA_REGISTER_COND](2, "c2", () => {
|
|
31
|
+
this.props;
|
|
32
|
+
return this.props.triggerLabel;
|
|
33
|
+
}, () => {
|
|
34
|
+
this.props;
|
|
35
|
+
return `<button data-part="trigger" class="dialog-trigger">${geaEscapeHtml(String(this.props.triggerLabel))}</button>`;
|
|
36
|
+
}, null);
|
|
37
|
+
}
|
|
38
|
+
createMachine(_props) {
|
|
39
|
+
return dialog.machine;
|
|
40
|
+
}
|
|
41
|
+
getMachineProps(props) {
|
|
42
|
+
return {
|
|
43
|
+
id: this.id,
|
|
44
|
+
open: props.open,
|
|
45
|
+
defaultOpen: props.defaultOpen,
|
|
46
|
+
modal: props.modal ?? true,
|
|
47
|
+
closeOnInteractOutside: props.closeOnInteractOutside ?? true,
|
|
48
|
+
closeOnEscape: props.closeOnEscape ?? true,
|
|
49
|
+
trapFocus: props.trapFocus ?? true,
|
|
50
|
+
preventScroll: props.preventScroll ?? true,
|
|
51
|
+
role: props.role ?? "dialog",
|
|
52
|
+
"aria-label": props["aria-label"],
|
|
53
|
+
onOpenChange: (details) => {
|
|
54
|
+
this.open = details.open;
|
|
55
|
+
props.onOpenChange?.(details);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
connectApi(service) {
|
|
60
|
+
return dialog.connect(service, normalizeProps);
|
|
61
|
+
}
|
|
62
|
+
getSpreadMap() {
|
|
63
|
+
return {
|
|
64
|
+
"[data-part=\"backdrop\"]": "getBackdropProps",
|
|
65
|
+
"[data-part=\"positioner\"]": (api) => ({
|
|
66
|
+
...api.getPositionerProps(),
|
|
67
|
+
hidden: !api.open
|
|
68
|
+
}),
|
|
69
|
+
"[data-part=\"content\"]": "getContentProps",
|
|
70
|
+
"[data-part=\"title\"]": "getTitleProps",
|
|
71
|
+
"[data-part=\"description\"]": "getDescriptionProps",
|
|
72
|
+
"[data-part=\"close-trigger\"]": (api) => {
|
|
73
|
+
const { id: _, ...props } = api.getCloseTriggerProps();
|
|
74
|
+
return {
|
|
75
|
+
...props,
|
|
76
|
+
onclick: (e) => {
|
|
77
|
+
if (e.defaultPrevented) return;
|
|
78
|
+
api.setOpen(false);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
"[data-part=\"trigger\"]": (api) => {
|
|
83
|
+
const props = api.getTriggerProps();
|
|
84
|
+
const origOnClick = props.onclick;
|
|
85
|
+
const preventTriggerFocus = (e) => {
|
|
86
|
+
if ("button" in e && e.button !== 0) return;
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
};
|
|
89
|
+
return {
|
|
90
|
+
...props,
|
|
91
|
+
onpointerdown: preventTriggerFocus,
|
|
92
|
+
onmousedown: preventTriggerFocus,
|
|
93
|
+
onclick: (e) => {
|
|
94
|
+
e.currentTarget?.blur();
|
|
95
|
+
origOnClick?.(e);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
syncState(api) {
|
|
102
|
+
this.open = api.open;
|
|
103
|
+
}
|
|
104
|
+
template(props) {
|
|
105
|
+
const __id = this.id;
|
|
106
|
+
Component._register(ZagComponent, "zag-component");
|
|
107
|
+
return `<div id="${__id}"${(props.class || "") == null || (props.class || "") === false ? "" : ` class="${((props.class || "") != null ? String(props.class || "") : "").trim()}"`}><!--${__id + "-c2"}-->${props.triggerLabel && `<button data-part="trigger" class="dialog-trigger">${geaEscapeHtml(String(props.triggerLabel))}</button>` || ""}<!--${__id + "-c2-end"}--><div data-part="backdrop" class="dialog-backdrop fixed inset-0 bg-black/50 z-50" hidden></div><div data-part="positioner" class="dialog-positioner fixed inset-0 flex items-center justify-center z-50" hidden><div data-part="content" class="dialog-content bg-white rounded-lg shadow-xl p-6 w-full max-w-md mx-4"><!--${__id + "-c0"}-->${props.title && `<h2 data-part="title" class="dialog-title text-lg font-semibold mb-2">${geaEscapeHtml(String(props.title))}</h2>` || ""}<!--${__id + "-c0-end"}--><!--${__id + "-c1"}-->${props.description && `<p data-part="description" class="dialog-description text-sm text-gray-500 mb-4">${geaEscapeHtml(String(props.description))}</p>` || ""}<!--${__id + "-c1-end"}--><div id="${__id + "-b1"}" class="dialog-body">${props.children}</div><button data-part="close-trigger" class="dialog-close-trigger absolute top-3 right-3 text-gray-400 hover:text-gray-600">✕</button></div></div></div>`;
|
|
108
|
+
}
|
|
109
|
+
__onPropChange(key, value) {
|
|
110
|
+
const __id = this.id;
|
|
111
|
+
if (key === "class") {
|
|
112
|
+
const __el = this[GEA_ELEMENT];
|
|
113
|
+
this.props;
|
|
114
|
+
const __boundValue = value || "";
|
|
115
|
+
if (__el) {
|
|
116
|
+
const __newClass = (__boundValue != null ? String(__boundValue) : "").trim();
|
|
117
|
+
if (__el.className !== __newClass) __el.className = __newClass;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (key === "children") {
|
|
121
|
+
const __el = this.__e0 || (this.__e0 = document.getElementById(__id + "-b1"));
|
|
122
|
+
if (__el && __el.innerHTML !== value) {
|
|
123
|
+
__el.innerHTML = value;
|
|
124
|
+
this.instantiateChildComponents_();
|
|
125
|
+
if (this.parentComponent) this.parentComponent.mountCompiledChildComponents_();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (key === "title") this[GEA_PATCH_COND](0);
|
|
129
|
+
if (key === "description") this[GEA_PATCH_COND](1);
|
|
130
|
+
if (key === "triggerLabel") this[GEA_PATCH_COND](2);
|
|
131
|
+
}
|
|
132
|
+
*GEA_RESET_ELS() {
|
|
133
|
+
this.__e0 = null;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
//#endregion
|
|
137
|
+
export { Dialog as default };
|
|
138
|
+
|
|
139
|
+
//# sourceMappingURL=dialog.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.mjs","names":["dialog","OpenChangeDetails","normalizeProps","ReactNode","ZagComponent","DialogProps","class","children","triggerLabel","title","description","open","defaultOpen","modal","closeOnInteractOutside","closeOnEscape","trapFocus","preventScroll","role","onOpenChange","details","Dialog","GEA_CTOR_TAG_NAME","constructor","args","props","geaCondValueSymbol","GEA_REGISTER_COND","geaEscapeHtml","String","createMachine","_props","machine","getMachineProps","id","connectApi","service","connect","getSpreadMap","[data-part=\"positioner\"]","api","getPositionerProps","hidden","[data-part=\"close-trigger\"]","_","getCloseTriggerProps","onclick","e","MouseEvent","defaultPrevented","setOpen","[data-part=\"trigger\"]","getTriggerProps","origOnClick","preventTriggerFocus","PointerEvent","button","preventDefault","onpointerdown","onmousedown","currentTarget","HTMLElement","blur","syncState","template","__id","Component","_register","trim","__onPropChange","key","value","__el","GEA_ELEMENT","__boundValue","__newClass","className","__e0","document","getElementById","innerHTML","instantiateChildComponents_","parentComponent","mountCompiledChildComponents_","GEA_PATCH_COND","GEA_RESET_ELS"],"sources":["../src/components/dialog.tsx"],"sourcesContent":["import * as dialog from '@zag-js/dialog'\nimport type { OpenChangeDetails } from '@zag-js/dialog'\nimport { normalizeProps } from '@zag-js/vanilla'\nimport type { ReactNode } from 'react'\nimport ZagComponent from '../primitives/zag-component'\n\nexport interface DialogProps {\n class?: string\n children?: ReactNode\n triggerLabel?: string\n title?: string\n description?: string\n open?: boolean\n defaultOpen?: boolean\n modal?: boolean\n closeOnInteractOutside?: boolean\n closeOnEscape?: boolean\n trapFocus?: boolean\n preventScroll?: boolean\n role?: string\n 'aria-label'?: string\n onOpenChange?: (details: OpenChangeDetails) => void\n}\n\nexport default class Dialog extends ZagComponent<DialogProps> {\n declare open: boolean\n\n createMachine(_props: DialogProps): any {\n return dialog.machine\n }\n\n getMachineProps(props: DialogProps) {\n return {\n id: this.id,\n open: props.open,\n defaultOpen: props.defaultOpen,\n modal: props.modal ?? true,\n closeOnInteractOutside: props.closeOnInteractOutside ?? true,\n closeOnEscape: props.closeOnEscape ?? true,\n trapFocus: props.trapFocus ?? true,\n preventScroll: props.preventScroll ?? true,\n role: props.role ?? 'dialog',\n 'aria-label': props['aria-label'],\n onOpenChange: (details: OpenChangeDetails) => {\n this.open = details.open\n props.onOpenChange?.(details)\n },\n }\n }\n\n connectApi(service: any) {\n return dialog.connect(service, normalizeProps)\n }\n\n getSpreadMap() {\n return {\n '[data-part=\"backdrop\"]': 'getBackdropProps',\n '[data-part=\"positioner\"]': (api: any) => ({\n ...api.getPositionerProps(),\n hidden: !api.open,\n }),\n '[data-part=\"content\"]': 'getContentProps',\n '[data-part=\"title\"]': 'getTitleProps',\n '[data-part=\"description\"]': 'getDescriptionProps',\n '[data-part=\"close-trigger\"]': (api: any) => {\n const { id: _, ...props } = api.getCloseTriggerProps()\n return {\n ...props,\n // normalizeProps lowercases onClick → onclick; must match to override\n // Zag's default handler which calls stopPropagation()\n onclick: (e: MouseEvent) => {\n if (e.defaultPrevented) return\n api.setOpen(false)\n },\n }\n },\n '[data-part=\"trigger\"]': (api: any) => {\n const props = api.getTriggerProps()\n const origOnClick = props.onclick\n const preventTriggerFocus = (e: MouseEvent | PointerEvent) => {\n if ('button' in e && e.button !== 0) return\n e.preventDefault()\n }\n return {\n ...props,\n onpointerdown: preventTriggerFocus,\n onmousedown: preventTriggerFocus,\n onclick: (e: MouseEvent) => {\n ;(e.currentTarget as HTMLElement)?.blur()\n origOnClick?.(e)\n },\n }\n },\n }\n }\n\n syncState(api: any) {\n this.open = api.open\n }\n\n template(props: DialogProps) {\n return (\n <div class={props.class || ''}>\n {props.triggerLabel && (\n <button data-part=\"trigger\" class=\"dialog-trigger\">\n {props.triggerLabel}\n </button>\n )}\n <div data-part=\"backdrop\" class=\"dialog-backdrop fixed inset-0 bg-black/50 z-50\" hidden></div>\n <div\n data-part=\"positioner\"\n class=\"dialog-positioner fixed inset-0 flex items-center justify-center z-50\"\n hidden\n >\n <div data-part=\"content\" class=\"dialog-content bg-white rounded-lg shadow-xl p-6 w-full max-w-md mx-4\">\n {props.title && (\n <h2 data-part=\"title\" class=\"dialog-title text-lg font-semibold mb-2\">\n {props.title}\n </h2>\n )}\n {props.description && (\n <p data-part=\"description\" class=\"dialog-description text-sm text-gray-500 mb-4\">\n {props.description}\n </p>\n )}\n <div class=\"dialog-body\">{props.children}</div>\n <button\n data-part=\"close-trigger\"\n class=\"dialog-close-trigger absolute top-3 right-3 text-gray-400 hover:text-gray-600\"\n >\n ✕\n </button>\n </div>\n </div>\n </div>\n )\n }\n}\n"],"mappings":";;;;;AAwBA,IAAqBqB,SAArB,cAAoCjB,aAA0B;;OAAAkB,qBAAA;;CAvB9DC,YAAsB,GAAGC,MAAI;AAAA,QAAA,GAAAA,KAAA;AAmGA,OAAAC;AAAA,OAAAC,mBAAA,EAAA,IAAA,CAAA,CAAA,KAAAD,MAeVhB;AAAK,OAAAiB,mBAAA,EAAA,IAAA,CAAA,CAAA,KAAAD,MAKLf;AAAW,OAAAgB,mBAAA,EAAA,IAAA,CAAA,CAAA,KAAAD,MAjBfjB;AAAY,OAAAmB,mBAAA,GAAA,YAAA;AAHE,QAAAF;AAAA,UAAA,KAAAA,MAeVhB;WAAK;AAfK,QAAAgB;AAAA,UAAA,yEAAAG,cAAAC,OAAA,KAAAJ,MAiBNhB,MAAK,CAAA,CAAA;KAAA,KAA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GAAA,MAAAiD,eAAAH,SAEI;AAAE,OAAAC,MAAA;IAAA,MAAAG,cAAAD,gBAAA,OAAA7C,OAAA6C,aAAA,GAAA,IAAAN,MAAA;AAAA,QAAAI,KAAAI,cAAAD,WAAAH,MAAAI,YAAAD;;;AAAA,MAAAL,QAAA,YAAA;GAAA,MAAAE,OAAA,KAAAK,SAAA,KAAAA,OAAAC,SAAAC,eAAAd,OAAA,MAAA;AAAA,OAAAO,QAAAA,KAAAQ,cAAAT,OAAA;AAAAC,SAAAQ,YAAAT;AAAA,SAAAU,6BAAA;AAAA,QAAA,KAAAC,gBAAA,MAAAA,gBAAAC,+BAAA;;;AAAA,MAAAb,QAAA,QAAA,MAAAc,gBAAA,EAAA;AAAA,MAAAd,QAAA,cAAA,MAAAc,gBAAA,EAAA;AAAA,MAAAd,QAAA,eAAA,MAAAc,gBAAA,EAAA;;CArGC,CAAAC,gBAAA;AAAA,OAAAR,OAAA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
//#region src/components/dnd-manager.d.ts
|
|
2
|
+
interface DragResult {
|
|
3
|
+
draggableId: string;
|
|
4
|
+
source: {
|
|
5
|
+
droppableId: string;
|
|
6
|
+
index: number;
|
|
7
|
+
};
|
|
8
|
+
destination: {
|
|
9
|
+
droppableId: string;
|
|
10
|
+
index: number;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
declare class DndManager {
|
|
14
|
+
droppables: Map<string, HTMLElement>;
|
|
15
|
+
private _onDragEnd;
|
|
16
|
+
get onDragEnd(): ((result: DragResult) => void) | null;
|
|
17
|
+
set onDragEnd(fn: ((result: DragResult) => void) | null);
|
|
18
|
+
private _dragging;
|
|
19
|
+
private _started;
|
|
20
|
+
private _draggedId;
|
|
21
|
+
private _sourceDroppableId;
|
|
22
|
+
private _sourceIndex;
|
|
23
|
+
private _sourceEl;
|
|
24
|
+
private _sourceHeight;
|
|
25
|
+
private _sourceRect;
|
|
26
|
+
private _savedCssText;
|
|
27
|
+
private _placeholder;
|
|
28
|
+
private _startX;
|
|
29
|
+
private _startY;
|
|
30
|
+
private _offsetX;
|
|
31
|
+
private _offsetY;
|
|
32
|
+
private _currentDroppableId;
|
|
33
|
+
private _currentIndex;
|
|
34
|
+
private _lastClientY;
|
|
35
|
+
private _cleanedUp;
|
|
36
|
+
private _boundMove;
|
|
37
|
+
private _boundUp;
|
|
38
|
+
private _boundKeyDown;
|
|
39
|
+
private _boundDocDown;
|
|
40
|
+
private _docListenerAttached;
|
|
41
|
+
get isDragging(): boolean;
|
|
42
|
+
private _ensureDocListener;
|
|
43
|
+
private _onDocumentPointerDown;
|
|
44
|
+
registerDroppable(id: string, el: HTMLElement): void;
|
|
45
|
+
unregisterDroppable(id: string): void;
|
|
46
|
+
startTracking(e: PointerEvent, draggableId: string, el: HTMLElement): void;
|
|
47
|
+
private _onPointerMove;
|
|
48
|
+
private _initDrag;
|
|
49
|
+
private _updateTarget;
|
|
50
|
+
private _onKeyDown;
|
|
51
|
+
private _cancelDrag;
|
|
52
|
+
private _onPointerUp;
|
|
53
|
+
private _getComponentFromElement;
|
|
54
|
+
private _restoreElStyles;
|
|
55
|
+
private _returnToSource;
|
|
56
|
+
private _performTransfer;
|
|
57
|
+
private _findCompiledArray;
|
|
58
|
+
private _animateDrop;
|
|
59
|
+
private _animateReturn;
|
|
60
|
+
private _removeGlobalListeners;
|
|
61
|
+
private _cleanup;
|
|
62
|
+
destroy(): void;
|
|
63
|
+
}
|
|
64
|
+
declare const dndManager: DndManager;
|
|
65
|
+
//#endregion
|
|
66
|
+
export { DragResult, dndManager };
|
|
67
|
+
//# sourceMappingURL=dnd-manager.d.mts.map
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { GEA_CHILD_COMPONENTS, GEA_DOM_COMPONENT } from "@geajs/core";
|
|
2
|
+
//#region src/components/dnd-manager.ts
|
|
3
|
+
const DRAG_THRESHOLD_SQ = 25;
|
|
4
|
+
const DRAGGABLE_SEL = "[data-draggable-id]";
|
|
5
|
+
const DROPPABLE_SEL = "[data-droppable-id]";
|
|
6
|
+
var DndManager = class {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.droppables = /* @__PURE__ */ new Map();
|
|
9
|
+
this._onDragEnd = null;
|
|
10
|
+
this._dragging = false;
|
|
11
|
+
this._started = false;
|
|
12
|
+
this._draggedId = "";
|
|
13
|
+
this._sourceDroppableId = "";
|
|
14
|
+
this._sourceIndex = 0;
|
|
15
|
+
this._sourceEl = null;
|
|
16
|
+
this._sourceHeight = 0;
|
|
17
|
+
this._sourceRect = null;
|
|
18
|
+
this._savedCssText = "";
|
|
19
|
+
this._placeholder = null;
|
|
20
|
+
this._startX = 0;
|
|
21
|
+
this._startY = 0;
|
|
22
|
+
this._offsetX = 0;
|
|
23
|
+
this._offsetY = 0;
|
|
24
|
+
this._currentDroppableId = null;
|
|
25
|
+
this._currentIndex = 0;
|
|
26
|
+
this._lastClientY = 0;
|
|
27
|
+
this._cleanedUp = false;
|
|
28
|
+
this._boundMove = this._onPointerMove.bind(this);
|
|
29
|
+
this._boundUp = this._onPointerUp.bind(this);
|
|
30
|
+
this._boundKeyDown = this._onKeyDown.bind(this);
|
|
31
|
+
this._boundDocDown = this._onDocumentPointerDown.bind(this);
|
|
32
|
+
this._docListenerAttached = false;
|
|
33
|
+
}
|
|
34
|
+
get onDragEnd() {
|
|
35
|
+
return this._onDragEnd;
|
|
36
|
+
}
|
|
37
|
+
set onDragEnd(fn) {
|
|
38
|
+
this._onDragEnd = fn;
|
|
39
|
+
if (fn) this._ensureDocListener();
|
|
40
|
+
}
|
|
41
|
+
get isDragging() {
|
|
42
|
+
return this._started;
|
|
43
|
+
}
|
|
44
|
+
_ensureDocListener() {
|
|
45
|
+
if (this._docListenerAttached || typeof document === "undefined") return;
|
|
46
|
+
document.addEventListener("pointerdown", this._boundDocDown, true);
|
|
47
|
+
this._docListenerAttached = true;
|
|
48
|
+
}
|
|
49
|
+
_onDocumentPointerDown(e) {
|
|
50
|
+
const el = e.target.closest?.(DRAGGABLE_SEL);
|
|
51
|
+
if (!el) return;
|
|
52
|
+
this.startTracking(e, el.dataset.draggableId, el);
|
|
53
|
+
}
|
|
54
|
+
registerDroppable(id, el) {
|
|
55
|
+
this.droppables.set(id, el);
|
|
56
|
+
this._ensureDocListener();
|
|
57
|
+
}
|
|
58
|
+
unregisterDroppable(id) {
|
|
59
|
+
this.droppables.delete(id);
|
|
60
|
+
}
|
|
61
|
+
startTracking(e, draggableId, el) {
|
|
62
|
+
if (this._dragging || e.button !== 0) return;
|
|
63
|
+
this._ensureDocListener();
|
|
64
|
+
const droppableEl = el.closest(DROPPABLE_SEL);
|
|
65
|
+
if (!droppableEl) return;
|
|
66
|
+
const droppableId = droppableEl.dataset.droppableId;
|
|
67
|
+
const sourceIndex = Array.from(droppableEl.querySelectorAll(`:scope > ${DRAGGABLE_SEL}`)).indexOf(el);
|
|
68
|
+
if (sourceIndex === -1) return;
|
|
69
|
+
this._dragging = true;
|
|
70
|
+
this._started = false;
|
|
71
|
+
this._cleanedUp = false;
|
|
72
|
+
this._draggedId = draggableId;
|
|
73
|
+
this._sourceDroppableId = droppableId;
|
|
74
|
+
this._sourceIndex = sourceIndex;
|
|
75
|
+
this._sourceEl = el;
|
|
76
|
+
const rect = el.getBoundingClientRect();
|
|
77
|
+
this._sourceHeight = rect.height;
|
|
78
|
+
this._sourceRect = rect;
|
|
79
|
+
this._startX = e.clientX;
|
|
80
|
+
this._startY = e.clientY;
|
|
81
|
+
this._lastClientY = e.clientY;
|
|
82
|
+
this._offsetX = e.clientX - rect.left;
|
|
83
|
+
this._offsetY = e.clientY - rect.top;
|
|
84
|
+
document.addEventListener("pointermove", this._boundMove);
|
|
85
|
+
document.addEventListener("pointerup", this._boundUp);
|
|
86
|
+
document.addEventListener("keydown", this._boundKeyDown);
|
|
87
|
+
e.preventDefault();
|
|
88
|
+
}
|
|
89
|
+
_onPointerMove(e) {
|
|
90
|
+
if (!this._dragging) return;
|
|
91
|
+
if (!this._started) {
|
|
92
|
+
const dx = e.clientX - this._startX;
|
|
93
|
+
const dy = e.clientY - this._startY;
|
|
94
|
+
if (dx * dx + dy * dy < DRAG_THRESHOLD_SQ) return;
|
|
95
|
+
this._initDrag();
|
|
96
|
+
this._updateTarget(e.clientX, e.clientY);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
this._sourceEl.style.transform = `translate(${e.clientX - this._offsetX}px, ${e.clientY - this._offsetY}px)`;
|
|
100
|
+
this._updateTarget(e.clientX, e.clientY);
|
|
101
|
+
this._lastClientY = e.clientY;
|
|
102
|
+
}
|
|
103
|
+
_initDrag() {
|
|
104
|
+
this._started = true;
|
|
105
|
+
const el = this._sourceEl;
|
|
106
|
+
const rect = this._sourceRect;
|
|
107
|
+
document.querySelectorAll(DROPPABLE_SEL).forEach((dropEl) => {
|
|
108
|
+
const id = dropEl.dataset.droppableId;
|
|
109
|
+
if (!this.droppables.has(id)) this.droppables.set(id, dropEl);
|
|
110
|
+
});
|
|
111
|
+
const elMargin = getComputedStyle(el).marginBottom;
|
|
112
|
+
this._savedCssText = el.style.cssText;
|
|
113
|
+
const placeholder = document.createElement("div");
|
|
114
|
+
placeholder.className = "gea-dnd-placeholder";
|
|
115
|
+
placeholder.style.height = rect.height + "px";
|
|
116
|
+
placeholder.style.marginBottom = elMargin;
|
|
117
|
+
placeholder.style.transition = "none";
|
|
118
|
+
el.parentElement.insertBefore(placeholder, el);
|
|
119
|
+
document.body.appendChild(el);
|
|
120
|
+
Object.assign(el.style, {
|
|
121
|
+
position: "fixed",
|
|
122
|
+
top: "0px",
|
|
123
|
+
left: "0",
|
|
124
|
+
width: rect.width + "px",
|
|
125
|
+
height: rect.height + "px",
|
|
126
|
+
transform: `translate(${rect.left}px, ${rect.top}px)`,
|
|
127
|
+
pointerEvents: "none",
|
|
128
|
+
zIndex: "99999",
|
|
129
|
+
margin: "0",
|
|
130
|
+
willChange: "transform",
|
|
131
|
+
boxShadow: "none"
|
|
132
|
+
});
|
|
133
|
+
el.offsetHeight;
|
|
134
|
+
el.style.boxShadow = "5px 10px 30px 0px rgba(9, 30, 66, 0.15)";
|
|
135
|
+
this._placeholder = placeholder;
|
|
136
|
+
this._currentDroppableId = this._sourceDroppableId;
|
|
137
|
+
this._currentIndex = this._sourceIndex;
|
|
138
|
+
}
|
|
139
|
+
_updateTarget(clientX, clientY) {
|
|
140
|
+
let foundId = null;
|
|
141
|
+
let foundEl = null;
|
|
142
|
+
for (const [id, el] of this.droppables) {
|
|
143
|
+
const r = el.getBoundingClientRect();
|
|
144
|
+
if (clientX >= r.left && clientX <= r.right && clientY >= r.top && clientY <= r.bottom) {
|
|
145
|
+
foundId = id;
|
|
146
|
+
foundEl = el;
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (!foundEl || foundId === null) {
|
|
151
|
+
this._currentDroppableId = null;
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const items = Array.from(foundEl.querySelectorAll(`:scope > ${DRAGGABLE_SEL}`));
|
|
155
|
+
const threshold = clientY >= this._lastClientY ? 0 : 1;
|
|
156
|
+
let insertIndex = items.length;
|
|
157
|
+
for (let i = 0; i < items.length; i++) {
|
|
158
|
+
const r = items[i].getBoundingClientRect();
|
|
159
|
+
if (clientY < r.top + r.height * threshold) {
|
|
160
|
+
insertIndex = i;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
this._currentDroppableId = foundId;
|
|
165
|
+
this._currentIndex = insertIndex;
|
|
166
|
+
if (!this._placeholder) return;
|
|
167
|
+
const refNode = items[insertIndex] || null;
|
|
168
|
+
if (this._placeholder.parentElement !== foundEl || this._placeholder.nextElementSibling !== refNode) {
|
|
169
|
+
if (this._placeholder.parentElement) {
|
|
170
|
+
const ghost = document.createElement("div");
|
|
171
|
+
ghost.style.height = this._sourceHeight + "px";
|
|
172
|
+
ghost.style.marginBottom = this._placeholder.style.marginBottom;
|
|
173
|
+
ghost.style.transition = "height 0.2s cubic-bezier(0.2, 0, 0, 1)";
|
|
174
|
+
ghost.style.overflow = "hidden";
|
|
175
|
+
this._placeholder.parentElement.insertBefore(ghost, this._placeholder);
|
|
176
|
+
ghost.offsetHeight;
|
|
177
|
+
ghost.style.height = "0px";
|
|
178
|
+
ghost.style.marginBottom = "0px";
|
|
179
|
+
ghost.addEventListener("transitionend", () => ghost.remove(), { once: true });
|
|
180
|
+
setTimeout(() => ghost.remove(), 250);
|
|
181
|
+
}
|
|
182
|
+
this._placeholder.style.transition = "none";
|
|
183
|
+
this._placeholder.style.height = "0px";
|
|
184
|
+
foundEl.insertBefore(this._placeholder, refNode);
|
|
185
|
+
this._placeholder.offsetHeight;
|
|
186
|
+
this._placeholder.style.transition = "height 0.2s cubic-bezier(0.2, 0, 0, 1)";
|
|
187
|
+
this._placeholder.style.height = this._sourceHeight + "px";
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
_onKeyDown(e) {
|
|
191
|
+
if (e.key === "Escape" && this._dragging) this._cancelDrag();
|
|
192
|
+
}
|
|
193
|
+
_cancelDrag() {
|
|
194
|
+
this._removeGlobalListeners();
|
|
195
|
+
if (!this._started) {
|
|
196
|
+
this._dragging = false;
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
this._animateReturn().then(() => {
|
|
200
|
+
this._returnToSource();
|
|
201
|
+
this._cleanup();
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
_onPointerUp(_e) {
|
|
205
|
+
this._removeGlobalListeners();
|
|
206
|
+
if (!this._started) {
|
|
207
|
+
this._dragging = false;
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
const destination = this._currentDroppableId !== null ? {
|
|
211
|
+
droppableId: this._currentDroppableId,
|
|
212
|
+
index: this._currentIndex
|
|
213
|
+
} : null;
|
|
214
|
+
const samePosition = destination && destination.droppableId === this._sourceDroppableId && destination.index === this._sourceIndex;
|
|
215
|
+
if (destination && this._placeholder && !samePosition) {
|
|
216
|
+
const result = {
|
|
217
|
+
draggableId: this._draggedId,
|
|
218
|
+
source: {
|
|
219
|
+
droppableId: this._sourceDroppableId,
|
|
220
|
+
index: this._sourceIndex
|
|
221
|
+
},
|
|
222
|
+
destination
|
|
223
|
+
};
|
|
224
|
+
this._animateDrop().then(() => {
|
|
225
|
+
this._restoreElStyles();
|
|
226
|
+
this._performTransfer(destination);
|
|
227
|
+
this._cleanup();
|
|
228
|
+
this._onDragEnd?.(result);
|
|
229
|
+
});
|
|
230
|
+
} else this._animateReturn().then(() => {
|
|
231
|
+
this._returnToSource();
|
|
232
|
+
this._cleanup();
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
_getComponentFromElement(el) {
|
|
236
|
+
let current = el;
|
|
237
|
+
while (current) {
|
|
238
|
+
const comp = current[GEA_DOM_COMPONENT];
|
|
239
|
+
if (comp) return comp;
|
|
240
|
+
current = current.parentElement;
|
|
241
|
+
}
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
_restoreElStyles() {
|
|
245
|
+
if (!this._sourceEl) return;
|
|
246
|
+
this._sourceEl.style.cssText = this._savedCssText;
|
|
247
|
+
}
|
|
248
|
+
_returnToSource() {
|
|
249
|
+
if (!this._sourceEl) return;
|
|
250
|
+
this._restoreElStyles();
|
|
251
|
+
if (this._placeholder?.parentElement) this._placeholder.parentElement.insertBefore(this._sourceEl, this._placeholder);
|
|
252
|
+
else {
|
|
253
|
+
const container = this.droppables.get(this._sourceDroppableId);
|
|
254
|
+
if (container) {
|
|
255
|
+
const items = Array.from(container.querySelectorAll(`:scope > ${DRAGGABLE_SEL}`));
|
|
256
|
+
container.insertBefore(this._sourceEl, items[this._sourceIndex] || null);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
_performTransfer(destination) {
|
|
261
|
+
const sourceEl = this._sourceEl;
|
|
262
|
+
if (!sourceEl) return;
|
|
263
|
+
const destContainer = this.droppables.get(destination.droppableId);
|
|
264
|
+
if (!destContainer) return;
|
|
265
|
+
const refNode = Array.from(destContainer.querySelectorAll(`:scope > ${DRAGGABLE_SEL}`))[destination.index] || null;
|
|
266
|
+
destContainer.insertBefore(sourceEl, refNode);
|
|
267
|
+
const draggedComp = this._getComponentFromElement(sourceEl);
|
|
268
|
+
if (!draggedComp) return;
|
|
269
|
+
const sourceParent = draggedComp.parentComponent;
|
|
270
|
+
if (!sourceParent) return;
|
|
271
|
+
const srcArr = this._findCompiledArray(sourceParent, draggedComp);
|
|
272
|
+
if (!srcArr) return;
|
|
273
|
+
const destParent = this._getComponentFromElement(destContainer);
|
|
274
|
+
if (!destParent) return;
|
|
275
|
+
srcArr.arr.splice(srcArr.index, 1);
|
|
276
|
+
const destArr = destParent[srcArr.key];
|
|
277
|
+
if (Array.isArray(destArr)) destArr.splice(destination.index, 0, draggedComp);
|
|
278
|
+
const srcChildren = sourceParent[GEA_CHILD_COMPONENTS];
|
|
279
|
+
if (Array.isArray(srcChildren)) {
|
|
280
|
+
const ci = srcChildren.indexOf(draggedComp);
|
|
281
|
+
if (ci !== -1) srcChildren.splice(ci, 1);
|
|
282
|
+
}
|
|
283
|
+
const destChildren = destParent[GEA_CHILD_COMPONENTS];
|
|
284
|
+
if (Array.isArray(destChildren) && !destChildren.includes(draggedComp)) destChildren.push(draggedComp);
|
|
285
|
+
draggedComp.parentComponent = destParent;
|
|
286
|
+
}
|
|
287
|
+
_findCompiledArray(parent, child) {
|
|
288
|
+
const stringKeys = Object.keys(parent);
|
|
289
|
+
const symbolKeys = Object.getOwnPropertySymbols(parent);
|
|
290
|
+
for (const key of stringKeys) if (key.startsWith("_") && key.endsWith("Items") && Array.isArray(parent[key])) {
|
|
291
|
+
const arr = parent[key];
|
|
292
|
+
const idx = arr.indexOf(child);
|
|
293
|
+
if (idx !== -1) return {
|
|
294
|
+
key,
|
|
295
|
+
arr,
|
|
296
|
+
index: idx
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
for (const key of symbolKeys) if (String(key).includes("gea.listItems") && Array.isArray(parent[key])) {
|
|
300
|
+
const arr = parent[key];
|
|
301
|
+
const idx = arr.indexOf(child);
|
|
302
|
+
if (idx !== -1) return {
|
|
303
|
+
key,
|
|
304
|
+
arr,
|
|
305
|
+
index: idx
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
return null;
|
|
309
|
+
}
|
|
310
|
+
_animateDrop() {
|
|
311
|
+
return new Promise((resolve) => {
|
|
312
|
+
if (!this._sourceEl || !this._placeholder) return resolve();
|
|
313
|
+
const phRect = this._placeholder.getBoundingClientRect();
|
|
314
|
+
this._sourceEl.style.transition = "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)";
|
|
315
|
+
this._sourceEl.style.transform = `translate(${phRect.left}px, ${phRect.top}px)`;
|
|
316
|
+
this._sourceEl.style.rotate = "0deg";
|
|
317
|
+
this._sourceEl.style.boxShadow = "none";
|
|
318
|
+
let done = false;
|
|
319
|
+
const finish = () => {
|
|
320
|
+
if (done) return;
|
|
321
|
+
done = true;
|
|
322
|
+
resolve();
|
|
323
|
+
};
|
|
324
|
+
this._sourceEl.addEventListener("transitionend", finish, { once: true });
|
|
325
|
+
setTimeout(finish, 250);
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
_animateReturn() {
|
|
329
|
+
return new Promise((resolve) => {
|
|
330
|
+
if (!this._sourceEl || !this._sourceRect) return resolve();
|
|
331
|
+
let targetX = this._sourceRect.left;
|
|
332
|
+
let targetY = this._sourceRect.top;
|
|
333
|
+
if (this._placeholder?.parentElement) {
|
|
334
|
+
const phRect = this._placeholder.getBoundingClientRect();
|
|
335
|
+
targetX = phRect.left;
|
|
336
|
+
targetY = phRect.top;
|
|
337
|
+
}
|
|
338
|
+
this._sourceEl.style.transition = "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)";
|
|
339
|
+
this._sourceEl.style.transform = `translate(${targetX}px, ${targetY}px)`;
|
|
340
|
+
this._sourceEl.style.rotate = "0deg";
|
|
341
|
+
this._sourceEl.style.boxShadow = "none";
|
|
342
|
+
let done = false;
|
|
343
|
+
const finish = () => {
|
|
344
|
+
if (done) return;
|
|
345
|
+
done = true;
|
|
346
|
+
resolve();
|
|
347
|
+
};
|
|
348
|
+
this._sourceEl.addEventListener("transitionend", finish, { once: true });
|
|
349
|
+
setTimeout(finish, 250);
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
_removeGlobalListeners() {
|
|
353
|
+
document.removeEventListener("pointermove", this._boundMove);
|
|
354
|
+
document.removeEventListener("pointerup", this._boundUp);
|
|
355
|
+
document.removeEventListener("keydown", this._boundKeyDown);
|
|
356
|
+
}
|
|
357
|
+
_cleanup() {
|
|
358
|
+
if (this._cleanedUp) return;
|
|
359
|
+
this._cleanedUp = true;
|
|
360
|
+
this._placeholder?.remove();
|
|
361
|
+
this._placeholder = null;
|
|
362
|
+
this._sourceEl = null;
|
|
363
|
+
this._sourceRect = null;
|
|
364
|
+
this._dragging = false;
|
|
365
|
+
this._started = false;
|
|
366
|
+
this._draggedId = "";
|
|
367
|
+
this._currentDroppableId = null;
|
|
368
|
+
}
|
|
369
|
+
destroy() {
|
|
370
|
+
this._removeGlobalListeners();
|
|
371
|
+
if (this._dragging) {
|
|
372
|
+
if (this._sourceEl) this._returnToSource();
|
|
373
|
+
this._cleanup();
|
|
374
|
+
}
|
|
375
|
+
if (this._docListenerAttached && typeof document !== "undefined") {
|
|
376
|
+
document.removeEventListener("pointerdown", this._boundDocDown, true);
|
|
377
|
+
this._docListenerAttached = false;
|
|
378
|
+
}
|
|
379
|
+
this.droppables.clear();
|
|
380
|
+
this.onDragEnd = null;
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
const dndManager = new DndManager();
|
|
384
|
+
//#endregion
|
|
385
|
+
export { dndManager };
|
|
386
|
+
|
|
387
|
+
//# sourceMappingURL=dnd-manager.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dnd-manager.mjs","names":[],"sources":["../src/components/dnd-manager.ts"],"sourcesContent":["import { GEA_CHILD_COMPONENTS, GEA_DOM_COMPONENT } 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\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 this._performTransfer(destination)\n this._cleanup()\n this._onDragEnd?.(result)\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 HTMLElement & { [GEA_DOM_COMPONENT]?: unknown })[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 sourceParent = draggedComp.parentComponent\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 const srcChildren = sourceParent[GEA_CHILD_COMPONENTS]\n if (Array.isArray(srcChildren)) {\n const ci = srcChildren.indexOf(draggedComp)\n if (ci !== -1) srcChildren.splice(ci, 1)\n }\n const destChildren = destParent[GEA_CHILD_COMPONENTS]\n if (Array.isArray(destChildren) && !destChildren.includes(draggedComp)) {\n destChildren.push(draggedComp)\n }\n draggedComp.parentComponent = destParent\n }\n\n private _findCompiledArray(parent: any, child: any): { key: PropertyKey; arr: any[]; index: number } | null {\n const stringKeys = Object.keys(parent)\n const symbolKeys = Object.getOwnPropertySymbols(parent)\n for (const key of stringKeys) {\n if (key.startsWith('_') && key.endsWith('Items') && Array.isArray((parent as any)[key])) {\n const arr = (parent as any)[key] as any[]\n const idx = arr.indexOf(child)\n if (idx !== -1) return { key, arr, index: idx }\n }\n }\n for (const key of symbolKeys) {\n if (String(key).includes('gea.listItems') && Array.isArray((parent as any)[key])) {\n const arr = (parent as any)[key] as any[]\n const idx = arr.indexOf(child)\n if (idx !== -1) return { key, arr, index: idx }\n }\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":";;AAQA,MAAM,oBAAoB;AAC1B,MAAM,gBAAgB;AACtB,MAAM,gBAAgB;AAEtB,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,cA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