@plexui/vue 0.32.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/components/Dialog/Dialog.js +7 -2
- package/dist/es/components/Dialog/Dialog.js.map +1 -1
- package/dist/es/components/Dialog/sheetDrag.js +70 -8
- package/dist/es/components/Dialog/sheetDrag.js.map +1 -1
- package/dist/es/components/Field/Field.js +40 -1
- package/dist/es/components/Field/Field.js.map +1 -1
- package/dist/es/components/NavigationRow/NavigationRow.js +74 -0
- package/dist/es/components/NavigationRow/NavigationRow.js.map +1 -0
- package/dist/es/components/NavigationRow/index.js +2 -0
- package/dist/es/components/NavigationRow/index.js.map +1 -0
- package/dist/es/components/SwipeActions/SwipeActions.js +222 -20
- package/dist/es/components/SwipeActions/SwipeActions.js.map +1 -1
- package/dist/es/components/SwipeActions/index.js +1 -1
- package/dist/es/components/SwipeActions/index.js.map +1 -1
- package/dist/es/lib/calendarFit.js +26 -1
- package/dist/es/lib/calendarFit.js.map +1 -1
- package/dist/es/lib/sortable.js +8 -4
- package/dist/es/lib/sortable.js.map +1 -1
- package/dist/types/components/NavigationRow/NavigationRow.d.ts +74 -0
- package/dist/types/components/NavigationRow/index.d.ts +1 -0
- package/dist/types/components/SwipeActions/SwipeActions.d.ts +8 -0
- package/dist/types/components/SwipeActions/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -4,8 +4,25 @@ import s from "@plexui/styles/components/SwipeActions/SwipeActions.module.css";
|
|
|
4
4
|
const SLOP = 10;
|
|
5
5
|
/** The width an open row moves by is the border box of its actions, edge and content gaps included. */
|
|
6
6
|
const BORDER_BOX = { box: "border-box" };
|
|
7
|
+
/** A finger lifting faster than this (px/ms) opens the side it moves toward, or closes the row when it moves back, however short the swipe. */
|
|
8
|
+
const FLICK = 0.3;
|
|
9
|
+
/** A finger that stopped this long (ms) before it lifted flicks nothing. */
|
|
10
|
+
const FLICK_WINDOW = 100;
|
|
11
|
+
/** A trackpad swipe (horizontal wheel) ends when no wheel event has come for this long (ms). */
|
|
12
|
+
const WHEEL_IDLE = 120;
|
|
7
13
|
/** Controls that take a horizontal drag themselves. */
|
|
8
14
|
const OWN_DRAG = 'input, textarea, select, [contenteditable]:not([contenteditable="false"]), [role="slider"]';
|
|
15
|
+
/** Whether a wheel over `target` belongs to a control or a box inside the row that scrolls across itself. */
|
|
16
|
+
const scrollsAcross = (target, row) => {
|
|
17
|
+
for (let element = target instanceof Element ? target : null; element && element !== row; element = element.parentElement) {
|
|
18
|
+
if (element.matches(OWN_DRAG))
|
|
19
|
+
return true;
|
|
20
|
+
const overflow = getComputedStyle(element).overflowX;
|
|
21
|
+
if ((overflow === "auto" || overflow === "scroll") && element.scrollWidth > element.clientWidth)
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
};
|
|
9
26
|
/** The open row: opening another one closes it, as a list keeps one row open. */
|
|
10
27
|
let closeOpenRow = null;
|
|
11
28
|
/** The row keeps the finger past its edges; a pointer that is no longer active (it lifted between events) cannot be held. */
|
|
@@ -18,6 +35,26 @@ const capture = (element, pointerId) => {
|
|
|
18
35
|
}
|
|
19
36
|
};
|
|
20
37
|
const sideOf = (offset) => offset > 0 ? "leading" : offset < 0 ? "trailing" : undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Where a swipe that ended at `offset` settles: a flick (`velocity` px/ms, toward the trailing edge when positive)
|
|
40
|
+
* opens the side it moves toward and closes the row when it moves back; a slow one opens a side moved past half its
|
|
41
|
+
* `width`.
|
|
42
|
+
*/
|
|
43
|
+
export const swipeActionsSettle = (offset, velocity, width) => {
|
|
44
|
+
if (Math.abs(velocity) >= FLICK)
|
|
45
|
+
return Math.sign(velocity) === Math.sign(offset);
|
|
46
|
+
return Math.abs(offset) >= width / 2;
|
|
47
|
+
};
|
|
48
|
+
/** The duration (ms) the row moves in, none when the motion is reduced. */
|
|
49
|
+
const durationOf = (element) => {
|
|
50
|
+
if (typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches)
|
|
51
|
+
return 0;
|
|
52
|
+
const value = getComputedStyle(element).getPropertyValue("--swipe-actions-duration").trim();
|
|
53
|
+
const time = parseFloat(value);
|
|
54
|
+
if (!Number.isFinite(time))
|
|
55
|
+
return 0;
|
|
56
|
+
return value.endsWith("ms") ? time : time * 1000;
|
|
57
|
+
};
|
|
21
58
|
/**
|
|
22
59
|
* Where the content goes for a swipe of `raw` px toward the trailing edge (negative: toward the leading edge), and
|
|
23
60
|
* whether that is a full swipe. A side without actions stays shut. Past its actions the content follows the finger
|
|
@@ -57,6 +94,13 @@ const SwipeActionsComponent = defineComponent({
|
|
|
57
94
|
const swiping = ref(false);
|
|
58
95
|
const rtl = ref(false);
|
|
59
96
|
const round = ref(false);
|
|
97
|
+
const removing = ref(false);
|
|
98
|
+
const height = ref(undefined);
|
|
99
|
+
/** The timers of a removal and of a trackpad swipe, cleared when the row goes. */
|
|
100
|
+
const timeouts = [];
|
|
101
|
+
let wheelTimer = 0;
|
|
102
|
+
/** A trackpad swipe: where it started, how far it went, the widths at its start. `locked` drops the momentum after it. */
|
|
103
|
+
let wheel = null;
|
|
60
104
|
const root = ref(null);
|
|
61
105
|
const sides = { leading: null, trailing: null };
|
|
62
106
|
let gesture = null;
|
|
@@ -76,7 +120,19 @@ const SwipeActionsComponent = defineComponent({
|
|
|
76
120
|
state?.detach();
|
|
77
121
|
return state;
|
|
78
122
|
};
|
|
123
|
+
/** No action of the row keeps the focus. */
|
|
124
|
+
const blurActions = () => {
|
|
125
|
+
const focused = document.activeElement;
|
|
126
|
+
if (focused instanceof HTMLElement && (sides.leading?.contains(focused) || sides.trailing?.contains(focused)))
|
|
127
|
+
focused.blur();
|
|
128
|
+
};
|
|
79
129
|
const close = () => {
|
|
130
|
+
if (removing.value)
|
|
131
|
+
return;
|
|
132
|
+
// Whatever closes or opens the row (a press, the focus, another row) ends a trackpad swipe and its momentum.
|
|
133
|
+
lockWheel();
|
|
134
|
+
// A closed row hides its actions, so none keeps the focus (Enter would run a hidden action).
|
|
135
|
+
blurActions();
|
|
80
136
|
if (closeOpenRow === closer)
|
|
81
137
|
closeOpenRow = null;
|
|
82
138
|
move(0);
|
|
@@ -90,6 +146,7 @@ const SwipeActionsComponent = defineComponent({
|
|
|
90
146
|
if (state.swiping)
|
|
91
147
|
suppressClick = true;
|
|
92
148
|
}
|
|
149
|
+
lockWheel();
|
|
93
150
|
close();
|
|
94
151
|
};
|
|
95
152
|
/** This row takes the place of the open one. */
|
|
@@ -100,8 +157,11 @@ const SwipeActionsComponent = defineComponent({
|
|
|
100
157
|
};
|
|
101
158
|
/** Shows a side as wide as its actions (`width` when known), or closes the row when that side has none (any more). */
|
|
102
159
|
const open = (side, width = widthOf(side)) => {
|
|
160
|
+
if (removing.value)
|
|
161
|
+
return;
|
|
103
162
|
if (!(width > 0))
|
|
104
163
|
return close();
|
|
164
|
+
lockWheel();
|
|
105
165
|
claim();
|
|
106
166
|
rtl.value = isRtl();
|
|
107
167
|
move(side === "leading" ? width : -width);
|
|
@@ -109,7 +169,7 @@ const SwipeActionsComponent = defineComponent({
|
|
|
109
169
|
/** An open row follows its actions: more of them, other labels or another width move it to their new width. */
|
|
110
170
|
const sync = () => {
|
|
111
171
|
const side = sideOf(offset.value);
|
|
112
|
-
if (!side || gesture?.swiping || full.value)
|
|
172
|
+
if (!side || removing.value || gesture?.swiping || (wheel && wheel !== "locked") || full.value)
|
|
113
173
|
return;
|
|
114
174
|
const width = widthOf(side);
|
|
115
175
|
if (!(width > 0))
|
|
@@ -149,46 +209,164 @@ const SwipeActionsComponent = defineComponent({
|
|
|
149
209
|
});
|
|
150
210
|
fit();
|
|
151
211
|
observeSides();
|
|
212
|
+
// A trackpad swipe has to stop the page's own scroll and back gesture, which a passive listener cannot.
|
|
213
|
+
root.value?.addEventListener("wheel", handleWheel, { passive: false });
|
|
152
214
|
});
|
|
153
215
|
onUpdated(() => {
|
|
154
216
|
fit();
|
|
155
217
|
sync();
|
|
156
218
|
observeSides();
|
|
157
219
|
});
|
|
158
|
-
// A press anywhere outside the open row closes it.
|
|
220
|
+
// A press anywhere outside the open row closes it, while a trackpad moves it too; a finger's own swipe keeps it.
|
|
159
221
|
const handleOutsidePointerDown = (event) => {
|
|
160
222
|
if (event.target instanceof Node && root.value?.contains(event.target))
|
|
161
223
|
return;
|
|
224
|
+
if (gesture?.swiping)
|
|
225
|
+
return;
|
|
162
226
|
close();
|
|
163
227
|
};
|
|
164
|
-
watch(
|
|
228
|
+
watch(revealed, (side) => {
|
|
165
229
|
document.removeEventListener("pointerdown", handleOutsidePointerDown, true);
|
|
166
|
-
if (side
|
|
230
|
+
if (side)
|
|
167
231
|
document.addEventListener("pointerdown", handleOutsidePointerDown, true);
|
|
168
232
|
});
|
|
169
233
|
// The open row lets go of the list, and of the finger, when it goes away.
|
|
170
234
|
onBeforeUnmount(() => {
|
|
171
235
|
document.removeEventListener("pointerdown", handleOutsidePointerDown, true);
|
|
236
|
+
root.value?.removeEventListener("wheel", handleWheel);
|
|
237
|
+
for (const id of timeouts)
|
|
238
|
+
window.clearTimeout(id);
|
|
239
|
+
window.clearTimeout(wheelTimer);
|
|
172
240
|
observer?.disconnect();
|
|
173
241
|
observer = null;
|
|
174
242
|
release();
|
|
175
243
|
if (closeOpenRow === closer)
|
|
176
244
|
closeOpenRow = null;
|
|
177
245
|
});
|
|
178
|
-
|
|
246
|
+
/**
|
|
247
|
+
* A destructive action: the content slides out to the side it was swiped to (the trailing one when pressed from
|
|
248
|
+
* the keys) and the row collapses, then the action runs; a row the list keeps comes back closed.
|
|
249
|
+
*/
|
|
250
|
+
const remove = (action, side) => {
|
|
251
|
+
const element = root.value;
|
|
252
|
+
if (!element || removing.value)
|
|
253
|
+
return;
|
|
254
|
+
const duration = durationOf(element);
|
|
255
|
+
const width = element.clientWidth;
|
|
256
|
+
claim();
|
|
257
|
+
height.value = element.getBoundingClientRect().height;
|
|
258
|
+
rtl.value = isRtl();
|
|
259
|
+
move(side === "leading" ? width : -width, full.value);
|
|
260
|
+
removing.value = true;
|
|
261
|
+
lockWheel();
|
|
262
|
+
timeouts.push(window.setTimeout(() => {
|
|
263
|
+
action.onSelect?.();
|
|
264
|
+
// A row the list dropped is gone by now; one it keeps comes back.
|
|
265
|
+
timeouts.push(window.setTimeout(() => {
|
|
266
|
+
removing.value = false;
|
|
267
|
+
height.value = undefined;
|
|
268
|
+
// An action that keeps the focus (chosen from the keys) keeps its side open, so the focus is never on a hidden action.
|
|
269
|
+
const focused = document.activeElement;
|
|
270
|
+
const side = ["leading", "trailing"].find((name) => !!focused && !!sides[name]?.contains(focused));
|
|
271
|
+
if (side)
|
|
272
|
+
open(side);
|
|
273
|
+
else
|
|
274
|
+
close();
|
|
275
|
+
}));
|
|
276
|
+
}, duration));
|
|
277
|
+
};
|
|
278
|
+
/** Runs an action from its side: a destructive one removes the row first. */
|
|
279
|
+
const run = (action, side) => {
|
|
280
|
+
if (!action)
|
|
281
|
+
return close();
|
|
282
|
+
if (action.role === "destructive")
|
|
283
|
+
return remove(action, side);
|
|
284
|
+
action.onSelect?.();
|
|
285
|
+
close();
|
|
286
|
+
};
|
|
287
|
+
const settle = (state, velocity = 0) => {
|
|
179
288
|
const side = sideOf(offset.value);
|
|
180
289
|
if (!side)
|
|
181
290
|
return close();
|
|
182
|
-
if (full.value)
|
|
183
|
-
(side === "leading" ? props.leading : props.trailing)[0]
|
|
184
|
-
return close();
|
|
185
|
-
}
|
|
291
|
+
if (full.value)
|
|
292
|
+
return run((side === "leading" ? props.leading : props.trailing)[0], side);
|
|
186
293
|
// The widths from the start of the swipe: a full swipe may have stretched the actions since.
|
|
187
|
-
if (
|
|
294
|
+
if (swipeActionsSettle(offset.value, velocity, state.widths[side]))
|
|
188
295
|
open(side, state.widths[side]);
|
|
189
296
|
else
|
|
190
297
|
close();
|
|
191
298
|
};
|
|
299
|
+
/** A trackpad swipe that has not settled yet settles no more, where it stands (a press or a removal takes over). */
|
|
300
|
+
function stopWheel() {
|
|
301
|
+
window.clearTimeout(wheelTimer);
|
|
302
|
+
if (wheel && wheel !== "locked")
|
|
303
|
+
swiping.value = false;
|
|
304
|
+
wheel = null;
|
|
305
|
+
}
|
|
306
|
+
/** Another row took over: this row's trackpad swipe ends here, and the momentum after it moves nothing. */
|
|
307
|
+
function lockWheel() {
|
|
308
|
+
if (!wheel || wheel === "locked")
|
|
309
|
+
return;
|
|
310
|
+
stopWheel();
|
|
311
|
+
wheel = "locked";
|
|
312
|
+
wheelTimer = window.setTimeout(() => {
|
|
313
|
+
wheel = null;
|
|
314
|
+
}, WHEEL_IDLE);
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* A two-finger swipe on a trackpad moves the row as a finger does, without a full swipe (the momentum after the
|
|
318
|
+
* fingers lift would run an action), and settles when the wheel stops. A swipe down scrolls the page.
|
|
319
|
+
*/
|
|
320
|
+
function handleWheel(event) {
|
|
321
|
+
if (event.ctrlKey)
|
|
322
|
+
return;
|
|
323
|
+
const horizontal = Math.abs(event.deltaX) > Math.abs(event.deltaY);
|
|
324
|
+
let state = wheel;
|
|
325
|
+
// The momentum after a swipe keeps the lock until it stops, a removal or not.
|
|
326
|
+
if (state === "locked") {
|
|
327
|
+
window.clearTimeout(wheelTimer);
|
|
328
|
+
if (horizontal)
|
|
329
|
+
event.preventDefault();
|
|
330
|
+
wheelTimer = window.setTimeout(() => {
|
|
331
|
+
wheel = null;
|
|
332
|
+
}, WHEEL_IDLE);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
if (removing.value || gesture || (props.leading.length < 1 && props.trailing.length < 1))
|
|
336
|
+
return;
|
|
337
|
+
if (!state && (!horizontal || scrollsAcross(event.target, root.value)))
|
|
338
|
+
return;
|
|
339
|
+
window.clearTimeout(wheelTimer);
|
|
340
|
+
event.preventDefault();
|
|
341
|
+
if (!state) {
|
|
342
|
+
// The row moves under the focus: an action that has it lets it go, as a closed row does.
|
|
343
|
+
const start = offset.value;
|
|
344
|
+
blurActions();
|
|
345
|
+
state = { start, across: 0, widths: { leading: widthOf("leading"), trailing: widthOf("trailing") }, rowWidth: root.value?.clientWidth ?? 0 };
|
|
346
|
+
wheel = state;
|
|
347
|
+
claim();
|
|
348
|
+
rtl.value = isRtl();
|
|
349
|
+
swiping.value = true;
|
|
350
|
+
}
|
|
351
|
+
const scale = event.deltaMode === 1 ? 16 : event.deltaMode === 2 ? state.rowWidth : 1;
|
|
352
|
+
// The page scrolls the other way the fingers move: fingers moving left give a positive deltaX.
|
|
353
|
+
state.across -= event.deltaX * scale * (isRtl() ? -1 : 1);
|
|
354
|
+
const next = swipeActionsOffset(state.start + state.across, state.widths, state.rowWidth, false);
|
|
355
|
+
move(next.offset);
|
|
356
|
+
const widths = state.widths;
|
|
357
|
+
wheelTimer = window.setTimeout(() => {
|
|
358
|
+
wheel = "locked";
|
|
359
|
+
swiping.value = false;
|
|
360
|
+
const side = sideOf(offset.value);
|
|
361
|
+
if (side && swipeActionsSettle(offset.value, 0, widths[side]))
|
|
362
|
+
open(side, widths[side]);
|
|
363
|
+
else
|
|
364
|
+
close();
|
|
365
|
+
wheelTimer = window.setTimeout(() => {
|
|
366
|
+
wheel = null;
|
|
367
|
+
}, WHEEL_IDLE);
|
|
368
|
+
}, WHEEL_IDLE);
|
|
369
|
+
}
|
|
192
370
|
/** The finger lifted (anywhere): a swipe settles, a press on an open row closes it. */
|
|
193
371
|
const finish = () => {
|
|
194
372
|
const state = release();
|
|
@@ -197,7 +375,7 @@ const SwipeActionsComponent = defineComponent({
|
|
|
197
375
|
if (state.swiping) {
|
|
198
376
|
suppressClick = true;
|
|
199
377
|
swiping.value = false;
|
|
200
|
-
settle(state);
|
|
378
|
+
settle(state, performance.now() - state.time <= FLICK_WINDOW ? state.velocity : 0);
|
|
201
379
|
}
|
|
202
380
|
else if (state.start !== 0) {
|
|
203
381
|
if (state.swiping === undefined)
|
|
@@ -218,7 +396,7 @@ const SwipeActionsComponent = defineComponent({
|
|
|
218
396
|
close();
|
|
219
397
|
};
|
|
220
398
|
const handlePointerDown = (event) => {
|
|
221
|
-
if (event.button !== 0 || gesture)
|
|
399
|
+
if (event.button !== 0 || gesture || removing.value)
|
|
222
400
|
return;
|
|
223
401
|
// A new press of the primary pointer starts clean: a swipe that another row ended and that was then cancelled leaves
|
|
224
402
|
// no click to swallow. Another finger's press keeps it, as only the primary pointer clicks.
|
|
@@ -226,6 +404,8 @@ const SwipeActionsComponent = defineComponent({
|
|
|
226
404
|
suppressClick = false;
|
|
227
405
|
if (props.leading.length < 1 && props.trailing.length < 1)
|
|
228
406
|
return;
|
|
407
|
+
// Any press ends a trackpad swipe still moving the row, and its momentum.
|
|
408
|
+
lockWheel();
|
|
229
409
|
// A drag in a text field or along a slider belongs to that control.
|
|
230
410
|
if (event.target instanceof Element && event.target.closest(OWN_DRAG))
|
|
231
411
|
return;
|
|
@@ -250,6 +430,9 @@ const SwipeActionsComponent = defineComponent({
|
|
|
250
430
|
rtl: isRtl(),
|
|
251
431
|
widths: { leading: widthOf("leading"), trailing: widthOf("trailing") },
|
|
252
432
|
rowWidth: root.value?.clientWidth ?? 0,
|
|
433
|
+
across: 0,
|
|
434
|
+
time: performance.now(),
|
|
435
|
+
velocity: 0,
|
|
253
436
|
detach: () => {
|
|
254
437
|
window.removeEventListener("pointerup", handleUp, true);
|
|
255
438
|
window.removeEventListener("pointercancel", handleCancel, true);
|
|
@@ -262,6 +445,12 @@ const SwipeActionsComponent = defineComponent({
|
|
|
262
445
|
return;
|
|
263
446
|
const across = (event.clientX - state.x) * (state.rtl ? -1 : 1);
|
|
264
447
|
const down = event.clientY - state.y;
|
|
448
|
+
// The speed is the finger's latest, from every move, the ones within the slop too.
|
|
449
|
+
const now = performance.now();
|
|
450
|
+
if (now > state.time)
|
|
451
|
+
state.velocity = (across - state.across) / (now - state.time);
|
|
452
|
+
state.across = across;
|
|
453
|
+
state.time = now;
|
|
265
454
|
if (state.swiping === undefined) {
|
|
266
455
|
if (Math.abs(across) < SLOP && Math.abs(down) < SLOP)
|
|
267
456
|
return;
|
|
@@ -296,12 +485,14 @@ const SwipeActionsComponent = defineComponent({
|
|
|
296
485
|
};
|
|
297
486
|
/** The focus on an action shows its side; on the content it closes the row. */
|
|
298
487
|
const handleFocusIn = (event) => {
|
|
299
|
-
if (gesture?.swiping)
|
|
488
|
+
if (gesture?.swiping || removing.value)
|
|
300
489
|
return;
|
|
301
490
|
const target = event.target;
|
|
302
491
|
const side = ["leading", "trailing"].find((name) => target instanceof Node && !!sides[name]?.contains(target));
|
|
303
492
|
if (side) {
|
|
304
|
-
|
|
493
|
+
// A trackpad swipe still moving the row ends with the side fully open.
|
|
494
|
+
const wheeling = !!wheel && wheel !== "locked";
|
|
495
|
+
if (wheeling || sideOf(offset.value) !== side)
|
|
305
496
|
open(side);
|
|
306
497
|
}
|
|
307
498
|
else if (offset.value !== 0) {
|
|
@@ -309,22 +500,30 @@ const SwipeActionsComponent = defineComponent({
|
|
|
309
500
|
}
|
|
310
501
|
};
|
|
311
502
|
const handleFocusOut = (event) => {
|
|
312
|
-
if (gesture?.swiping)
|
|
503
|
+
if (gesture?.swiping || removing.value)
|
|
313
504
|
return;
|
|
314
505
|
if (event.relatedTarget instanceof Node && root.value?.contains(event.relatedTarget))
|
|
315
506
|
return;
|
|
316
507
|
if (offset.value !== 0)
|
|
317
508
|
close();
|
|
318
509
|
};
|
|
319
|
-
const select = (action, event) => {
|
|
510
|
+
const select = (action, side, event) => {
|
|
511
|
+
// A row being removed runs nothing more, from the keys either.
|
|
512
|
+
if (removing.value)
|
|
513
|
+
return;
|
|
514
|
+
// A press ends a trackpad swipe still moving the row.
|
|
515
|
+
lockWheel();
|
|
516
|
+
// A pointer leaves no focus on the action, so a row the list keeps closes.
|
|
517
|
+
const target = event.currentTarget;
|
|
518
|
+
if (event.detail !== 0 && target instanceof HTMLElement)
|
|
519
|
+
target.blur();
|
|
520
|
+
if (action.role === "destructive")
|
|
521
|
+
return remove(action, side);
|
|
320
522
|
action.onSelect?.();
|
|
321
523
|
// A press closes the row, as iOS does. From the keys the action keeps the focus, so its side stays open until
|
|
322
524
|
// the focus leaves the row.
|
|
323
525
|
if (event.detail === 0)
|
|
324
526
|
return;
|
|
325
|
-
const target = event.currentTarget;
|
|
326
|
-
if (target instanceof HTMLElement)
|
|
327
|
-
target.blur();
|
|
328
527
|
close();
|
|
329
528
|
};
|
|
330
529
|
const renderSide = (side, actions) => {
|
|
@@ -354,7 +553,7 @@ const SwipeActionsComponent = defineComponent({
|
|
|
354
553
|
"data-shape": shape,
|
|
355
554
|
"data-first": action === actions[0] ? "" : undefined,
|
|
356
555
|
"aria-label": labelInside || labelBelow ? undefined : action.label,
|
|
357
|
-
"onClick": (event) => select(action, event),
|
|
556
|
+
"onClick": (event) => select(action, side, event),
|
|
358
557
|
}, [
|
|
359
558
|
h("span", { class: s.Capsule }, [
|
|
360
559
|
action.Icon ? h(action.Icon, { "class": s.Icon, "aria-hidden": "true" }) : null,
|
|
@@ -374,6 +573,9 @@ const SwipeActionsComponent = defineComponent({
|
|
|
374
573
|
"data-round": round.value ? "" : undefined,
|
|
375
574
|
"data-revealed": revealed.value,
|
|
376
575
|
"data-swiping": swiping.value ? "" : undefined,
|
|
576
|
+
"data-removing": removing.value ? "" : undefined,
|
|
577
|
+
// The row collapses from its height (keyframes in the CSS), so no frame has to pass first.
|
|
578
|
+
"style": height.value !== undefined ? [attrs.style, { "--swipe-actions-row-height": `${height.value}px` }] : attrs.style,
|
|
377
579
|
"onFocusin": handleFocusIn,
|
|
378
580
|
"onFocusout": handleFocusOut,
|
|
379
581
|
}, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwipeActions.js","sourceRoot":"","sources":["../../../../src/components/SwipeActions/SwipeActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAiC,MAAM,KAAK,CAAA;AACp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","sourcesContent":["import { computed, defineComponent, h, onBeforeUnmount, onMounted, onUpdated, ref, watch, type Component, type PropType } from \"vue\"\nimport s from \"@plexui/styles/components/SwipeActions/SwipeActions.module.css\"\n\n// Vue port of packages/ui/src/components/SwipeActions/SwipeActions.tsx: the same row, sides, gesture, full swipe,\n// keys and focus. The content of the row is the default slot; an action's `Icon` is a component, as in Select.\n\nexport type SwipeActionColor =\n | \"primary\"\n | \"secondary\"\n | \"danger\"\n | \"success\"\n | \"info\"\n | \"discovery\"\n | \"caution\"\n | \"warning\"\n\nexport type SwipeAction = {\n /** Unique ID of the action within its side */\n id: string\n /** Name of the action: shown with `labelPlacement` `\"inside\"` or `\"below\"` (and on an action without an icon), and its accessible name always */\n label: string\n /** Icon of the action */\n Icon?: Component\n /** Solid color of the action. @default \"secondary\" */\n color?: SwipeActionColor\n /** Called when the action is pressed, or by a full swipe when it is the first action of its side */\n onSelect?: () => void\n}\n\nexport type SwipeActionsSide = \"leading\" | \"trailing\"\n\n/** A finger has to travel this far, and farther across than down, before the row follows it. */\nconst SLOP = 10\n\n/** The width an open row moves by is the border box of its actions, edge and content gaps included. */\nconst BORDER_BOX: ResizeObserverOptions = { box: \"border-box\" }\n\n/** Controls that take a horizontal drag themselves. */\nconst OWN_DRAG = 'input, textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"slider\"]'\n\ntype Gesture = {\n pointerId: number\n x: number\n y: number\n start: number\n /** Undecided while within the slop, then a swipe (true) or a scroll (false). */\n swiping: boolean | undefined\n rtl: boolean\n widths: Record<SwipeActionsSide, number>\n rowWidth: number\n /** Removes the listeners for the end of the gesture. */\n detach: () => void\n}\n\n/** The open row: opening another one closes it, as a list keeps one row open. */\nlet closeOpenRow: (() => void) | null = null\n\n/** The row keeps the finger past its edges; a pointer that is no longer active (it lifted between events) cannot be held. */\nconst capture = (element: Element, pointerId: number) => {\n try {\n element.setPointerCapture?.(pointerId)\n } catch {\n // The swipe goes on with the events the row still gets.\n }\n}\n\nconst sideOf = (offset: number): SwipeActionsSide | undefined =>\n offset > 0 ? \"leading\" : offset < 0 ? \"trailing\" : undefined\n\n/**\n * Where the content goes for a swipe of `raw` px toward the trailing edge (negative: toward the leading edge), and\n * whether that is a full swipe. A side without actions stays shut. Past its actions the content follows the finger\n * where a full swipe is allowed, and a third as fast where it is not; past the middle between the open actions and\n * the far edge of the row the swipe is full.\n */\nexport const swipeActionsOffset = (\n raw: number,\n widths: Record<SwipeActionsSide, number>,\n rowWidth: number,\n fullSwipe: boolean,\n): { offset: number; full: boolean } => {\n const side = sideOf(raw)\n const width = side ? widths[side] : 0\n if (!side || !(width > 0)) return { offset: 0, full: false }\n const sign = Math.sign(raw)\n const distance = Math.abs(raw)\n if (distance <= width) return { offset: raw, full: false }\n if (!fullSwipe) return { offset: sign * (width + (distance - width) / 3), full: false }\n const travel = Math.min(distance, Math.max(width, rowWidth))\n return { offset: sign * travel, full: travel >= (width + rowWidth) / 2 }\n}\n\nconst SwipeActionsComponent = defineComponent({\n name: \"SwipeActions\",\n inheritAttrs: false,\n props: {\n /** Actions revealed by a swipe toward the trailing edge, the first one at the leading edge */\n leading: { type: Array as PropType<SwipeAction[]>, default: () => [] },\n /** Actions revealed by a swipe toward the leading edge, the first one at the trailing edge */\n trailing: { type: Array as PropType<SwipeAction[]>, default: () => [] },\n /** Where the actions show their labels: `\"hidden\"` (symbols only), `\"inside\"` the capsule, or `\"below\"` it (for rows of 60px and taller, as iOS sets them). @default \"hidden\" */\n labelPlacement: { type: String as PropType<\"hidden\" | \"inside\" | \"below\">, default: \"hidden\" },\n /** A swipe past the middle between the open actions and the far edge runs the first action of that side. @default true */\n fullSwipe: { type: Boolean, default: true },\n },\n setup(props, { attrs, slots }) {\n const offset = ref(0)\n const full = ref(false)\n const swiping = ref(false)\n const rtl = ref(false)\n const round = ref(false)\n const root = ref<HTMLElement | null>(null)\n const sides: Record<SwipeActionsSide, HTMLElement | null> = { leading: null, trailing: null }\n let gesture: Gesture | null = null\n let suppressClick = false\n let observer: ResizeObserver | null = null\n const revealed = computed(() => sideOf(offset.value))\n\n const widthOf = (side: SwipeActionsSide) => sides[side]?.getBoundingClientRect().width ?? 0\n\n const isRtl = () => !!root.value && getComputedStyle(root.value).direction === \"rtl\"\n\n const move = (next: number, nextFull = false) => {\n offset.value = next\n full.value = nextFull\n }\n\n /** Lets go of the gesture: the listeners for its end go, and the row no longer follows the finger. */\n const release = () => {\n const state = gesture\n gesture = null\n state?.detach()\n return state\n }\n\n const close = () => {\n if (closeOpenRow === closer) closeOpenRow = null\n move(0)\n }\n\n /** One function for the life of the row, so the list knows which row is open; another row that opens ends this one's gesture too. */\n const closer = () => {\n const state = release()\n if (state) {\n swiping.value = false\n // The finger of the ended swipe still lifts over this row: its click is not a click on the content.\n if (state.swiping) suppressClick = true\n }\n close()\n }\n\n /** This row takes the place of the open one. */\n const claim = () => {\n if (closeOpenRow && closeOpenRow !== closer) closeOpenRow()\n closeOpenRow = closer\n }\n\n /** Shows a side as wide as its actions (`width` when known), or closes the row when that side has none (any more). */\n const open = (side: SwipeActionsSide, width = widthOf(side)) => {\n if (!(width > 0)) return close()\n claim()\n rtl.value = isRtl()\n move(side === \"leading\" ? width : -width)\n }\n\n /** An open row follows its actions: more of them, other labels or another width move it to their new width. */\n const sync = () => {\n const side = sideOf(offset.value)\n if (!side || gesture?.swiping || full.value) return\n const width = widthOf(side)\n if (!(width > 0)) return close()\n const target = side === \"leading\" ? width : -width\n if (target !== offset.value) move(target)\n }\n\n /**\n * A symbol that has grown as tall as its circle (its max-height) is one, as iOS draws a circle from there. The\n * measure is a capsule that is laid out: a full swipe hides all but the first action of its side, and while none\n * is laid out the shape stays.\n */\n const fit = () => {\n const capsules = [...(root.value?.querySelectorAll<HTMLElement>('[data-shape=\"symbol\"] > :first-child') ?? [])]\n if (capsules.length < 1) {\n round.value = false\n return\n }\n const capsule = capsules.find((element) => element.getBoundingClientRect().height > 0)\n if (!capsule) return\n const max = parseFloat(getComputedStyle(capsule).maxHeight)\n round.value = max > 0 && capsule.getBoundingClientRect().height >= max - 0.5\n }\n\n // After each render, and whenever the actions change size, an open row takes their width and a symbol its shape.\n const observeSides = () => {\n for (const element of [sides.leading, sides.trailing]) if (element) observer?.observe(element, BORDER_BOX)\n }\n onMounted(() => {\n if (typeof ResizeObserver !== \"undefined\") observer = new ResizeObserver(() => {\n fit()\n sync()\n })\n fit()\n observeSides()\n })\n onUpdated(() => {\n fit()\n sync()\n observeSides()\n })\n\n // A press anywhere outside the open row closes it.\n const handleOutsidePointerDown = (event: PointerEvent) => {\n if (event.target instanceof Node && root.value?.contains(event.target)) return\n close()\n }\n watch([revealed, swiping], ([side, moving]) => {\n document.removeEventListener(\"pointerdown\", handleOutsidePointerDown, true)\n if (side && !moving) document.addEventListener(\"pointerdown\", handleOutsidePointerDown, true)\n })\n\n // The open row lets go of the list, and of the finger, when it goes away.\n onBeforeUnmount(() => {\n document.removeEventListener(\"pointerdown\", handleOutsidePointerDown, true)\n observer?.disconnect()\n observer = null\n release()\n if (closeOpenRow === closer) closeOpenRow = null\n })\n\n const settle = (state: Gesture) => {\n const side = sideOf(offset.value)\n if (!side) return close()\n if (full.value) {\n (side === \"leading\" ? props.leading : props.trailing)[0]?.onSelect?.()\n return close()\n }\n // The widths from the start of the swipe: a full swipe may have stretched the actions since.\n if (Math.abs(offset.value) >= state.widths[side] / 2) open(side, state.widths[side])\n else close()\n }\n\n /** The finger lifted (anywhere): a swipe settles, a press on an open row closes it. */\n const finish = () => {\n const state = release()\n if (!state) return\n if (state.swiping) {\n suppressClick = true\n swiping.value = false\n settle(state)\n } else if (state.start !== 0) {\n if (state.swiping === undefined) suppressClick = true\n close()\n }\n }\n\n /** The browser took the gesture (a scroll) or the row lost the finger: the row goes back to where it was. */\n const cancel = () => {\n const state = release()\n if (!state) return\n swiping.value = false\n const side = sideOf(state.start)\n if (state.swiping && side) open(side, state.widths[side])\n else close()\n }\n\n const handlePointerDown = (event: PointerEvent) => {\n if (event.button !== 0 || gesture) return\n // A new press of the primary pointer starts clean: a swipe that another row ended and that was then cancelled leaves\n // no click to swallow. Another finger's press keeps it, as only the primary pointer clicks.\n if (event.isPrimary) suppressClick = false\n if (props.leading.length < 1 && props.trailing.length < 1) return\n // A drag in a text field or along a slider belongs to that control.\n if (event.target instanceof Element && event.target.closest(OWN_DRAG)) return\n const pointerId = event.pointerId\n // The end of the gesture is heard wherever the finger lifts, inside the row or not.\n const handleUp = (end: PointerEvent) => {\n if (end.pointerId === pointerId) finish()\n }\n const handleCancel = (end: PointerEvent) => {\n if (end.pointerId === pointerId) cancel()\n }\n window.addEventListener(\"pointerup\", handleUp, true)\n window.addEventListener(\"pointercancel\", handleCancel, true)\n gesture = {\n pointerId,\n x: event.clientX,\n y: event.clientY,\n start: offset.value,\n swiping: undefined,\n rtl: isRtl(),\n widths: { leading: widthOf(\"leading\"), trailing: widthOf(\"trailing\") },\n rowWidth: root.value?.clientWidth ?? 0,\n detach: () => {\n window.removeEventListener(\"pointerup\", handleUp, true)\n window.removeEventListener(\"pointercancel\", handleCancel, true)\n },\n }\n }\n\n const handlePointerMove = (event: PointerEvent) => {\n const state = gesture\n if (!state || state.pointerId !== event.pointerId || state.swiping === false) return\n const across = (event.clientX - state.x) * (state.rtl ? -1 : 1)\n const down = event.clientY - state.y\n if (state.swiping === undefined) {\n if (Math.abs(across) < SLOP && Math.abs(down) < SLOP) return\n if (Math.abs(across) <= Math.abs(down)) {\n state.swiping = false\n return\n }\n state.swiping = true\n const target = event.currentTarget\n if (target instanceof Element) capture(target, event.pointerId)\n window.getSelection?.()?.removeAllRanges()\n claim()\n rtl.value = state.rtl\n swiping.value = true\n }\n const next = swipeActionsOffset(state.start + across, state.widths, state.rowWidth, props.fullSwipe)\n move(next.offset, next.full)\n }\n\n /** The content lost the finger it held. A child that loses the finger to the content (as a touch moves its implicit capture) ends nothing. */\n const handleLostPointerCapture = (event: PointerEvent) => {\n if (event.target === event.currentTarget && gesture?.pointerId === event.pointerId) cancel()\n }\n\n /** A swipe or a press that closed the row is not a click on the content; a click from the keys still is. */\n const handleClickCapture = (event: MouseEvent) => {\n if (!suppressClick || event.detail === 0) return\n suppressClick = false\n event.preventDefault()\n event.stopPropagation()\n }\n\n /** The focus on an action shows its side; on the content it closes the row. */\n const handleFocusIn = (event: FocusEvent) => {\n if (gesture?.swiping) return\n const target = event.target\n const side = ([\"leading\", \"trailing\"] as const).find((name) => target instanceof Node && !!sides[name]?.contains(target))\n if (side) {\n if (sideOf(offset.value) !== side) open(side)\n } else if (offset.value !== 0) {\n close()\n }\n }\n\n const handleFocusOut = (event: FocusEvent) => {\n if (gesture?.swiping) return\n if (event.relatedTarget instanceof Node && root.value?.contains(event.relatedTarget)) return\n if (offset.value !== 0) close()\n }\n\n const select = (action: SwipeAction, event: MouseEvent) => {\n action.onSelect?.()\n // A press closes the row, as iOS does. From the keys the action keeps the focus, so its side stays open until\n // the focus leaves the row.\n if (event.detail === 0) return\n const target = event.currentTarget\n if (target instanceof HTMLElement) target.blur()\n close()\n }\n\n const renderSide = (side: SwipeActionsSide, actions: SwipeAction[]) => {\n if (actions.length < 1) return null\n const shown = side === \"leading\" ? actions : [...actions].reverse()\n const isFull = full.value && revealed.value === side\n return h(\"div\", {\n \"ref\": (element: unknown) => {\n sides[side] = element instanceof HTMLElement ? element : null\n },\n \"class\": s.Actions,\n \"data-side\": side,\n \"data-full\": isFull ? \"\" : undefined,\n \"style\": isFull ? { width: `${Math.abs(offset.value)}px` } : undefined,\n }, shown.map((action) => {\n const color = action.color ?? \"secondary\"\n // A label alone (text), a symbol with its label inside (label), or a symbol with its label hidden or below.\n const shape = !action.Icon ? \"text\" : props.labelPlacement === \"inside\" ? \"label\" : \"symbol\"\n const labelInside = shape !== \"symbol\"\n const labelBelow = shape === \"symbol\" && props.labelPlacement === \"below\"\n return h(\"button\", {\n \"key\": action.id,\n \"type\": \"button\",\n \"class\": s.Action,\n \"data-color\": color,\n \"data-shape\": shape,\n \"data-first\": action === actions[0] ? \"\" : undefined,\n \"aria-label\": labelInside || labelBelow ? undefined : action.label,\n \"onClick\": (event: MouseEvent) => select(action, event),\n }, [\n h(\"span\", { class: s.Capsule }, [\n action.Icon ? h(action.Icon, { \"class\": s.Icon, \"aria-hidden\": \"true\" }) : null,\n labelInside ? h(\"span\", { class: s.Label }, action.label) : null,\n ]),\n labelBelow ? h(\"span\", { class: s.Caption }, action.label) : null,\n ])\n }))\n }\n\n return () => h(\"div\", {\n ...attrs,\n \"ref\": root,\n \"class\": [s.SwipeActions, attrs.class],\n \"data-row\": \"\",\n \"data-swipe-actions\": \"\",\n \"data-label-placement\": props.labelPlacement,\n \"data-round\": round.value ? \"\" : undefined,\n \"data-revealed\": revealed.value,\n \"data-swiping\": swiping.value ? \"\" : undefined,\n \"onFocusin\": handleFocusIn,\n \"onFocusout\": handleFocusOut,\n }, [\n renderSide(\"leading\", props.leading),\n h(\"div\", {\n \"class\": s.Content,\n \"data-swipe-content\": \"\",\n \"style\": offset.value !== 0 ? { \"--swipe-actions-offset\": `${rtl.value ? -offset.value : offset.value}px` } : undefined,\n \"onPointerdown\": handlePointerDown,\n \"onPointermove\": handlePointerMove,\n \"onLostpointercapture\": handleLostPointerCapture,\n \"onClickCapture\": handleClickCapture,\n }, slots.default?.()),\n renderSide(\"trailing\", props.trailing),\n ])\n },\n})\n\ntype SwipeActionsOwnProps = InstanceType<typeof SwipeActionsComponent>[\"$props\"]\n\n/** SwipeActions props. */\nexport type SwipeActionsProps = SwipeActionsOwnProps\n\n/**\n * Actions behind a row of a list, as the swipe actions of an iOS list: a swipe toward the leading edge reveals the\n * trailing actions, a swipe toward the trailing edge the leading ones, and a full swipe runs the first action of\n * that side. The row is a `data-row` of a FieldGroup. Each action is also a button in the order of the screen, and\n * the focus on one shows its side.\n */\nexport const SwipeActions = SwipeActionsComponent\n"]}
|
|
1
|
+
{"version":3,"file":"SwipeActions.js","sourceRoot":"","sources":["../../../../src/components/SwipeActions/SwipeActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAA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AAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS;gBACvH,eAAe,EAAE,iBAAiB;gBAClC,eAAe,EAAE,iBAAiB;gBAClC,sBAAsB,EAAE,wBAAwB;gBAChD,gBAAgB,EAAE,kBAAkB;aACrC,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YACrB,UAAU,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC;SACvC,CAAC,CAAA;IACJ,CAAC;CACF,CAAC,CAAA;AAOF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,qBAAqB,CAAA","sourcesContent":["import { computed, defineComponent, h, onBeforeUnmount, onMounted, onUpdated, ref, watch, type Component, type PropType } from \"vue\"\nimport s from \"@plexui/styles/components/SwipeActions/SwipeActions.module.css\"\n\n// Vue port of packages/ui/src/components/SwipeActions/SwipeActions.tsx: the same row, sides, gesture, full swipe,\n// keys and focus. The content of the row is the default slot; an action's `Icon` is a component, as in Select.\n\nexport type SwipeActionColor =\n | \"primary\"\n | \"secondary\"\n | \"danger\"\n | \"success\"\n | \"info\"\n | \"discovery\"\n | \"caution\"\n | \"warning\"\n\nexport type SwipeAction = {\n /** Unique ID of the action within its side */\n id: string\n /** Name of the action: shown with `labelPlacement` `\"inside\"` or `\"below\"` (and on an action without an icon), and its accessible name always */\n label: string\n /** Icon of the action */\n Icon?: Component\n /** Solid color of the action. @default \"secondary\" */\n color?: SwipeActionColor\n /** Called when the action is pressed, or by a full swipe when it is the first action of its side */\n onSelect?: () => void\n /** `\"destructive\"`: the action removes the row, so the row slides out and its height collapses, as iOS deletes a row, and `onSelect` comes at the end of that for the list to drop it. A row the list keeps comes back. */\n role?: \"destructive\"\n}\n\nexport type SwipeActionsSide = \"leading\" | \"trailing\"\n\n/** A finger has to travel this far, and farther across than down, before the row follows it. */\nconst SLOP = 10\n\n/** The width an open row moves by is the border box of its actions, edge and content gaps included. */\nconst BORDER_BOX: ResizeObserverOptions = { box: \"border-box\" }\n\n/** A finger lifting faster than this (px/ms) opens the side it moves toward, or closes the row when it moves back, however short the swipe. */\nconst FLICK = 0.3\n\n/** A finger that stopped this long (ms) before it lifted flicks nothing. */\nconst FLICK_WINDOW = 100\n\n/** A trackpad swipe (horizontal wheel) ends when no wheel event has come for this long (ms). */\nconst WHEEL_IDLE = 120\n\n/** Controls that take a horizontal drag themselves. */\nconst OWN_DRAG = 'input, textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"slider\"]'\n\n/** Whether a wheel over `target` belongs to a control or a box inside the row that scrolls across itself. */\nconst scrollsAcross = (target: EventTarget | null, row: Element | null): boolean => {\n for (let element = target instanceof Element ? target : null; element && element !== row; element = element.parentElement) {\n if (element.matches(OWN_DRAG)) return true\n const overflow = getComputedStyle(element).overflowX\n if ((overflow === \"auto\" || overflow === \"scroll\") && element.scrollWidth > element.clientWidth) return true\n }\n return false\n}\n\ntype Gesture = {\n pointerId: number\n x: number\n y: number\n start: number\n /** Undecided while within the slop, then a swipe (true) or a scroll (false). */\n swiping: boolean | undefined\n rtl: boolean\n widths: Record<SwipeActionsSide, number>\n rowWidth: number\n /** Where the finger last was across (px) and when (ms), and how fast it moved there (px/ms). */\n across: number\n time: number\n velocity: number\n /** Removes the listeners for the end of the gesture. */\n detach: () => void\n}\n\n/** The open row: opening another one closes it, as a list keeps one row open. */\nlet closeOpenRow: (() => void) | null = null\n\n/** The row keeps the finger past its edges; a pointer that is no longer active (it lifted between events) cannot be held. */\nconst capture = (element: Element, pointerId: number) => {\n try {\n element.setPointerCapture?.(pointerId)\n } catch {\n // The swipe goes on with the events the row still gets.\n }\n}\n\nconst sideOf = (offset: number): SwipeActionsSide | undefined =>\n offset > 0 ? \"leading\" : offset < 0 ? \"trailing\" : undefined\n\n/**\n * Where a swipe that ended at `offset` settles: a flick (`velocity` px/ms, toward the trailing edge when positive)\n * opens the side it moves toward and closes the row when it moves back; a slow one opens a side moved past half its\n * `width`.\n */\nexport const swipeActionsSettle = (offset: number, velocity: number, width: number): boolean => {\n if (Math.abs(velocity) >= FLICK) return Math.sign(velocity) === Math.sign(offset)\n return Math.abs(offset) >= width / 2\n}\n\n/** The duration (ms) the row moves in, none when the motion is reduced. */\nconst durationOf = (element: Element) => {\n if (typeof matchMedia === \"function\" && matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return 0\n const value = getComputedStyle(element).getPropertyValue(\"--swipe-actions-duration\").trim()\n const time = parseFloat(value)\n if (!Number.isFinite(time)) return 0\n return value.endsWith(\"ms\") ? time : time * 1000\n}\n\n/**\n * Where the content goes for a swipe of `raw` px toward the trailing edge (negative: toward the leading edge), and\n * whether that is a full swipe. A side without actions stays shut. Past its actions the content follows the finger\n * where a full swipe is allowed, and a third as fast where it is not; past the middle between the open actions and\n * the far edge of the row the swipe is full.\n */\nexport const swipeActionsOffset = (\n raw: number,\n widths: Record<SwipeActionsSide, number>,\n rowWidth: number,\n fullSwipe: boolean,\n): { offset: number; full: boolean } => {\n const side = sideOf(raw)\n const width = side ? widths[side] : 0\n if (!side || !(width > 0)) return { offset: 0, full: false }\n const sign = Math.sign(raw)\n const distance = Math.abs(raw)\n if (distance <= width) return { offset: raw, full: false }\n if (!fullSwipe) return { offset: sign * (width + (distance - width) / 3), full: false }\n const travel = Math.min(distance, Math.max(width, rowWidth))\n return { offset: sign * travel, full: travel >= (width + rowWidth) / 2 }\n}\n\nconst SwipeActionsComponent = defineComponent({\n name: \"SwipeActions\",\n inheritAttrs: false,\n props: {\n /** Actions revealed by a swipe toward the trailing edge, the first one at the leading edge */\n leading: { type: Array as PropType<SwipeAction[]>, default: () => [] },\n /** Actions revealed by a swipe toward the leading edge, the first one at the trailing edge */\n trailing: { type: Array as PropType<SwipeAction[]>, default: () => [] },\n /** Where the actions show their labels: `\"hidden\"` (symbols only), `\"inside\"` the capsule, or `\"below\"` it (for rows of 60px and taller, as iOS sets them). @default \"hidden\" */\n labelPlacement: { type: String as PropType<\"hidden\" | \"inside\" | \"below\">, default: \"hidden\" },\n /** A swipe past the middle between the open actions and the far edge runs the first action of that side. @default true */\n fullSwipe: { type: Boolean, default: true },\n },\n setup(props, { attrs, slots }) {\n const offset = ref(0)\n const full = ref(false)\n const swiping = ref(false)\n const rtl = ref(false)\n const round = ref(false)\n const removing = ref(false)\n const height = ref<number | undefined>(undefined)\n /** The timers of a removal and of a trackpad swipe, cleared when the row goes. */\n const timeouts: number[] = []\n let wheelTimer = 0\n /** A trackpad swipe: where it started, how far it went, the widths at its start. `locked` drops the momentum after it. */\n let wheel: { start: number; across: number; widths: Record<SwipeActionsSide, number>; rowWidth: number } | \"locked\" | null = null\n const root = ref<HTMLElement | null>(null)\n const sides: Record<SwipeActionsSide, HTMLElement | null> = { leading: null, trailing: null }\n let gesture: Gesture | null = null\n let suppressClick = false\n let observer: ResizeObserver | null = null\n const revealed = computed(() => sideOf(offset.value))\n\n const widthOf = (side: SwipeActionsSide) => sides[side]?.getBoundingClientRect().width ?? 0\n\n const isRtl = () => !!root.value && getComputedStyle(root.value).direction === \"rtl\"\n\n const move = (next: number, nextFull = false) => {\n offset.value = next\n full.value = nextFull\n }\n\n /** Lets go of the gesture: the listeners for its end go, and the row no longer follows the finger. */\n const release = () => {\n const state = gesture\n gesture = null\n state?.detach()\n return state\n }\n\n /** No action of the row keeps the focus. */\n const blurActions = () => {\n const focused = document.activeElement\n if (focused instanceof HTMLElement && (sides.leading?.contains(focused) || sides.trailing?.contains(focused))) focused.blur()\n }\n\n const close = () => {\n if (removing.value) return\n // Whatever closes or opens the row (a press, the focus, another row) ends a trackpad swipe and its momentum.\n lockWheel()\n // A closed row hides its actions, so none keeps the focus (Enter would run a hidden action).\n blurActions()\n if (closeOpenRow === closer) closeOpenRow = null\n move(0)\n }\n\n /** One function for the life of the row, so the list knows which row is open; another row that opens ends this one's gesture too. */\n const closer = () => {\n const state = release()\n if (state) {\n swiping.value = false\n // The finger of the ended swipe still lifts over this row: its click is not a click on the content.\n if (state.swiping) suppressClick = true\n }\n lockWheel()\n close()\n }\n\n /** This row takes the place of the open one. */\n const claim = () => {\n if (closeOpenRow && closeOpenRow !== closer) closeOpenRow()\n closeOpenRow = closer\n }\n\n /** Shows a side as wide as its actions (`width` when known), or closes the row when that side has none (any more). */\n const open = (side: SwipeActionsSide, width = widthOf(side)) => {\n if (removing.value) return\n if (!(width > 0)) return close()\n lockWheel()\n claim()\n rtl.value = isRtl()\n move(side === \"leading\" ? width : -width)\n }\n\n /** An open row follows its actions: more of them, other labels or another width move it to their new width. */\n const sync = () => {\n const side = sideOf(offset.value)\n if (!side || removing.value || gesture?.swiping || (wheel && wheel !== \"locked\") || full.value) return\n const width = widthOf(side)\n if (!(width > 0)) return close()\n const target = side === \"leading\" ? width : -width\n if (target !== offset.value) move(target)\n }\n\n /**\n * A symbol that has grown as tall as its circle (its max-height) is one, as iOS draws a circle from there. The\n * measure is a capsule that is laid out: a full swipe hides all but the first action of its side, and while none\n * is laid out the shape stays.\n */\n const fit = () => {\n const capsules = [...(root.value?.querySelectorAll<HTMLElement>('[data-shape=\"symbol\"] > :first-child') ?? [])]\n if (capsules.length < 1) {\n round.value = false\n return\n }\n const capsule = capsules.find((element) => element.getBoundingClientRect().height > 0)\n if (!capsule) return\n const max = parseFloat(getComputedStyle(capsule).maxHeight)\n round.value = max > 0 && capsule.getBoundingClientRect().height >= max - 0.5\n }\n\n // After each render, and whenever the actions change size, an open row takes their width and a symbol its shape.\n const observeSides = () => {\n for (const element of [sides.leading, sides.trailing]) if (element) observer?.observe(element, BORDER_BOX)\n }\n onMounted(() => {\n if (typeof ResizeObserver !== \"undefined\") observer = new ResizeObserver(() => {\n fit()\n sync()\n })\n fit()\n observeSides()\n // A trackpad swipe has to stop the page's own scroll and back gesture, which a passive listener cannot.\n root.value?.addEventListener(\"wheel\", handleWheel, { passive: false })\n })\n onUpdated(() => {\n fit()\n sync()\n observeSides()\n })\n\n // A press anywhere outside the open row closes it, while a trackpad moves it too; a finger's own swipe keeps it.\n const handleOutsidePointerDown = (event: PointerEvent) => {\n if (event.target instanceof Node && root.value?.contains(event.target)) return\n if (gesture?.swiping) return\n close()\n }\n watch(revealed, (side) => {\n document.removeEventListener(\"pointerdown\", handleOutsidePointerDown, true)\n if (side) document.addEventListener(\"pointerdown\", handleOutsidePointerDown, true)\n })\n\n // The open row lets go of the list, and of the finger, when it goes away.\n onBeforeUnmount(() => {\n document.removeEventListener(\"pointerdown\", handleOutsidePointerDown, true)\n root.value?.removeEventListener(\"wheel\", handleWheel)\n for (const id of timeouts) window.clearTimeout(id)\n window.clearTimeout(wheelTimer)\n observer?.disconnect()\n observer = null\n release()\n if (closeOpenRow === closer) closeOpenRow = null\n })\n\n /**\n * A destructive action: the content slides out to the side it was swiped to (the trailing one when pressed from\n * the keys) and the row collapses, then the action runs; a row the list keeps comes back closed.\n */\n const remove = (action: SwipeAction, side: SwipeActionsSide) => {\n const element = root.value\n if (!element || removing.value) return\n const duration = durationOf(element)\n const width = element.clientWidth\n claim()\n height.value = element.getBoundingClientRect().height\n rtl.value = isRtl()\n move(side === \"leading\" ? width : -width, full.value)\n removing.value = true\n lockWheel()\n timeouts.push(window.setTimeout(() => {\n action.onSelect?.()\n // A row the list dropped is gone by now; one it keeps comes back.\n timeouts.push(window.setTimeout(() => {\n removing.value = false\n height.value = undefined\n // An action that keeps the focus (chosen from the keys) keeps its side open, so the focus is never on a hidden action.\n const focused = document.activeElement\n const side = ([\"leading\", \"trailing\"] as const).find((name) => !!focused && !!sides[name]?.contains(focused))\n if (side) open(side)\n else close()\n }))\n }, duration))\n }\n\n /** Runs an action from its side: a destructive one removes the row first. */\n const run = (action: SwipeAction | undefined, side: SwipeActionsSide) => {\n if (!action) return close()\n if (action.role === \"destructive\") return remove(action, side)\n action.onSelect?.()\n close()\n }\n\n const settle = (state: Gesture, velocity = 0) => {\n const side = sideOf(offset.value)\n if (!side) return close()\n if (full.value) return run((side === \"leading\" ? props.leading : props.trailing)[0], side)\n // The widths from the start of the swipe: a full swipe may have stretched the actions since.\n if (swipeActionsSettle(offset.value, velocity, state.widths[side])) open(side, state.widths[side])\n else close()\n }\n\n /** A trackpad swipe that has not settled yet settles no more, where it stands (a press or a removal takes over). */\n function stopWheel() {\n window.clearTimeout(wheelTimer)\n if (wheel && wheel !== \"locked\") swiping.value = false\n wheel = null\n }\n\n /** Another row took over: this row's trackpad swipe ends here, and the momentum after it moves nothing. */\n function lockWheel() {\n if (!wheel || wheel === \"locked\") return\n stopWheel()\n wheel = \"locked\"\n wheelTimer = window.setTimeout(() => {\n wheel = null\n }, WHEEL_IDLE)\n }\n\n /**\n * A two-finger swipe on a trackpad moves the row as a finger does, without a full swipe (the momentum after the\n * fingers lift would run an action), and settles when the wheel stops. A swipe down scrolls the page.\n */\n function handleWheel(event: WheelEvent) {\n if (event.ctrlKey) return\n const horizontal = Math.abs(event.deltaX) > Math.abs(event.deltaY)\n let state = wheel\n // The momentum after a swipe keeps the lock until it stops, a removal or not.\n if (state === \"locked\") {\n window.clearTimeout(wheelTimer)\n if (horizontal) event.preventDefault()\n wheelTimer = window.setTimeout(() => {\n wheel = null\n }, WHEEL_IDLE)\n return\n }\n if (removing.value || gesture || (props.leading.length < 1 && props.trailing.length < 1)) return\n if (!state && (!horizontal || scrollsAcross(event.target, root.value))) return\n window.clearTimeout(wheelTimer)\n event.preventDefault()\n if (!state) {\n // The row moves under the focus: an action that has it lets it go, as a closed row does.\n const start = offset.value\n blurActions()\n state = { start, across: 0, widths: { leading: widthOf(\"leading\"), trailing: widthOf(\"trailing\") }, rowWidth: root.value?.clientWidth ?? 0 }\n wheel = state\n claim()\n rtl.value = isRtl()\n swiping.value = true\n }\n const scale = event.deltaMode === 1 ? 16 : event.deltaMode === 2 ? state.rowWidth : 1\n // The page scrolls the other way the fingers move: fingers moving left give a positive deltaX.\n state.across -= event.deltaX * scale * (isRtl() ? -1 : 1)\n const next = swipeActionsOffset(state.start + state.across, state.widths, state.rowWidth, false)\n move(next.offset)\n const widths = state.widths\n wheelTimer = window.setTimeout(() => {\n wheel = \"locked\"\n swiping.value = false\n const side = sideOf(offset.value)\n if (side && swipeActionsSettle(offset.value, 0, widths[side])) open(side, widths[side])\n else close()\n wheelTimer = window.setTimeout(() => {\n wheel = null\n }, WHEEL_IDLE)\n }, WHEEL_IDLE)\n }\n\n /** The finger lifted (anywhere): a swipe settles, a press on an open row closes it. */\n const finish = () => {\n const state = release()\n if (!state) return\n if (state.swiping) {\n suppressClick = true\n swiping.value = false\n settle(state, performance.now() - state.time <= FLICK_WINDOW ? state.velocity : 0)\n } else if (state.start !== 0) {\n if (state.swiping === undefined) suppressClick = true\n close()\n }\n }\n\n /** The browser took the gesture (a scroll) or the row lost the finger: the row goes back to where it was. */\n const cancel = () => {\n const state = release()\n if (!state) return\n swiping.value = false\n const side = sideOf(state.start)\n if (state.swiping && side) open(side, state.widths[side])\n else close()\n }\n\n const handlePointerDown = (event: PointerEvent) => {\n if (event.button !== 0 || gesture || removing.value) return\n // A new press of the primary pointer starts clean: a swipe that another row ended and that was then cancelled leaves\n // no click to swallow. Another finger's press keeps it, as only the primary pointer clicks.\n if (event.isPrimary) suppressClick = false\n if (props.leading.length < 1 && props.trailing.length < 1) return\n // Any press ends a trackpad swipe still moving the row, and its momentum.\n lockWheel()\n // A drag in a text field or along a slider belongs to that control.\n if (event.target instanceof Element && event.target.closest(OWN_DRAG)) return\n const pointerId = event.pointerId\n // The end of the gesture is heard wherever the finger lifts, inside the row or not.\n const handleUp = (end: PointerEvent) => {\n if (end.pointerId === pointerId) finish()\n }\n const handleCancel = (end: PointerEvent) => {\n if (end.pointerId === pointerId) cancel()\n }\n window.addEventListener(\"pointerup\", handleUp, true)\n window.addEventListener(\"pointercancel\", handleCancel, true)\n gesture = {\n pointerId,\n x: event.clientX,\n y: event.clientY,\n start: offset.value,\n swiping: undefined,\n rtl: isRtl(),\n widths: { leading: widthOf(\"leading\"), trailing: widthOf(\"trailing\") },\n rowWidth: root.value?.clientWidth ?? 0,\n across: 0,\n time: performance.now(),\n velocity: 0,\n detach: () => {\n window.removeEventListener(\"pointerup\", handleUp, true)\n window.removeEventListener(\"pointercancel\", handleCancel, true)\n },\n }\n }\n\n const handlePointerMove = (event: PointerEvent) => {\n const state = gesture\n if (!state || state.pointerId !== event.pointerId || state.swiping === false) return\n const across = (event.clientX - state.x) * (state.rtl ? -1 : 1)\n const down = event.clientY - state.y\n // The speed is the finger's latest, from every move, the ones within the slop too.\n const now = performance.now()\n if (now > state.time) state.velocity = (across - state.across) / (now - state.time)\n state.across = across\n state.time = now\n if (state.swiping === undefined) {\n if (Math.abs(across) < SLOP && Math.abs(down) < SLOP) return\n if (Math.abs(across) <= Math.abs(down)) {\n state.swiping = false\n return\n }\n state.swiping = true\n const target = event.currentTarget\n if (target instanceof Element) capture(target, event.pointerId)\n window.getSelection?.()?.removeAllRanges()\n claim()\n rtl.value = state.rtl\n swiping.value = true\n }\n const next = swipeActionsOffset(state.start + across, state.widths, state.rowWidth, props.fullSwipe)\n move(next.offset, next.full)\n }\n\n /** The content lost the finger it held. A child that loses the finger to the content (as a touch moves its implicit capture) ends nothing. */\n const handleLostPointerCapture = (event: PointerEvent) => {\n if (event.target === event.currentTarget && gesture?.pointerId === event.pointerId) cancel()\n }\n\n /** A swipe or a press that closed the row is not a click on the content; a click from the keys still is. */\n const handleClickCapture = (event: MouseEvent) => {\n if (!suppressClick || event.detail === 0) return\n suppressClick = false\n event.preventDefault()\n event.stopPropagation()\n }\n\n /** The focus on an action shows its side; on the content it closes the row. */\n const handleFocusIn = (event: FocusEvent) => {\n if (gesture?.swiping || removing.value) return\n const target = event.target\n const side = ([\"leading\", \"trailing\"] as const).find((name) => target instanceof Node && !!sides[name]?.contains(target))\n if (side) {\n // A trackpad swipe still moving the row ends with the side fully open.\n const wheeling = !!wheel && wheel !== \"locked\"\n if (wheeling || sideOf(offset.value) !== side) open(side)\n } else if (offset.value !== 0) {\n close()\n }\n }\n\n const handleFocusOut = (event: FocusEvent) => {\n if (gesture?.swiping || removing.value) return\n if (event.relatedTarget instanceof Node && root.value?.contains(event.relatedTarget)) return\n if (offset.value !== 0) close()\n }\n\n const select = (action: SwipeAction, side: SwipeActionsSide, event: MouseEvent) => {\n // A row being removed runs nothing more, from the keys either.\n if (removing.value) return\n // A press ends a trackpad swipe still moving the row.\n lockWheel()\n // A pointer leaves no focus on the action, so a row the list keeps closes.\n const target = event.currentTarget\n if (event.detail !== 0 && target instanceof HTMLElement) target.blur()\n if (action.role === \"destructive\") return remove(action, side)\n action.onSelect?.()\n // A press closes the row, as iOS does. From the keys the action keeps the focus, so its side stays open until\n // the focus leaves the row.\n if (event.detail === 0) return\n close()\n }\n\n const renderSide = (side: SwipeActionsSide, actions: SwipeAction[]) => {\n if (actions.length < 1) return null\n const shown = side === \"leading\" ? actions : [...actions].reverse()\n const isFull = full.value && revealed.value === side\n return h(\"div\", {\n \"ref\": (element: unknown) => {\n sides[side] = element instanceof HTMLElement ? element : null\n },\n \"class\": s.Actions,\n \"data-side\": side,\n \"data-full\": isFull ? \"\" : undefined,\n \"style\": isFull ? { width: `${Math.abs(offset.value)}px` } : undefined,\n }, shown.map((action) => {\n const color = action.color ?? \"secondary\"\n // A label alone (text), a symbol with its label inside (label), or a symbol with its label hidden or below.\n const shape = !action.Icon ? \"text\" : props.labelPlacement === \"inside\" ? \"label\" : \"symbol\"\n const labelInside = shape !== \"symbol\"\n const labelBelow = shape === \"symbol\" && props.labelPlacement === \"below\"\n return h(\"button\", {\n \"key\": action.id,\n \"type\": \"button\",\n \"class\": s.Action,\n \"data-color\": color,\n \"data-shape\": shape,\n \"data-first\": action === actions[0] ? \"\" : undefined,\n \"aria-label\": labelInside || labelBelow ? undefined : action.label,\n \"onClick\": (event: MouseEvent) => select(action, side, event),\n }, [\n h(\"span\", { class: s.Capsule }, [\n action.Icon ? h(action.Icon, { \"class\": s.Icon, \"aria-hidden\": \"true\" }) : null,\n labelInside ? h(\"span\", { class: s.Label }, action.label) : null,\n ]),\n labelBelow ? h(\"span\", { class: s.Caption }, action.label) : null,\n ])\n }))\n }\n\n return () => h(\"div\", {\n ...attrs,\n \"ref\": root,\n \"class\": [s.SwipeActions, attrs.class],\n \"data-row\": \"\",\n \"data-swipe-actions\": \"\",\n \"data-label-placement\": props.labelPlacement,\n \"data-round\": round.value ? \"\" : undefined,\n \"data-revealed\": revealed.value,\n \"data-swiping\": swiping.value ? \"\" : undefined,\n \"data-removing\": removing.value ? \"\" : undefined,\n // The row collapses from its height (keyframes in the CSS), so no frame has to pass first.\n \"style\": height.value !== undefined ? [attrs.style, { \"--swipe-actions-row-height\": `${height.value}px` }] : attrs.style,\n \"onFocusin\": handleFocusIn,\n \"onFocusout\": handleFocusOut,\n }, [\n renderSide(\"leading\", props.leading),\n h(\"div\", {\n \"class\": s.Content,\n \"data-swipe-content\": \"\",\n \"style\": offset.value !== 0 ? { \"--swipe-actions-offset\": `${rtl.value ? -offset.value : offset.value}px` } : undefined,\n \"onPointerdown\": handlePointerDown,\n \"onPointermove\": handlePointerMove,\n \"onLostpointercapture\": handleLostPointerCapture,\n \"onClickCapture\": handleClickCapture,\n }, slots.default?.()),\n renderSide(\"trailing\", props.trailing),\n ])\n },\n})\n\ntype SwipeActionsOwnProps = InstanceType<typeof SwipeActionsComponent>[\"$props\"]\n\n/** SwipeActions props. */\nexport type SwipeActionsProps = SwipeActionsOwnProps\n\n/**\n * Actions behind a row of a list, as the swipe actions of an iOS list: a swipe toward the leading edge reveals the\n * trailing actions, a swipe toward the trailing edge the leading ones, and a full swipe runs the first action of\n * that side. The row is a `data-row` of a FieldGroup. Each action is also a button in the order of the screen, and\n * the focus on one shows its side.\n */\nexport const SwipeActions = SwipeActionsComponent\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { SwipeActions, swipeActionsOffset, } from "./SwipeActions.js";
|
|
1
|
+
export { SwipeActions, swipeActionsOffset, swipeActionsSettle, } from "./SwipeActions.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/SwipeActions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,kBAAkB,GAKnB,MAAM,mBAAmB,CAAA","sourcesContent":["export {\n SwipeActions,\n swipeActionsOffset,\n type SwipeAction,\n type SwipeActionColor,\n type SwipeActionsProps,\n type SwipeActionsSide,\n} from \"./SwipeActions.js\"\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/SwipeActions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,GAKnB,MAAM,mBAAmB,CAAA","sourcesContent":["export {\n SwipeActions,\n swipeActionsOffset,\n swipeActionsSettle,\n type SwipeAction,\n type SwipeActionColor,\n type SwipeActionsProps,\n type SwipeActionsSide,\n} from \"./SwipeActions.js\"\n"]}
|