@editora/ui-core 0.1.23 → 0.1.25
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 +215 -5
- package/dist/components/gantt-schedule.d.ts +79 -0
- package/dist/components/gantt-schedule.d.ts.map +1 -0
- package/dist/components/ui-gantt.d.ts +186 -2
- package/dist/components/ui-gantt.d.ts.map +1 -1
- package/dist/components/ui-sortable.d.ts +209 -12
- package/dist/components/ui-sortable.d.ts.map +1 -1
- package/dist/gantt.cjs.js +519 -104
- package/dist/gantt.esm.js +1876 -371
- package/dist/sortable.cjs.js +504 -369
- package/dist/sortable.d.ts +1 -1
- package/dist/sortable.d.ts.map +1 -1
- package/dist/sortable.esm.js +1758 -1168
- package/package.json +1 -1
package/dist/sortable.esm.js
CHANGED
|
@@ -1,43 +1,106 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
function
|
|
3
|
-
if (!Number.isFinite(
|
|
4
|
-
const s = Math.min(
|
|
5
|
-
return s <= 0 ? 0 :
|
|
1
|
+
import { E as dt } from "./ElementBase-BeZT54Hj.mjs";
|
|
2
|
+
function K(u, t, e, i = 56, r = 18) {
|
|
3
|
+
if (!Number.isFinite(u) || !(e > t)) return 0;
|
|
4
|
+
const s = Math.min(i, (e - t) / 2);
|
|
5
|
+
return s <= 0 ? 0 : u < t + s ? -Math.ceil(r * Math.min(1, (t + s - u) / s)) : u > e - s ? Math.ceil(r * Math.min(1, (u - (e - s)) / s)) : 0;
|
|
6
6
|
}
|
|
7
|
-
const
|
|
8
|
-
function
|
|
9
|
-
let
|
|
10
|
-
for (;
|
|
11
|
-
if (
|
|
12
|
-
if (
|
|
13
|
-
const { overflowY:
|
|
14
|
-
if (
|
|
7
|
+
const ct = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]);
|
|
8
|
+
function ut(u) {
|
|
9
|
+
let t = u;
|
|
10
|
+
for (; t; ) {
|
|
11
|
+
if (t = t.parentNode instanceof ShadowRoot ? t.parentNode.host : t.parentNode, !(t instanceof HTMLElement)) continue;
|
|
12
|
+
if (t === t.ownerDocument.body || t === t.ownerDocument.documentElement) return null;
|
|
13
|
+
const { overflowY: e } = t.ownerDocument.defaultView?.getComputedStyle(t) ?? { overflowY: "" };
|
|
14
|
+
if (ct.has(e) && t.scrollHeight > t.clientHeight) return t;
|
|
15
15
|
}
|
|
16
16
|
return null;
|
|
17
17
|
}
|
|
18
|
-
const
|
|
18
|
+
const ht = 1, Y = {
|
|
19
|
+
hintHandle: "Use the handle to drag, or press Space on a focused item to start keyboard reordering.",
|
|
20
|
+
hintItem: "Drag from anywhere on an item, or press Space on a focused item to start keyboard reordering.",
|
|
21
|
+
hintCustom: "Use your custom drag handle element, or press Space on a focused item to start keyboard reordering.",
|
|
22
|
+
hintKeyboard: "Keyboard drag active. Use arrow keys to choose a drop target, Space or Enter to drop, and Escape to cancel.",
|
|
23
|
+
hintNestGutter: "To nest an item, hold Alt or drop it on the far side of another.",
|
|
24
|
+
hintNestModifier: "To nest an item, hold Alt while you drop it on another.",
|
|
25
|
+
hintNestArea: "To nest an item, drop it on the middle of another.",
|
|
26
|
+
hintPausedSort: "Dragging is paused while alphabetical sorting is active.",
|
|
27
|
+
hintPausedFilter: "Dragging is paused while the list is filtered.",
|
|
28
|
+
hintDisabled: "Dragging is currently disabled.",
|
|
29
|
+
selectedOne: "item selected",
|
|
30
|
+
selectedMany: "items selected",
|
|
31
|
+
listReadOnly: "This list is read-only.",
|
|
32
|
+
listClone: "Dragging from this list creates a copy.",
|
|
33
|
+
listAccepts: "Accepts drops from: {lists}",
|
|
34
|
+
listFull: "This list is full ({max} items).",
|
|
35
|
+
emptyList: "Drop items here.",
|
|
36
|
+
dropHere: "Drop here",
|
|
37
|
+
nestHere: "Nest here",
|
|
38
|
+
badgeSelected: "Selected",
|
|
39
|
+
badgeClone: "Clone on drag",
|
|
40
|
+
badgePinned: "Pinned",
|
|
41
|
+
dropPreview: "Drop preview",
|
|
42
|
+
copyPreview: "Copy preview",
|
|
43
|
+
releaseMove: "Release to place this item here.",
|
|
44
|
+
releaseMoveMany: "Release to place this selection here.",
|
|
45
|
+
releaseCopy: "Release to add a copy here.",
|
|
46
|
+
movingOne: "Moving item",
|
|
47
|
+
movingMany: "Moving {count} items",
|
|
48
|
+
copyingOne: "Copying item",
|
|
49
|
+
copyingMany: "Copying {count} items",
|
|
50
|
+
announceSelectedMany: "{count} items selected.",
|
|
51
|
+
announceDragDisabled: "Dragging is disabled right now.",
|
|
52
|
+
announceDragging: "Dragging {label}.",
|
|
53
|
+
announceDraggingMany: "Dragging {count} items.",
|
|
54
|
+
announceDraggingCopy: "Dragging {label} as a copy.",
|
|
55
|
+
announceDraggingCopyMany: "Dragging {count} items as a copy.",
|
|
56
|
+
announceCancelled: "Drag cancelled.",
|
|
57
|
+
announceRejected: "That move is not allowed.",
|
|
58
|
+
announceLifted: "Lifted {label}.",
|
|
59
|
+
announceLiftedMany: "Lifted {count} items.",
|
|
60
|
+
announceLiftedHelp: "Use arrow keys to choose a destination.",
|
|
61
|
+
announceCopiedOne: "Item copied into {list}.",
|
|
62
|
+
announceCopiedMany: "{count} items copied into {list}.",
|
|
63
|
+
announceNestedOne: "Item nested in {list}.",
|
|
64
|
+
announceNestedMany: "{count} items nested in {list}.",
|
|
65
|
+
announceMovedOne: "Item moved to {list}.",
|
|
66
|
+
announceMovedMany: "{count} items moved to {list}.",
|
|
67
|
+
announceReorderedOne: "Item reordered in {list}.",
|
|
68
|
+
announceReorderedMany: "{count} items reordered in {list}.",
|
|
69
|
+
targetBefore: "Before {label}",
|
|
70
|
+
targetInside: "Nest inside {label}",
|
|
71
|
+
targetEnd: "End of {list}",
|
|
72
|
+
targetAfterChildren: "After children"
|
|
73
|
+
}, W = 44, Q = 72, Z = 350, pt = 10, gt = `
|
|
19
74
|
:host {
|
|
20
75
|
--ui-sortable-accent: var(--ui-color-primary, #2563eb);
|
|
21
76
|
--ui-sortable-surface: var(--ui-color-surface, #ffffff);
|
|
22
|
-
--ui-sortable-surface-muted: color-mix(in srgb, var(--ui-sortable-surface) 92%, #eff6ff);
|
|
23
|
-
--ui-sortable-border: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 76%, transparent);
|
|
24
77
|
--ui-sortable-text: var(--ui-color-text, #0f172a);
|
|
25
|
-
--ui-sortable-muted: var(--ui-color-muted, #
|
|
26
|
-
--ui-sortable-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
--ui-sortable-
|
|
30
|
-
--ui-sortable-
|
|
31
|
-
--ui-sortable-
|
|
32
|
-
--ui-sortable-
|
|
33
|
-
--ui-sortable-
|
|
34
|
-
--ui-sortable-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
--ui-sortable-
|
|
38
|
-
--ui-sortable-
|
|
78
|
+
--ui-sortable-muted: var(--ui-color-muted, #5b6778);
|
|
79
|
+
--ui-sortable-lane: color-mix(in srgb, var(--ui-sortable-text) 3.5%, var(--ui-sortable-surface));
|
|
80
|
+
--ui-sortable-card: var(--ui-sortable-surface);
|
|
81
|
+
--ui-sortable-surface-muted: var(--ui-sortable-lane);
|
|
82
|
+
--ui-sortable-border: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 62%, transparent);
|
|
83
|
+
--ui-sortable-border-strong: color-mix(in srgb, var(--ui-sortable-text) 24%, var(--ui-sortable-surface));
|
|
84
|
+
--ui-sortable-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
|
|
85
|
+
--ui-sortable-card-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
|
|
86
|
+
--ui-sortable-card-shadow-hover: 0 3px 10px rgba(15, 23, 42, 0.1);
|
|
87
|
+
--ui-sortable-lift-shadow:
|
|
88
|
+
0 22px 44px -10px rgba(15, 23, 42, 0.32),
|
|
89
|
+
0 8px 16px rgba(15, 23, 42, 0.14);
|
|
90
|
+
--ui-sortable-radius: 14px;
|
|
91
|
+
--ui-sortable-panel-radius: 14px;
|
|
92
|
+
--ui-sortable-item-radius: 10px;
|
|
93
|
+
--ui-sortable-handle-radius: 6px;
|
|
94
|
+
--ui-sortable-gap: 12px;
|
|
95
|
+
--ui-sortable-list-gap: 6px;
|
|
96
|
+
--ui-sortable-item-gap: 6px;
|
|
97
|
+
--ui-sortable-list-min-size: 260px;
|
|
98
|
+
--ui-sortable-dropzone-size: 0px;
|
|
99
|
+
--ui-sortable-dropzone-hit-size: 7px;
|
|
100
|
+
--ui-sortable-dropzone-inside-size: 0px;
|
|
101
|
+
--ui-sortable-dropzone-container-min-block-size: 56px;
|
|
39
102
|
--ui-sortable-dropzone-container-min-inline-size: 180px;
|
|
40
|
-
--ui-sortable-indent:
|
|
103
|
+
--ui-sortable-indent: 16px;
|
|
41
104
|
display: block;
|
|
42
105
|
min-inline-size: 0;
|
|
43
106
|
color: var(--ui-sortable-text);
|
|
@@ -52,7 +115,7 @@ const se = 1, oe = 44, ne = 72, ae = `
|
|
|
52
115
|
|
|
53
116
|
.root {
|
|
54
117
|
display: grid;
|
|
55
|
-
gap:
|
|
118
|
+
gap: 10px;
|
|
56
119
|
min-inline-size: 0;
|
|
57
120
|
}
|
|
58
121
|
|
|
@@ -61,13 +124,25 @@ const se = 1, oe = 44, ne = 72, ae = `
|
|
|
61
124
|
flex-wrap: wrap;
|
|
62
125
|
align-items: center;
|
|
63
126
|
justify-content: space-between;
|
|
64
|
-
gap:
|
|
127
|
+
gap: 6px 16px;
|
|
65
128
|
padding: 0 2px;
|
|
66
129
|
color: var(--ui-sortable-muted);
|
|
67
|
-
font-size:
|
|
130
|
+
font-size: 12px;
|
|
68
131
|
line-height: 1.5;
|
|
69
132
|
}
|
|
70
133
|
|
|
134
|
+
/* hide-toolbar: the hint is still what the lists are described by, so it is hidden from sight only. */
|
|
135
|
+
.toolbar[data-hidden="true"] {
|
|
136
|
+
position: absolute;
|
|
137
|
+
inline-size: 1px;
|
|
138
|
+
block-size: 1px;
|
|
139
|
+
margin: -1px;
|
|
140
|
+
padding: 0;
|
|
141
|
+
overflow: hidden;
|
|
142
|
+
clip: rect(0, 0, 0, 0);
|
|
143
|
+
white-space: nowrap;
|
|
144
|
+
}
|
|
145
|
+
|
|
71
146
|
.helper {
|
|
72
147
|
display: inline-flex;
|
|
73
148
|
align-items: center;
|
|
@@ -75,40 +150,54 @@ const se = 1, oe = 44, ne = 72, ae = `
|
|
|
75
150
|
min-inline-size: 0;
|
|
76
151
|
}
|
|
77
152
|
|
|
153
|
+
.selection-summary[data-count="0"] {
|
|
154
|
+
display: none;
|
|
155
|
+
}
|
|
156
|
+
|
|
78
157
|
.selection-pill {
|
|
79
158
|
display: inline-flex;
|
|
80
159
|
align-items: center;
|
|
81
160
|
justify-content: center;
|
|
82
|
-
min-inline-size:
|
|
83
|
-
min-block-size:
|
|
84
|
-
padding-inline:
|
|
161
|
+
min-inline-size: 22px;
|
|
162
|
+
min-block-size: 20px;
|
|
163
|
+
padding-inline: 7px;
|
|
85
164
|
border-radius: 999px;
|
|
86
165
|
background: color-mix(in srgb, var(--ui-sortable-accent) 14%, transparent);
|
|
87
166
|
color: color-mix(in srgb, var(--ui-sortable-accent) 84%, var(--ui-sortable-text));
|
|
167
|
+
font-size: 11.5px;
|
|
88
168
|
font-weight: 700;
|
|
89
169
|
}
|
|
90
170
|
|
|
171
|
+
/* Lists sit side by side and scroll sideways when they do not fit (a board), instead of wrapping onto
|
|
172
|
+
rows. One list fills the width. The padding gives card shadows and focus rings room inside the
|
|
173
|
+
scroller; the negative margin hands that room back to the layout. */
|
|
91
174
|
.lists {
|
|
92
175
|
display: grid;
|
|
176
|
+
grid-auto-flow: column;
|
|
177
|
+
grid-auto-columns: minmax(min(var(--ui-sortable-list-min-size), 100%), 1fr);
|
|
93
178
|
gap: var(--ui-sortable-gap);
|
|
94
|
-
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
95
179
|
min-inline-size: 0;
|
|
180
|
+
padding: 4px;
|
|
181
|
+
margin: -4px;
|
|
182
|
+
overflow: auto hidden;
|
|
183
|
+
overscroll-behavior-x: contain;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.lists,
|
|
187
|
+
.items {
|
|
188
|
+
scrollbar-width: thin;
|
|
189
|
+
scrollbar-color: color-mix(in srgb, var(--ui-sortable-text) 28%, transparent) transparent;
|
|
96
190
|
}
|
|
97
191
|
|
|
98
192
|
.list {
|
|
99
193
|
display: grid;
|
|
100
194
|
grid-template-rows: auto 1fr;
|
|
101
|
-
gap:
|
|
195
|
+
gap: 10px;
|
|
102
196
|
min-inline-size: 0;
|
|
103
|
-
padding:
|
|
197
|
+
padding: 12px;
|
|
104
198
|
border: 1px solid var(--ui-sortable-border);
|
|
105
199
|
border-radius: var(--ui-sortable-radius);
|
|
106
|
-
background:
|
|
107
|
-
linear-gradient(
|
|
108
|
-
180deg,
|
|
109
|
-
color-mix(in srgb, var(--ui-sortable-surface) 96%, transparent),
|
|
110
|
-
color-mix(in srgb, var(--ui-sortable-accent) 4%, var(--ui-sortable-surface))
|
|
111
|
-
);
|
|
200
|
+
background: var(--ui-sortable-lane);
|
|
112
201
|
box-shadow: var(--ui-sortable-shadow);
|
|
113
202
|
}
|
|
114
203
|
|
|
@@ -117,6 +206,7 @@ const se = 1, oe = 44, ne = 72, ae = `
|
|
|
117
206
|
flex-wrap: nowrap;
|
|
118
207
|
overflow: auto hidden;
|
|
119
208
|
align-items: stretch;
|
|
209
|
+
min-block-size: 0;
|
|
120
210
|
}
|
|
121
211
|
|
|
122
212
|
/* The cards live inside one root .tree wrapper, which is a vertical grid. Without this the
|
|
@@ -126,20 +216,26 @@ const se = 1, oe = 44, ne = 72, ae = `
|
|
|
126
216
|
flex-wrap: nowrap;
|
|
127
217
|
align-items: stretch;
|
|
128
218
|
min-inline-size: min-content;
|
|
219
|
+
margin-block: 0;
|
|
220
|
+
margin-inline: calc(var(--ui-sortable-list-gap) / -2);
|
|
129
221
|
}
|
|
130
222
|
|
|
131
223
|
.list[data-orientation="horizontal"] .items > .tree > .item-shell {
|
|
132
224
|
flex: 0 0 auto;
|
|
133
225
|
min-inline-size: min(220px, 70vw);
|
|
226
|
+
align-content: start;
|
|
227
|
+
padding-block: 0;
|
|
228
|
+
padding-inline: calc(var(--ui-sortable-list-gap) / 2);
|
|
134
229
|
}
|
|
135
230
|
|
|
136
231
|
.list[data-disabled="true"] {
|
|
137
|
-
opacity: 0.
|
|
232
|
+
opacity: 0.62;
|
|
138
233
|
}
|
|
139
234
|
|
|
140
235
|
.list-header {
|
|
141
236
|
display: grid;
|
|
142
|
-
gap:
|
|
237
|
+
gap: 2px;
|
|
238
|
+
padding: 2px 4px 0;
|
|
143
239
|
}
|
|
144
240
|
|
|
145
241
|
.list-custom-header:empty {
|
|
@@ -162,9 +258,10 @@ const se = 1, oe = 44, ne = 72, ae = `
|
|
|
162
258
|
}
|
|
163
259
|
|
|
164
260
|
.list-label {
|
|
165
|
-
font-size:
|
|
261
|
+
font-size: 13px;
|
|
166
262
|
line-height: 1.4;
|
|
167
|
-
font-weight:
|
|
263
|
+
font-weight: 650;
|
|
264
|
+
letter-spacing: 0.005em;
|
|
168
265
|
color: var(--ui-sortable-text);
|
|
169
266
|
}
|
|
170
267
|
|
|
@@ -172,36 +269,85 @@ const se = 1, oe = 44, ne = 72, ae = `
|
|
|
172
269
|
display: inline-flex;
|
|
173
270
|
align-items: center;
|
|
174
271
|
justify-content: center;
|
|
175
|
-
min-inline-size:
|
|
176
|
-
min-block-size:
|
|
177
|
-
padding-inline:
|
|
272
|
+
min-inline-size: 22px;
|
|
273
|
+
min-block-size: 20px;
|
|
274
|
+
padding-inline: 7px;
|
|
178
275
|
border-radius: 999px;
|
|
179
|
-
background: color-mix(in srgb, var(--ui-sortable-
|
|
276
|
+
background: color-mix(in srgb, var(--ui-sortable-text) 7%, transparent);
|
|
180
277
|
color: var(--ui-sortable-muted);
|
|
181
|
-
font-size:
|
|
182
|
-
font-weight:
|
|
278
|
+
font-size: 11.5px;
|
|
279
|
+
font-weight: 650;
|
|
280
|
+
font-variant-numeric: tabular-nums;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/* A list at its maxItems takes nothing more: the count turns to a warning colour. */
|
|
284
|
+
.list[data-full="true"] .list-count {
|
|
285
|
+
background: color-mix(in srgb, var(--ui-sortable-warning, #d97706) 16%, transparent);
|
|
286
|
+
color: color-mix(in srgb, var(--ui-sortable-warning, #d97706) 80%, var(--ui-sortable-text));
|
|
183
287
|
}
|
|
184
288
|
|
|
185
289
|
.list-description,
|
|
186
|
-
.list-helper
|
|
187
|
-
.empty {
|
|
290
|
+
.list-helper {
|
|
188
291
|
color: var(--ui-sortable-muted);
|
|
189
292
|
font-size: 12px;
|
|
190
|
-
line-height: 1.
|
|
293
|
+
line-height: 1.5;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.list-helper {
|
|
297
|
+
font-size: 11.5px;
|
|
298
|
+
opacity: 0.85;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.empty {
|
|
302
|
+
display: grid;
|
|
303
|
+
place-items: center;
|
|
304
|
+
min-block-size: 64px;
|
|
305
|
+
margin-block: calc(var(--ui-sortable-list-gap) / 2);
|
|
306
|
+
padding: 14px;
|
|
307
|
+
border: 1px dashed var(--ui-sortable-border-strong);
|
|
308
|
+
border-radius: var(--ui-sortable-item-radius);
|
|
309
|
+
color: var(--ui-sortable-muted);
|
|
310
|
+
font-size: 12.5px;
|
|
311
|
+
line-height: 1.5;
|
|
312
|
+
text-align: center;
|
|
313
|
+
transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.empty:has(+ .dropzone[data-active="true"]) {
|
|
317
|
+
border-color: var(--ui-sortable-accent);
|
|
318
|
+
background: color-mix(in srgb, var(--ui-sortable-accent) 7%, transparent);
|
|
319
|
+
color: color-mix(in srgb, var(--ui-sortable-accent) 80%, var(--ui-sortable-text));
|
|
191
320
|
}
|
|
192
321
|
|
|
193
322
|
.items {
|
|
194
323
|
display: grid;
|
|
195
324
|
align-content: start;
|
|
196
|
-
gap:
|
|
197
|
-
min-block-size:
|
|
325
|
+
gap: 0;
|
|
326
|
+
min-block-size: 88px;
|
|
198
327
|
min-inline-size: 0;
|
|
199
328
|
}
|
|
200
329
|
|
|
330
|
+
/* A list with a height of its own scrolls by itself. The padding (and the cards' own spacing) gives shadows and
|
|
331
|
+
focus rings room inside the scroller; the negative margin hands that room back to the layout. The wrapper's
|
|
332
|
+
negative margin is dropped here: inside a scroller it would count as overflow, and a list whose cards all fit
|
|
333
|
+
would still scroll by a few pixels. */
|
|
334
|
+
.items[data-scroll="true"] {
|
|
335
|
+
max-block-size: var(--ui-sortable-list-max-block-size);
|
|
336
|
+
overflow-y: auto;
|
|
337
|
+
overscroll-behavior: contain;
|
|
338
|
+
padding: 1px 4px;
|
|
339
|
+
margin: -4px;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
.items[data-scroll="true"] > .tree {
|
|
343
|
+
margin-block: 0;
|
|
344
|
+
}
|
|
345
|
+
|
|
201
346
|
.tree {
|
|
202
347
|
display: grid;
|
|
203
|
-
gap:
|
|
348
|
+
gap: 0;
|
|
204
349
|
min-inline-size: 0;
|
|
350
|
+
margin-block: calc(var(--ui-sortable-list-gap) / -2);
|
|
205
351
|
}
|
|
206
352
|
|
|
207
353
|
.list-custom-empty:empty {
|
|
@@ -216,169 +362,235 @@ const se = 1, oe = 44, ne = 72, ae = `
|
|
|
216
362
|
display: none;
|
|
217
363
|
}
|
|
218
364
|
|
|
365
|
+
/* The cards are spaced by the shell's padding, not by a grid gap: the drop rails between them take
|
|
366
|
+
no height, so the list is as tall as its cards. */
|
|
219
367
|
.item-shell {
|
|
220
368
|
display: grid;
|
|
221
|
-
gap:
|
|
369
|
+
gap: 0;
|
|
222
370
|
min-inline-size: 0;
|
|
371
|
+
padding-block: calc(var(--ui-sortable-list-gap) / 2);
|
|
223
372
|
}
|
|
224
373
|
|
|
225
374
|
.item {
|
|
226
375
|
display: grid;
|
|
227
376
|
grid-template-columns: auto minmax(0, 1fr);
|
|
228
|
-
align-items:
|
|
377
|
+
align-items: center;
|
|
229
378
|
gap: var(--ui-sortable-item-gap);
|
|
230
379
|
min-inline-size: 0;
|
|
231
|
-
padding: 12px;
|
|
232
|
-
border: 1px solid
|
|
380
|
+
padding: 9px 12px 9px 6px;
|
|
381
|
+
border: 1px solid var(--ui-sortable-border);
|
|
233
382
|
border-radius: var(--ui-sortable-item-radius);
|
|
234
|
-
background: var(--ui-sortable-
|
|
235
|
-
box-shadow:
|
|
236
|
-
will-change: transform, opacity, box-shadow, border-color, background;
|
|
383
|
+
background: var(--ui-sortable-card);
|
|
384
|
+
box-shadow: var(--ui-sortable-card-shadow);
|
|
237
385
|
transition:
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
386
|
+
opacity 160ms ease,
|
|
387
|
+
box-shadow 160ms ease,
|
|
388
|
+
border-color 160ms ease,
|
|
389
|
+
background 160ms ease;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.item:hover {
|
|
393
|
+
border-color: var(--ui-sortable-border-strong);
|
|
394
|
+
box-shadow: var(--ui-sortable-card-shadow-hover);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.item:focus {
|
|
398
|
+
outline: none;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.item:focus-visible {
|
|
402
|
+
outline: 2px solid var(--ui-sortable-accent);
|
|
403
|
+
outline-offset: 2px;
|
|
243
404
|
}
|
|
244
405
|
|
|
245
406
|
.item[data-drag-handle-mode="item"],
|
|
246
407
|
.item[data-drag-handle-mode="custom"] {
|
|
247
408
|
grid-template-columns: minmax(0, 1fr);
|
|
409
|
+
padding-inline-start: 12px;
|
|
248
410
|
}
|
|
249
411
|
|
|
250
412
|
.item[data-drag-handle-mode="item"] {
|
|
251
413
|
cursor: grab;
|
|
252
414
|
}
|
|
253
415
|
|
|
416
|
+
/* A card that is dragged by its body is held to lift on touch: no text selection or callout while holding. */
|
|
417
|
+
.item[data-drag-handle-mode="item"],
|
|
418
|
+
.item[data-drag-handle-mode="custom"] {
|
|
419
|
+
-webkit-user-select: none;
|
|
420
|
+
user-select: none;
|
|
421
|
+
-webkit-touch-callout: none;
|
|
422
|
+
}
|
|
423
|
+
|
|
254
424
|
.item[data-drag-handle-mode="item"][data-dragging="true"] {
|
|
255
425
|
cursor: grabbing;
|
|
256
426
|
}
|
|
257
427
|
|
|
258
428
|
.item[data-selected="true"] {
|
|
259
|
-
border-color: color-mix(in srgb, var(--ui-sortable-accent)
|
|
260
|
-
background: color-mix(in srgb, var(--ui-sortable-accent)
|
|
429
|
+
border-color: color-mix(in srgb, var(--ui-sortable-accent) 60%, var(--ui-sortable-border));
|
|
430
|
+
background: color-mix(in srgb, var(--ui-sortable-accent) 7%, var(--ui-sortable-card));
|
|
261
431
|
box-shadow:
|
|
262
|
-
0 0 0 1px color-mix(in srgb, var(--ui-sortable-accent)
|
|
263
|
-
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
.item[data-focused="true"] {
|
|
267
|
-
border-color: color-mix(in srgb, var(--ui-sortable-accent) 42%, var(--ui-sortable-border));
|
|
268
|
-
box-shadow:
|
|
269
|
-
0 0 0 3px color-mix(in srgb, var(--ui-sortable-accent) 12%, transparent),
|
|
270
|
-
0 10px 24px rgba(15, 23, 42, 0.08);
|
|
432
|
+
0 0 0 1px color-mix(in srgb, var(--ui-sortable-accent) 28%, transparent),
|
|
433
|
+
var(--ui-sortable-card-shadow);
|
|
271
434
|
}
|
|
272
435
|
|
|
273
436
|
.item[data-drop-inside-active="true"] {
|
|
274
|
-
border-color:
|
|
275
|
-
background:
|
|
276
|
-
linear-gradient(
|
|
277
|
-
180deg,
|
|
278
|
-
color-mix(in srgb, var(--ui-sortable-accent) 14%, var(--ui-sortable-surface)),
|
|
279
|
-
color-mix(in srgb, var(--ui-sortable-accent) 10%, var(--ui-sortable-surface-muted))
|
|
280
|
-
);
|
|
437
|
+
border-color: var(--ui-sortable-accent);
|
|
438
|
+
background: color-mix(in srgb, var(--ui-sortable-accent) 10%, var(--ui-sortable-card));
|
|
281
439
|
box-shadow:
|
|
282
|
-
0 0 0 3px color-mix(in srgb, var(--ui-sortable-accent)
|
|
283
|
-
|
|
440
|
+
0 0 0 3px color-mix(in srgb, var(--ui-sortable-accent) 20%, transparent),
|
|
441
|
+
var(--ui-sortable-card-shadow);
|
|
284
442
|
}
|
|
285
443
|
|
|
444
|
+
/* While a card is being dragged its place in the list stays as an empty slot, so the list does not
|
|
445
|
+
jump; the card itself is the ghost that follows the pointer. */
|
|
286
446
|
.item[data-dragging="true"] {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
447
|
+
border-style: dashed;
|
|
448
|
+
border-color: color-mix(in srgb, var(--ui-sortable-accent) 45%, var(--ui-sortable-border));
|
|
449
|
+
background: color-mix(in srgb, var(--ui-sortable-accent) 5%, var(--ui-sortable-card));
|
|
450
|
+
box-shadow: none;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
.item[data-dragging="true"] > * {
|
|
454
|
+
visibility: hidden;
|
|
290
455
|
}
|
|
291
456
|
|
|
457
|
+
/* The keyboard drag shows the card at its destination as a quiet dashed card. */
|
|
292
458
|
.item.item-placeholder {
|
|
293
459
|
grid-template-columns: 1fr;
|
|
460
|
+
padding-inline-start: 12px;
|
|
294
461
|
border-style: dashed;
|
|
295
|
-
border-color: color-mix(in srgb, var(--ui-sortable-accent)
|
|
296
|
-
background:
|
|
297
|
-
|
|
298
|
-
180deg,
|
|
299
|
-
color-mix(in srgb, var(--ui-sortable-accent) 10%, var(--ui-sortable-surface)),
|
|
300
|
-
color-mix(in srgb, var(--ui-sortable-accent) 6%, var(--ui-sortable-surface-muted))
|
|
301
|
-
);
|
|
302
|
-
box-shadow:
|
|
303
|
-
inset 0 0 0 1px color-mix(in srgb, var(--ui-sortable-accent) 18%, transparent),
|
|
304
|
-
0 12px 26px rgba(15, 23, 42, 0.08);
|
|
462
|
+
border-color: color-mix(in srgb, var(--ui-sortable-accent) 55%, var(--ui-sortable-border));
|
|
463
|
+
background: color-mix(in srgb, var(--ui-sortable-accent) 7%, var(--ui-sortable-card));
|
|
464
|
+
box-shadow: none;
|
|
305
465
|
}
|
|
306
466
|
|
|
307
467
|
.placeholder-content {
|
|
308
468
|
display: grid;
|
|
309
|
-
gap:
|
|
469
|
+
gap: 3px;
|
|
310
470
|
min-inline-size: 0;
|
|
311
471
|
}
|
|
312
472
|
|
|
313
473
|
.placeholder-kicker {
|
|
314
|
-
font-size:
|
|
474
|
+
font-size: 10.5px;
|
|
315
475
|
line-height: 1.4;
|
|
316
476
|
font-weight: 700;
|
|
317
477
|
letter-spacing: 0.08em;
|
|
318
478
|
text-transform: uppercase;
|
|
319
|
-
color: color-mix(in srgb, var(--ui-sortable-accent)
|
|
479
|
+
color: color-mix(in srgb, var(--ui-sortable-accent) 78%, var(--ui-sortable-text));
|
|
320
480
|
}
|
|
321
481
|
|
|
322
482
|
.placeholder-title {
|
|
323
|
-
font-size:
|
|
483
|
+
font-size: 13.5px;
|
|
324
484
|
line-height: 1.4;
|
|
325
|
-
font-weight:
|
|
485
|
+
font-weight: 600;
|
|
326
486
|
color: var(--ui-sortable-text);
|
|
327
487
|
}
|
|
328
488
|
|
|
329
489
|
.placeholder-description {
|
|
330
490
|
color: var(--ui-sortable-muted);
|
|
331
491
|
font-size: 12px;
|
|
332
|
-
line-height: 1.
|
|
492
|
+
line-height: 1.5;
|
|
333
493
|
}
|
|
334
494
|
|
|
335
|
-
.
|
|
495
|
+
/* The card that follows the pointer: a copy of the real card, lifted. */
|
|
496
|
+
.item.item-ghost {
|
|
336
497
|
position: fixed;
|
|
337
|
-
inset:
|
|
338
|
-
|
|
339
|
-
left: -9999px;
|
|
340
|
-
z-index: 2147483646;
|
|
498
|
+
inset: 0 auto auto 0;
|
|
499
|
+
z-index: 2147483647;
|
|
341
500
|
box-sizing: border-box;
|
|
342
|
-
inline-size:
|
|
343
|
-
|
|
344
|
-
border: 1px dashed color-mix(in srgb, var(--ui-sortable-accent) 50%, var(--ui-sortable-border));
|
|
345
|
-
border-radius: var(--ui-sortable-item-radius);
|
|
346
|
-
background:
|
|
347
|
-
linear-gradient(
|
|
348
|
-
180deg,
|
|
349
|
-
color-mix(in srgb, var(--ui-sortable-accent) 10%, var(--ui-sortable-surface)),
|
|
350
|
-
color-mix(in srgb, var(--ui-sortable-accent) 6%, var(--ui-sortable-surface-muted))
|
|
351
|
-
);
|
|
352
|
-
box-shadow:
|
|
353
|
-
inset 0 0 0 1px color-mix(in srgb, var(--ui-sortable-accent) 18%, transparent),
|
|
354
|
-
0 18px 40px rgba(15, 23, 42, 0.12);
|
|
501
|
+
max-inline-size: calc(100vw - 16px);
|
|
502
|
+
margin: 0;
|
|
355
503
|
pointer-events: none;
|
|
356
|
-
|
|
357
|
-
|
|
504
|
+
cursor: grabbing;
|
|
505
|
+
border-color: color-mix(in srgb, var(--ui-sortable-accent) 55%, var(--ui-sortable-border));
|
|
506
|
+
background: var(--ui-sortable-card);
|
|
507
|
+
box-shadow: var(--ui-sortable-lift-shadow);
|
|
508
|
+
rotate: 1.2deg;
|
|
509
|
+
scale: 1.025;
|
|
510
|
+
transition: none;
|
|
511
|
+
will-change: transform;
|
|
512
|
+
animation: ui-sortable-lift 150ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
|
|
358
513
|
}
|
|
359
514
|
|
|
360
|
-
.
|
|
515
|
+
.item.item-ghost[data-count="stack"] {
|
|
516
|
+
box-shadow:
|
|
517
|
+
5px 5px 0 -1px var(--ui-sortable-card),
|
|
518
|
+
5px 5px 0 0 var(--ui-sortable-border-strong),
|
|
519
|
+
10px 10px 0 -2px var(--ui-sortable-card),
|
|
520
|
+
10px 10px 0 -1px var(--ui-sortable-border-strong),
|
|
521
|
+
var(--ui-sortable-lift-shadow);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
.item.item-ghost[data-refused] {
|
|
525
|
+
border-color: var(--ui-sortable-danger, #dc2626);
|
|
526
|
+
box-shadow:
|
|
527
|
+
0 0 0 3px color-mix(in srgb, var(--ui-sortable-danger, #dc2626) 22%, transparent),
|
|
528
|
+
var(--ui-sortable-lift-shadow);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.item.item-ghost[data-refused] .handle {
|
|
532
|
+
color: var(--ui-sortable-danger, #dc2626);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
.item.item-ghost .handle {
|
|
361
536
|
opacity: 1;
|
|
537
|
+
color: var(--ui-sortable-accent);
|
|
538
|
+
cursor: grabbing;
|
|
362
539
|
}
|
|
363
540
|
|
|
364
|
-
.
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
541
|
+
.item.item-ghost[data-compact="true"] .item-description,
|
|
542
|
+
.item.item-ghost[data-compact="true"] .item-meta {
|
|
543
|
+
display: none;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
.ghost-badge {
|
|
547
|
+
position: absolute;
|
|
548
|
+
inset-block-start: -9px;
|
|
549
|
+
inset-inline-end: -9px;
|
|
550
|
+
min-inline-size: 22px;
|
|
551
|
+
block-size: 22px;
|
|
552
|
+
padding-inline: 6px;
|
|
553
|
+
box-sizing: border-box;
|
|
554
|
+
border-radius: 999px;
|
|
555
|
+
background: var(--ui-sortable-accent);
|
|
556
|
+
color: var(--ui-sortable-accent-contrast, #ffffff);
|
|
557
|
+
font-size: 11px;
|
|
558
|
+
font-weight: 700;
|
|
559
|
+
line-height: 22px;
|
|
560
|
+
text-align: center;
|
|
561
|
+
box-shadow: 0 0 0 2px var(--ui-sortable-card);
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
/* Fallback when the dragged card cannot be copied. */
|
|
565
|
+
.drag-pill {
|
|
566
|
+
position: fixed;
|
|
567
|
+
inset: 0 auto auto 0;
|
|
568
|
+
z-index: 2147483647;
|
|
569
|
+
padding: 8px 12px;
|
|
570
|
+
border-radius: 999px;
|
|
571
|
+
background: var(--ui-sortable-text);
|
|
572
|
+
color: var(--ui-sortable-surface);
|
|
573
|
+
font-size: 12px;
|
|
574
|
+
font-weight: 600;
|
|
575
|
+
line-height: 1;
|
|
576
|
+
pointer-events: none;
|
|
577
|
+
box-shadow: var(--ui-sortable-lift-shadow);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
@keyframes ui-sortable-lift {
|
|
581
|
+
from {
|
|
582
|
+
rotate: 0deg;
|
|
583
|
+
scale: 1;
|
|
584
|
+
}
|
|
373
585
|
}
|
|
374
586
|
|
|
375
587
|
.item[data-disabled="true"] {
|
|
376
|
-
opacity: 0.
|
|
588
|
+
opacity: 0.55;
|
|
377
589
|
}
|
|
378
590
|
|
|
379
591
|
.item-content {
|
|
380
592
|
display: grid;
|
|
381
|
-
gap:
|
|
593
|
+
gap: 2px;
|
|
382
594
|
min-inline-size: 0;
|
|
383
595
|
}
|
|
384
596
|
|
|
@@ -409,9 +621,9 @@ const se = 1, oe = 44, ne = 72, ae = `
|
|
|
409
621
|
}
|
|
410
622
|
|
|
411
623
|
.item-title {
|
|
412
|
-
font-size:
|
|
624
|
+
font-size: 13.5px;
|
|
413
625
|
line-height: 1.4;
|
|
414
|
-
font-weight:
|
|
626
|
+
font-weight: 600;
|
|
415
627
|
color: var(--ui-sortable-text);
|
|
416
628
|
overflow-wrap: anywhere;
|
|
417
629
|
}
|
|
@@ -419,35 +631,41 @@ const se = 1, oe = 44, ne = 72, ae = `
|
|
|
419
631
|
.item-description {
|
|
420
632
|
color: var(--ui-sortable-muted);
|
|
421
633
|
font-size: 12px;
|
|
422
|
-
line-height: 1.
|
|
634
|
+
line-height: 1.5;
|
|
423
635
|
overflow-wrap: anywhere;
|
|
424
636
|
}
|
|
425
637
|
|
|
426
638
|
.item-meta {
|
|
427
639
|
display: flex;
|
|
428
640
|
flex-wrap: wrap;
|
|
429
|
-
gap:
|
|
641
|
+
gap: 4px;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
.item-meta:has(.item-badge:not([hidden]):not(.drop-badge)),
|
|
645
|
+
.item[data-drop-inside-active="true"] .item-meta {
|
|
646
|
+
margin-block-start: 4px;
|
|
430
647
|
}
|
|
431
648
|
|
|
432
649
|
.item-badge {
|
|
433
650
|
display: inline-flex;
|
|
434
651
|
align-items: center;
|
|
435
652
|
gap: 6px;
|
|
436
|
-
padding:
|
|
653
|
+
padding: 1px 7px;
|
|
437
654
|
border-radius: 999px;
|
|
438
|
-
background: color-mix(in srgb, var(--ui-sortable-
|
|
655
|
+
background: color-mix(in srgb, var(--ui-sortable-text) 6%, transparent);
|
|
439
656
|
color: var(--ui-sortable-muted);
|
|
440
|
-
font-size:
|
|
657
|
+
font-size: 10.5px;
|
|
441
658
|
font-weight: 600;
|
|
659
|
+
line-height: 1.6;
|
|
442
660
|
}
|
|
443
661
|
|
|
444
|
-
.item-badge
|
|
445
|
-
|
|
662
|
+
.item-badge.selection-badge {
|
|
663
|
+
background: color-mix(in srgb, var(--ui-sortable-accent) 14%, transparent);
|
|
664
|
+
color: color-mix(in srgb, var(--ui-sortable-accent) 82%, var(--ui-sortable-text));
|
|
446
665
|
}
|
|
447
666
|
|
|
448
|
-
.item[
|
|
449
|
-
|
|
450
|
-
color: color-mix(in srgb, var(--ui-sortable-accent) 78%, var(--ui-sortable-text));
|
|
667
|
+
.item-badge[hidden] {
|
|
668
|
+
display: none;
|
|
451
669
|
}
|
|
452
670
|
|
|
453
671
|
.item-badge.drop-badge {
|
|
@@ -456,263 +674,220 @@ const se = 1, oe = 44, ne = 72, ae = `
|
|
|
456
674
|
|
|
457
675
|
.item[data-drop-inside-active="true"] .item-badge.drop-badge {
|
|
458
676
|
display: inline-flex;
|
|
677
|
+
background: color-mix(in srgb, var(--ui-sortable-accent) 18%, var(--ui-sortable-card));
|
|
678
|
+
color: color-mix(in srgb, var(--ui-sortable-accent) 80%, var(--ui-sortable-text));
|
|
459
679
|
}
|
|
460
680
|
|
|
681
|
+
/* A quiet grip: faint until the card is hovered, focused, selected or dragged. */
|
|
461
682
|
.handle {
|
|
462
683
|
display: inline-grid;
|
|
463
684
|
place-items: center;
|
|
464
|
-
inline-size:
|
|
465
|
-
block-size:
|
|
685
|
+
inline-size: 22px;
|
|
686
|
+
block-size: 28px;
|
|
466
687
|
margin: 0;
|
|
467
688
|
padding: 0;
|
|
468
|
-
border:
|
|
689
|
+
border: 0;
|
|
469
690
|
border-radius: var(--ui-sortable-handle-radius);
|
|
470
|
-
background:
|
|
691
|
+
background: transparent;
|
|
471
692
|
color: var(--ui-sortable-muted);
|
|
693
|
+
opacity: 0.4;
|
|
472
694
|
cursor: grab;
|
|
473
695
|
touch-action: none;
|
|
474
696
|
user-select: none;
|
|
475
697
|
-webkit-user-select: none;
|
|
476
698
|
transition:
|
|
477
|
-
|
|
478
|
-
color
|
|
479
|
-
|
|
480
|
-
|
|
699
|
+
opacity 140ms ease,
|
|
700
|
+
color 140ms ease,
|
|
701
|
+
background 140ms ease;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
.item:hover .handle,
|
|
705
|
+
.item:focus-visible .handle,
|
|
706
|
+
.item[data-selected="true"] .handle {
|
|
707
|
+
opacity: 1;
|
|
481
708
|
}
|
|
482
709
|
|
|
483
710
|
.handle:hover {
|
|
484
|
-
color:
|
|
485
|
-
|
|
486
|
-
background: color-mix(in srgb, var(--ui-sortable-accent) 8%, var(--ui-sortable-surface));
|
|
711
|
+
color: var(--ui-sortable-text);
|
|
712
|
+
background: color-mix(in srgb, var(--ui-sortable-text) 8%, transparent);
|
|
487
713
|
}
|
|
488
714
|
|
|
489
715
|
.handle:active {
|
|
490
716
|
cursor: grabbing;
|
|
491
|
-
transform: scale(0.96);
|
|
492
717
|
}
|
|
493
718
|
|
|
494
719
|
.handle[disabled] {
|
|
495
720
|
cursor: not-allowed;
|
|
496
|
-
opacity: 0.
|
|
721
|
+
opacity: 0.25;
|
|
497
722
|
}
|
|
498
723
|
|
|
499
724
|
.handle svg {
|
|
500
|
-
inline-size:
|
|
501
|
-
block-size:
|
|
725
|
+
inline-size: 14px;
|
|
726
|
+
block-size: 14px;
|
|
727
|
+
fill: currentColor;
|
|
502
728
|
}
|
|
503
729
|
|
|
730
|
+
/* Nested cards hang off a guide line under their parent. */
|
|
504
731
|
.children {
|
|
505
732
|
display: grid;
|
|
506
|
-
gap:
|
|
507
|
-
padding-inline-start: var(--ui-sortable-indent);
|
|
733
|
+
gap: 0;
|
|
508
734
|
min-inline-size: 0;
|
|
735
|
+
margin-inline-start: 11px;
|
|
736
|
+
padding-block-start: calc(var(--ui-sortable-list-gap) / 2);
|
|
737
|
+
padding-inline-start: var(--ui-sortable-indent);
|
|
738
|
+
border-inline-start: 1px solid var(--ui-sortable-border-strong);
|
|
509
739
|
}
|
|
510
740
|
|
|
741
|
+
/* Drop rails take no height: they are the thin lines between cards, with an invisible hit area
|
|
742
|
+
around them. The line shows only on the rail the pointer is over. */
|
|
511
743
|
.dropzone {
|
|
512
744
|
position: relative;
|
|
513
745
|
display: block;
|
|
746
|
+
block-size: var(--ui-sortable-dropzone-size);
|
|
514
747
|
min-block-size: var(--ui-sortable-dropzone-size);
|
|
515
748
|
min-inline-size: 0;
|
|
516
|
-
border-radius: 999px;
|
|
517
|
-
will-change: opacity, background;
|
|
518
|
-
transition: opacity 140ms ease, background 140ms ease;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
.root[data-dropzone-style="container"] .dropzone {
|
|
522
|
-
display: grid;
|
|
523
|
-
place-items: center;
|
|
524
|
-
min-block-size: var(--ui-sortable-dropzone-match-block-size, var(--ui-sortable-dropzone-container-min-block-size));
|
|
525
|
-
inline-size: min(100%, var(--ui-sortable-dropzone-match-inline-size, 100%));
|
|
526
|
-
max-inline-size: var(--ui-sortable-dropzone-container-max-inline-size, none);
|
|
527
|
-
padding: 12px;
|
|
528
|
-
border: 1px dashed color-mix(in srgb, var(--ui-sortable-accent) 40%, var(--ui-sortable-border));
|
|
529
|
-
border-radius: var(--ui-sortable-item-radius);
|
|
530
|
-
background:
|
|
531
|
-
linear-gradient(
|
|
532
|
-
180deg,
|
|
533
|
-
color-mix(in srgb, var(--ui-sortable-accent) 9%, var(--ui-sortable-surface)),
|
|
534
|
-
color-mix(in srgb, var(--ui-sortable-accent) 5%, var(--ui-sortable-surface-muted))
|
|
535
|
-
);
|
|
536
|
-
box-shadow:
|
|
537
|
-
inset 0 0 0 1px color-mix(in srgb, var(--ui-sortable-accent) 12%, transparent),
|
|
538
|
-
0 8px 18px rgba(15, 23, 42, 0.05);
|
|
539
|
-
opacity: 0.82;
|
|
540
|
-
overflow: hidden;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
.list[data-orientation="horizontal"] .dropzone {
|
|
544
|
-
min-block-size: auto;
|
|
545
|
-
min-inline-size: 16px;
|
|
546
|
-
align-self: stretch;
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
.root[data-dropzone-style="container"] .list[data-orientation="horizontal"] .dropzone {
|
|
550
|
-
min-block-size: var(--ui-sortable-dropzone-match-block-size, var(--ui-sortable-dropzone-container-min-block-size));
|
|
551
|
-
min-inline-size: var(--ui-sortable-dropzone-match-inline-size, var(--ui-sortable-dropzone-container-min-inline-size));
|
|
552
|
-
inline-size: auto;
|
|
553
|
-
align-self: stretch;
|
|
554
749
|
}
|
|
555
750
|
|
|
556
751
|
.dropzone::before {
|
|
557
752
|
content: '';
|
|
558
753
|
position: absolute;
|
|
559
|
-
inset-block-start:
|
|
754
|
+
inset-block-start: 0;
|
|
560
755
|
inset-inline: 0;
|
|
561
756
|
block-size: 2px;
|
|
562
|
-
|
|
563
|
-
transform-origin: center;
|
|
757
|
+
margin-block-start: -1px;
|
|
564
758
|
border-radius: 999px;
|
|
565
|
-
background:
|
|
566
|
-
|
|
759
|
+
background: var(--ui-sortable-accent);
|
|
760
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-sortable-accent) 20%, transparent);
|
|
761
|
+
opacity: 0;
|
|
762
|
+
transform: scaleX(0.35);
|
|
763
|
+
transform-origin: center;
|
|
764
|
+
transition: opacity 120ms ease, transform 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
|
|
567
765
|
}
|
|
568
766
|
|
|
569
|
-
.
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
inset-inline
|
|
573
|
-
|
|
574
|
-
block-size: 100%;
|
|
575
|
-
transform: translateX(-50%) scaleY(0.24);
|
|
767
|
+
.dropzone::after {
|
|
768
|
+
content: '';
|
|
769
|
+
position: absolute;
|
|
770
|
+
inset-inline: 0;
|
|
771
|
+
inset-block: calc(var(--ui-sortable-dropzone-hit-size) * -1);
|
|
576
772
|
}
|
|
577
773
|
|
|
578
|
-
|
|
579
|
-
|
|
774
|
+
/* The last rail of a group only reaches up: below the last card the list body is already a drop area, and a
|
|
775
|
+
hit area hanging out of the bottom would count as overflow in a list that scrolls. */
|
|
776
|
+
.dropzone:last-child::after {
|
|
777
|
+
inset-block-end: 0;
|
|
580
778
|
}
|
|
581
779
|
|
|
582
|
-
.
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
linear-gradient(
|
|
586
|
-
180deg,
|
|
587
|
-
color-mix(in srgb, var(--ui-sortable-accent) 14%, var(--ui-sortable-surface)),
|
|
588
|
-
color-mix(in srgb, var(--ui-sortable-accent) 10%, var(--ui-sortable-surface-muted))
|
|
589
|
-
);
|
|
590
|
-
box-shadow:
|
|
591
|
-
inset 0 0 0 1px color-mix(in srgb, var(--ui-sortable-accent) 16%, transparent),
|
|
592
|
-
0 12px 24px rgba(15, 23, 42, 0.08);
|
|
780
|
+
.dropzone[data-active="true"]::before {
|
|
781
|
+
opacity: 1;
|
|
782
|
+
transform: scaleX(1);
|
|
593
783
|
}
|
|
594
784
|
|
|
595
|
-
.
|
|
785
|
+
.root[data-drop-indicator-visibility="always"] .dropzone::before {
|
|
596
786
|
opacity: 1;
|
|
787
|
+
transform: scaleX(1);
|
|
788
|
+
background: color-mix(in srgb, var(--ui-sortable-accent) 22%, transparent);
|
|
789
|
+
box-shadow: none;
|
|
597
790
|
}
|
|
598
791
|
|
|
599
|
-
.dropzone[data-active="true"]::before {
|
|
600
|
-
|
|
601
|
-
|
|
792
|
+
.root[data-drop-indicator-visibility="always"] .dropzone[data-active="true"]::before {
|
|
793
|
+
background: var(--ui-sortable-accent);
|
|
794
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-sortable-accent) 20%, transparent);
|
|
602
795
|
}
|
|
603
796
|
|
|
604
|
-
|
|
605
|
-
|
|
797
|
+
/* A card shows "drop inside" by highlighting itself, so its inside rail draws nothing. */
|
|
798
|
+
.root[data-dropzone-style="indicator"] .dropzone[data-mode="inside"]::before,
|
|
799
|
+
.root[data-dropzone-style="indicator"] .dropzone[data-mode="inside"]::after {
|
|
800
|
+
display: none;
|
|
606
801
|
}
|
|
607
802
|
|
|
608
|
-
.
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
803
|
+
.list[data-orientation="horizontal"] .dropzone {
|
|
804
|
+
align-self: stretch;
|
|
805
|
+
block-size: auto;
|
|
806
|
+
min-block-size: 0;
|
|
807
|
+
inline-size: var(--ui-sortable-dropzone-size);
|
|
808
|
+
min-inline-size: var(--ui-sortable-dropzone-size);
|
|
612
809
|
}
|
|
613
810
|
|
|
614
|
-
.
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
811
|
+
.list[data-orientation="horizontal"] .dropzone::before {
|
|
812
|
+
inset-block: 0;
|
|
813
|
+
inset-inline: auto;
|
|
814
|
+
inset-inline-start: 0;
|
|
815
|
+
inline-size: 2px;
|
|
816
|
+
block-size: auto;
|
|
619
817
|
margin-block-start: 0;
|
|
620
|
-
|
|
818
|
+
margin-inline-start: -1px;
|
|
819
|
+
transform: scaleY(0.35);
|
|
621
820
|
}
|
|
622
821
|
|
|
623
|
-
.
|
|
624
|
-
inset-
|
|
625
|
-
inset-inline
|
|
626
|
-
inline-size: 42px;
|
|
822
|
+
.list[data-orientation="horizontal"] .dropzone::after {
|
|
823
|
+
inset-block: 0;
|
|
824
|
+
inset-inline: calc(var(--ui-sortable-dropzone-hit-size) * -1);
|
|
627
825
|
}
|
|
628
826
|
|
|
629
|
-
.dropzone-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
inset-inline-start: 50%;
|
|
633
|
-
inset-inline-end: auto;
|
|
634
|
-
transform: translate(-50%, -50%) scale(0.98);
|
|
635
|
-
padding: 2px 8px;
|
|
636
|
-
border-radius: 999px;
|
|
637
|
-
background: color-mix(in srgb, var(--ui-sortable-surface) 84%, transparent);
|
|
638
|
-
color: var(--ui-sortable-muted);
|
|
639
|
-
font-size: 11px;
|
|
640
|
-
opacity: 0;
|
|
641
|
-
transition: opacity 120ms ease, transform 120ms ease;
|
|
642
|
-
pointer-events: none;
|
|
827
|
+
.list[data-orientation="horizontal"] .dropzone[data-active="true"]::before,
|
|
828
|
+
.root[data-drop-indicator-visibility="always"] .list[data-orientation="horizontal"] .dropzone::before {
|
|
829
|
+
transform: scaleY(1);
|
|
643
830
|
}
|
|
644
831
|
|
|
645
|
-
.
|
|
832
|
+
.dropzone-label {
|
|
646
833
|
display: none;
|
|
647
834
|
}
|
|
648
835
|
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
836
|
+
/* dropzone-style="container": the target is drawn as a whole dashed card in place. */
|
|
837
|
+
.root[data-dropzone-style="container"] .dropzone {
|
|
838
|
+
display: grid;
|
|
839
|
+
place-items: center;
|
|
840
|
+
block-size: auto;
|
|
841
|
+
min-block-size: var(--ui-sortable-dropzone-match-block-size, var(--ui-sortable-dropzone-container-min-block-size));
|
|
842
|
+
inline-size: min(100%, var(--ui-sortable-dropzone-match-inline-size, 100%));
|
|
843
|
+
max-inline-size: var(--ui-sortable-dropzone-container-max-inline-size, none);
|
|
844
|
+
padding: 10px;
|
|
845
|
+
border: 1px dashed color-mix(in srgb, var(--ui-sortable-accent) 45%, var(--ui-sortable-border));
|
|
846
|
+
border-radius: var(--ui-sortable-item-radius);
|
|
847
|
+
background: color-mix(in srgb, var(--ui-sortable-accent) 5%, var(--ui-sortable-card));
|
|
848
|
+
opacity: 0.85;
|
|
849
|
+
overflow: hidden;
|
|
662
850
|
}
|
|
663
851
|
|
|
664
|
-
.dropzone[data-
|
|
665
|
-
|
|
666
|
-
|
|
852
|
+
.root[data-dropzone-style="container"] .list[data-orientation="horizontal"] .dropzone {
|
|
853
|
+
min-block-size: var(--ui-sortable-dropzone-match-block-size, var(--ui-sortable-dropzone-container-min-block-size));
|
|
854
|
+
min-inline-size: var(--ui-sortable-dropzone-match-inline-size, var(--ui-sortable-dropzone-container-min-inline-size));
|
|
855
|
+
inline-size: auto;
|
|
667
856
|
}
|
|
668
857
|
|
|
669
|
-
.root[data-
|
|
670
|
-
|
|
858
|
+
.root[data-dropzone-style="container"] .dropzone::before,
|
|
859
|
+
.root[data-dropzone-style="container"] .dropzone::after {
|
|
860
|
+
display: none;
|
|
671
861
|
}
|
|
672
862
|
|
|
673
|
-
.root[data-dropzone-style="container"][data-
|
|
863
|
+
.root[data-dropzone-style="container"] .dropzone[data-active="true"] {
|
|
674
864
|
opacity: 1;
|
|
865
|
+
border-color: var(--ui-sortable-accent);
|
|
866
|
+
background: color-mix(in srgb, var(--ui-sortable-accent) 10%, var(--ui-sortable-card));
|
|
675
867
|
}
|
|
676
868
|
|
|
677
|
-
.root[data-
|
|
678
|
-
|
|
869
|
+
.root[data-dropzone-style="container"] .dropzone[data-mode="inside"] {
|
|
870
|
+
min-block-size: max(
|
|
871
|
+
calc(var(--ui-sortable-dropzone-match-block-size, var(--ui-sortable-dropzone-container-min-block-size)) * 0.78),
|
|
872
|
+
var(--ui-sortable-dropzone-container-min-block-size)
|
|
873
|
+
);
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
.root[data-dropzone-style="container"] .dropzone-label {
|
|
877
|
+
display: block;
|
|
878
|
+
color: color-mix(in srgb, var(--ui-sortable-accent) 80%, var(--ui-sortable-text));
|
|
879
|
+
font-size: 12px;
|
|
880
|
+
font-weight: 650;
|
|
881
|
+
letter-spacing: 0.02em;
|
|
882
|
+
white-space: nowrap;
|
|
679
883
|
}
|
|
680
884
|
|
|
681
885
|
.root[data-dropzone-style="container"][data-drop-indicator-visibility="active"] .dropzone {
|
|
682
886
|
display: none;
|
|
683
|
-
opacity: 0;
|
|
684
887
|
}
|
|
685
888
|
|
|
686
889
|
.root[data-dropzone-style="container"][data-drop-indicator-visibility="active"] .dropzone[data-active="true"] {
|
|
687
890
|
display: grid;
|
|
688
|
-
opacity: 1;
|
|
689
|
-
}
|
|
690
|
-
|
|
691
|
-
.root[data-drop-indicator-visibility="active"] .dropzone::before {
|
|
692
|
-
background: transparent;
|
|
693
|
-
transform: translateY(-50%) scaleX(0.16);
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
.root[data-drop-indicator-visibility="active"] .list[data-orientation="horizontal"] .dropzone::before {
|
|
697
|
-
transform: translateX(-50%) scaleY(0.16);
|
|
698
|
-
}
|
|
699
|
-
|
|
700
|
-
.root[data-drop-indicator-visibility="active"] .dropzone[data-active="true"] {
|
|
701
|
-
opacity: 1;
|
|
702
|
-
}
|
|
703
|
-
|
|
704
|
-
.root[data-drop-indicator-visibility="active"] .dropzone[data-active="true"]::before {
|
|
705
|
-
transform: translateY(-50%) scaleX(1);
|
|
706
|
-
background: color-mix(in srgb, var(--ui-sortable-accent) 86%, var(--ui-sortable-text));
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
.root[data-drop-indicator-visibility="active"] .list[data-orientation="horizontal"] .dropzone[data-active="true"]::before {
|
|
710
|
-
transform: translateX(-50%) scaleY(1);
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
.root[data-drop-indicator-visibility="active"] .dropzone[data-active="true"] .dropzone-label {
|
|
714
|
-
opacity: 1;
|
|
715
|
-
transform: translate(-50%, -50%) scale(1);
|
|
716
891
|
}
|
|
717
892
|
|
|
718
893
|
.sr-only {
|
|
@@ -727,14 +902,26 @@ const se = 1, oe = 44, ne = 72, ae = `
|
|
|
727
902
|
border: 0;
|
|
728
903
|
}
|
|
729
904
|
|
|
905
|
+
/* Touch screens have no hover: keep the grip clearly visible. */
|
|
906
|
+
@media (hover: none) {
|
|
907
|
+
.handle {
|
|
908
|
+
opacity: 1;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
|
|
730
912
|
@media (prefers-reduced-motion: reduce) {
|
|
731
913
|
.item,
|
|
732
914
|
.handle,
|
|
733
|
-
.
|
|
734
|
-
.dropzone::before
|
|
735
|
-
.dropzone-label {
|
|
915
|
+
.empty,
|
|
916
|
+
.dropzone::before {
|
|
736
917
|
transition: none;
|
|
737
918
|
}
|
|
919
|
+
|
|
920
|
+
.item.item-ghost {
|
|
921
|
+
animation: none;
|
|
922
|
+
rotate: 0deg;
|
|
923
|
+
scale: 1;
|
|
924
|
+
}
|
|
738
925
|
}
|
|
739
926
|
|
|
740
927
|
@media (forced-colors: active) {
|
|
@@ -747,257 +934,294 @@ const se = 1, oe = 44, ne = 72, ae = `
|
|
|
747
934
|
border-color: CanvasText;
|
|
748
935
|
}
|
|
749
936
|
|
|
937
|
+
.item[data-selected="true"],
|
|
938
|
+
.item:focus-visible {
|
|
939
|
+
outline: 2px solid Highlight;
|
|
940
|
+
}
|
|
941
|
+
|
|
750
942
|
.dropzone::before {
|
|
751
943
|
background: Highlight;
|
|
944
|
+
box-shadow: none;
|
|
752
945
|
}
|
|
753
946
|
}
|
|
754
947
|
`;
|
|
755
|
-
function
|
|
756
|
-
if (!
|
|
948
|
+
function V(u) {
|
|
949
|
+
if (!u) return [];
|
|
757
950
|
try {
|
|
758
|
-
const
|
|
759
|
-
return Array.isArray(
|
|
951
|
+
const t = JSON.parse(u);
|
|
952
|
+
return Array.isArray(t) ? t : [];
|
|
760
953
|
} catch {
|
|
761
954
|
return [];
|
|
762
955
|
}
|
|
763
956
|
}
|
|
764
|
-
function
|
|
765
|
-
|
|
957
|
+
function tt(u) {
|
|
958
|
+
if (u === void 0) return "";
|
|
959
|
+
let t;
|
|
960
|
+
try {
|
|
961
|
+
t = JSON.stringify(u) ?? "";
|
|
962
|
+
} catch {
|
|
963
|
+
return "";
|
|
964
|
+
}
|
|
965
|
+
let e = 5381;
|
|
966
|
+
for (let i = 0; i < t.length; i += 1) e = (e << 5) + e + t.charCodeAt(i) | 0;
|
|
967
|
+
return (e >>> 0).toString(36);
|
|
766
968
|
}
|
|
767
|
-
function
|
|
768
|
-
return
|
|
969
|
+
function mt(u) {
|
|
970
|
+
if (!u) return {};
|
|
971
|
+
try {
|
|
972
|
+
const t = JSON.parse(u);
|
|
973
|
+
if (!t || typeof t != "object" || Array.isArray(t)) return {};
|
|
974
|
+
const e = {};
|
|
975
|
+
return Object.keys(Y).forEach((i) => {
|
|
976
|
+
typeof t[i] == "string" && (e[i] = t[i]);
|
|
977
|
+
}), e;
|
|
978
|
+
} catch {
|
|
979
|
+
return {};
|
|
980
|
+
}
|
|
769
981
|
}
|
|
770
|
-
function
|
|
771
|
-
|
|
982
|
+
function ot(u) {
|
|
983
|
+
if (typeof u == "number") return Number.isFinite(u) && u > 0 ? `${u}px` : void 0;
|
|
984
|
+
if (typeof u != "string") return;
|
|
985
|
+
const t = u.trim();
|
|
986
|
+
return /^(?:\d+\.?\d*|\.\d+)(?:px|rem|em|ch|vh|svh|dvh|vw|%)$/.test(t) ? t : void 0;
|
|
772
987
|
}
|
|
773
|
-
function
|
|
774
|
-
return
|
|
988
|
+
function v(u) {
|
|
989
|
+
return u.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
775
990
|
}
|
|
776
|
-
function
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
}
|
|
991
|
+
function w(u, t) {
|
|
992
|
+
return `${u}::${t ?? "__root__"}`;
|
|
993
|
+
}
|
|
994
|
+
function et(u) {
|
|
995
|
+
return u ? [u.listId, u.parentId ?? "", u.beforeId ?? "", u.mode].join("::") : "";
|
|
996
|
+
}
|
|
997
|
+
function H(u, t) {
|
|
998
|
+
return et(u) === et(t);
|
|
999
|
+
}
|
|
1000
|
+
function ft(u) {
|
|
1001
|
+
return u === "item" ? "item" : "handle";
|
|
1002
|
+
}
|
|
1003
|
+
function A(u) {
|
|
1004
|
+
return { ...u };
|
|
1005
|
+
}
|
|
1006
|
+
function B(u) {
|
|
1007
|
+
if (u == null || typeof u != "object") return u;
|
|
1008
|
+
try {
|
|
1009
|
+
return JSON.parse(JSON.stringify(u));
|
|
1010
|
+
} catch {
|
|
1011
|
+
return u;
|
|
798
1012
|
}
|
|
799
|
-
return { x: 1, y: 1 };
|
|
800
1013
|
}
|
|
801
|
-
function
|
|
802
|
-
|
|
1014
|
+
function q(u) {
|
|
1015
|
+
const t = { ...u };
|
|
1016
|
+
return u.data !== void 0 && (t.data = B(u.data)), t;
|
|
803
1017
|
}
|
|
804
|
-
function
|
|
805
|
-
|
|
1018
|
+
function G(u) {
|
|
1019
|
+
const t = { ...u };
|
|
1020
|
+
return u.data !== void 0 && (t.data = B(u.data)), t;
|
|
806
1021
|
}
|
|
807
|
-
function
|
|
808
|
-
const n = T(
|
|
809
|
-
const
|
|
810
|
-
!
|
|
1022
|
+
function j(u, t, e, i, r, s) {
|
|
1023
|
+
const n = T(u), a = M(u), d = /* @__PURE__ */ new Set(), o = [], c = (m) => {
|
|
1024
|
+
const S = n.get(m);
|
|
1025
|
+
!S || d.has(m) || (d.add(m), o.push(m), (a.get(w(S.listId, m)) || []).forEach(c));
|
|
811
1026
|
};
|
|
812
|
-
|
|
813
|
-
const
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
}), b.forEach((
|
|
817
|
-
const
|
|
818
|
-
|
|
1027
|
+
i.forEach(c);
|
|
1028
|
+
const l = u.map(A), p = l.filter((m) => d.has(m.id)), g = r ? l.map(A) : l.filter((m) => !d.has(m.id)), b = r ? p.map((m) => s(m, o)) : p.map(A), y = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
|
|
1029
|
+
r && p.forEach((m, S) => {
|
|
1030
|
+
y.set(m.id, b[S].id), h.set(b[S].id, m.id);
|
|
1031
|
+
}), b.forEach((m) => {
|
|
1032
|
+
const S = r ? h.get(m.id) : m.id, L = S ? n.get(S) : null;
|
|
1033
|
+
L && (r && (m.parentId = L.parentId && y.has(L.parentId) && y.get(L.parentId) || null), m.listId = e.listId);
|
|
819
1034
|
});
|
|
820
|
-
const
|
|
821
|
-
|
|
822
|
-
const [,
|
|
823
|
-
(
|
|
1035
|
+
const f = i.map((m) => y.get(m) || m), x = [...g, ...b], D = M(g), C = w(e.listId, e.parentId), z = [...D.get(C) || []], E = e.beforeId ? z.indexOf(e.beforeId) : z.length, F = E >= 0 ? E : z.length;
|
|
1036
|
+
z.splice(F, 0, ...f), D.set(C, z), M(b).forEach((m, S) => {
|
|
1037
|
+
const [, L] = S.split("::");
|
|
1038
|
+
(L || "") !== "__root__" && D.set(S, [...m]);
|
|
824
1039
|
});
|
|
825
|
-
const
|
|
826
|
-
|
|
827
|
-
const
|
|
828
|
-
|
|
1040
|
+
const I = T(x);
|
|
1041
|
+
f.forEach((m) => {
|
|
1042
|
+
const S = I.get(m);
|
|
1043
|
+
S && (S.parentId = e.parentId, S.listId = e.listId);
|
|
829
1044
|
});
|
|
830
|
-
const
|
|
831
|
-
(
|
|
832
|
-
const
|
|
833
|
-
!
|
|
1045
|
+
const P = [], k = /* @__PURE__ */ new Set(), R = (m, S) => {
|
|
1046
|
+
(D.get(w(m, S)) || []).forEach((N, lt) => {
|
|
1047
|
+
const O = I.get(N);
|
|
1048
|
+
!O || k.has(N) || (k.add(N), O.listId = m, O.parentId = S, O.order = lt, P.push(O), R(m, N));
|
|
834
1049
|
});
|
|
835
1050
|
};
|
|
836
|
-
return
|
|
837
|
-
|
|
1051
|
+
return t.forEach((m) => R(m.id, null)), x.forEach((m) => {
|
|
1052
|
+
k.has(m.id) || (m.parentId = null, P.push(m));
|
|
838
1053
|
}), {
|
|
839
|
-
items:
|
|
840
|
-
insertedRootIds:
|
|
1054
|
+
items: P.map(A),
|
|
1055
|
+
insertedRootIds: f
|
|
841
1056
|
};
|
|
842
1057
|
}
|
|
843
|
-
function
|
|
844
|
-
const
|
|
845
|
-
return
|
|
846
|
-
const
|
|
847
|
-
|
|
848
|
-
}),
|
|
1058
|
+
function M(u) {
|
|
1059
|
+
const t = /* @__PURE__ */ new Map();
|
|
1060
|
+
return u.forEach((e) => {
|
|
1061
|
+
const i = w(e.listId, e.parentId), r = t.get(i);
|
|
1062
|
+
r ? r.push(e.id) : t.set(i, [e.id]);
|
|
1063
|
+
}), t;
|
|
849
1064
|
}
|
|
850
|
-
function T(
|
|
851
|
-
return new Map(
|
|
1065
|
+
function T(u) {
|
|
1066
|
+
return new Map(u.map((t) => [t.id, t]));
|
|
852
1067
|
}
|
|
853
|
-
function
|
|
854
|
-
const
|
|
855
|
-
return
|
|
856
|
-
const s = typeof
|
|
857
|
-
|
|
1068
|
+
function it(u) {
|
|
1069
|
+
const t = /* @__PURE__ */ new Set(), e = [];
|
|
1070
|
+
return u.forEach((i, r) => {
|
|
1071
|
+
const s = typeof i?.id == "string" && i.id.trim() ? i.id.trim() : `list-${r + 1}`;
|
|
1072
|
+
t.has(s) || (t.add(s), e.push({
|
|
858
1073
|
id: s,
|
|
859
|
-
label: typeof
|
|
860
|
-
description: typeof
|
|
861
|
-
emptyLabel: typeof
|
|
862
|
-
orientation:
|
|
863
|
-
disabled: !!
|
|
864
|
-
cloneOnDrag: !!
|
|
865
|
-
accepts: Array.isArray(
|
|
1074
|
+
label: typeof i?.label == "string" && i.label.trim() ? i.label.trim() : `List ${r + 1}`,
|
|
1075
|
+
description: typeof i?.description == "string" ? i.description : "",
|
|
1076
|
+
emptyLabel: typeof i?.emptyLabel == "string" && i.emptyLabel.trim() ? i.emptyLabel.trim() : "",
|
|
1077
|
+
orientation: i?.orientation === "horizontal" ? "horizontal" : "vertical",
|
|
1078
|
+
disabled: !!i?.disabled,
|
|
1079
|
+
cloneOnDrag: !!i?.cloneOnDrag,
|
|
1080
|
+
accepts: Array.isArray(i?.accepts) ? i.accepts.filter((n) => typeof n == "string" && n.trim().length > 0) : void 0,
|
|
1081
|
+
maxItems: Number.isFinite(i?.maxItems) && Number(i.maxItems) >= 0 ? Math.floor(Number(i.maxItems)) : void 0,
|
|
1082
|
+
maxHeight: ot(i?.maxHeight),
|
|
1083
|
+
...i?.data !== void 0 ? { data: i.data } : {}
|
|
866
1084
|
}));
|
|
867
|
-
}),
|
|
1085
|
+
}), e.length ? e : [{
|
|
868
1086
|
id: "default",
|
|
869
1087
|
label: "Items",
|
|
870
1088
|
description: "",
|
|
871
|
-
emptyLabel: "
|
|
1089
|
+
emptyLabel: "",
|
|
872
1090
|
orientation: "vertical",
|
|
873
1091
|
disabled: !1,
|
|
874
1092
|
cloneOnDrag: !1
|
|
875
1093
|
}];
|
|
876
1094
|
}
|
|
877
|
-
function U(
|
|
878
|
-
const
|
|
879
|
-
|
|
880
|
-
const
|
|
881
|
-
if (!
|
|
882
|
-
const
|
|
883
|
-
|
|
884
|
-
id:
|
|
885
|
-
label:
|
|
886
|
-
listId:
|
|
1095
|
+
function U(u, t) {
|
|
1096
|
+
const e = new Set(u.map((o) => o.id)), i = [];
|
|
1097
|
+
t.forEach((o, c) => {
|
|
1098
|
+
const l = typeof o?.id == "string" && o.id.trim() ? o.id.trim() : "", p = typeof o?.label == "string" && o.label.trim() ? o.label.trim() : "";
|
|
1099
|
+
if (!l || !p) return;
|
|
1100
|
+
const g = typeof o?.listId == "string" && e.has(o.listId) ? o.listId : u[0].id;
|
|
1101
|
+
i.push({
|
|
1102
|
+
id: l,
|
|
1103
|
+
label: p,
|
|
1104
|
+
listId: g,
|
|
887
1105
|
parentId: typeof o?.parentId == "string" && o.parentId.trim() ? o.parentId.trim() : null,
|
|
888
1106
|
description: typeof o?.description == "string" ? o.description : "",
|
|
889
|
-
order: Number.isFinite(o?.order) ? Number(o.order) :
|
|
1107
|
+
order: Number.isFinite(o?.order) ? Number(o.order) : c,
|
|
890
1108
|
disabled: !!o?.disabled,
|
|
891
1109
|
dragDisabled: !!o?.dragDisabled,
|
|
892
1110
|
cloneOnDrag: !!o?.cloneOnDrag,
|
|
893
|
-
hidden: !!o?.hidden
|
|
1111
|
+
hidden: !!o?.hidden,
|
|
1112
|
+
...o?.data !== void 0 ? { data: o.data } : {}
|
|
894
1113
|
});
|
|
895
1114
|
});
|
|
896
|
-
const
|
|
897
|
-
|
|
1115
|
+
const r = new Map(i.map((o) => [o.id, o]));
|
|
1116
|
+
i.forEach((o) => {
|
|
898
1117
|
if (!o.parentId) return;
|
|
899
|
-
const
|
|
900
|
-
(!
|
|
1118
|
+
const c = r.get(o.parentId);
|
|
1119
|
+
(!c || c.id === o.id || c.listId !== o.listId) && (o.parentId = null);
|
|
901
1120
|
});
|
|
902
1121
|
const s = /* @__PURE__ */ new Map();
|
|
903
|
-
|
|
904
|
-
const
|
|
905
|
-
|
|
906
|
-
}), s.forEach((o) => o.sort((
|
|
907
|
-
const n = [], a = /* @__PURE__ */ new Set(), d = (o,
|
|
908
|
-
(s.get(
|
|
909
|
-
a.has(
|
|
1122
|
+
i.forEach((o) => {
|
|
1123
|
+
const c = w(o.listId, o.parentId), l = s.get(c);
|
|
1124
|
+
l ? l.push(o) : s.set(c, [o]);
|
|
1125
|
+
}), s.forEach((o) => o.sort((c, l) => c.order - l.order || c.label.localeCompare(l.label)));
|
|
1126
|
+
const n = [], a = /* @__PURE__ */ new Set(), d = (o, c) => {
|
|
1127
|
+
(s.get(w(o, c)) || []).forEach((p, g) => {
|
|
1128
|
+
a.has(p.id) || (a.add(p.id), p.order = g, n.push(p), d(o, p.id));
|
|
910
1129
|
});
|
|
911
1130
|
};
|
|
912
|
-
return
|
|
1131
|
+
return u.forEach((o) => d(o.id, null)), i.forEach((o) => {
|
|
913
1132
|
a.has(o.id) || (o.parentId = null, n.push(o));
|
|
914
|
-
}), n.map(
|
|
1133
|
+
}), n.map(A);
|
|
915
1134
|
}
|
|
916
|
-
function
|
|
917
|
-
return JSON.stringify(
|
|
918
|
-
id:
|
|
919
|
-
label:
|
|
920
|
-
listId:
|
|
921
|
-
parentId:
|
|
922
|
-
description:
|
|
923
|
-
order:
|
|
924
|
-
disabled:
|
|
925
|
-
dragDisabled:
|
|
926
|
-
cloneOnDrag:
|
|
927
|
-
hidden:
|
|
1135
|
+
function bt(u) {
|
|
1136
|
+
return JSON.stringify(u.map((t) => ({
|
|
1137
|
+
id: t.id,
|
|
1138
|
+
label: t.label,
|
|
1139
|
+
listId: t.listId,
|
|
1140
|
+
parentId: t.parentId,
|
|
1141
|
+
description: t.description,
|
|
1142
|
+
order: t.order,
|
|
1143
|
+
disabled: t.disabled,
|
|
1144
|
+
dragDisabled: t.dragDisabled,
|
|
1145
|
+
cloneOnDrag: t.cloneOnDrag,
|
|
1146
|
+
hidden: t.hidden,
|
|
1147
|
+
data: t.data
|
|
928
1148
|
})));
|
|
929
1149
|
}
|
|
930
|
-
function
|
|
931
|
-
return JSON.stringify(
|
|
932
|
-
id:
|
|
933
|
-
label:
|
|
934
|
-
description:
|
|
935
|
-
emptyLabel:
|
|
936
|
-
orientation:
|
|
937
|
-
disabled:
|
|
938
|
-
cloneOnDrag:
|
|
939
|
-
accepts:
|
|
1150
|
+
function _t(u) {
|
|
1151
|
+
return JSON.stringify(u.map((t) => ({
|
|
1152
|
+
id: t.id,
|
|
1153
|
+
label: t.label,
|
|
1154
|
+
description: t.description,
|
|
1155
|
+
emptyLabel: t.emptyLabel,
|
|
1156
|
+
orientation: t.orientation,
|
|
1157
|
+
disabled: t.disabled,
|
|
1158
|
+
cloneOnDrag: t.cloneOnDrag,
|
|
1159
|
+
accepts: t.accepts,
|
|
1160
|
+
maxItems: t.maxItems,
|
|
1161
|
+
maxHeight: t.maxHeight,
|
|
1162
|
+
data: t.data
|
|
940
1163
|
})));
|
|
941
1164
|
}
|
|
942
|
-
function
|
|
943
|
-
return JSON.stringify(
|
|
1165
|
+
function rt(u) {
|
|
1166
|
+
return JSON.stringify(u);
|
|
944
1167
|
}
|
|
945
|
-
function J(
|
|
946
|
-
const
|
|
947
|
-
const
|
|
948
|
-
return
|
|
949
|
-
id:
|
|
950
|
-
listId:
|
|
951
|
-
parentId:
|
|
1168
|
+
function J(u) {
|
|
1169
|
+
const t = /* @__PURE__ */ new Map(), e = u.map((i) => {
|
|
1170
|
+
const r = w(i.listId, i.parentId), s = t.get(r) ?? 0;
|
|
1171
|
+
return t.set(r, s + 1), {
|
|
1172
|
+
id: i.id,
|
|
1173
|
+
listId: i.listId,
|
|
1174
|
+
parentId: i.parentId,
|
|
952
1175
|
index: s
|
|
953
1176
|
};
|
|
954
1177
|
});
|
|
955
1178
|
return {
|
|
956
|
-
version:
|
|
957
|
-
records:
|
|
1179
|
+
version: ht,
|
|
1180
|
+
records: e
|
|
958
1181
|
};
|
|
959
1182
|
}
|
|
960
|
-
function
|
|
961
|
-
return
|
|
1183
|
+
function st(u) {
|
|
1184
|
+
return /class="item[\s"]/.test(u);
|
|
962
1185
|
}
|
|
963
|
-
function
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
1186
|
+
function at(u, t) {
|
|
1187
|
+
return t ? `${u.label} ${u.description}`.toLowerCase().includes(t.toLowerCase()) : !0;
|
|
1188
|
+
}
|
|
1189
|
+
function nt(u, t, e, i, r) {
|
|
1190
|
+
const s = T(u), n = M(u), a = /* @__PURE__ */ new Map(), d = (l, p) => {
|
|
1191
|
+
const g = [...n.get(w(l, p)) || []];
|
|
1192
|
+
return r === "label" && g.sort((b, y) => {
|
|
1193
|
+
const h = s.get(b), f = s.get(y);
|
|
1194
|
+
return !h || !f ? 0 : h.label.localeCompare(f.label);
|
|
1195
|
+
}), g;
|
|
1196
|
+
}, o = (l, p, g) => {
|
|
971
1197
|
const b = [];
|
|
972
|
-
return d(
|
|
973
|
-
const
|
|
974
|
-
if (!
|
|
975
|
-
const
|
|
976
|
-
!
|
|
977
|
-
id:
|
|
978
|
-
disabled:
|
|
979
|
-
}),
|
|
1198
|
+
return d(l, p).forEach((y) => {
|
|
1199
|
+
const h = s.get(y);
|
|
1200
|
+
if (!h || h.hidden) return;
|
|
1201
|
+
const f = o(l, h.id);
|
|
1202
|
+
!at(h, i) && f.length === 0 || (b.push({
|
|
1203
|
+
id: h.id,
|
|
1204
|
+
disabled: h.disabled
|
|
1205
|
+
}), f.length && b.push(...f));
|
|
980
1206
|
}), b;
|
|
981
1207
|
};
|
|
982
|
-
return Array.from(new Set(
|
|
983
|
-
a.set(
|
|
1208
|
+
return Array.from(new Set(u.map((l) => l.listId))).forEach((l) => {
|
|
1209
|
+
a.set(l, o(l, null));
|
|
984
1210
|
}), a;
|
|
985
1211
|
}
|
|
986
|
-
class
|
|
1212
|
+
const $ = class $ extends dt {
|
|
987
1213
|
constructor() {
|
|
988
|
-
super(), this._lists =
|
|
1214
|
+
super(), this._lists = it([]), this._items = [], this._selection = [], this._focusedId = null, this._rangeAnchorId = null, this._dragState = null, this._liveMessage = "Sortable list ready.", this._lastListsAttr = null, this._lastItemsAttr = null, this._lastSelectionAttr = null, this._lastLabelsAttr = null, this._canDropCallback = null, this._renderItemFn = null, this._renderListHeaderFn = null, this._renderEmptyStateFn = null, this._labels = {}, this._hydratedPersistKey = null, this._cloneSeed = 1, this._dragImage = null, this._dragImageOffset = { x: -14, y: -14 }, this._pendingFocusId = null, this._pointerGesture = null, this._pendingDropTarget = null, this._pendingTimer = null, this._focusWasInside = !1, this._revealPending = !1, this._externalTarget = null, this._nestModifier = !1, this._lastPointer = null, this._suppressAttributeRender = !1, this._autoScrollFrame = 0, this._autoScrollPoint = null, this._autoScrollTick = () => {
|
|
989
1215
|
this._autoScrollFrame = 0;
|
|
990
|
-
const
|
|
991
|
-
if (!
|
|
992
|
-
const
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
}
|
|
1000
|
-
}, this._onClick = this._onClick.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onDragStart = this._onDragStart.bind(this), this._onDragOver = this._onDragOver.bind(this), this._onDrop = this._onDrop.bind(this), this._onDragEnd = this._onDragEnd.bind(this), this._onPointerDown = this._onPointerDown.bind(this), this._onPointerMove = this._onPointerMove.bind(this), this._onPointerUp = this._onPointerUp.bind(this), this._onPointerCancel = this._onPointerCancel.bind(this), this._onFocusIn = this._onFocusIn.bind(this), this._onDocumentKeyDown = this._onDocumentKeyDown.bind(this);
|
|
1216
|
+
const t = this._autoScrollPoint;
|
|
1217
|
+
if (!t || !this._dragState || this._dragState.keyboard) return;
|
|
1218
|
+
const e = this.ownerDocument?.defaultView;
|
|
1219
|
+
let i = this._scrollOwn(t.x, t.y);
|
|
1220
|
+
const r = this._peerUnder(t.x, t.y);
|
|
1221
|
+
r && r._scrollOwn(t.x, t.y) && (i = !0);
|
|
1222
|
+
const s = ut(this), n = s ? s.getBoundingClientRect() : null, a = Math.max(0, n ? n.top : 0), d = Math.min(e?.innerHeight ?? 0, n ? n.bottom : 1 / 0), o = K(t.y, a, d);
|
|
1223
|
+
o && (s ? s.scrollTop += o : e?.scrollBy(0, o), i = !0), i && (this._retarget(t.x, t.y, { timestamp: performance.now() }), this._autoScrollFrame = requestAnimationFrame(this._autoScrollTick));
|
|
1224
|
+
}, this._onClick = this._onClick.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onDragStart = this._onDragStart.bind(this), this._onPointerDown = this._onPointerDown.bind(this), this._onPointerMove = this._onPointerMove.bind(this), this._onPointerUp = this._onPointerUp.bind(this), this._onPointerCancel = this._onPointerCancel.bind(this), this._onFocusIn = this._onFocusIn.bind(this), this._onTouchMove = this._onTouchMove.bind(this), this._onContextMenu = this._onContextMenu.bind(this), this._onDocumentKeyDown = this._onDocumentKeyDown.bind(this), this._onDocumentKeyUp = this._onDocumentKeyUp.bind(this);
|
|
1001
1225
|
}
|
|
1002
1226
|
static get observedAttributes() {
|
|
1003
1227
|
return [
|
|
@@ -1016,63 +1240,128 @@ class he extends ee {
|
|
|
1016
1240
|
"drag-handle-selector",
|
|
1017
1241
|
"custom-item-rendering",
|
|
1018
1242
|
"show-selection-badge",
|
|
1243
|
+
"nest-trigger",
|
|
1244
|
+
"touch-hold-delay",
|
|
1245
|
+
"list-max-height",
|
|
1246
|
+
"group",
|
|
1247
|
+
"labels",
|
|
1248
|
+
"hide-toolbar",
|
|
1019
1249
|
"disabled"
|
|
1020
1250
|
];
|
|
1021
1251
|
}
|
|
1022
|
-
shouldRenderOnAttributeChange(
|
|
1023
|
-
return this._suppressAttributeRender ? !["lists", "items", "selection"].includes(
|
|
1252
|
+
shouldRenderOnAttributeChange(t, e, i) {
|
|
1253
|
+
return this._suppressAttributeRender ? !["lists", "items", "selection"].includes(t) : !0;
|
|
1024
1254
|
}
|
|
1025
|
-
attributeChangedCallback(
|
|
1026
|
-
if (
|
|
1027
|
-
if (
|
|
1028
|
-
this._syncSelectionFromAttribute(
|
|
1255
|
+
attributeChangedCallback(t, e, i) {
|
|
1256
|
+
if (e !== i && this.isConnected) {
|
|
1257
|
+
if (t === "selection" && !this._suppressAttributeRender && this._canSyncInteractiveStateInPlace()) {
|
|
1258
|
+
this._syncSelectionFromAttribute(i ?? null), this._syncSelectionVisualState();
|
|
1029
1259
|
return;
|
|
1030
1260
|
}
|
|
1031
|
-
if (
|
|
1261
|
+
if (t === "show-selection-badge" && this._canSyncInteractiveStateInPlace()) {
|
|
1032
1262
|
this._syncSelectionVisualState();
|
|
1033
1263
|
return;
|
|
1034
1264
|
}
|
|
1035
|
-
super.attributeChangedCallback(
|
|
1265
|
+
super.attributeChangedCallback(t, e, i);
|
|
1036
1266
|
}
|
|
1037
1267
|
}
|
|
1038
1268
|
connectedCallback() {
|
|
1039
|
-
super.connectedCallback(), this.root.addEventListener("click", this._onClick), this.root.addEventListener("keydown", this._onKeyDown), this.root.addEventListener("dragstart", this._onDragStart), this.root.addEventListener("
|
|
1269
|
+
super.connectedCallback(), $._instances.add(this), this.root.addEventListener("click", this._onClick), this.root.addEventListener("keydown", this._onKeyDown), this.root.addEventListener("dragstart", this._onDragStart), this.root.addEventListener("pointerdown", this._onPointerDown), this.root.addEventListener("focusin", this._onFocusIn), this.root.addEventListener("touchmove", this._onTouchMove, { passive: !1 }), this.root.addEventListener("contextmenu", this._onContextMenu), this.ownerDocument?.addEventListener("keydown", this._onDocumentKeyDown, !0), this.ownerDocument?.addEventListener("keyup", this._onDocumentKeyUp, !0), this.ownerDocument?.addEventListener("pointermove", this._onPointerMove, !0), this.ownerDocument?.addEventListener("pointerup", this._onPointerUp, !0), this.ownerDocument?.addEventListener("pointercancel", this._onPointerCancel, !0);
|
|
1040
1270
|
}
|
|
1041
1271
|
disconnectedCallback() {
|
|
1042
|
-
this.root.removeEventListener("click", this._onClick), this.root.removeEventListener("keydown", this._onKeyDown), this.root.removeEventListener("dragstart", this._onDragStart), this.root.removeEventListener("
|
|
1272
|
+
this.root.removeEventListener("click", this._onClick), this.root.removeEventListener("keydown", this._onKeyDown), this.root.removeEventListener("dragstart", this._onDragStart), this.root.removeEventListener("pointerdown", this._onPointerDown), this.root.removeEventListener("focusin", this._onFocusIn), this.root.removeEventListener("touchmove", this._onTouchMove), this.root.removeEventListener("contextmenu", this._onContextMenu), this._clearHoldTimer(), this.ownerDocument?.removeEventListener("keydown", this._onDocumentKeyDown, !0), this.ownerDocument?.removeEventListener("keyup", this._onDocumentKeyUp, !0), this.ownerDocument?.removeEventListener("pointermove", this._onPointerMove, !0), this.ownerDocument?.removeEventListener("pointerup", this._onPointerUp, !0), this.ownerDocument?.removeEventListener("pointercancel", this._onPointerCancel, !0), this._stopAutoScroll(), this._removeDragImage(), this._pendingTimer && clearTimeout(this._pendingTimer), this._pendingTimer = null, $._instances.delete(this), this._setExternal(null), this._showExternalTarget(null), super.disconnectedCallback();
|
|
1043
1273
|
}
|
|
1044
1274
|
get lists() {
|
|
1045
|
-
return this._lists.map(
|
|
1275
|
+
return this._lists.map(G);
|
|
1046
1276
|
}
|
|
1047
|
-
set lists(
|
|
1048
|
-
this.setAttribute("lists", JSON.stringify(
|
|
1277
|
+
set lists(t) {
|
|
1278
|
+
this.setAttribute("lists", JSON.stringify(t ?? []));
|
|
1049
1279
|
}
|
|
1050
1280
|
get items() {
|
|
1051
|
-
return this._items.map(
|
|
1281
|
+
return this._items.map(q);
|
|
1282
|
+
}
|
|
1283
|
+
set items(t) {
|
|
1284
|
+
this.setAttribute("items", JSON.stringify(t ?? []));
|
|
1285
|
+
}
|
|
1286
|
+
/**
|
|
1287
|
+
* Decides whether items may go somewhere. It is asked wherever a place is considered: a refused place is not
|
|
1288
|
+
* highlighted, the keyboard skips it, a drop on it does nothing, and `moveSelection` returns false. Return
|
|
1289
|
+
* true to allow. It runs on every pointer move: keep it quick.
|
|
1290
|
+
*/
|
|
1291
|
+
get canDrop() {
|
|
1292
|
+
return this._canDropCallback;
|
|
1052
1293
|
}
|
|
1053
|
-
set
|
|
1054
|
-
this.
|
|
1294
|
+
set canDrop(t) {
|
|
1295
|
+
this._canDropCallback = typeof t == "function" ? t : null;
|
|
1296
|
+
}
|
|
1297
|
+
/**
|
|
1298
|
+
* Draws the inside of a card yourself, in plain JavaScript (React has `renderItem` on the wrapper). Return a
|
|
1299
|
+
* fresh DOM node, or a string of HTML; return nothing to keep the built-in card. It is called again whenever
|
|
1300
|
+
* the card is drawn anew, when its `data` changes, and when it is selected or deselected.
|
|
1301
|
+
*/
|
|
1302
|
+
get renderItem() {
|
|
1303
|
+
return this._renderItemFn;
|
|
1304
|
+
}
|
|
1305
|
+
set renderItem(t) {
|
|
1306
|
+
this._renderItemFn = typeof t == "function" ? t : null, this.requestRender();
|
|
1307
|
+
}
|
|
1308
|
+
/** Draws a list's header yourself. Return a fresh DOM node or a string of HTML; nothing keeps the built-in header. */
|
|
1309
|
+
get renderListHeader() {
|
|
1310
|
+
return this._renderListHeaderFn;
|
|
1311
|
+
}
|
|
1312
|
+
set renderListHeader(t) {
|
|
1313
|
+
this._renderListHeaderFn = typeof t == "function" ? t : null, this.requestRender();
|
|
1314
|
+
}
|
|
1315
|
+
/** Draws what an empty list shows. Return a fresh DOM node or a string of HTML; nothing keeps the built-in message. */
|
|
1316
|
+
get renderEmptyState() {
|
|
1317
|
+
return this._renderEmptyStateFn;
|
|
1318
|
+
}
|
|
1319
|
+
set renderEmptyState(t) {
|
|
1320
|
+
this._renderEmptyStateFn = typeof t == "function" ? t : null, this.requestRender();
|
|
1321
|
+
}
|
|
1322
|
+
/**
|
|
1323
|
+
* Elements with the same non-empty `group` can exchange items: a card held over another of them can be
|
|
1324
|
+
* dropped there, and both report it (`change`, with `external`). Ids must be unique across the group.
|
|
1325
|
+
*/
|
|
1326
|
+
get group() {
|
|
1327
|
+
return this._group();
|
|
1328
|
+
}
|
|
1329
|
+
set group(t) {
|
|
1330
|
+
t ? this.setAttribute("group", t) : this.removeAttribute("group");
|
|
1331
|
+
}
|
|
1332
|
+
_group() {
|
|
1333
|
+
return this.getAttribute("group")?.trim() || "";
|
|
1334
|
+
}
|
|
1335
|
+
/** The text the component shows, with any `labels` you set applied over the English defaults. */
|
|
1336
|
+
get labels() {
|
|
1337
|
+
return { ...Y, ...this._labels };
|
|
1338
|
+
}
|
|
1339
|
+
set labels(t) {
|
|
1340
|
+
!t || !Object.keys(t).length ? this.removeAttribute("labels") : this.setAttribute("labels", JSON.stringify(t));
|
|
1341
|
+
}
|
|
1342
|
+
_t(t, e) {
|
|
1343
|
+
return (this._labels[t] ?? Y[t]).replace(/\{(\w+)\}/g, (r, s) => String(e?.[s] ?? ""));
|
|
1055
1344
|
}
|
|
1056
1345
|
get selection() {
|
|
1057
1346
|
return [...this._selection];
|
|
1058
1347
|
}
|
|
1059
|
-
set selection(
|
|
1060
|
-
this.setAttribute("selection", JSON.stringify(
|
|
1348
|
+
set selection(t) {
|
|
1349
|
+
this.setAttribute("selection", JSON.stringify(t ?? []));
|
|
1061
1350
|
}
|
|
1062
1351
|
get sort() {
|
|
1063
1352
|
return this.getAttribute("sort") === "label" ? "label" : "manual";
|
|
1064
1353
|
}
|
|
1065
|
-
set sort(
|
|
1066
|
-
!
|
|
1354
|
+
set sort(t) {
|
|
1355
|
+
!t || t === "manual" ? this.removeAttribute("sort") : this.setAttribute("sort", t);
|
|
1067
1356
|
}
|
|
1068
1357
|
get filterQuery() {
|
|
1069
1358
|
return this.getAttribute("filter-query") || "";
|
|
1070
1359
|
}
|
|
1071
|
-
set filterQuery(
|
|
1072
|
-
|
|
1360
|
+
set filterQuery(t) {
|
|
1361
|
+
t ? this.setAttribute("filter-query", t) : this.removeAttribute("filter-query");
|
|
1073
1362
|
}
|
|
1074
|
-
select(
|
|
1075
|
-
this._setSelection(
|
|
1363
|
+
select(t) {
|
|
1364
|
+
this._setSelection(t, "api");
|
|
1076
1365
|
}
|
|
1077
1366
|
clearSelection() {
|
|
1078
1367
|
this._setSelection([], "api");
|
|
@@ -1080,140 +1369,192 @@ class he extends ee {
|
|
|
1080
1369
|
cancelDrag() {
|
|
1081
1370
|
this._cancelDrag(!0);
|
|
1082
1371
|
}
|
|
1083
|
-
focusItem(
|
|
1084
|
-
this._items.some((
|
|
1372
|
+
focusItem(t) {
|
|
1373
|
+
this._items.some((e) => e.id === t) && (this._focusedId = t, this._pendingFocusId = t, this._revealPending = !0, !this._applyInteractiveStateInPlace({ restoreFocus: !0 }) && this.requestRender());
|
|
1085
1374
|
}
|
|
1086
|
-
|
|
1375
|
+
/** Moves (or copies) the selected items. Returns false when nothing moved: no selection, a place that is not allowed, or `before-change` cancelled. */
|
|
1376
|
+
moveSelection(t) {
|
|
1087
1377
|
this._syncSelectionFromAttribute(this.getAttribute("selection"));
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1378
|
+
const e = this._selectedRootIds();
|
|
1379
|
+
return e.length ? this._commitMove({
|
|
1380
|
+
listId: t.targetListId,
|
|
1381
|
+
parentId: t.parentId ?? null,
|
|
1382
|
+
beforeId: t.beforeId ?? null,
|
|
1383
|
+
mode: t.mode ?? (t.parentId ? "inside" : "before")
|
|
1384
|
+
}, e, !!t.clone, t.source ?? "api") : !1;
|
|
1385
|
+
}
|
|
1386
|
+
/**
|
|
1387
|
+
* Moves (or, with `clone`, copies) the selected items into another `<ui-sortable>`: the same as dragging them
|
|
1388
|
+
* there, for code and for keyboard users. `options` is the place in `peer`. Returns false when nothing moved.
|
|
1389
|
+
*/
|
|
1390
|
+
moveSelectionTo(t, e) {
|
|
1391
|
+
if (!t || !(t instanceof $)) return !1;
|
|
1392
|
+
if (t === this) return this.moveSelection(e);
|
|
1393
|
+
this._syncSelectionFromAttribute(this.getAttribute("selection"));
|
|
1394
|
+
const i = this._selectedRootIds();
|
|
1395
|
+
return i.length ? this._transferTo(t, {
|
|
1090
1396
|
listId: e.targetListId,
|
|
1091
1397
|
parentId: e.parentId ?? null,
|
|
1092
1398
|
beforeId: e.beforeId ?? null,
|
|
1093
1399
|
mode: e.mode ?? (e.parentId ? "inside" : "before")
|
|
1094
|
-
},
|
|
1400
|
+
}, i, !!e.clone, e.source ?? "api") : !1;
|
|
1095
1401
|
}
|
|
1096
1402
|
getPersistenceSnapshot() {
|
|
1097
1403
|
return J(this._items);
|
|
1098
1404
|
}
|
|
1099
1405
|
render() {
|
|
1100
1406
|
this._syncStateFromAttributes();
|
|
1101
|
-
const
|
|
1102
|
-
<style>${
|
|
1407
|
+
const t = this._measureItemShellRects(), e = new Set(this._draggingIds()), i = new Set(this._selection), s = !!this._dragState?.keyboard ? this._projectedMoveResult() : null, n = s?.items || this._items, a = new Set(s?.insertedRootIds || []), d = !!this._dragState && !this._dragState.keyboard && !!this._dragState.dropTarget, o = nt(n, i, e, this.filterQuery, this.sort), c = this._resolvedFocusedId(o), l = this._isDragLocked(), p = this._selection.length, g = this.getAttribute("allow-nesting") !== "false", b = this.getAttribute("drop-indicator-visibility") === "always" ? "always" : "active", y = this._dropzoneStyle(), h = this.getAttribute("show-selection-badge") !== "false", f = this._dragHandleMode(), x = this._usesCustomHandleSelector(), D = l ? this.sort === "label" ? this._t("hintPausedSort") : this.filterQuery && !this.hasAttribute("allow-filtered-drag") ? this._t("hintPausedFilter") : this._t("hintDisabled") : this._dragState?.keyboard ? this._t("hintKeyboard") : f === "item" ? this._t("hintItem") : x ? this._t("hintCustom") : this._t("hintHandle"), C = this.hasAttribute("hide-toolbar"), z = g && !l && !this._dragState?.keyboard ? this._t(this._nestTrigger() === "area" ? "hintNestArea" : this._nestTrigger() === "modifier" ? "hintNestModifier" : "hintNestGutter") : "", E = `
|
|
1408
|
+
<style>${gt}</style>
|
|
1103
1409
|
<div
|
|
1104
1410
|
class="root"
|
|
1105
1411
|
part="root"
|
|
1106
|
-
data-drag-locked="${
|
|
1412
|
+
data-drag-locked="${l}"
|
|
1107
1413
|
data-drag-preview="${a.size || d ? "true" : "false"}"
|
|
1108
1414
|
data-drop-indicator-visibility="${b}"
|
|
1109
|
-
data-dropzone-style="${
|
|
1415
|
+
data-dropzone-style="${y}"
|
|
1110
1416
|
>
|
|
1111
|
-
<div class="toolbar" part="toolbar">
|
|
1112
|
-
<div class="helper" id="ui-sortable-helper">${
|
|
1113
|
-
<div class="helper selection-summary">
|
|
1114
|
-
<span class="selection-pill" part="selection-count">${
|
|
1115
|
-
<span class="selection-text">${
|
|
1417
|
+
<div class="toolbar" part="toolbar"${C ? ' data-hidden="true"' : ""}>
|
|
1418
|
+
<div class="helper" id="ui-sortable-helper">${v(z ? `${D} ${z}` : D)}</div>
|
|
1419
|
+
<div class="helper selection-summary" data-count="${p}">
|
|
1420
|
+
<span class="selection-pill" part="selection-count">${p}</span>
|
|
1421
|
+
<span class="selection-text">${v(p === 1 ? this._t("selectedOne") : this._t("selectedMany"))}</span>
|
|
1116
1422
|
</div>
|
|
1117
1423
|
</div>
|
|
1118
1424
|
<div class="lists" part="lists">
|
|
1119
|
-
${this._lists.map((
|
|
1120
|
-
const
|
|
1425
|
+
${this._lists.map((_) => {
|
|
1426
|
+
const I = o.get(_.id) || [], P = I.length ? this._renderListTree(n, _, c, e, g, a, h) : "", k = _.orientation === "horizontal" ? void 0 : _.maxHeight ?? ot(this.getAttribute("list-max-height")), R = this._items.filter((L) => L.listId === _.id).length, m = _.maxItems !== void 0 && R >= _.maxItems, S = _.disabled ? this._t("listReadOnly") : m ? this._t("listFull", { max: _.maxItems ?? 0 }) : _.cloneOnDrag ? this._t("listClone") : _.accepts?.length ? this._t("listAccepts", { lists: _.accepts.join(", ") }) : "";
|
|
1121
1427
|
return `
|
|
1122
1428
|
<section
|
|
1123
1429
|
class="list"
|
|
1124
1430
|
part="list"
|
|
1125
|
-
data-list-id="${
|
|
1126
|
-
data-orientation="${
|
|
1127
|
-
data-disabled="${
|
|
1128
|
-
|
|
1431
|
+
data-list-id="${v(_.id)}"
|
|
1432
|
+
data-orientation="${_.orientation}"
|
|
1433
|
+
data-disabled="${_.disabled}"
|
|
1434
|
+
data-full="${m}"
|
|
1435
|
+
${this._renderListHeaderFn || this._renderEmptyStateFn ? `data-rev="${tt(_.data)}"` : ""}
|
|
1436
|
+
aria-label="${v(_.label)}"
|
|
1129
1437
|
>
|
|
1130
1438
|
<header class="list-header">
|
|
1131
|
-
<div class="list-custom-header" part="list-custom-header" data-list-header-target="${
|
|
1439
|
+
<div class="list-custom-header" part="list-custom-header" data-list-header-target="${v(_.id)}"></div>
|
|
1132
1440
|
<div class="list-default-header">
|
|
1133
1441
|
<div class="list-topline">
|
|
1134
|
-
<div class="list-label">${
|
|
1135
|
-
<span class="list-count">${
|
|
1442
|
+
<div class="list-label">${v(_.label)}</div>
|
|
1443
|
+
<span class="list-count">${_.maxItems !== void 0 ? `${R}/${_.maxItems}` : I.length}</span>
|
|
1136
1444
|
</div>
|
|
1137
|
-
${
|
|
1138
|
-
${
|
|
1445
|
+
${_.description ? `<div class="list-description">${v(_.description)}</div>` : ""}
|
|
1446
|
+
${S ? `<div class="list-helper">${v(S)}</div>` : ""}
|
|
1139
1447
|
</div>
|
|
1140
1448
|
</header>
|
|
1141
|
-
<div class="items" role="${
|
|
1142
|
-
${
|
|
1143
|
-
listId:
|
|
1449
|
+
<div class="items" part="items"${k ? ` data-scroll="true" style="--ui-sortable-list-max-block-size: ${k}"` : ""} role="${I.length ? "listbox" : "group"}" ${I.length ? 'aria-multiselectable="true"' : ""} aria-label="${v(_.label)}" aria-describedby="ui-sortable-helper">
|
|
1450
|
+
${P || `<div class="list-custom-empty" part="list-custom-empty" data-list-empty-target="${v(_.id)}"></div><div class="empty">${v(_.emptyLabel || this._t("emptyList"))}</div>${this._renderDropzone({
|
|
1451
|
+
listId: _.id,
|
|
1144
1452
|
parentId: null,
|
|
1145
1453
|
beforeId: null,
|
|
1146
1454
|
mode: "before"
|
|
1147
|
-
}, "
|
|
1455
|
+
}, this._t("dropHere"))}`}
|
|
1148
1456
|
</div>
|
|
1149
1457
|
</section>
|
|
1150
1458
|
`;
|
|
1151
1459
|
}).join("")}
|
|
1152
1460
|
</div>
|
|
1153
|
-
<div class="sr-only" aria-live="polite" aria-atomic="true">${
|
|
1461
|
+
<div class="sr-only" aria-live="polite" aria-atomic="true">${v(this._liveMessage)}</div>
|
|
1154
1462
|
</div>
|
|
1155
|
-
|
|
1156
|
-
this.setContent(
|
|
1157
|
-
this._restorePendingFocus(), this.
|
|
1463
|
+
`, F = this._captureScroll();
|
|
1464
|
+
this._focusWasInside = !!this.root.activeElement, this.setContent(E), this._restoreScroll(F), this._fillCustomTargets(), queueMicrotask(() => {
|
|
1465
|
+
this._restorePendingFocus(), this._dragState?.keyboard && this.root.querySelector(".item-placeholder")?.scrollIntoView?.({ block: "nearest", inline: "nearest" }), this._applyCurrentDropTargetVisualState(), this._applyLiveMessage(), this._animateItemShellReflow(t);
|
|
1158
1466
|
});
|
|
1159
1467
|
}
|
|
1160
1468
|
_syncStateFromAttributes() {
|
|
1161
|
-
const
|
|
1162
|
-
|
|
1163
|
-
const
|
|
1164
|
-
if (
|
|
1165
|
-
this._lastItemsAttr =
|
|
1166
|
-
const
|
|
1167
|
-
|
|
1469
|
+
const t = this.getAttribute("lists");
|
|
1470
|
+
t !== this._lastListsAttr && (this._lastListsAttr = t, this._lists = it(V(t)));
|
|
1471
|
+
const e = this.getAttribute("items");
|
|
1472
|
+
if (e !== this._lastItemsAttr) {
|
|
1473
|
+
this._lastItemsAttr = e, this._items = U(this._lists, V(e)), this._lastSelectionAttr = null;
|
|
1474
|
+
const s = this.getAttribute("persist-key");
|
|
1475
|
+
s && this._hydratedPersistKey !== s && (this._items = this._restorePersistedItems(s, this._items), this._hydratedPersistKey = s);
|
|
1168
1476
|
}
|
|
1169
|
-
const
|
|
1170
|
-
|
|
1477
|
+
const i = this.getAttribute("selection");
|
|
1478
|
+
i !== this._lastSelectionAttr && this._syncSelectionFromAttribute(i);
|
|
1479
|
+
const r = this.getAttribute("labels");
|
|
1480
|
+
r !== this._lastLabelsAttr && (this._lastLabelsAttr = r, this._labels = mt(r)), this._focusedId || (this._focusedId = this._items.find((s) => !s.hidden)?.id || null);
|
|
1171
1481
|
}
|
|
1172
|
-
_restorePersistedItems(
|
|
1482
|
+
_restorePersistedItems(t, e) {
|
|
1173
1483
|
try {
|
|
1174
|
-
const
|
|
1175
|
-
if (!
|
|
1176
|
-
const
|
|
1177
|
-
if (!
|
|
1178
|
-
const s = new Map(
|
|
1484
|
+
const i = window.localStorage.getItem(t);
|
|
1485
|
+
if (!i) return e;
|
|
1486
|
+
const r = JSON.parse(i);
|
|
1487
|
+
if (!r || typeof r != "object" || !Array.isArray(r.records)) return e;
|
|
1488
|
+
const s = new Map(r.records.map((a) => [a.id, a])), n = e.map((a, d) => {
|
|
1179
1489
|
const o = s.get(a.id);
|
|
1180
1490
|
return o ? {
|
|
1181
1491
|
...a,
|
|
1182
|
-
listId: this._lists.some((
|
|
1492
|
+
listId: this._lists.some((c) => c.id === o.listId) ? o.listId : a.listId,
|
|
1183
1493
|
parentId: typeof o.parentId == "string" ? o.parentId : null,
|
|
1184
1494
|
order: Number.isFinite(o.index) ? o.index : d
|
|
1185
1495
|
} : { ...a, order: d };
|
|
1186
1496
|
});
|
|
1187
1497
|
return U(this._lists, n);
|
|
1188
1498
|
} catch {
|
|
1189
|
-
return
|
|
1499
|
+
return e;
|
|
1190
1500
|
}
|
|
1191
1501
|
}
|
|
1192
|
-
_resolvedFocusedId(
|
|
1193
|
-
const
|
|
1194
|
-
return this._focusedId &&
|
|
1502
|
+
_resolvedFocusedId(t) {
|
|
1503
|
+
const e = new Set(Array.from(t.values()).flat().map((r) => r.id));
|
|
1504
|
+
return this._focusedId && e.has(this._focusedId) ? this._focusedId : Array.from(t.values()).flat().find((r) => !r.disabled)?.id || null;
|
|
1195
1505
|
}
|
|
1196
1506
|
_restorePendingFocus() {
|
|
1197
|
-
const
|
|
1198
|
-
if (!
|
|
1199
|
-
const
|
|
1200
|
-
|
|
1507
|
+
const t = this._pendingFocusId || (this._focusWasInside ? this._focusedId : null);
|
|
1508
|
+
if (this._focusWasInside = !1, !t) return;
|
|
1509
|
+
const e = typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(t) : t.replace(/"/g, '\\"'), i = this.root.querySelector(`.item[data-id="${e}"]`);
|
|
1510
|
+
i && (document.activeElement !== i && i.focus({ preventScroll: !0 }), this._revealPending ? (this._revealPending = !1, i.scrollIntoView?.({ block: "nearest", inline: "nearest" })) : this._revealInBoard(i), this._pendingFocusId = null);
|
|
1511
|
+
}
|
|
1512
|
+
// Every render replaces the shadow content, which would send the board (and any list with its own
|
|
1513
|
+
// scrollbar) back to the start.
|
|
1514
|
+
_captureScroll() {
|
|
1515
|
+
const t = this.root.querySelector(".lists");
|
|
1516
|
+
if (!t) return null;
|
|
1517
|
+
const e = /* @__PURE__ */ new Map();
|
|
1518
|
+
return this.root.querySelectorAll(".list[data-list-id]").forEach((i) => {
|
|
1519
|
+
const r = i.querySelector(".items"), s = i.getAttribute("data-list-id");
|
|
1520
|
+
r && s && (r.scrollLeft || r.scrollTop) && e.set(s, { left: r.scrollLeft, top: r.scrollTop });
|
|
1521
|
+
}), { board: t.scrollLeft, lists: e };
|
|
1522
|
+
}
|
|
1523
|
+
_restoreScroll(t) {
|
|
1524
|
+
if (!t) return;
|
|
1525
|
+
const e = this.root.querySelector(".lists");
|
|
1526
|
+
e && t.board && (e.scrollLeft = t.board), t.lists.size && this.root.querySelectorAll(".list[data-list-id]").forEach((i) => {
|
|
1527
|
+
const r = t.lists.get(i.getAttribute("data-list-id") || ""), s = i.querySelector(".items");
|
|
1528
|
+
!r || !s || (s.scrollLeft = r.left, s.scrollTop = r.top);
|
|
1529
|
+
});
|
|
1530
|
+
}
|
|
1531
|
+
// A board that scrolls sideways can hold the focused card off screen (after a drop into a far list,
|
|
1532
|
+
// or when the keyboard moves into one): bring that list into view.
|
|
1533
|
+
_revealInBoard(t) {
|
|
1534
|
+
const e = this.root.querySelector(".lists"), i = t.closest(".list");
|
|
1535
|
+
if (!e || !i || e.scrollWidth <= e.clientWidth + 1) return;
|
|
1536
|
+
const r = e.getBoundingClientRect(), s = i.getBoundingClientRect();
|
|
1537
|
+
s.left < r.left ? e.scrollLeft -= r.left - s.left + 4 : s.right > r.right && (e.scrollLeft += Math.min(s.right - r.right + 4, s.left - r.left));
|
|
1201
1538
|
}
|
|
1202
|
-
_escapeSelectorValue(
|
|
1203
|
-
return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(
|
|
1539
|
+
_escapeSelectorValue(t) {
|
|
1540
|
+
return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(t) : t.replace(/"/g, '\\"');
|
|
1204
1541
|
}
|
|
1205
|
-
_findDropzone(
|
|
1206
|
-
const
|
|
1542
|
+
_findDropzone(t) {
|
|
1543
|
+
const e = this._escapeSelectorValue(t.listId), i = this._escapeSelectorValue(t.parentId ?? ""), r = this._escapeSelectorValue(t.beforeId ?? ""), s = this._escapeSelectorValue(t.mode);
|
|
1207
1544
|
return this.root.querySelector(
|
|
1208
|
-
`.dropzone[data-list-id="${
|
|
1545
|
+
`.dropzone[data-list-id="${e}"][data-parent-id="${i}"][data-before-id="${r}"][data-mode="${s}"]`
|
|
1209
1546
|
);
|
|
1210
1547
|
}
|
|
1211
|
-
_findItemElement(
|
|
1212
|
-
const
|
|
1213
|
-
return this.root.querySelector(`.item[data-id="${
|
|
1548
|
+
_findItemElement(t) {
|
|
1549
|
+
const e = this._escapeSelectorValue(t);
|
|
1550
|
+
return this.root.querySelector(`.item[data-id="${e}"]`);
|
|
1214
1551
|
}
|
|
1215
1552
|
_dragHandleMode() {
|
|
1216
|
-
return
|
|
1553
|
+
return ft(this.getAttribute("drag-handle-mode"));
|
|
1554
|
+
}
|
|
1555
|
+
_nestTrigger() {
|
|
1556
|
+
const t = this.getAttribute("nest-trigger");
|
|
1557
|
+
return t === "modifier" || t === "area" ? t : "gutter";
|
|
1217
1558
|
}
|
|
1218
1559
|
_dropzoneStyle() {
|
|
1219
1560
|
return this.getAttribute("dropzone-style") === "container" ? "container" : "indicator";
|
|
@@ -1221,331 +1562,343 @@ class he extends ee {
|
|
|
1221
1562
|
_usesCustomHandleSelector() {
|
|
1222
1563
|
return !!this.getAttribute("drag-handle-selector")?.trim();
|
|
1223
1564
|
}
|
|
1224
|
-
_dragActivatorFromPath(
|
|
1225
|
-
const
|
|
1226
|
-
if (!
|
|
1227
|
-
const
|
|
1228
|
-
return s ? { element:
|
|
1565
|
+
_dragActivatorFromPath(t) {
|
|
1566
|
+
const e = t.find((n) => n instanceof HTMLElement && !!n.getAttribute("data-drag-trigger"));
|
|
1567
|
+
if (!e) return null;
|
|
1568
|
+
const i = e.getAttribute("data-drag-trigger"), r = i === "item" ? "item" : i === "custom" ? "custom" : "handle", s = e.getAttribute("data-id") || e.closest(".item[data-id]")?.getAttribute("data-id");
|
|
1569
|
+
return s ? { element: e, id: s, kind: r } : null;
|
|
1229
1570
|
}
|
|
1230
|
-
_setDropTargetVisualState(
|
|
1231
|
-
if (!
|
|
1232
|
-
const
|
|
1233
|
-
|
|
1571
|
+
_setDropTargetVisualState(t, e) {
|
|
1572
|
+
if (!t) return;
|
|
1573
|
+
const i = this._findDropzone(t);
|
|
1574
|
+
i && (i.setAttribute("data-active", e ? "true" : "false"), e ? this._syncDropzoneContainerSize(i, t) : this._clearDropzoneContainerSize(i)), t.mode === "inside" && t.parentId && this._findItemElement(t.parentId)?.setAttribute("data-drop-inside-active", e ? "true" : "false");
|
|
1234
1575
|
}
|
|
1235
|
-
_applyCurrentDropTargetVisualState(
|
|
1236
|
-
this._setDropTargetVisualState(
|
|
1576
|
+
_applyCurrentDropTargetVisualState(t) {
|
|
1577
|
+
this._setDropTargetVisualState(t ?? null, !1), this._setDropTargetVisualState(this._dragState?.dropTarget ?? null, !0);
|
|
1237
1578
|
}
|
|
1238
1579
|
_applyLiveMessage() {
|
|
1239
|
-
const
|
|
1240
|
-
|
|
1580
|
+
const t = this.root.querySelector(".sr-only[aria-live]");
|
|
1581
|
+
t && (t.textContent = this._liveMessage);
|
|
1241
1582
|
}
|
|
1242
1583
|
_canSyncInteractiveStateInPlace() {
|
|
1243
1584
|
return !!this.root.querySelector(".root") && !this._dragState;
|
|
1244
1585
|
}
|
|
1245
|
-
_applyInteractiveStateInPlace(
|
|
1246
|
-
return this._canSyncInteractiveStateInPlace() ? (this._syncSelectionVisualState(),
|
|
1586
|
+
_applyInteractiveStateInPlace(t) {
|
|
1587
|
+
return this._canSyncInteractiveStateInPlace() ? (this._syncSelectionVisualState(), t?.restoreFocus && this._restorePendingFocus(), this._applyLiveMessage(), !0) : !1;
|
|
1588
|
+
}
|
|
1589
|
+
// Fills the places the markup leaves for custom content (the inside of a card, a list header, an empty state)
|
|
1590
|
+
// from the render functions. Fresh markup has them empty; `itemIds` redraws just those cards.
|
|
1591
|
+
_fillCustomTargets(t) {
|
|
1592
|
+
if (!this._renderItemFn && !this._renderListHeaderFn && !this._renderEmptyStateFn) return;
|
|
1593
|
+
const e = this._isDragLocked(), i = new Map(this._lists.map((d) => [d.id, d])), r = (d, o) => {
|
|
1594
|
+
let c;
|
|
1595
|
+
try {
|
|
1596
|
+
c = o();
|
|
1597
|
+
} catch (l) {
|
|
1598
|
+
console.error("ui-sortable: a render function threw; the built-in markup is shown.", l);
|
|
1599
|
+
return;
|
|
1600
|
+
}
|
|
1601
|
+
typeof c == "string" ? d.innerHTML = c : c && typeof c.nodeType == "number" && d.replaceChildren(c);
|
|
1602
|
+
}, s = this._renderItemFn;
|
|
1603
|
+
if (s) {
|
|
1604
|
+
const d = new Map(this._items.map((l) => [l.id, l])), o = new Set(this._selection), c = this.getAttribute("drag-handle-selector")?.trim() || "";
|
|
1605
|
+
this.root.querySelectorAll(".item-custom-content[data-item-content-target]").forEach((l) => {
|
|
1606
|
+
const p = l.getAttribute("data-item-content-target") || "";
|
|
1607
|
+
if (t ? !t.itemIds.has(p) : l.hasChildNodes()) return;
|
|
1608
|
+
const g = d.get(p);
|
|
1609
|
+
if (!g) return;
|
|
1610
|
+
t && l.replaceChildren();
|
|
1611
|
+
const b = i.get(g.listId);
|
|
1612
|
+
r(l, () => s(q(g), {
|
|
1613
|
+
selected: o.has(p),
|
|
1614
|
+
disabled: g.disabled,
|
|
1615
|
+
dragDisabled: g.dragDisabled,
|
|
1616
|
+
cloneOnDrag: g.cloneOnDrag || !!b?.cloneOnDrag,
|
|
1617
|
+
list: b ? G(b) : void 0
|
|
1618
|
+
})), c && this._markCustomHandles(l, p, c);
|
|
1619
|
+
});
|
|
1620
|
+
}
|
|
1621
|
+
if (t) return;
|
|
1622
|
+
const n = this._renderListHeaderFn;
|
|
1623
|
+
n && this.root.querySelectorAll(".list-custom-header[data-list-header-target]").forEach((d) => {
|
|
1624
|
+
if (d.hasChildNodes()) return;
|
|
1625
|
+
const o = i.get(d.getAttribute("data-list-header-target") || "");
|
|
1626
|
+
if (!o) return;
|
|
1627
|
+
const c = this._items.filter((l) => l.listId === o.id).length;
|
|
1628
|
+
r(d, () => n(G(o), { itemCount: c, dragLocked: e }));
|
|
1629
|
+
});
|
|
1630
|
+
const a = this._renderEmptyStateFn;
|
|
1631
|
+
a && this.root.querySelectorAll(".list-custom-empty[data-list-empty-target]").forEach((d) => {
|
|
1632
|
+
if (d.hasChildNodes()) return;
|
|
1633
|
+
const o = i.get(d.getAttribute("data-list-empty-target") || "");
|
|
1634
|
+
if (!o) return;
|
|
1635
|
+
const c = this._items.filter((l) => l.listId === o.id).length;
|
|
1636
|
+
r(d, () => a(G(o), { itemCount: c, dragLocked: e, filterQuery: this.filterQuery }));
|
|
1637
|
+
});
|
|
1638
|
+
}
|
|
1639
|
+
// The parts of a custom card that match `drag-handle-selector` start a drag, the way the built-in grip does.
|
|
1640
|
+
_markCustomHandles(t, e, i) {
|
|
1641
|
+
let r;
|
|
1642
|
+
try {
|
|
1643
|
+
r = t.querySelectorAll(i);
|
|
1644
|
+
} catch {
|
|
1645
|
+
return;
|
|
1646
|
+
}
|
|
1647
|
+
r.forEach((s) => {
|
|
1648
|
+
s.setAttribute("data-sortable-custom-handle", ""), s.setAttribute("data-drag-trigger", "custom"), s.setAttribute("data-id", e), s.hasAttribute("tabindex") || s.setAttribute("tabindex", "-1");
|
|
1649
|
+
});
|
|
1247
1650
|
}
|
|
1248
1651
|
_hasCustomItemRendering() {
|
|
1249
|
-
return this.hasAttribute("custom-item-rendering");
|
|
1652
|
+
return this.hasAttribute("custom-item-rendering") || !!this._renderItemFn;
|
|
1250
1653
|
}
|
|
1251
|
-
_syncSelectionFromAttribute(
|
|
1252
|
-
this._lastSelectionAttr =
|
|
1253
|
-
const
|
|
1254
|
-
this._selection =
|
|
1654
|
+
_syncSelectionFromAttribute(t) {
|
|
1655
|
+
this._lastSelectionAttr = t;
|
|
1656
|
+
const e = new Set(this._items.map((i) => i.id));
|
|
1657
|
+
this._selection = V(t).filter((i) => e.has(i)), !this._selection.length && this._focusedId && !e.has(this._focusedId) && (this._focusedId = null);
|
|
1255
1658
|
}
|
|
1256
1659
|
_syncSelectionVisualState() {
|
|
1257
|
-
const
|
|
1258
|
-
this.root.querySelectorAll(".item[data-id]").forEach((
|
|
1259
|
-
const
|
|
1260
|
-
if (!
|
|
1261
|
-
const
|
|
1262
|
-
|
|
1263
|
-
const o =
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1660
|
+
const t = new Set(this._selection), e = this.getAttribute("show-selection-badge") !== "false", i = /* @__PURE__ */ new Set();
|
|
1661
|
+
this.root.querySelectorAll(".item[data-id]").forEach((n) => {
|
|
1662
|
+
const a = n.getAttribute("data-id");
|
|
1663
|
+
if (!a) return;
|
|
1664
|
+
const d = t.has(a);
|
|
1665
|
+
n.getAttribute("data-selected") === "true" !== d && i.add(a);
|
|
1666
|
+
const o = this._focusedId === a;
|
|
1667
|
+
n.setAttribute("data-selected", d ? "true" : "false"), n.setAttribute("aria-selected", d ? "true" : "false"), n.setAttribute("data-focused", o ? "true" : "false"), n.setAttribute("tabindex", o ? "0" : "-1");
|
|
1668
|
+
const c = n.querySelector('[data-selection-badge="true"]');
|
|
1669
|
+
if (c) {
|
|
1670
|
+
const l = d && e;
|
|
1671
|
+
c.hidden = !l, c.textContent = l ? this._t("badgeSelected") : "";
|
|
1267
1672
|
}
|
|
1268
|
-
});
|
|
1673
|
+
}), i.size && this._renderItemFn && this._fillCustomTargets({ itemIds: i }), this.root.querySelector(".selection-summary")?.setAttribute("data-count", String(this._selection.length));
|
|
1269
1674
|
const r = this.root.querySelector(".selection-pill");
|
|
1270
1675
|
r && (r.textContent = String(this._selection.length));
|
|
1271
|
-
const
|
|
1272
|
-
|
|
1676
|
+
const s = this.root.querySelector(".selection-text");
|
|
1677
|
+
s && (s.textContent = this._selection.length === 1 ? this._t("selectedOne") : this._t("selectedMany"));
|
|
1273
1678
|
}
|
|
1274
|
-
_clearDropzoneContainerSize(
|
|
1275
|
-
|
|
1679
|
+
_clearDropzoneContainerSize(t) {
|
|
1680
|
+
t.style.removeProperty("--ui-sortable-dropzone-match-block-size"), t.style.removeProperty("--ui-sortable-dropzone-match-inline-size");
|
|
1276
1681
|
}
|
|
1277
|
-
_dropzoneReferenceElement(
|
|
1278
|
-
if (
|
|
1279
|
-
let
|
|
1280
|
-
for (; r; ) {
|
|
1281
|
-
if (r instanceof HTMLElement && r.classList.contains("item-shell"))
|
|
1282
|
-
return r.querySelector(".item[data-id]");
|
|
1283
|
-
r = r.nextElementSibling;
|
|
1284
|
-
}
|
|
1285
|
-
let i = t.previousElementSibling;
|
|
1682
|
+
_dropzoneReferenceElement(t, e) {
|
|
1683
|
+
if (t.mode === "inside" && t.parentId) return this._findItemElement(t.parentId);
|
|
1684
|
+
let i = e.nextElementSibling;
|
|
1286
1685
|
for (; i; ) {
|
|
1287
1686
|
if (i instanceof HTMLElement && i.classList.contains("item-shell"))
|
|
1288
1687
|
return i.querySelector(".item[data-id]");
|
|
1289
|
-
i = i.
|
|
1688
|
+
i = i.nextElementSibling;
|
|
1290
1689
|
}
|
|
1291
|
-
|
|
1690
|
+
let r = e.previousElementSibling;
|
|
1691
|
+
for (; r; ) {
|
|
1692
|
+
if (r instanceof HTMLElement && r.classList.contains("item-shell"))
|
|
1693
|
+
return r.querySelector(".item[data-id]");
|
|
1694
|
+
r = r.previousElementSibling;
|
|
1695
|
+
}
|
|
1696
|
+
const s = this._escapeSelectorValue(t.listId), n = this.root.querySelector(`.list[data-list-id="${s}"] .items`), a = n?.querySelector(".item[data-id]");
|
|
1292
1697
|
return a || n || null;
|
|
1293
1698
|
}
|
|
1294
|
-
_syncDropzoneContainerSize(
|
|
1295
|
-
if (this._clearDropzoneContainerSize(
|
|
1296
|
-
const
|
|
1297
|
-
if (!
|
|
1298
|
-
const
|
|
1299
|
-
|
|
1300
|
-
}
|
|
1301
|
-
_ensureDragPreviewOverlay() {
|
|
1302
|
-
if (this._dragPreviewOverlay && this._dragPreviewOverlay.isConnected) return this._dragPreviewOverlay;
|
|
1303
|
-
const e = document.createElement("div");
|
|
1304
|
-
return e.className = "drag-preview-overlay", e.setAttribute("data-visible", "false"), this.root.appendChild(e), this._dragPreviewOverlay = e, e;
|
|
1699
|
+
_syncDropzoneContainerSize(t, e) {
|
|
1700
|
+
if (this._clearDropzoneContainerSize(t), this._dropzoneStyle() !== "container") return;
|
|
1701
|
+
const i = this._dropzoneReferenceElement(e, t);
|
|
1702
|
+
if (!i) return;
|
|
1703
|
+
const r = i.getBoundingClientRect();
|
|
1704
|
+
t.style.setProperty("--ui-sortable-dropzone-match-block-size", `${Math.max(76, Math.round(r.height))}px`), t.style.setProperty("--ui-sortable-dropzone-match-inline-size", `${Math.max(180, Math.round(r.width))}px`);
|
|
1305
1705
|
}
|
|
1306
1706
|
_clearPointerDragPreview() {
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
e && !this._dragState?.keyboard && e.setAttribute("data-drag-preview", "false");
|
|
1310
|
-
}
|
|
1311
|
-
_pointerPreviewContent() {
|
|
1312
|
-
if (!this._dragState || this._dragState.keyboard) return null;
|
|
1313
|
-
const e = this._dragState.movedRootIds[0], t = this._items.find((r) => r.id === e);
|
|
1314
|
-
return t ? {
|
|
1315
|
-
kicker: this._dragState.clone ? "Copy preview" : "Drop preview",
|
|
1316
|
-
title: this._dragState.clone ? `${t.label} copy` : t.label,
|
|
1317
|
-
description: this._dragState.clone ? "Release to add a copy here." : this._dragState.movedRootIds.length > 1 ? "Release to place this selection here." : "Release to place this item here."
|
|
1318
|
-
} : null;
|
|
1319
|
-
}
|
|
1320
|
-
_pointerPreviewSize() {
|
|
1321
|
-
if (this.getAttribute("drag-preview-size") === "compact" || !this._dragState || this._dragState.keyboard) return null;
|
|
1322
|
-
const e = this._dragState.movedRootIds[0], t = e ? this._findItemElement(e) : null;
|
|
1323
|
-
if (!t) return null;
|
|
1324
|
-
const r = window.getComputedStyle(t), i = le(r.transform);
|
|
1325
|
-
return {
|
|
1326
|
-
width: t.offsetWidth * i.x,
|
|
1327
|
-
height: t.offsetHeight * i.y
|
|
1328
|
-
};
|
|
1707
|
+
const t = this.root.querySelector(".root");
|
|
1708
|
+
t && !this._dragState?.keyboard && t.setAttribute("data-drag-preview", "false");
|
|
1329
1709
|
}
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
this.
|
|
1333
|
-
|
|
1334
|
-
}
|
|
1335
|
-
const e = this._pointerPreviewContent();
|
|
1336
|
-
if (!e) {
|
|
1337
|
-
this._clearPointerDragPreview();
|
|
1338
|
-
return;
|
|
1339
|
-
}
|
|
1340
|
-
const t = this.root.querySelector(".root"), i = this._dragPreviewOverlay?.getAttribute("data-visible") === "true", s = this._pointerPreviewSize();
|
|
1341
|
-
if (!this._dragState.dropTarget) {
|
|
1342
|
-
i && t && t.setAttribute("data-drag-preview", "true");
|
|
1343
|
-
return;
|
|
1344
|
-
}
|
|
1345
|
-
const n = this._findDropzone(this._dragState.dropTarget);
|
|
1346
|
-
if (!n) {
|
|
1347
|
-
i && t && t.setAttribute("data-drag-preview", "true");
|
|
1348
|
-
return;
|
|
1349
|
-
}
|
|
1350
|
-
const a = this._ensureDragPreviewOverlay();
|
|
1351
|
-
a.innerHTML = `
|
|
1352
|
-
<div class="placeholder-content">
|
|
1353
|
-
<div class="placeholder-kicker">${I(e.kicker)}</div>
|
|
1354
|
-
<div class="placeholder-title">${I(e.title)}</div>
|
|
1355
|
-
<div class="placeholder-description">${I(e.description)}</div>
|
|
1356
|
-
</div>
|
|
1357
|
-
`;
|
|
1358
|
-
const d = n.getBoundingClientRect();
|
|
1359
|
-
t && t.setAttribute("data-drag-preview", "true"), a.style.setProperty("left", "-9999px"), a.style.setProperty("top", "-9999px"), s ? (a.style.setProperty("inline-size", `${s.width}px`), a.style.setProperty("block-size", `${s.height}px`)) : (a.style.removeProperty("inline-size"), a.style.removeProperty("block-size")), a.setAttribute("data-visible", "true");
|
|
1360
|
-
const o = a.getBoundingClientRect(), u = s?.width ?? o.width, c = s?.height ?? o.height, h = Math.max(16, Math.min(d.left, window.innerWidth - u - 16)), _ = Math.max(
|
|
1361
|
-
16,
|
|
1362
|
-
Math.min(
|
|
1363
|
-
d.top + (d.height - c) / 2,
|
|
1364
|
-
window.innerHeight - c - 16
|
|
1365
|
-
)
|
|
1366
|
-
);
|
|
1367
|
-
a.style.setProperty("left", `${Math.round(h)}px`), a.style.setProperty("top", `${Math.round(_)}px`);
|
|
1368
|
-
}
|
|
1369
|
-
_setDraggingVisualState(e, t) {
|
|
1370
|
-
e.forEach((r) => {
|
|
1371
|
-
const i = this._findItemElement(r);
|
|
1372
|
-
i && (i.setAttribute("data-dragging", t ? "true" : "false"), t && i.getBoundingClientRect());
|
|
1710
|
+
_setDraggingVisualState(t, e) {
|
|
1711
|
+
e && this._dragState?.clone && !this._dragState.keyboard || t.forEach((i) => {
|
|
1712
|
+
const r = this._findItemElement(i);
|
|
1713
|
+
r && (r.setAttribute("data-dragging", e ? "true" : "false"), e && r.getBoundingClientRect());
|
|
1373
1714
|
});
|
|
1374
1715
|
}
|
|
1375
|
-
_setDropTarget(
|
|
1376
|
-
const
|
|
1377
|
-
if (!(!this._dragState ||
|
|
1378
|
-
if (this._pendingDropTarget = null, this._dragState.dropTarget =
|
|
1716
|
+
_setDropTarget(t, e) {
|
|
1717
|
+
const i = this._dragState?.dropTarget ?? null;
|
|
1718
|
+
if (!(!this._dragState || H(i, t))) {
|
|
1719
|
+
if (this._pendingDropTarget = null, this._dragState.dropTarget = t, this._applyCurrentDropTargetVisualState(i), e?.announceLabel && this._announce(e.announceLabel), this._dragState.keyboard) {
|
|
1379
1720
|
this.requestRender();
|
|
1380
1721
|
return;
|
|
1381
1722
|
}
|
|
1382
|
-
this.
|
|
1723
|
+
this.root.querySelector(".root")?.setAttribute("data-drag-preview", t ? "true" : "false");
|
|
1383
1724
|
}
|
|
1384
1725
|
}
|
|
1385
|
-
_queueDropTarget(
|
|
1726
|
+
_queueDropTarget(t, e, i) {
|
|
1386
1727
|
if (!this._dragState) return;
|
|
1387
|
-
const
|
|
1388
|
-
if (
|
|
1728
|
+
const r = this._dragState.dropTarget ?? null;
|
|
1729
|
+
if (H(r, t)) {
|
|
1389
1730
|
this._pendingDropTarget = null;
|
|
1390
1731
|
return;
|
|
1391
1732
|
}
|
|
1392
|
-
if (!
|
|
1393
|
-
this._setDropTarget(
|
|
1733
|
+
if (!r && t) {
|
|
1734
|
+
this._setDropTarget(t, i);
|
|
1394
1735
|
return;
|
|
1395
1736
|
}
|
|
1396
|
-
const s = typeof
|
|
1397
|
-
if (n &&
|
|
1398
|
-
const a =
|
|
1399
|
-
s - n.startedAt >= a && this._setDropTarget(
|
|
1737
|
+
const s = typeof e == "number" && Number.isFinite(e) ? e : performance.now(), n = this._pendingDropTarget;
|
|
1738
|
+
if (n && H(n.target, t)) {
|
|
1739
|
+
const a = t ? W : Q;
|
|
1740
|
+
s - n.startedAt >= a && this._setDropTarget(t, n.announceLabel ? { announceLabel: n.announceLabel } : i);
|
|
1400
1741
|
return;
|
|
1401
1742
|
}
|
|
1402
1743
|
this._pendingDropTarget = {
|
|
1403
|
-
target:
|
|
1744
|
+
target: t,
|
|
1404
1745
|
startedAt: s,
|
|
1405
|
-
announceLabel:
|
|
1406
|
-
};
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1746
|
+
announceLabel: i?.announceLabel
|
|
1747
|
+
}, this._schedulePendingFlush(t ? W : Q);
|
|
1748
|
+
}
|
|
1749
|
+
// The settle delay is judged on the next pointer event, so a pointer that has stopped (over a place that
|
|
1750
|
+
// refuses the drop, say) would leave the old highlight on. This applies the change once the delay is up.
|
|
1751
|
+
_schedulePendingFlush(t) {
|
|
1752
|
+
this._pendingTimer && clearTimeout(this._pendingTimer), this._pendingTimer = setTimeout(() => {
|
|
1753
|
+
this._pendingTimer = null;
|
|
1754
|
+
const e = this._pendingDropTarget;
|
|
1755
|
+
!e || !this._dragState || this._dragState.committed || this._dragState.keyboard || this._setDropTarget(e.target, e.announceLabel ? { announceLabel: e.announceLabel } : void 0);
|
|
1756
|
+
}, t + 8);
|
|
1757
|
+
}
|
|
1758
|
+
_releaseDropTarget(t, e) {
|
|
1409
1759
|
if (!this._dragState) return null;
|
|
1410
|
-
if (Number.isFinite(
|
|
1411
|
-
const n = this._dropTargetFromPoint(
|
|
1760
|
+
if (Number.isFinite(t) && Number.isFinite(e)) {
|
|
1761
|
+
const n = this._dropTargetFromPoint(t, e);
|
|
1412
1762
|
if (n && this._canDrop(n, this._dragState.movedRootIds))
|
|
1413
1763
|
return this._pendingDropTarget = null, n;
|
|
1414
1764
|
}
|
|
1415
|
-
const
|
|
1765
|
+
const i = this._pendingDropTarget?.target ?? null;
|
|
1416
1766
|
this._pendingDropTarget = null;
|
|
1417
|
-
const
|
|
1418
|
-
if (
|
|
1767
|
+
const r = (n) => this._pointerIsOverList(n.listId, t, e);
|
|
1768
|
+
if (i && this._canDrop(i, this._dragState.movedRootIds) && r(i)) return i;
|
|
1419
1769
|
const s = this._dragState.dropTarget ?? null;
|
|
1420
|
-
return s && this._canDrop(s, this._dragState.movedRootIds) &&
|
|
1770
|
+
return s && this._canDrop(s, this._dragState.movedRootIds) && r(s) ? s : null;
|
|
1421
1771
|
}
|
|
1422
|
-
_pointerIsOverList(
|
|
1423
|
-
if (!Number.isFinite(
|
|
1424
|
-
const s = Array.from(this.root.querySelectorAll(".list[data-list-id]")).find((a) => a.getAttribute("data-list-id") ===
|
|
1772
|
+
_pointerIsOverList(t, e, i) {
|
|
1773
|
+
if (!Number.isFinite(e) || !Number.isFinite(i)) return !0;
|
|
1774
|
+
const s = Array.from(this.root.querySelectorAll(".list[data-list-id]")).find((a) => a.getAttribute("data-list-id") === t);
|
|
1425
1775
|
if (!s) return !0;
|
|
1426
1776
|
const n = s.getBoundingClientRect();
|
|
1427
|
-
return
|
|
1777
|
+
return e >= n.left && e <= n.right && i >= n.top && i <= n.bottom;
|
|
1428
1778
|
}
|
|
1429
|
-
_pathFromPoint(
|
|
1430
|
-
const
|
|
1431
|
-
let s = typeof
|
|
1432
|
-
for (; s && (s instanceof HTMLElement &&
|
|
1779
|
+
_pathFromPoint(t, e) {
|
|
1780
|
+
const i = [], r = this.root;
|
|
1781
|
+
let s = typeof r.elementFromPoint == "function" ? r.elementFromPoint(t, e) : this.ownerDocument?.elementFromPoint?.(t, e) ?? null;
|
|
1782
|
+
for (; s && (s instanceof HTMLElement && i.push(s), s !== this); ) {
|
|
1433
1783
|
if (s instanceof ShadowRoot) {
|
|
1434
1784
|
s = s.host;
|
|
1435
1785
|
continue;
|
|
1436
1786
|
}
|
|
1437
|
-
s = s.parentNode, !s &&
|
|
1787
|
+
s = s.parentNode, !s && i[i.length - 1]?.getRootNode() instanceof ShadowRoot && (s = i[i.length - 1].getRootNode().host);
|
|
1438
1788
|
}
|
|
1439
|
-
return
|
|
1789
|
+
return i;
|
|
1440
1790
|
}
|
|
1441
1791
|
_measureItemShellRects() {
|
|
1442
|
-
const
|
|
1443
|
-
return this.root.querySelectorAll(".item-shell[data-item-shell]").forEach((
|
|
1444
|
-
const
|
|
1445
|
-
if (!
|
|
1446
|
-
const
|
|
1447
|
-
|
|
1448
|
-
}),
|
|
1449
|
-
}
|
|
1450
|
-
_animateItemShellReflow(
|
|
1451
|
-
if (!
|
|
1452
|
-
const
|
|
1453
|
-
this.root.querySelectorAll(".item-shell[data-item-shell]").forEach((
|
|
1454
|
-
const
|
|
1455
|
-
if (!
|
|
1456
|
-
const s =
|
|
1792
|
+
const t = /* @__PURE__ */ new Map();
|
|
1793
|
+
return this.root.querySelectorAll(".item-shell[data-item-shell]").forEach((e) => {
|
|
1794
|
+
const i = e.getAttribute("data-item-shell");
|
|
1795
|
+
if (!i) return;
|
|
1796
|
+
const r = e.getBoundingClientRect();
|
|
1797
|
+
t.set(i, { top: r.top, left: r.left });
|
|
1798
|
+
}), t;
|
|
1799
|
+
}
|
|
1800
|
+
_animateItemShellReflow(t) {
|
|
1801
|
+
if (!t.size) return;
|
|
1802
|
+
const e = new Set(this._draggingIds());
|
|
1803
|
+
this.root.querySelectorAll(".item-shell[data-item-shell]").forEach((i) => {
|
|
1804
|
+
const r = i.getAttribute("data-item-shell");
|
|
1805
|
+
if (!r || e.has(r)) return;
|
|
1806
|
+
const s = t.get(r);
|
|
1457
1807
|
if (!s) return;
|
|
1458
|
-
const n =
|
|
1459
|
-
Math.abs(a) < 0.5 && Math.abs(d) < 0.5 || (
|
|
1460
|
-
|
|
1808
|
+
const n = i.getBoundingClientRect(), a = s.left - n.left, d = s.top - n.top;
|
|
1809
|
+
Math.abs(a) < 0.5 && Math.abs(d) < 0.5 || (i.style.transition = "none", i.style.transform = `translate(${a}px, ${d}px)`, i.style.willChange = "transform", i.getBoundingClientRect(), requestAnimationFrame(() => {
|
|
1810
|
+
i.style.transition = "transform 180ms ease", i.style.transform = "";
|
|
1461
1811
|
const o = () => {
|
|
1462
|
-
|
|
1812
|
+
i.style.transition = "", i.style.willChange = "", i.removeEventListener("transitionend", o);
|
|
1463
1813
|
};
|
|
1464
|
-
|
|
1814
|
+
i.addEventListener("transitionend", o), window.setTimeout(o, 220);
|
|
1465
1815
|
}));
|
|
1466
1816
|
});
|
|
1467
1817
|
}
|
|
1468
|
-
_previewCloneSubtreeItem(
|
|
1469
|
-
const
|
|
1818
|
+
_previewCloneSubtreeItem(t, e) {
|
|
1819
|
+
const i = t.id.includes("--copy-") ? t.id.split("--copy-")[0] : t.id;
|
|
1470
1820
|
return {
|
|
1471
|
-
...
|
|
1472
|
-
id: `${
|
|
1473
|
-
label:
|
|
1821
|
+
...t,
|
|
1822
|
+
id: `${i}--preview`,
|
|
1823
|
+
label: e[0] === t.id ? `${t.label} copy` : t.label
|
|
1474
1824
|
};
|
|
1475
1825
|
}
|
|
1476
1826
|
_projectedMoveResult() {
|
|
1477
|
-
return !this._dragState?.dropTarget || !this._canDrop(this._dragState.dropTarget, this._dragState.movedRootIds) ? null :
|
|
1827
|
+
return !this._dragState?.dropTarget || !this._canDrop(this._dragState.dropTarget, this._dragState.movedRootIds) ? null : j(
|
|
1478
1828
|
this._items,
|
|
1479
1829
|
this._lists,
|
|
1480
1830
|
this._dragState.dropTarget,
|
|
1481
1831
|
this._dragState.movedRootIds,
|
|
1482
1832
|
this._dragState.clone,
|
|
1483
|
-
(
|
|
1833
|
+
(t, e) => this._previewCloneSubtreeItem(t, e)
|
|
1484
1834
|
);
|
|
1485
1835
|
}
|
|
1486
|
-
_renderListTree(e,
|
|
1487
|
-
const d = T(
|
|
1488
|
-
const
|
|
1489
|
-
const
|
|
1490
|
-
return !
|
|
1491
|
-
}) :
|
|
1836
|
+
_renderListTree(t, e, i, r, s, n, a) {
|
|
1837
|
+
const d = T(t), o = M(t), c = (l) => {
|
|
1838
|
+
const p = o.get(w(e.id, l)) || [], g = this.sort === "label" ? [...p].sort((y, h) => {
|
|
1839
|
+
const f = d.get(y), x = d.get(h);
|
|
1840
|
+
return !f || !x ? 0 : f.label.localeCompare(x.label);
|
|
1841
|
+
}) : p;
|
|
1492
1842
|
let b = "";
|
|
1493
|
-
return
|
|
1494
|
-
const
|
|
1495
|
-
if (!
|
|
1496
|
-
const
|
|
1497
|
-
|
|
1498
|
-
r,
|
|
1843
|
+
return g.forEach((y) => {
|
|
1844
|
+
const h = d.get(y);
|
|
1845
|
+
if (!h || h.hidden) return;
|
|
1846
|
+
const f = this._renderChildBranch(
|
|
1847
|
+
h,
|
|
1499
1848
|
i,
|
|
1500
|
-
|
|
1849
|
+
r,
|
|
1850
|
+
c,
|
|
1501
1851
|
s,
|
|
1502
1852
|
n,
|
|
1503
1853
|
a
|
|
1504
1854
|
);
|
|
1505
|
-
!
|
|
1506
|
-
listId:
|
|
1507
|
-
parentId:
|
|
1508
|
-
beforeId:
|
|
1855
|
+
!at(h, this.filterQuery) && !st(f) || (b += this._renderDropzone({
|
|
1856
|
+
listId: e.id,
|
|
1857
|
+
parentId: l,
|
|
1858
|
+
beforeId: y,
|
|
1509
1859
|
mode: "before"
|
|
1510
|
-
}, "
|
|
1860
|
+
}, this._t("dropHere")), b += f);
|
|
1511
1861
|
}), b += this._renderDropzone({
|
|
1512
|
-
listId:
|
|
1513
|
-
parentId:
|
|
1862
|
+
listId: e.id,
|
|
1863
|
+
parentId: l,
|
|
1514
1864
|
beforeId: null,
|
|
1515
1865
|
mode: "before"
|
|
1516
|
-
}, "
|
|
1866
|
+
}, this._t("dropHere")), b;
|
|
1517
1867
|
};
|
|
1518
|
-
return `<div class="tree">${
|
|
1868
|
+
return `<div class="tree">${c(null)}</div>`;
|
|
1519
1869
|
}
|
|
1520
|
-
_renderChildBranch(e,
|
|
1521
|
-
const d =
|
|
1870
|
+
_renderChildBranch(t, e, i, r, s, n, a) {
|
|
1871
|
+
const d = v(t.id), o = n.has(t.id), c = o ? "" : r(t.id), l = st(c), p = o ? !1 : this._selection.includes(t.id), g = o ? !1 : i.has(t.id), b = t.disabled, y = b || t.dragDisabled || this._isDragLocked(), h = this._dragState?.dropTarget?.mode === "inside" && this._dragState.dropTarget.parentId === t.id, f = this._t(this._dragState?.clone ? "copyPreview" : "dropPreview"), x = this._t(
|
|
1872
|
+
this._dragState?.clone ? "releaseCopy" : this._dragState && this._dragState.movedRootIds.length > 1 ? "releaseMoveMany" : "releaseMove"
|
|
1873
|
+
), D = this._dragHandleMode(), C = this._usesCustomHandleSelector(), z = C ? "custom" : D, E = !C && D === "handle";
|
|
1522
1874
|
return `
|
|
1523
1875
|
<div class="item-shell" data-item-shell="${d}">
|
|
1524
1876
|
<div
|
|
1525
1877
|
class="item${o ? " item-placeholder" : ""}"
|
|
1526
1878
|
part="item"
|
|
1527
1879
|
data-id="${d}"
|
|
1528
|
-
data-drag-handle-mode="${
|
|
1529
|
-
${!o &&
|
|
1530
|
-
data-selected="${
|
|
1531
|
-
data-focused="${o ? "false" :
|
|
1532
|
-
data-dragging="${
|
|
1880
|
+
data-drag-handle-mode="${z}"
|
|
1881
|
+
${!o && z === "item" ? 'data-drag-trigger="item"' : ""}
|
|
1882
|
+
data-selected="${p}"
|
|
1883
|
+
data-focused="${o ? "false" : e === t.id}"
|
|
1884
|
+
data-dragging="${g}"
|
|
1533
1885
|
data-disabled="${b}"
|
|
1534
|
-
data-drop-inside-active="${
|
|
1886
|
+
data-drop-inside-active="${h ? "true" : "false"}"
|
|
1887
|
+
${this._renderItemFn && !o ? `data-rev="${tt(t.data)}"` : ""}
|
|
1535
1888
|
role="${o ? "presentation" : "option"}"
|
|
1536
|
-
aria-selected="${o ? "false" :
|
|
1889
|
+
aria-selected="${o ? "false" : p}"
|
|
1537
1890
|
aria-disabled="${b}"
|
|
1538
1891
|
aria-hidden="${o ? "true" : "false"}"
|
|
1539
|
-
tabindex="${o ? "-1" :
|
|
1892
|
+
tabindex="${o ? "-1" : e === t.id ? "0" : "-1"}"
|
|
1540
1893
|
>
|
|
1541
1894
|
${o ? `
|
|
1542
1895
|
<div class="placeholder-content">
|
|
1543
|
-
<div class="placeholder-kicker">${
|
|
1544
|
-
<div class="placeholder-title">${
|
|
1545
|
-
<div class="placeholder-description">${
|
|
1896
|
+
<div class="placeholder-kicker">${v(f)}</div>
|
|
1897
|
+
<div class="placeholder-title">${v(t.label)}</div>
|
|
1898
|
+
<div class="placeholder-description">${v(x)}</div>
|
|
1546
1899
|
</div>
|
|
1547
1900
|
` : `
|
|
1548
|
-
${
|
|
1901
|
+
${E ? `
|
|
1549
1902
|
<span
|
|
1550
1903
|
class="handle"
|
|
1551
1904
|
part="handle"
|
|
@@ -1555,7 +1908,7 @@ class he extends ee {
|
|
|
1555
1908
|
data-drag-trigger="handle"
|
|
1556
1909
|
data-id="${d}"
|
|
1557
1910
|
draggable="false"
|
|
1558
|
-
${
|
|
1911
|
+
${y ? "disabled" : ""}
|
|
1559
1912
|
>
|
|
1560
1913
|
<svg viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
1561
1914
|
<circle cx="5" cy="4" r="1.25"></circle>
|
|
@@ -1570,252 +1923,367 @@ class he extends ee {
|
|
|
1570
1923
|
<div class="item-content" data-action="select" data-id="${d}">
|
|
1571
1924
|
<div class="item-custom-content" part="item-custom-content" data-item-content-target="${d}"></div>
|
|
1572
1925
|
<div class="item-default-content">
|
|
1573
|
-
<div class="item-title">${
|
|
1574
|
-
${
|
|
1926
|
+
<div class="item-title">${v(t.label)}</div>
|
|
1927
|
+
${t.description ? `<div class="item-description">${v(t.description)}</div>` : ""}
|
|
1575
1928
|
<div class="item-meta">
|
|
1576
|
-
<span class="item-badge selection-badge" data-selection-badge="true" ${
|
|
1577
|
-
${
|
|
1578
|
-
${
|
|
1579
|
-
${s ?
|
|
1929
|
+
<span class="item-badge selection-badge" data-selection-badge="true" ${p && a ? "" : "hidden"}>${p && a ? v(this._t("badgeSelected")) : ""}</span>
|
|
1930
|
+
${t.cloneOnDrag ? `<span class="item-badge">${v(this._t("badgeClone"))}</span>` : ""}
|
|
1931
|
+
${t.dragDisabled ? `<span class="item-badge">${v(this._t("badgePinned"))}</span>` : ""}
|
|
1932
|
+
${s ? `<span class="item-badge drop-badge">${v(this._t("nestHere"))}</span>` : ""}
|
|
1580
1933
|
</div>
|
|
1581
1934
|
</div>
|
|
1582
1935
|
</div>
|
|
1583
1936
|
`}
|
|
1584
1937
|
</div>
|
|
1585
1938
|
${s && !o ? this._renderDropzone({
|
|
1586
|
-
listId:
|
|
1587
|
-
parentId:
|
|
1939
|
+
listId: t.listId,
|
|
1940
|
+
parentId: t.id,
|
|
1588
1941
|
beforeId: null,
|
|
1589
1942
|
mode: "inside"
|
|
1590
|
-
}, "
|
|
1591
|
-
${
|
|
1943
|
+
}, this._t("nestHere")) : ""}
|
|
1944
|
+
${l ? `<div class="children">${c}</div>` : ""}
|
|
1592
1945
|
</div>
|
|
1593
1946
|
`;
|
|
1594
1947
|
}
|
|
1595
|
-
_renderDropzone(
|
|
1596
|
-
const
|
|
1948
|
+
_renderDropzone(t, e) {
|
|
1949
|
+
const i = this._dragState?.dropTarget ?? this._externalTarget, r = i && i.listId === t.listId && i.parentId === t.parentId && i.beforeId === t.beforeId && i.mode === t.mode;
|
|
1597
1950
|
return `
|
|
1598
1951
|
<div
|
|
1599
1952
|
class="dropzone"
|
|
1600
1953
|
part="dropzone"
|
|
1601
|
-
data-list-id="${
|
|
1602
|
-
data-parent-id="${
|
|
1603
|
-
data-before-id="${
|
|
1604
|
-
data-mode="${
|
|
1954
|
+
data-list-id="${v(t.listId)}"
|
|
1955
|
+
data-parent-id="${v(t.parentId ?? "")}"
|
|
1956
|
+
data-before-id="${v(t.beforeId ?? "")}"
|
|
1957
|
+
data-mode="${t.mode}"
|
|
1605
1958
|
data-active="${r ? "true" : "false"}"
|
|
1606
1959
|
aria-hidden="true"
|
|
1607
1960
|
>
|
|
1608
|
-
<span class="dropzone-label">${
|
|
1961
|
+
<span class="dropzone-label">${v(e)}</span>
|
|
1609
1962
|
</div>
|
|
1610
1963
|
`;
|
|
1611
1964
|
}
|
|
1612
|
-
_onClick(
|
|
1613
|
-
const
|
|
1614
|
-
if (
|
|
1965
|
+
_onClick(t) {
|
|
1966
|
+
const e = t.composedPath(), i = e.find((o) => o instanceof HTMLElement && o.classList?.contains("toolbar")), r = this._dragActivatorFromPath(e), s = e.find((o) => o instanceof HTMLElement && o.classList.contains("item"));
|
|
1967
|
+
if (r && r.kind !== "item") return;
|
|
1615
1968
|
if (!s)
|
|
1616
|
-
return
|
|
1969
|
+
return i && !(t.target instanceof HTMLButtonElement), void 0;
|
|
1617
1970
|
const n = s.getAttribute("data-id");
|
|
1618
1971
|
if (!n) return;
|
|
1619
1972
|
const a = this._items.find((o) => o.id === n);
|
|
1620
1973
|
if (!a || a.disabled) return;
|
|
1621
|
-
const d =
|
|
1974
|
+
const d = t;
|
|
1622
1975
|
if (d.shiftKey ? this._selectRangeTo(n) : d.metaKey || d.ctrlKey ? this._toggleSelection(n) : this._setSelection([n], "pointer"), this._focusedId = n, this._rangeAnchorId = n, this._pendingFocusId = n, this._hasCustomItemRendering()) {
|
|
1623
1976
|
this._syncSelectionVisualState(), this._restorePendingFocus();
|
|
1624
1977
|
return;
|
|
1625
1978
|
}
|
|
1626
1979
|
this.requestRender();
|
|
1627
1980
|
}
|
|
1628
|
-
_onFocusIn(
|
|
1629
|
-
const
|
|
1630
|
-
|
|
1981
|
+
_onFocusIn(t) {
|
|
1982
|
+
const i = t.composedPath().find((r) => r instanceof HTMLElement && r.classList.contains("item"))?.getAttribute("data-id");
|
|
1983
|
+
i && (this._focusedId = i, this._syncSelectionVisualState());
|
|
1631
1984
|
}
|
|
1632
1985
|
// Keys typed into a control that lives inside an item (an <input> or <button> in a custom card)
|
|
1633
1986
|
// belong to that control: swallowing Space/Enter/arrows there made it impossible to type a space
|
|
1634
1987
|
// or press the button from the keyboard. The drag handle is part of the item, not a foreign control.
|
|
1635
|
-
_isForeignControl(
|
|
1636
|
-
const
|
|
1637
|
-
return !(
|
|
1638
|
-
}
|
|
1639
|
-
_onKeyDown(
|
|
1640
|
-
if (this._isForeignControl(
|
|
1641
|
-
const
|
|
1642
|
-
if (!
|
|
1643
|
-
const
|
|
1988
|
+
_isForeignControl(t) {
|
|
1989
|
+
const e = t.composedPath()[0];
|
|
1990
|
+
return !(e instanceof HTMLElement) || e.classList.contains("handle") || e.classList.contains("item") ? !1 : e.isContentEditable || e.matches('input, textarea, select, button, summary, a[href], [role="button"], [role="textbox"], [role="combobox"]');
|
|
1991
|
+
}
|
|
1992
|
+
_onKeyDown(t) {
|
|
1993
|
+
if (this._isForeignControl(t)) return;
|
|
1994
|
+
const e = this._visibleItemIds();
|
|
1995
|
+
if (!e.length) return;
|
|
1996
|
+
const i = this._focusedId && e.includes(this._focusedId) ? this._focusedId : e[0], r = e.indexOf(i), s = this._items.find((l) => l.id === i), a = (s ? this._lists.find((l) => l.id === s.listId) : null)?.orientation === "horizontal", d = this._isRtl(), o = a ? d ? "ArrowLeft" : "ArrowRight" : "ArrowDown", c = a ? d ? "ArrowRight" : "ArrowLeft" : "ArrowUp";
|
|
1644
1997
|
if (!this._dragState?.keyboard) {
|
|
1645
|
-
if (
|
|
1646
|
-
|
|
1998
|
+
if (t.key === o) {
|
|
1999
|
+
t.preventDefault(), this._moveFocusBy(e, r, 1);
|
|
1647
2000
|
return;
|
|
1648
2001
|
}
|
|
1649
|
-
if (
|
|
1650
|
-
|
|
2002
|
+
if (t.key === c) {
|
|
2003
|
+
t.preventDefault(), this._moveFocusBy(e, r, -1);
|
|
1651
2004
|
return;
|
|
1652
2005
|
}
|
|
1653
|
-
if ((
|
|
1654
|
-
|
|
2006
|
+
if ((t.ctrlKey || t.metaKey) && t.key.toLowerCase() === "a") {
|
|
2007
|
+
t.preventDefault(), this._setSelection(e, "keyboard"), this._announce(this._t("announceSelectedMany", { count: e.length }));
|
|
1655
2008
|
return;
|
|
1656
2009
|
}
|
|
1657
|
-
if (
|
|
1658
|
-
|
|
2010
|
+
if (t.key === "Enter") {
|
|
2011
|
+
t.preventDefault(), this._setSelection([i], "keyboard");
|
|
1659
2012
|
return;
|
|
1660
2013
|
}
|
|
1661
|
-
if (
|
|
1662
|
-
if (
|
|
1663
|
-
this._announce(
|
|
2014
|
+
if (t.key === " " || t.code === "Space") {
|
|
2015
|
+
if (t.preventDefault(), this._isDragLocked()) {
|
|
2016
|
+
this._announce(this._t("announceDragDisabled"));
|
|
1664
2017
|
return;
|
|
1665
2018
|
}
|
|
1666
|
-
const
|
|
1667
|
-
if (!
|
|
1668
|
-
const
|
|
2019
|
+
const l = this._selectedRootIds(i);
|
|
2020
|
+
if (!l.length) return;
|
|
2021
|
+
const p = this._itemClonesOnDrag(i);
|
|
1669
2022
|
this._dragState = {
|
|
1670
|
-
snapshot: this._items.map(
|
|
1671
|
-
movedRootIds:
|
|
1672
|
-
originId:
|
|
1673
|
-
clone:
|
|
2023
|
+
snapshot: this._items.map(A),
|
|
2024
|
+
movedRootIds: l,
|
|
2025
|
+
originId: i,
|
|
2026
|
+
clone: p,
|
|
1674
2027
|
keyboard: !0,
|
|
1675
|
-
dropTarget: this._initialKeyboardDropTarget(
|
|
2028
|
+
dropTarget: this._initialKeyboardDropTarget(i),
|
|
1676
2029
|
committed: !1
|
|
1677
2030
|
};
|
|
1678
|
-
const
|
|
1679
|
-
this._announce(`${
|
|
2031
|
+
const g = l.length === 1 ? this._t("announceLifted", { label: s?.label || "item" }) : this._t("announceLiftedMany", { count: l.length });
|
|
2032
|
+
this._announce(`${g} ${this._t("announceLiftedHelp")}`), this.requestRender();
|
|
1680
2033
|
return;
|
|
1681
2034
|
}
|
|
1682
|
-
if (
|
|
2035
|
+
if (t.key === "Escape") {
|
|
1683
2036
|
this._setSelection([], "keyboard");
|
|
1684
2037
|
return;
|
|
1685
2038
|
}
|
|
1686
2039
|
return;
|
|
1687
2040
|
}
|
|
1688
|
-
if (
|
|
1689
|
-
|
|
2041
|
+
if (t.key === "Escape") {
|
|
2042
|
+
t.preventDefault(), this._cancelDrag(!0);
|
|
1690
2043
|
return;
|
|
1691
2044
|
}
|
|
1692
|
-
if (
|
|
1693
|
-
|
|
1694
|
-
const
|
|
1695
|
-
if (!
|
|
1696
|
-
this._commitMove(
|
|
2045
|
+
if (t.key === "Enter" || t.key === " " || t.code === "Space") {
|
|
2046
|
+
t.preventDefault();
|
|
2047
|
+
const l = this._dragState.dropTarget;
|
|
2048
|
+
if (!l) return;
|
|
2049
|
+
this._commitMove(l, this._dragState.movedRootIds, this._dragState.clone, "keyboard");
|
|
1697
2050
|
return;
|
|
1698
2051
|
}
|
|
1699
|
-
if (["ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"].includes(
|
|
1700
|
-
|
|
1701
|
-
const
|
|
1702
|
-
this._moveKeyboardDropTarget(
|
|
2052
|
+
if (["ArrowDown", "ArrowUp", "ArrowLeft", "ArrowRight"].includes(t.key)) {
|
|
2053
|
+
t.preventDefault();
|
|
2054
|
+
const l = d ? "ArrowLeft" : "ArrowRight", p = t.key === "ArrowDown" || t.key === l ? 1 : -1;
|
|
2055
|
+
this._moveKeyboardDropTarget(p);
|
|
1703
2056
|
}
|
|
1704
2057
|
}
|
|
1705
2058
|
_isRtl() {
|
|
1706
|
-
const
|
|
1707
|
-
return
|
|
2059
|
+
const t = this.ownerDocument?.defaultView?.getComputedStyle(this).direction;
|
|
2060
|
+
return t ? t === "rtl" : this.closest("[dir]")?.getAttribute("dir") === "rtl";
|
|
1708
2061
|
}
|
|
1709
|
-
_moveFocusBy(
|
|
1710
|
-
const
|
|
1711
|
-
this._focusedId = s, this._pendingFocusId = s, !this._applyInteractiveStateInPlace({ restoreFocus: !0 }) && this.requestRender();
|
|
2062
|
+
_moveFocusBy(t, e, i) {
|
|
2063
|
+
const r = Math.max(0, Math.min(t.length - 1, e + i)), s = t[r];
|
|
2064
|
+
this._focusedId = s, this._pendingFocusId = s, this._revealPending = !0, !this._applyInteractiveStateInPlace({ restoreFocus: !0 }) && this.requestRender();
|
|
1712
2065
|
}
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
if (
|
|
1720
|
-
|
|
1721
|
-
return;
|
|
1722
|
-
}
|
|
1723
|
-
const i = this._items.find((a) => a.id === r);
|
|
1724
|
-
if (!i || i.disabled || i.dragDisabled) {
|
|
1725
|
-
e.preventDefault();
|
|
2066
|
+
// The browser must not start a native drag while a card is being dragged with the pointer (an image or a
|
|
2067
|
+
// link inside a card would): the pointer drag is the only drag.
|
|
2068
|
+
_onDragStart(t) {
|
|
2069
|
+
(this._pointerGesture || this._dragState && !this._dragState.keyboard) && t.preventDefault();
|
|
2070
|
+
}
|
|
2071
|
+
_onDocumentKeyDown(t) {
|
|
2072
|
+
if (t.key === "Alt") {
|
|
2073
|
+
this._setNestModifier(!0);
|
|
1726
2074
|
return;
|
|
1727
2075
|
}
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
if (
|
|
1745
|
-
|
|
1746
|
-
if (!t || !this._canDrop(t, this._dragState.movedRootIds)) {
|
|
1747
|
-
this._queueDropTarget(null, e.timeStamp);
|
|
2076
|
+
t.key === "Escape" && (!this._dragState || this._dragState.keyboard || (t.preventDefault(), this._cancelDrag(!0)));
|
|
2077
|
+
}
|
|
2078
|
+
_onDocumentKeyUp(t) {
|
|
2079
|
+
t.key === "Alt" && this._setNestModifier(!1);
|
|
2080
|
+
}
|
|
2081
|
+
// Pressing or releasing Alt changes where a card would land without the pointer moving, so the target is
|
|
2082
|
+
// worked out again straight away.
|
|
2083
|
+
_setNestModifier(t) {
|
|
2084
|
+
this._nestModifier !== t && (this._nestModifier = t, !(!this._dragState || this._dragState.keyboard || this._dragState.committed || !this._lastPointer) && this._retarget(this._lastPointer.x, this._lastPointer.y, { immediate: !0 }));
|
|
2085
|
+
}
|
|
2086
|
+
// Works out where the held card would land at (x, y): in this element, or, when it is over another element of the
|
|
2087
|
+
// same group, in that one. `immediate` skips the short delay that stops the highlight flickering.
|
|
2088
|
+
_retarget(t, e, i) {
|
|
2089
|
+
const r = this._dragState;
|
|
2090
|
+
if (!r || r.keyboard || r.committed) return;
|
|
2091
|
+
const s = this._externalAt(t, e);
|
|
2092
|
+
if (s) {
|
|
2093
|
+
r.dropTarget && this._setDropTarget(null), this._pendingDropTarget = null, this._noteRefusal(!!s.target && !s.usable), this._setExternal(s.usable && s.target ? { peer: s.peer, target: s.target } : null);
|
|
1748
2094
|
return;
|
|
1749
2095
|
}
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
2096
|
+
this._setExternal(null);
|
|
2097
|
+
const n = this._dropTargetFromPoint(t, e), a = n && this._canDrop(n, r.movedRootIds) ? n : null;
|
|
2098
|
+
this._noteRefusal(!!n && !a), i.immediate ? this._setDropTarget(a) : this._queueDropTarget(a, i.timestamp ?? performance.now());
|
|
2099
|
+
}
|
|
2100
|
+
// The other element of the same group under the pointer (this one wins where they overlap), and whether it
|
|
2101
|
+
// takes the held items at the place it found.
|
|
2102
|
+
_peerUnder(t, e) {
|
|
2103
|
+
const i = this._group();
|
|
2104
|
+
if (!i) return null;
|
|
2105
|
+
const r = (s) => {
|
|
2106
|
+
const n = s.getBoundingClientRect();
|
|
2107
|
+
return t >= n.left && t <= n.right && e >= n.top && e <= n.bottom && n.width > 0 && n.height > 0;
|
|
2108
|
+
};
|
|
2109
|
+
if (r(this)) return null;
|
|
2110
|
+
for (const s of $._instances)
|
|
2111
|
+
if (!(s === this || s._group() !== i || !s.isConnected || s.ownerDocument !== this.ownerDocument) && r(s))
|
|
2112
|
+
return s;
|
|
2113
|
+
return null;
|
|
1762
2114
|
}
|
|
1763
|
-
|
|
1764
|
-
|
|
2115
|
+
_externalAt(t, e) {
|
|
2116
|
+
if (!this._dragState || this._dragState.keyboard) return null;
|
|
2117
|
+
const i = this._peerUnder(t, e);
|
|
2118
|
+
if (!i) return null;
|
|
2119
|
+
const r = this._sessionFor(this._dragState.movedRootIds, this._dragState.clone);
|
|
2120
|
+
i._nestModifier = this._nestModifier;
|
|
2121
|
+
const s = i._dropTargetFromPoint(t, e), n = !!s && i._canDrop(s, r.rootIds, r.clone, r);
|
|
2122
|
+
return { peer: i, target: s, usable: n };
|
|
2123
|
+
}
|
|
2124
|
+
_setExternal(t) {
|
|
2125
|
+
const e = this._dragState;
|
|
2126
|
+
if (!e) return;
|
|
2127
|
+
const i = e.external ?? null;
|
|
2128
|
+
if (!(i && t && i.peer === t.peer && H(i.target, t.target))) {
|
|
2129
|
+
if (!i && !t) {
|
|
2130
|
+
e.external = null;
|
|
2131
|
+
return;
|
|
2132
|
+
}
|
|
2133
|
+
i?.peer._showExternalTarget(null), e.external = t, t?.peer._showExternalTarget(t.target);
|
|
2134
|
+
}
|
|
1765
2135
|
}
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
2136
|
+
// Marks the place in this element where a card held over it from another element would land.
|
|
2137
|
+
_showExternalTarget(t) {
|
|
2138
|
+
H(this._externalTarget, t) || (this._setDropTargetVisualState(this._externalTarget, !1), this._externalTarget = t, this._setDropTargetVisualState(t, !0));
|
|
2139
|
+
}
|
|
2140
|
+
// The held items, with all their children, as they leave this element.
|
|
2141
|
+
_sessionFor(t, e) {
|
|
2142
|
+
const i = this._dragState?.session;
|
|
2143
|
+
if (i && i.clone === e && i.rootIds.join() === t.join()) return i;
|
|
2144
|
+
const r = T(this._items), s = M(this._items), n = /* @__PURE__ */ new Set(), a = [], d = (c) => {
|
|
2145
|
+
const l = r.get(c);
|
|
2146
|
+
!l || n.has(c) || (n.add(c), a.push(A(l)), (s.get(w(l.listId, c)) || []).forEach(d));
|
|
2147
|
+
};
|
|
2148
|
+
t.forEach(d);
|
|
2149
|
+
const o = {
|
|
2150
|
+
source: this,
|
|
2151
|
+
rootIds: [...t],
|
|
2152
|
+
items: a,
|
|
2153
|
+
clone: e,
|
|
2154
|
+
sourceListIds: Array.from(new Set(t.map((c) => r.get(c)?.listId).filter((c) => !!c)))
|
|
2155
|
+
};
|
|
2156
|
+
return this._dragState && (this._dragState.session = o), o;
|
|
2157
|
+
}
|
|
2158
|
+
// Moves (or copies) items into another element: both report it, and either can cancel it first.
|
|
2159
|
+
_transferTo(t, e, i, r, s) {
|
|
2160
|
+
const n = () => (this._dragState && this._cancelDrag(!1), this._announce(this._t("announceRejected")), !1), a = this._sessionFor(i, r);
|
|
2161
|
+
if (!t._canDrop(e, a.rootIds, a.clone, a)) return n();
|
|
2162
|
+
const d = new Set(t._items.map((h) => h.id)), o = /* @__PURE__ */ new Map();
|
|
2163
|
+
a.items.forEach((h) => {
|
|
2164
|
+
if (!r) {
|
|
2165
|
+
o.set(h.id, h.id);
|
|
2166
|
+
return;
|
|
2167
|
+
}
|
|
2168
|
+
const f = h.id.includes("--copy-") ? h.id.split("--copy-")[0] : h.id;
|
|
2169
|
+
let x = "";
|
|
2170
|
+
do
|
|
2171
|
+
x = `${f}--copy-${this._cloneSeed++}`;
|
|
2172
|
+
while (d.has(x));
|
|
2173
|
+
d.add(x), o.set(h.id, x);
|
|
2174
|
+
});
|
|
2175
|
+
const c = a.items.map((h) => {
|
|
2176
|
+
const f = a.rootIds.indexOf(h.id);
|
|
2177
|
+
return {
|
|
2178
|
+
...A(h),
|
|
2179
|
+
id: o.get(h.id) || h.id,
|
|
2180
|
+
parentId: h.parentId && o.has(h.parentId) && o.get(h.parentId) || null,
|
|
2181
|
+
listId: e.listId,
|
|
2182
|
+
label: r && f === 0 ? `${h.label} copy` : h.label,
|
|
2183
|
+
...h.data !== void 0 ? { data: B(h.data) } : {}
|
|
1774
2184
|
};
|
|
1775
|
-
|
|
2185
|
+
}), l = a.rootIds.map((h) => o.get(h) || h), p = j(
|
|
2186
|
+
[...t._items, ...c],
|
|
2187
|
+
t._lists,
|
|
2188
|
+
e,
|
|
2189
|
+
l,
|
|
2190
|
+
!1,
|
|
2191
|
+
(h) => h
|
|
2192
|
+
), g = t._lists.find((h) => h.id === e.listId), b = {
|
|
2193
|
+
items: p.items,
|
|
2194
|
+
movedIds: l,
|
|
2195
|
+
nextSelection: [...l],
|
|
2196
|
+
operation: r ? "clone" : e.mode === "inside" ? "nest" : "transfer",
|
|
2197
|
+
target: e,
|
|
2198
|
+
clone: r,
|
|
2199
|
+
source: s,
|
|
2200
|
+
external: { direction: "in", peer: this }
|
|
2201
|
+
};
|
|
2202
|
+
let y = null;
|
|
2203
|
+
if (!r) {
|
|
2204
|
+
const h = new Set(a.items.map((f) => f.id));
|
|
2205
|
+
y = {
|
|
2206
|
+
items: U(this._lists, this._items.filter((f) => !h.has(f.id)).map(A)),
|
|
2207
|
+
movedIds: [...a.rootIds],
|
|
2208
|
+
nextSelection: this._selection.filter((f) => !h.has(f)),
|
|
2209
|
+
operation: "transfer",
|
|
2210
|
+
target: e,
|
|
2211
|
+
clone: !1,
|
|
2212
|
+
source: s,
|
|
2213
|
+
external: { direction: "out", peer: t },
|
|
2214
|
+
destination: g?.label || e.listId
|
|
2215
|
+
};
|
|
2216
|
+
}
|
|
2217
|
+
return !t._askBeforeChange(b) || y && !this._askBeforeChange(y) ? n() : (this._setExternal(null), t._showExternalTarget(null), y ? this._applyPlan(y) : (this._dragState && (this._dragState.committed = !0), this._stopAutoScroll(), this._clearPointerDragPreview(), this._dragState = null, this._removeDragImage(), this.requestRender()), t._applyPlan(b), !0);
|
|
2218
|
+
}
|
|
2219
|
+
// Over a place that exists but will not take the drop (a full list, a read-only one, canDrop said no) the
|
|
2220
|
+
// lifted card says so.
|
|
2221
|
+
_noteRefusal(t) {
|
|
2222
|
+
this._dragImage?.toggleAttribute && this._dragImage.toggleAttribute("data-refused", t);
|
|
2223
|
+
}
|
|
2224
|
+
_dropTargetFromPath(t, e, i) {
|
|
2225
|
+
const r = t.find((I) => I instanceof HTMLElement && I.classList.contains("dropzone"));
|
|
2226
|
+
if (r) {
|
|
2227
|
+
const I = {
|
|
2228
|
+
listId: r.getAttribute("data-list-id") || "",
|
|
2229
|
+
parentId: r.getAttribute("data-parent-id") || null,
|
|
2230
|
+
beforeId: r.getAttribute("data-before-id") || null,
|
|
2231
|
+
mode: r.getAttribute("data-mode") === "inside" ? "inside" : "before"
|
|
2232
|
+
};
|
|
2233
|
+
if (I.listId) return I;
|
|
1776
2234
|
}
|
|
1777
|
-
const s =
|
|
2235
|
+
const s = t.find((I) => I instanceof HTMLElement && I.classList.contains("item"));
|
|
1778
2236
|
if (!s) {
|
|
1779
|
-
const
|
|
1780
|
-
(
|
|
2237
|
+
const P = t.find(
|
|
2238
|
+
(k) => k instanceof HTMLElement && k.classList.contains("list") && k.hasAttribute("data-list-id")
|
|
1781
2239
|
)?.getAttribute("data-list-id");
|
|
1782
|
-
return
|
|
2240
|
+
return P ? { listId: P, parentId: null, beforeId: null, mode: "before" } : null;
|
|
1783
2241
|
}
|
|
1784
2242
|
const n = s.getAttribute("data-id");
|
|
1785
2243
|
if (!n) return null;
|
|
1786
|
-
const a = this._items.find((
|
|
2244
|
+
const a = this._items.find((I) => I.id === n);
|
|
1787
2245
|
if (!a) return null;
|
|
1788
|
-
const d = this._lists.find((
|
|
1789
|
-
if (
|
|
1790
|
-
return {
|
|
1791
|
-
listId: a.listId,
|
|
1792
|
-
parentId: a.parentId,
|
|
1793
|
-
beforeId: a.id,
|
|
1794
|
-
mode: "before"
|
|
1795
|
-
};
|
|
1796
|
-
if (v && m >= 0.34 && m <= 0.74)
|
|
2246
|
+
const d = this._lists.find((I) => I.id === a.listId), o = s.getBoundingClientRect(), c = d?.orientation === "horizontal", l = c ? o.left : o.top, p = c ? o.right : o.bottom, g = c ? e : i, b = Math.max(1, p - l), y = (g - l) / b, h = c && this._isRtl() ? 1 - y : y, f = this.getAttribute("allow-nesting") !== "false" && !a.disabled, x = this._nestTrigger(), D = f && (x === "area" ? h > 0.34 && h <= 0.74 : h >= 0.25 && h <= 0.75 && (this._nestModifier || x === "gutter" && this._inNestGutter(o, e, i, c))), C = x === "area" ? h <= 0.34 : h < 0.5;
|
|
2247
|
+
if (D)
|
|
1797
2248
|
return {
|
|
1798
2249
|
listId: a.listId,
|
|
1799
2250
|
parentId: a.id,
|
|
1800
2251
|
beforeId: null,
|
|
1801
2252
|
mode: "inside"
|
|
1802
2253
|
};
|
|
1803
|
-
|
|
2254
|
+
if (C)
|
|
2255
|
+
return {
|
|
2256
|
+
listId: a.listId,
|
|
2257
|
+
parentId: a.parentId,
|
|
2258
|
+
beforeId: a.id,
|
|
2259
|
+
mode: "before"
|
|
2260
|
+
};
|
|
2261
|
+
const E = M(this._items).get(w(a.listId, a.parentId)) || [], F = E.indexOf(a.id), _ = F >= 0 && E[F + 1] || null;
|
|
1804
2262
|
return {
|
|
1805
2263
|
listId: a.listId,
|
|
1806
2264
|
parentId: a.parentId,
|
|
1807
|
-
beforeId:
|
|
2265
|
+
beforeId: _,
|
|
1808
2266
|
mode: "before"
|
|
1809
2267
|
};
|
|
1810
2268
|
}
|
|
1811
|
-
|
|
1812
|
-
|
|
2269
|
+
// The far side of a card (its right in a left-to-right list, the bottom of a card in a horizontal lane):
|
|
2270
|
+
// somewhere a pointer only goes on purpose, and the only way to nest without a keyboard.
|
|
2271
|
+
_inNestGutter(t, e, i, r) {
|
|
2272
|
+
if (r) {
|
|
2273
|
+
const a = t.bottom - t.top;
|
|
2274
|
+
return i >= t.bottom - Math.max(24, Math.min(70, a * 0.3));
|
|
2275
|
+
}
|
|
2276
|
+
const s = t.right - t.left, n = Math.max(48, Math.min(140, s * 0.3));
|
|
2277
|
+
return this._isRtl() ? e <= t.left + n : e >= t.right - n;
|
|
2278
|
+
}
|
|
2279
|
+
_dropTargetFromPoint(t, e) {
|
|
2280
|
+
return this._dropTargetFromPath(this._pathFromPoint(t, e), t, e);
|
|
1813
2281
|
}
|
|
1814
|
-
_beginPointerDrag(
|
|
2282
|
+
_beginPointerDrag(t, e) {
|
|
1815
2283
|
if (!this._pointerGesture || this._dragState) return;
|
|
1816
|
-
const
|
|
1817
|
-
|
|
1818
|
-
snapshot: this._items.map(
|
|
2284
|
+
const i = this._items.find((r) => r.id === this._pointerGesture?.originId);
|
|
2285
|
+
i && (this._dragState = {
|
|
2286
|
+
snapshot: this._items.map(A),
|
|
1819
2287
|
movedRootIds: [...this._pointerGesture.movedRootIds],
|
|
1820
2288
|
originId: this._pointerGesture.originId,
|
|
1821
2289
|
clone: this._pointerGesture.clone,
|
|
@@ -1823,336 +2291,458 @@ class he extends ee {
|
|
|
1823
2291
|
dropTarget: null,
|
|
1824
2292
|
committed: !1
|
|
1825
2293
|
}, this._pendingDropTarget = null, this._applyPointerPreview(
|
|
1826
|
-
e,
|
|
1827
2294
|
t,
|
|
2295
|
+
e,
|
|
1828
2296
|
this._dragState.movedRootIds.length,
|
|
1829
|
-
this._dragState.clone
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
if (!t || !r) return;
|
|
2297
|
+
this._dragState.clone,
|
|
2298
|
+
{ x: this._pointerGesture.startX, y: this._pointerGesture.startY }
|
|
2299
|
+
), this._setDraggingVisualState(this._draggingIds(), !0), this._announceDragging(i.label, this._dragState.movedRootIds.length, this._dragState.clone));
|
|
2300
|
+
}
|
|
2301
|
+
_onPointerDown(t) {
|
|
2302
|
+
const e = this._dragActivatorFromPath(t.composedPath()), i = e?.id;
|
|
2303
|
+
if (!e || !i) return;
|
|
1837
2304
|
if (this._isDragLocked()) {
|
|
1838
|
-
|
|
2305
|
+
t.preventDefault(), this._announce(this._t("announceDragDisabled"));
|
|
1839
2306
|
return;
|
|
1840
2307
|
}
|
|
1841
|
-
const
|
|
1842
|
-
if (!
|
|
1843
|
-
|
|
2308
|
+
const r = this._items.find((a) => a.id === i);
|
|
2309
|
+
if (!r || r.disabled || r.dragDisabled) {
|
|
2310
|
+
t.preventDefault();
|
|
1844
2311
|
return;
|
|
1845
2312
|
}
|
|
1846
|
-
e.
|
|
2313
|
+
const s = t.pointerType === "touch" && e.kind !== "handle" && this._touchHoldDelay() > 0;
|
|
2314
|
+
s || t.preventDefault();
|
|
1847
2315
|
try {
|
|
1848
|
-
|
|
2316
|
+
e.element.setPointerCapture?.(t.pointerId);
|
|
1849
2317
|
} catch {
|
|
1850
2318
|
}
|
|
1851
|
-
|
|
1852
|
-
this.
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
2319
|
+
this._clearHoldTimer();
|
|
2320
|
+
const n = this._selection.includes(i) ? this._selectedRootIds(i) : [i];
|
|
2321
|
+
if (this._pointerGesture = {
|
|
2322
|
+
pointerId: t.pointerId,
|
|
2323
|
+
pointerType: t.pointerType,
|
|
2324
|
+
originId: i,
|
|
2325
|
+
movedRootIds: n,
|
|
2326
|
+
clone: this._itemClonesOnDrag(i),
|
|
2327
|
+
startX: t.clientX,
|
|
2328
|
+
startY: t.clientY,
|
|
1860
2329
|
moved: !1,
|
|
1861
|
-
captureTarget:
|
|
1862
|
-
|
|
2330
|
+
captureTarget: e.element,
|
|
2331
|
+
hold: s,
|
|
2332
|
+
holdTimer: null
|
|
2333
|
+
}, s) {
|
|
2334
|
+
const a = this._pointerGesture;
|
|
2335
|
+
a.holdTimer = setTimeout(() => {
|
|
2336
|
+
if (a.holdTimer = null, !(this._pointerGesture !== a || a.moved)) {
|
|
2337
|
+
a.hold = !1, a.moved = !0, this._beginPointerDrag(a.startX, a.startY), this._lastPointer = { x: a.startX, y: a.startY };
|
|
2338
|
+
try {
|
|
2339
|
+
this.ownerDocument?.defaultView?.navigator?.vibrate?.(8);
|
|
2340
|
+
} catch {
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
}, this._touchHoldDelay());
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2346
|
+
_touchHoldDelay() {
|
|
2347
|
+
const t = this.getAttribute("touch-hold-delay");
|
|
2348
|
+
if (t === null || t.trim() === "") return Z;
|
|
2349
|
+
const e = Number(t);
|
|
2350
|
+
return Number.isFinite(e) ? Math.min(2e3, Math.max(0, e)) : Z;
|
|
2351
|
+
}
|
|
2352
|
+
_clearHoldTimer() {
|
|
2353
|
+
this._pointerGesture?.holdTimer && clearTimeout(this._pointerGesture.holdTimer), this._pointerGesture && (this._pointerGesture.holdTimer = null);
|
|
2354
|
+
}
|
|
2355
|
+
// While a card is lifted (or about to be) the finger must drag it, not scroll the page.
|
|
2356
|
+
_onTouchMove(t) {
|
|
2357
|
+
this._dragState && !this._dragState.keyboard && t.cancelable && t.preventDefault();
|
|
2358
|
+
}
|
|
2359
|
+
// A long press raises the system's context menu (copy, save image): not while a card is held.
|
|
2360
|
+
_onContextMenu(t) {
|
|
2361
|
+
(this._pointerGesture?.pointerType === "touch" || this._dragState && !this._dragState.keyboard) && t.preventDefault();
|
|
1863
2362
|
}
|
|
1864
|
-
_onPointerMove(
|
|
1865
|
-
if (!(!this._pointerGesture ||
|
|
1866
|
-
if (
|
|
1867
|
-
|
|
1868
|
-
|
|
2363
|
+
_onPointerMove(t) {
|
|
2364
|
+
if (!(!this._pointerGesture || t.pointerId !== this._pointerGesture.pointerId)) {
|
|
2365
|
+
if (this._pointerGesture.hold) {
|
|
2366
|
+
Math.hypot(t.clientX - this._pointerGesture.startX, t.clientY - this._pointerGesture.startY) > pt && (this._clearHoldTimer(), this._pointerGesture = null);
|
|
2367
|
+
return;
|
|
1869
2368
|
}
|
|
1870
|
-
if (
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
this._queueDropTarget(null, e.timeStamp);
|
|
1874
|
-
return;
|
|
1875
|
-
}
|
|
1876
|
-
this._queueDropTarget(t, e.timeStamp);
|
|
2369
|
+
if (t.preventDefault(), !this._pointerGesture.moved) {
|
|
2370
|
+
if (Math.hypot(t.clientX - this._pointerGesture.startX, t.clientY - this._pointerGesture.startY) < 6) return;
|
|
2371
|
+
this._pointerGesture.moved = !0, this._beginPointerDrag(t.clientX, t.clientY);
|
|
1877
2372
|
}
|
|
2373
|
+
!this._dragState || this._dragState.keyboard || (this._nestModifier = !!t.altKey, this._lastPointer = { x: t.clientX, y: t.clientY }, this._movePointerPreview(t.clientX, t.clientY), this._updateAutoScroll(t.clientX, t.clientY), this._retarget(t.clientX, t.clientY, { timestamp: t.timeStamp }));
|
|
1878
2374
|
}
|
|
1879
2375
|
}
|
|
1880
|
-
// Holding a dragged card near
|
|
1881
|
-
//
|
|
1882
|
-
|
|
1883
|
-
|
|
2376
|
+
// Holding a dragged card near an edge scrolls what is under it: the board sideways, the list under
|
|
2377
|
+
// the pointer when it has its own scrollbar, and the page (or the nearest scrolling container) up
|
|
2378
|
+
// and down, so lists and positions that are off screen can be reached with the pointer.
|
|
2379
|
+
_updateAutoScroll(t, e) {
|
|
2380
|
+
this._autoScrollPoint = { x: t, y: e }, !this._autoScrollFrame && typeof requestAnimationFrame == "function" && (this._autoScrollFrame = requestAnimationFrame(this._autoScrollTick));
|
|
1884
2381
|
}
|
|
1885
2382
|
_stopAutoScroll() {
|
|
1886
2383
|
this._autoScrollFrame && typeof cancelAnimationFrame == "function" && cancelAnimationFrame(this._autoScrollFrame), this._autoScrollFrame = 0, this._autoScrollPoint = null;
|
|
1887
2384
|
}
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
2385
|
+
// Scrolls this element's own board sideways, and the list under (x, y) when it has a scrollbar of its own, if the
|
|
2386
|
+
// pointer is at their edge. True when something moved.
|
|
2387
|
+
_scrollOwn(t, e) {
|
|
2388
|
+
const i = this.ownerDocument?.defaultView;
|
|
2389
|
+
let r = !1;
|
|
2390
|
+
const s = this.root.querySelector(".lists");
|
|
2391
|
+
if (s && s.scrollWidth > s.clientWidth + 1) {
|
|
2392
|
+
const a = s.getBoundingClientRect(), d = K(t, Math.max(0, a.left), Math.min(i?.innerWidth ?? 1 / 0, a.right));
|
|
2393
|
+
d && (s.scrollLeft += d, r = !0);
|
|
2394
|
+
}
|
|
2395
|
+
const n = this._pathFromPoint(t, e).find((a) => a.classList?.contains("items"));
|
|
2396
|
+
if (n && n.scrollHeight > n.clientHeight + 1 && i?.getComputedStyle(n).overflowY !== "visible") {
|
|
2397
|
+
const a = n.getBoundingClientRect(), d = K(e, a.top, a.bottom);
|
|
2398
|
+
d && (n.scrollTop += d, r = !0);
|
|
2399
|
+
}
|
|
2400
|
+
return r;
|
|
2401
|
+
}
|
|
2402
|
+
_onPointerUp(t) {
|
|
2403
|
+
if (!this._pointerGesture || t.pointerId !== this._pointerGesture.pointerId) return;
|
|
2404
|
+
t.preventDefault();
|
|
1891
2405
|
try {
|
|
1892
|
-
this._pointerGesture.captureTarget?.releasePointerCapture?.(
|
|
2406
|
+
this._pointerGesture.captureTarget?.releasePointerCapture?.(t.pointerId);
|
|
1893
2407
|
} catch {
|
|
1894
2408
|
}
|
|
1895
|
-
const
|
|
1896
|
-
if (this._pointerGesture = null, this._stopAutoScroll(), !this._dragState || this._dragState.keyboard) return;
|
|
1897
|
-
|
|
1898
|
-
|
|
2409
|
+
const e = this._pointerGesture;
|
|
2410
|
+
if (this._clearHoldTimer(), this._pointerGesture = null, this._stopAutoScroll(), !this._dragState || this._dragState.keyboard) return;
|
|
2411
|
+
this._nestModifier = !!t.altKey;
|
|
2412
|
+
const i = e.moved ? this._externalAt(t.clientX, t.clientY) : null;
|
|
2413
|
+
if (i) {
|
|
2414
|
+
i.usable && i.target ? this._transferTo(i.peer, i.target, this._dragState.movedRootIds, this._dragState.clone, "pointer") : this._cancelDrag(!0);
|
|
2415
|
+
return;
|
|
2416
|
+
}
|
|
2417
|
+
const r = e.moved ? this._releaseDropTarget(t.clientX, t.clientY) : null;
|
|
2418
|
+
if (e.moved && r) {
|
|
1899
2419
|
this._commitMove(r, this._dragState.movedRootIds, this._dragState.clone, "pointer");
|
|
1900
2420
|
return;
|
|
1901
2421
|
}
|
|
1902
|
-
|
|
2422
|
+
e.moved ? this._cancelDrag(!0) : (this._setDropTargetVisualState(this._dragState.dropTarget, !1), this._clearPointerDragPreview(), this._dragState = null, this._removeDragImage(), this.requestRender());
|
|
1903
2423
|
}
|
|
1904
|
-
_onPointerCancel(
|
|
1905
|
-
!this._pointerGesture ||
|
|
2424
|
+
_onPointerCancel(t) {
|
|
2425
|
+
!this._pointerGesture || t.pointerId !== this._pointerGesture.pointerId || (this._clearHoldTimer(), this._pointerGesture = null, this._stopAutoScroll(), this._dragState && this._cancelDrag(!0));
|
|
1906
2426
|
}
|
|
1907
|
-
_setSelection(
|
|
1908
|
-
const
|
|
1909
|
-
this._selection =
|
|
1910
|
-
const n =
|
|
2427
|
+
_setSelection(t, e) {
|
|
2428
|
+
const i = new Set(this._items.map((a) => a.id)), r = Array.from(new Set(t.filter((a) => i.has(a)))), s = [...this._selection];
|
|
2429
|
+
this._selection = r, this._rangeAnchorId = r[r.length - 1] || null, this._focusedId = r[r.length - 1] || this._focusedId;
|
|
2430
|
+
const n = rt(r);
|
|
1911
2431
|
if (this.getAttribute("selection") !== n) {
|
|
1912
2432
|
this._lastSelectionAttr = n, this._suppressAttributeRender = !0;
|
|
1913
2433
|
try {
|
|
1914
|
-
|
|
2434
|
+
r.length ? this.setAttribute("selection", n) : this.removeAttribute("selection");
|
|
1915
2435
|
} finally {
|
|
1916
2436
|
this._suppressAttributeRender = !1;
|
|
1917
2437
|
}
|
|
1918
2438
|
}
|
|
1919
2439
|
if (this.dispatchEvent(new CustomEvent("selection-change", {
|
|
1920
2440
|
detail: {
|
|
1921
|
-
selection: [...
|
|
2441
|
+
selection: [...r],
|
|
1922
2442
|
previousSelection: s
|
|
1923
2443
|
},
|
|
1924
2444
|
bubbles: !0,
|
|
1925
2445
|
composed: !0
|
|
1926
|
-
})),
|
|
2446
|
+
})), e !== "restore") {
|
|
1927
2447
|
if (this._applyInteractiveStateInPlace({ restoreFocus: !0 })) return;
|
|
1928
2448
|
this.requestRender();
|
|
1929
2449
|
}
|
|
1930
2450
|
}
|
|
1931
|
-
_toggleSelection(
|
|
1932
|
-
const
|
|
1933
|
-
this._setSelection(
|
|
2451
|
+
_toggleSelection(t) {
|
|
2452
|
+
const e = this._selection.includes(t) ? this._selection.filter((i) => i !== t) : [...this._selection, t];
|
|
2453
|
+
this._setSelection(e, "pointer"), this._announce(this._t("announceSelectedMany", { count: e.length }));
|
|
1934
2454
|
}
|
|
1935
|
-
_selectRangeTo(
|
|
1936
|
-
const
|
|
1937
|
-
if (
|
|
1938
|
-
this._setSelection([
|
|
2455
|
+
_selectRangeTo(t) {
|
|
2456
|
+
const e = this._visibleItemIds(), i = this._rangeAnchorId || this._focusedId || t, r = e.indexOf(i), s = e.indexOf(t);
|
|
2457
|
+
if (r < 0 || s < 0) {
|
|
2458
|
+
this._setSelection([t], "pointer");
|
|
1939
2459
|
return;
|
|
1940
2460
|
}
|
|
1941
|
-
const [n, a] =
|
|
1942
|
-
this._setSelection(
|
|
2461
|
+
const [n, a] = r <= s ? [r, s] : [s, r];
|
|
2462
|
+
this._setSelection(e.slice(n, a + 1), "pointer"), this._announce(this._t("announceSelectedMany", { count: a - n + 1 }));
|
|
1943
2463
|
}
|
|
1944
2464
|
_visibleItemIds() {
|
|
1945
|
-
const
|
|
1946
|
-
return Array.from(
|
|
2465
|
+
const t = nt(this._items, new Set(this._selection), new Set(this._draggingIds()), this.filterQuery, this.sort);
|
|
2466
|
+
return Array.from(t.values()).flat().filter((e) => !e.disabled).map((e) => e.id);
|
|
1947
2467
|
}
|
|
1948
|
-
_selectedRootIds(
|
|
1949
|
-
const
|
|
1950
|
-
return
|
|
1951
|
-
const n =
|
|
2468
|
+
_selectedRootIds(t) {
|
|
2469
|
+
const e = this._selection.length ? [...this._selection] : t ? [t] : [], i = T(this._items), r = new Set(e);
|
|
2470
|
+
return e.filter((s) => {
|
|
2471
|
+
const n = i.get(s);
|
|
1952
2472
|
if (!n) return !1;
|
|
1953
2473
|
let a = n.parentId;
|
|
1954
2474
|
for (; a; ) {
|
|
1955
|
-
if (
|
|
1956
|
-
a =
|
|
2475
|
+
if (r.has(a)) return !1;
|
|
2476
|
+
a = i.get(a)?.parentId ?? null;
|
|
1957
2477
|
}
|
|
1958
2478
|
return !n.disabled;
|
|
1959
2479
|
});
|
|
1960
2480
|
}
|
|
1961
2481
|
_draggingIds() {
|
|
1962
2482
|
if (!this._dragState) return [];
|
|
1963
|
-
const
|
|
1964
|
-
|
|
1965
|
-
const n =
|
|
2483
|
+
const t = T(this._items), e = M(this._items), i = [], r = (s) => {
|
|
2484
|
+
i.push(s);
|
|
2485
|
+
const n = t.get(s);
|
|
1966
2486
|
if (!n) return;
|
|
1967
|
-
(
|
|
2487
|
+
(e.get(w(n.listId, s)) || []).forEach(r);
|
|
1968
2488
|
};
|
|
1969
|
-
return this._dragState.movedRootIds.forEach(
|
|
2489
|
+
return this._dragState.movedRootIds.forEach(r), i;
|
|
1970
2490
|
}
|
|
1971
|
-
_itemClonesOnDrag(
|
|
1972
|
-
const
|
|
1973
|
-
return
|
|
2491
|
+
_itemClonesOnDrag(t) {
|
|
2492
|
+
const e = this._items.find((r) => r.id === t);
|
|
2493
|
+
return e ? e.cloneOnDrag ? !0 : !!this._lists.find((r) => r.id === e.listId)?.cloneOnDrag : !1;
|
|
1974
2494
|
}
|
|
1975
2495
|
_isDragLocked() {
|
|
1976
2496
|
return !!(this.hasAttribute("disabled") || this.sort !== "manual" || this.filterQuery && !this.hasAttribute("allow-filtered-drag"));
|
|
1977
2497
|
}
|
|
1978
|
-
|
|
2498
|
+
// `incoming` is set when the items come from another element: they are not in this one yet, so the checks
|
|
2499
|
+
// that refer to them (they cannot be dropped inside themselves) are replaced by the ones that matter for
|
|
2500
|
+
// newcomers (their ids must be free here).
|
|
2501
|
+
_canDrop(t, e, i = this._dragState?.clone ?? !1, r) {
|
|
1979
2502
|
if (this._isDragLocked()) return !1;
|
|
1980
|
-
const
|
|
1981
|
-
if (!
|
|
1982
|
-
const
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2503
|
+
const s = this._lists.find((l) => l.id === t.listId);
|
|
2504
|
+
if (!s || s.disabled) return !1;
|
|
2505
|
+
const n = T(this._items), a = /* @__PURE__ */ new Set(), d = M(this._items);
|
|
2506
|
+
if (r)
|
|
2507
|
+
r.items.forEach((l) => a.add(l.id));
|
|
2508
|
+
else {
|
|
2509
|
+
const l = (p) => {
|
|
2510
|
+
a.add(p);
|
|
2511
|
+
const g = n.get(p);
|
|
2512
|
+
g && (d.get(w(g.listId, p)) || []).forEach(l);
|
|
2513
|
+
};
|
|
2514
|
+
if (e.forEach(l), t.parentId && a.has(t.parentId) || t.beforeId && a.has(t.beforeId)) return !1;
|
|
2515
|
+
}
|
|
2516
|
+
if (r && !r.clone && r.items.some((l) => n.has(l.id))) return !1;
|
|
2517
|
+
const o = r ? r.sourceListIds : Array.from(new Set(e.map((l) => n.get(l)?.listId).filter(Boolean)));
|
|
2518
|
+
if (s.accepts?.length && o.some((l) => !s.accepts?.includes(l)) || t.mode === "inside" && this.getAttribute("allow-nesting") === "false") return !1;
|
|
2519
|
+
if (s.maxItems !== void 0) {
|
|
2520
|
+
const l = this._items.filter((g) => g.listId === t.listId), p = r ? r.items.length : i ? a.size : Array.from(a).filter((g) => n.get(g)?.listId !== t.listId).length;
|
|
2521
|
+
if (p > 0 && l.length + p > s.maxItems) return !1;
|
|
2522
|
+
}
|
|
2523
|
+
const c = this._canDropCallback;
|
|
2524
|
+
if (c)
|
|
2525
|
+
try {
|
|
2526
|
+
const l = r ? r.items.filter((g) => r.rootIds.includes(g.id)) : e.map((g) => n.get(g)).filter((g) => !!g);
|
|
2527
|
+
if (!c({
|
|
2528
|
+
items: l.map(q),
|
|
2529
|
+
movedIds: [...e],
|
|
2530
|
+
targetListId: t.listId,
|
|
2531
|
+
parentId: t.parentId,
|
|
2532
|
+
beforeId: t.beforeId,
|
|
2533
|
+
mode: t.mode,
|
|
2534
|
+
clone: i,
|
|
2535
|
+
...r ? { from: r.source } : {}
|
|
2536
|
+
})) return !1;
|
|
2537
|
+
} catch (l) {
|
|
2538
|
+
return console.error("ui-sortable: canDrop threw; the drop is refused.", l), !1;
|
|
2539
|
+
}
|
|
2540
|
+
return !0;
|
|
2541
|
+
}
|
|
2542
|
+
_commitMove(t, e, i, r) {
|
|
2543
|
+
if (!this._canDrop(t, e, i)) return !1;
|
|
2544
|
+
const s = T(this._items), n = j(
|
|
2545
|
+
this._items,
|
|
2546
|
+
this._lists,
|
|
2547
|
+
t,
|
|
2548
|
+
e,
|
|
2549
|
+
i,
|
|
2550
|
+
(c, l) => this._cloneSubtreeItem(c, l)
|
|
2551
|
+
), a = e.map((c) => s.get(c)).filter((c) => !!c), d = i ? "clone" : t.mode === "inside" ? "nest" : a.some((c) => c.listId !== t.listId) ? "transfer" : "reorder", o = {
|
|
2552
|
+
items: n.items,
|
|
2553
|
+
movedIds: n.insertedRootIds,
|
|
2554
|
+
nextSelection: [...n.insertedRootIds],
|
|
2555
|
+
operation: d,
|
|
2556
|
+
target: t,
|
|
2557
|
+
clone: i,
|
|
2558
|
+
source: r
|
|
2020
2559
|
};
|
|
2021
|
-
this.
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2560
|
+
return this._askBeforeChange(o) ? (this._applyPlan(o), !0) : (this._dragState && this._cancelDrag(!1), this._announce(this._t("announceRejected")), !1);
|
|
2561
|
+
}
|
|
2562
|
+
// The last word before anything changes: a listener of `before-change` can cancel the move.
|
|
2563
|
+
_askBeforeChange(t) {
|
|
2564
|
+
return this.dispatchEvent(new CustomEvent("before-change", {
|
|
2565
|
+
detail: {
|
|
2566
|
+
items: t.items.map(q),
|
|
2567
|
+
lists: this.lists,
|
|
2568
|
+
selection: [...t.nextSelection],
|
|
2569
|
+
previousSelection: [...this._selection],
|
|
2570
|
+
movedIds: [...t.movedIds],
|
|
2571
|
+
source: t.source,
|
|
2572
|
+
operation: t.operation,
|
|
2573
|
+
persistence: J(t.items),
|
|
2574
|
+
target: { listId: t.target.listId, parentId: t.target.parentId, beforeId: t.target.beforeId, mode: t.target.mode },
|
|
2575
|
+
clone: t.clone,
|
|
2576
|
+
...t.external ? { external: t.external } : {}
|
|
2577
|
+
},
|
|
2578
|
+
bubbles: !0,
|
|
2579
|
+
composed: !0,
|
|
2580
|
+
cancelable: !0
|
|
2581
|
+
}));
|
|
2582
|
+
}
|
|
2583
|
+
// Makes a move that was accepted real: the items, the selection, the attributes, the saved positions, the
|
|
2584
|
+
// events and the announcement.
|
|
2585
|
+
_applyPlan(t) {
|
|
2586
|
+
const e = [...this._selection];
|
|
2587
|
+
this._dragState && (this._dragState.committed = !0), this._items = t.items.map(A), this._clearPointerDragPreview(), this._dragState = null, this._removeDragImage(), this._selection = [...t.nextSelection], this._focusedId = t.nextSelection[0] || null, this._pendingFocusId = this._focusedId, this._syncAttributesFromState();
|
|
2588
|
+
const i = J(this._items);
|
|
2589
|
+
this._persistSnapshot(i);
|
|
2590
|
+
const r = {
|
|
2029
2591
|
items: this.items,
|
|
2030
2592
|
lists: this.lists,
|
|
2031
|
-
selection: [...
|
|
2032
|
-
previousSelection:
|
|
2033
|
-
movedIds: [...
|
|
2034
|
-
source:
|
|
2035
|
-
operation:
|
|
2036
|
-
persistence:
|
|
2593
|
+
selection: [...t.nextSelection],
|
|
2594
|
+
previousSelection: e,
|
|
2595
|
+
movedIds: [...t.movedIds],
|
|
2596
|
+
source: t.source,
|
|
2597
|
+
operation: t.operation,
|
|
2598
|
+
persistence: i,
|
|
2599
|
+
...t.external ? { external: t.external } : {}
|
|
2037
2600
|
};
|
|
2038
2601
|
this.dispatchEvent(new CustomEvent("change", {
|
|
2039
|
-
detail:
|
|
2602
|
+
detail: r,
|
|
2040
2603
|
bubbles: !0,
|
|
2041
2604
|
composed: !0
|
|
2042
2605
|
})), this.dispatchEvent(new CustomEvent("persist-request", {
|
|
2043
|
-
detail:
|
|
2606
|
+
detail: r,
|
|
2044
2607
|
bubbles: !0,
|
|
2045
2608
|
composed: !0
|
|
2046
|
-
})), this._announce(this._messageForMove(
|
|
2609
|
+
})), this._announce(this._messageForMove(t.operation, t.movedIds.length, t.target, t.destination)), this.requestRender();
|
|
2047
2610
|
}
|
|
2048
2611
|
_syncAttributesFromState() {
|
|
2049
|
-
const
|
|
2050
|
-
this._lastListsAttr =
|
|
2612
|
+
const t = _t(this._lists), e = bt(this._items), i = rt(this._selection);
|
|
2613
|
+
this._lastListsAttr = t, this._lastItemsAttr = e, this._lastSelectionAttr = i, this._suppressAttributeRender = !0;
|
|
2051
2614
|
try {
|
|
2052
|
-
this.setAttribute("lists",
|
|
2615
|
+
this.setAttribute("lists", t), this.setAttribute("items", e), this._selection.length ? this.setAttribute("selection", i) : this.removeAttribute("selection");
|
|
2053
2616
|
} finally {
|
|
2054
2617
|
this._suppressAttributeRender = !1;
|
|
2055
2618
|
}
|
|
2056
2619
|
}
|
|
2057
|
-
_cloneSubtreeItem(
|
|
2058
|
-
const
|
|
2620
|
+
_cloneSubtreeItem(t, e) {
|
|
2621
|
+
const r = `copy-${this._cloneSeed++}`, n = `${t.id.includes("--copy-") ? t.id.split("--copy-")[0] : t.id}--${r}`;
|
|
2059
2622
|
return {
|
|
2060
|
-
...
|
|
2623
|
+
...t,
|
|
2061
2624
|
id: n,
|
|
2062
|
-
label:
|
|
2625
|
+
label: e[0] === t.id ? `${t.label} copy` : t.label,
|
|
2626
|
+
data: B(t.data)
|
|
2063
2627
|
};
|
|
2064
2628
|
}
|
|
2065
|
-
_messageForMove(e,
|
|
2066
|
-
const s = this._lists.find((
|
|
2067
|
-
return
|
|
2629
|
+
_messageForMove(t, e, i, r) {
|
|
2630
|
+
const s = this._lists.find((d) => d.id === i.listId), n = r || s?.label || i.listId, a = { count: e, list: n };
|
|
2631
|
+
return t === "clone" ? this._t(e === 1 ? "announceCopiedOne" : "announceCopiedMany", a) : t === "nest" ? this._t(e === 1 ? "announceNestedOne" : "announceNestedMany", a) : t === "transfer" ? this._t(e === 1 ? "announceMovedOne" : "announceMovedMany", a) : this._t(e === 1 ? "announceReorderedOne" : "announceReorderedMany", a);
|
|
2632
|
+
}
|
|
2633
|
+
_announceDragging(t, e, i) {
|
|
2634
|
+
e === 1 ? this._announce(this._t(i ? "announceDraggingCopy" : "announceDragging", { label: t })) : this._announce(this._t(i ? "announceDraggingCopyMany" : "announceDraggingMany", { count: e }));
|
|
2068
2635
|
}
|
|
2069
|
-
_persistSnapshot(
|
|
2070
|
-
const
|
|
2071
|
-
if (
|
|
2636
|
+
_persistSnapshot(t) {
|
|
2637
|
+
const e = this.getAttribute("persist-key");
|
|
2638
|
+
if (e)
|
|
2072
2639
|
try {
|
|
2073
|
-
window.localStorage.setItem(
|
|
2640
|
+
window.localStorage.setItem(e, JSON.stringify(t));
|
|
2074
2641
|
} catch {
|
|
2075
2642
|
}
|
|
2076
2643
|
}
|
|
2077
|
-
_announce(
|
|
2078
|
-
this._liveMessage =
|
|
2644
|
+
_announce(t) {
|
|
2645
|
+
this._liveMessage = t, this._applyLiveMessage();
|
|
2079
2646
|
}
|
|
2080
|
-
_cancelDrag(
|
|
2081
|
-
this._stopAutoScroll(), this._dragState && (this._setDraggingVisualState(this._draggingIds(), !1), this._pendingDropTarget = null, this._setDropTargetVisualState(this._dragState.dropTarget, !1), this._clearPointerDragPreview(), this._items = this._dragState.snapshot.map(
|
|
2082
|
-
}
|
|
2083
|
-
_applyDragImage(e, t) {
|
|
2084
|
-
this._removeDragImage();
|
|
2085
|
-
const r = document.createElement("div");
|
|
2086
|
-
r.textContent = t === 1 ? "Dragging item" : `Dragging ${t} items`, r.style.position = "fixed", r.style.top = "-999px", r.style.left = "-999px", r.style.padding = "8px 12px", r.style.borderRadius = "999px", r.style.background = "rgba(15, 23, 42, 0.92)", r.style.color = "#f8fafc", r.style.font = "600 12px/1 Inter, sans-serif", r.style.pointerEvents = "none", document.body.appendChild(r), e.setDragImage(r, 12, 12), this._dragImage = r;
|
|
2647
|
+
_cancelDrag(t) {
|
|
2648
|
+
this._stopAutoScroll(), this._dragState && (this._setDraggingVisualState(this._draggingIds(), !1), this._pendingDropTarget = null, this._setExternal(null), this._setDropTargetVisualState(this._dragState.dropTarget, !1), this._clearPointerDragPreview(), this._items = this._dragState.snapshot.map(A), this._dragState = null, this._clearHoldTimer(), this._pointerGesture = null, this._removeDragImage(), t && this._announce(this._t("announceCancelled")), this._syncAttributesFromState(), this.requestRender());
|
|
2087
2649
|
}
|
|
2088
2650
|
_removeDragImage() {
|
|
2089
2651
|
this._dragImage?.remove(), this._dragImage = null;
|
|
2090
2652
|
}
|
|
2091
|
-
|
|
2092
|
-
this._dragPreviewOverlay?.remove(), this._dragPreviewOverlay = null;
|
|
2093
|
-
}
|
|
2094
|
-
_applyPointerPreview(e, t, r, i) {
|
|
2653
|
+
_applyPointerPreview(t, e, i, r, s) {
|
|
2095
2654
|
this._removeDragImage();
|
|
2096
|
-
const
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2655
|
+
const n = this._dragState ? this._findItemElement(this._dragState.originId) : null, a = n ? this._buildDragGhost(n, i, r, s) : null;
|
|
2656
|
+
if (a)
|
|
2657
|
+
this.root.appendChild(a), this._dragImage = a;
|
|
2658
|
+
else {
|
|
2659
|
+
const d = document.createElement("div");
|
|
2660
|
+
d.className = "drag-pill", d.textContent = r ? i === 1 ? this._t("copyingOne") : this._t("copyingMany", { count: i }) : i === 1 ? this._t("movingOne") : this._t("movingMany", { count: i }), this.root.appendChild(d), this._dragImage = d, this._dragImageOffset = { x: -14, y: -14 };
|
|
2661
|
+
}
|
|
2662
|
+
this._movePointerPreview(t, e);
|
|
2663
|
+
}
|
|
2664
|
+
// The ghost is a copy of the card being dragged, so it looks like the thing you picked up. It is
|
|
2665
|
+
// inert and carries no ids, so nothing that looks cards up by id can find it.
|
|
2666
|
+
_buildDragGhost(t, e, i, r) {
|
|
2667
|
+
const s = t.getBoundingClientRect(), n = t.cloneNode(!0);
|
|
2668
|
+
if (n.classList.add("item-ghost"), ["id", "data-id", "data-drag-trigger", "tabindex", "role", "aria-selected", "aria-disabled"].forEach((c) => {
|
|
2669
|
+
n.removeAttribute(c);
|
|
2670
|
+
}), n.querySelectorAll("[id], [data-id], [data-drag-trigger], [tabindex]").forEach((c) => {
|
|
2671
|
+
["id", "data-id", "data-drag-trigger", "tabindex"].forEach((l) => c.removeAttribute(l));
|
|
2672
|
+
}), n.setAttribute("part", "drag-ghost"), n.setAttribute("aria-hidden", "true"), n.setAttribute("inert", ""), n.setAttribute("data-dragging", "false"), n.setAttribute("data-focused", "false"), n.setAttribute("data-drop-inside-active", "false"), e > 1 && n.setAttribute("data-count", "stack"), e > 1 || i) {
|
|
2673
|
+
const c = document.createElement("span");
|
|
2674
|
+
c.className = "ghost-badge", c.textContent = e > 1 ? String(e) : "+", n.appendChild(c);
|
|
2675
|
+
}
|
|
2676
|
+
const a = this.getAttribute("drag-preview-size") === "compact";
|
|
2677
|
+
a && n.setAttribute("data-compact", "true");
|
|
2678
|
+
const d = a ? Math.min(s.width, 240) : s.width;
|
|
2679
|
+
n.style.inlineSize = `${Math.round(d)}px`;
|
|
2680
|
+
const o = !!r && Number.isFinite(r.x) && Number.isFinite(r.y);
|
|
2681
|
+
return this._dragImageOffset = {
|
|
2682
|
+
x: o ? Math.min(Math.max(r.x - s.left, 0), d) : d / 2,
|
|
2683
|
+
y: o ? Math.min(Math.max(r.y - s.top, 0), s.height) : s.height / 2
|
|
2684
|
+
}, n;
|
|
2685
|
+
}
|
|
2686
|
+
_movePointerPreview(t, e) {
|
|
2687
|
+
const i = this._dragImage;
|
|
2688
|
+
i && (i.isConnected || this.root.appendChild(i), i.style.transform = `translate(${Math.round(t - this._dragImageOffset.x)}px, ${Math.round(e - this._dragImageOffset.y)}px)`);
|
|
2101
2689
|
}
|
|
2102
2690
|
_keyboardDropTargets() {
|
|
2103
|
-
const
|
|
2104
|
-
const d =
|
|
2691
|
+
const t = T(this._items), e = M(this._items), i = [], r = this.getAttribute("allow-nesting") !== "false", s = (n, a) => {
|
|
2692
|
+
const d = e.get(w(n, a)) || [];
|
|
2105
2693
|
d.forEach((o) => {
|
|
2106
|
-
const
|
|
2107
|
-
!
|
|
2694
|
+
const c = t.get(o);
|
|
2695
|
+
!c || c.hidden || (i.push({
|
|
2108
2696
|
listId: n,
|
|
2109
2697
|
parentId: a,
|
|
2110
2698
|
beforeId: o,
|
|
2111
2699
|
mode: "before",
|
|
2112
|
-
label:
|
|
2113
|
-
}),
|
|
2700
|
+
label: this._t("targetBefore", { label: c.label })
|
|
2701
|
+
}), r && i.push({
|
|
2114
2702
|
listId: n,
|
|
2115
2703
|
parentId: o,
|
|
2116
2704
|
beforeId: null,
|
|
2117
2705
|
mode: "inside",
|
|
2118
|
-
label:
|
|
2706
|
+
label: this._t("targetInside", { label: c.label })
|
|
2119
2707
|
}), s(n, o));
|
|
2120
|
-
}), a ?
|
|
2708
|
+
}), a ? r && d.length > 0 && i.push({
|
|
2121
2709
|
listId: n,
|
|
2122
2710
|
parentId: a,
|
|
2123
2711
|
beforeId: null,
|
|
2124
2712
|
mode: "before",
|
|
2125
|
-
label: "
|
|
2126
|
-
}) :
|
|
2713
|
+
label: this._t("targetAfterChildren")
|
|
2714
|
+
}) : i.push({
|
|
2127
2715
|
listId: n,
|
|
2128
2716
|
parentId: a,
|
|
2129
2717
|
beforeId: null,
|
|
2130
2718
|
mode: "before",
|
|
2131
|
-
label:
|
|
2719
|
+
label: this._t("targetEnd", { list: this._lists.find((o) => o.id === n)?.label || n })
|
|
2132
2720
|
});
|
|
2133
2721
|
};
|
|
2134
|
-
return this._lists.forEach((n) => s(n.id, null)),
|
|
2722
|
+
return this._lists.forEach((n) => s(n.id, null)), i.filter((n) => this._canDrop(n, this._dragState?.movedRootIds || []));
|
|
2135
2723
|
}
|
|
2136
|
-
_initialKeyboardDropTarget(
|
|
2137
|
-
const
|
|
2138
|
-
return
|
|
2139
|
-
listId:
|
|
2140
|
-
parentId:
|
|
2141
|
-
beforeId:
|
|
2724
|
+
_initialKeyboardDropTarget(t) {
|
|
2725
|
+
const e = this._items.find((i) => i.id === t);
|
|
2726
|
+
return e ? {
|
|
2727
|
+
listId: e.listId,
|
|
2728
|
+
parentId: e.parentId,
|
|
2729
|
+
beforeId: t,
|
|
2142
2730
|
mode: "before"
|
|
2143
2731
|
} : null;
|
|
2144
2732
|
}
|
|
2145
|
-
_moveKeyboardDropTarget(
|
|
2733
|
+
_moveKeyboardDropTarget(t) {
|
|
2146
2734
|
if (!this._dragState) return;
|
|
2147
|
-
const
|
|
2148
|
-
if (!
|
|
2149
|
-
const
|
|
2735
|
+
const e = this._keyboardDropTargets();
|
|
2736
|
+
if (!e.length) return;
|
|
2737
|
+
const i = Math.max(0, e.findIndex(
|
|
2150
2738
|
(s) => s.listId === this._dragState?.dropTarget?.listId && s.parentId === this._dragState?.dropTarget?.parentId && s.beforeId === this._dragState?.dropTarget?.beforeId && s.mode === this._dragState?.dropTarget?.mode
|
|
2151
|
-
)),
|
|
2152
|
-
this._setDropTarget(
|
|
2739
|
+
)), r = Math.max(0, Math.min(e.length - 1, i + t));
|
|
2740
|
+
this._setDropTarget(e[r], { announceLabel: e[r].label });
|
|
2153
2741
|
}
|
|
2154
|
-
}
|
|
2155
|
-
|
|
2742
|
+
};
|
|
2743
|
+
$._instances = /* @__PURE__ */ new Set();
|
|
2744
|
+
let X = $;
|
|
2745
|
+
typeof customElements < "u" && !customElements.get("ui-sortable") && customElements.define("ui-sortable", X);
|
|
2156
2746
|
export {
|
|
2157
|
-
|
|
2747
|
+
X as UISortable
|
|
2158
2748
|
};
|