@1337exp/taoux 0.3.0 → 0.5.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/CHANGELOG.md +11 -0
- package/README.md +5 -2
- package/README.ru.md +5 -2
- package/dist/sortable.d.ts +66 -0
- package/dist/sortable.js +293 -0
- package/dist/sortable.js.map +1 -0
- package/dist/swiperow/TaoxSwipeRow.vue.d.ts +50 -0
- package/dist/swiperow/index.d.ts +3 -0
- package/dist/swiperow/model.d.ts +66 -0
- package/dist/swiperow.css +95 -0
- package/dist/swiperow.js +309 -0
- package/dist/swiperow.js.map +1 -0
- package/dist/undo.d.ts +113 -0
- package/dist/undo.js +166 -0
- package/dist/undo.js.map +1 -0
- package/package.json +15 -2
- package/skills/taoux/SKILL.md +5 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type SwipeRelease } from '../gestures';
|
|
2
|
+
/**
|
|
3
|
+
* An action of a swipe row. `tone` is a TaoUI tone (`neutral`, `danger`, `success`…), `icon` a TaoIcon name.
|
|
4
|
+
* Действие свайп-строки. `tone` — тон TaoUI, `icon` — имя TaoIcon.
|
|
5
|
+
*/
|
|
6
|
+
export interface SwipeRowAction {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
icon?: string;
|
|
10
|
+
tone?: 'accent' | 'neutral' | 'success' | 'danger' | 'warning' | 'info';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The thresholds of the row, px or a share of its width.
|
|
14
|
+
* Пороги строки, px или доля её ширины.
|
|
15
|
+
*/
|
|
16
|
+
export interface SwipeRowGeometry {
|
|
17
|
+
/** The row width. / Ширина строки. */
|
|
18
|
+
width: number;
|
|
19
|
+
/** How wide each end action stands when the row is open. / Ширина каждого действия справа в открытой строке. */
|
|
20
|
+
actionWidth: number;
|
|
21
|
+
/** How many end actions. / Сколько действий справа. */
|
|
22
|
+
endCount: number;
|
|
23
|
+
/** Whether there is a start action. / Есть ли действие слева. */
|
|
24
|
+
hasStart: boolean;
|
|
25
|
+
/** Whether pulling far runs the last end action by itself. / Выполняет ли длинный свайп последнее действие сам. */
|
|
26
|
+
fullSwipe: boolean;
|
|
27
|
+
}
|
|
28
|
+
/** Past this share of the width a pull to the end runs the last action. / После этой доли ширины длинный свайп выполняет последнее действие. */
|
|
29
|
+
export declare const FULL_SWIPE_RATIO = 0.6;
|
|
30
|
+
/** A pull to the start runs its action past this many px (or a third of a narrow row). / Свайп вправо выполняет действие после стольких px. */
|
|
31
|
+
export declare const START_THRESHOLD_PX = 96;
|
|
32
|
+
export declare const startThreshold: (g: SwipeRowGeometry) => number;
|
|
33
|
+
export declare const endOpenWidth: (g: SwipeRowGeometry) => number;
|
|
34
|
+
export declare const fullThreshold: (g: SwipeRowGeometry) => number;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the row, at this offset, is past the point where releasing runs an action: `start`, `full` or null.
|
|
37
|
+
* Пройдена ли при этом сдвиге точка, после которой отпускание выполняет действие: `start`, `full` или null.
|
|
38
|
+
*/
|
|
39
|
+
export declare function armedAt(offset: number, g: SwipeRowGeometry): 'start' | 'full' | null;
|
|
40
|
+
/** How far the row may move: no further than there is something behind it. / Насколько строка может уехать. */
|
|
41
|
+
export declare function clampOffset(offset: number, g: SwipeRowGeometry): number;
|
|
42
|
+
export type SwipeRowOutcome = {
|
|
43
|
+
kind: 'rest';
|
|
44
|
+
open: boolean;
|
|
45
|
+
} | {
|
|
46
|
+
kind: 'start';
|
|
47
|
+
} | {
|
|
48
|
+
kind: 'full';
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* What a release does. A pull to the start past its threshold (or flung that way past half of it) runs the start
|
|
52
|
+
* action; a pull to the end past the full threshold runs the last end action; otherwise the row rests open or closed,
|
|
53
|
+
* a fling going on in its direction (`settleOpen`).
|
|
54
|
+
* Что делает отпускание. Свайп вправо дальше порога (или брошенный туда дальше его половины) выполняет действие слева;
|
|
55
|
+
* влево дальше полного порога — последнее действие справа; иначе строка встаёт открытой или закрытой, бросок
|
|
56
|
+
* продолжается в своём направлении.
|
|
57
|
+
*/
|
|
58
|
+
export declare function swipeRowRelease(release: SwipeRelease, g: SwipeRowGeometry): SwipeRowOutcome;
|
|
59
|
+
/**
|
|
60
|
+
* The widths of the end actions at a pull of `drag` px (≥ 0): they share the space evenly, so they grow from slivers
|
|
61
|
+
* to their full width and on; once the full swipe is armed the last one takes nearly all of it and the others shrink
|
|
62
|
+
* to slivers.
|
|
63
|
+
* Ширины действий справа при протяжке на `drag` px: делят место поровну, поэтому растут от полосок до полной ширины и
|
|
64
|
+
* дальше; когда длинный свайп взведён, последнее занимает почти всё, остальные сжимаются в полоски.
|
|
65
|
+
*/
|
|
66
|
+
export declare function endWidths(drag: number, g: SwipeRowGeometry, armed: boolean, gap?: number): number[];
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
|
|
2
|
+
.tx-swipe {
|
|
3
|
+
--tx-swipe-gap: 6px;
|
|
4
|
+
--tx-swipe-radius: var(--tao-radius-panel, 12px);
|
|
5
|
+
position: relative;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
border-radius: var(--tx-swipe-radius);
|
|
8
|
+
}
|
|
9
|
+
.tx-swipe__front {
|
|
10
|
+
position: relative;
|
|
11
|
+
z-index: 1;
|
|
12
|
+
/* the page keeps the vertical scroll, the tracker takes the sideways pull / вертикаль — странице, вбок — трекеру */
|
|
13
|
+
touch-action: pan-y;
|
|
14
|
+
border-radius: inherit;
|
|
15
|
+
background: var(--tao-color-surface-raised, #1f1f1f);
|
|
16
|
+
transition: transform 0.22s ease;
|
|
17
|
+
}
|
|
18
|
+
.tx-swipe--dragging .tx-swipe__front {
|
|
19
|
+
transition: none;
|
|
20
|
+
}
|
|
21
|
+
.tx-swipe__start,
|
|
22
|
+
.tx-swipe__end {
|
|
23
|
+
position: absolute;
|
|
24
|
+
inset-block: 0;
|
|
25
|
+
display: flex;
|
|
26
|
+
gap: var(--tx-swipe-gap);
|
|
27
|
+
}
|
|
28
|
+
.tx-swipe__start {
|
|
29
|
+
inset-inline-start: 0;
|
|
30
|
+
padding-inline-end: var(--tx-swipe-gap);
|
|
31
|
+
transition: width 0.22s ease;
|
|
32
|
+
}
|
|
33
|
+
.tx-swipe__end {
|
|
34
|
+
inset-inline-end: 0;
|
|
35
|
+
justify-content: flex-end;
|
|
36
|
+
}
|
|
37
|
+
.tx-swipe--dragging .tx-swipe__start {
|
|
38
|
+
transition: none;
|
|
39
|
+
}
|
|
40
|
+
.tx-swipe__action {
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
flex: none;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
gap: 4px;
|
|
47
|
+
min-width: 0;
|
|
48
|
+
height: 100%;
|
|
49
|
+
padding: 0;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
border: 0;
|
|
52
|
+
border-radius: var(--tx-swipe-radius);
|
|
53
|
+
background: color-mix(in srgb, var(--tao-tone) 22%, var(--tao-color-surface-raised, #1f1f1f));
|
|
54
|
+
color: var(--tao-tone-text);
|
|
55
|
+
font: inherit;
|
|
56
|
+
font-size: 13px;
|
|
57
|
+
cursor: pointer;
|
|
58
|
+
transition:
|
|
59
|
+
width 0.15s ease,
|
|
60
|
+
background-color 0.15s ease;
|
|
61
|
+
}
|
|
62
|
+
.tx-swipe--dragging .tx-swipe__end .tx-swipe__action {
|
|
63
|
+
transition: background-color 0.15s ease;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* the full swipe armed: the last action takes the row; the widths animate to it / длинный свайп взведён */
|
|
67
|
+
.tx-swipe--armed-full .tx-swipe__end .tx-swipe__action {
|
|
68
|
+
transition:
|
|
69
|
+
width 0.15s ease,
|
|
70
|
+
background-color 0.15s ease;
|
|
71
|
+
}
|
|
72
|
+
.tx-swipe__action--start {
|
|
73
|
+
flex: 1;
|
|
74
|
+
}
|
|
75
|
+
.tx-swipe__action--armed {
|
|
76
|
+
background: color-mix(in srgb, var(--tao-tone) 45%, var(--tao-color-surface-raised, #1f1f1f));
|
|
77
|
+
color: var(--tao-color-text-strong);
|
|
78
|
+
}
|
|
79
|
+
.tx-swipe__action:focus-visible {
|
|
80
|
+
outline: 2px solid var(--tao-color-accent);
|
|
81
|
+
outline-offset: -2px;
|
|
82
|
+
}
|
|
83
|
+
.tx-swipe__label {
|
|
84
|
+
max-width: 100%;
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
text-overflow: ellipsis;
|
|
87
|
+
white-space: nowrap;
|
|
88
|
+
}
|
|
89
|
+
@media (prefers-reduced-motion: reduce) {
|
|
90
|
+
.tx-swipe__front,
|
|
91
|
+
.tx-swipe__start,
|
|
92
|
+
.tx-swipe__action {
|
|
93
|
+
transition: none;
|
|
94
|
+
}
|
|
95
|
+
}
|
package/dist/swiperow.js
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { SwipeTracker, settleOpen } from "./gestures.js";
|
|
2
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeModels, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, openBlock, ref, renderList, renderSlot, toDisplayString, unref, useModel, watch } from "vue";
|
|
3
|
+
import { TaoIcon, toneClass } from "@1337exp/taoui";
|
|
4
|
+
//#region src/swiperow/model.ts
|
|
5
|
+
/** Past this share of the width a pull to the end runs the last action. / После этой доли ширины длинный свайп выполняет последнее действие. */
|
|
6
|
+
var FULL_SWIPE_RATIO = .6;
|
|
7
|
+
/** A pull to the start runs its action past this many px (or a third of a narrow row). / Свайп вправо выполняет действие после стольких px. */
|
|
8
|
+
var START_THRESHOLD_PX = 96;
|
|
9
|
+
var startThreshold = (g) => Math.min(96, g.width / 3);
|
|
10
|
+
var endOpenWidth = (g) => g.actionWidth * g.endCount;
|
|
11
|
+
var fullThreshold = (g) => Math.max(endOpenWidth(g) + 24, g.width * FULL_SWIPE_RATIO);
|
|
12
|
+
/**
|
|
13
|
+
* Whether the row, at this offset, is past the point where releasing runs an action: `start`, `full` or null.
|
|
14
|
+
* Пройдена ли при этом сдвиге точка, после которой отпускание выполняет действие: `start`, `full` или null.
|
|
15
|
+
*/
|
|
16
|
+
function armedAt(offset, g) {
|
|
17
|
+
if (offset > 0 && g.hasStart && offset >= startThreshold(g)) return "start";
|
|
18
|
+
if (offset < 0 && g.fullSwipe && g.endCount > 0 && -offset >= fullThreshold(g)) return "full";
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
/** How far the row may move: no further than there is something behind it. / Насколько строка может уехать. */
|
|
22
|
+
function clampOffset(offset, g) {
|
|
23
|
+
const right = g.hasStart ? g.width : 0;
|
|
24
|
+
const left = g.endCount === 0 ? 0 : g.fullSwipe ? -g.width : -endOpenWidth(g) * 1.5;
|
|
25
|
+
return Math.min(right, Math.max(left, offset));
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* What a release does. A pull to the start past its threshold (or flung that way past half of it) runs the start
|
|
29
|
+
* action; a pull to the end past the full threshold runs the last end action; otherwise the row rests open or closed,
|
|
30
|
+
* a fling going on in its direction (`settleOpen`).
|
|
31
|
+
* Что делает отпускание. Свайп вправо дальше порога (или брошенный туда дальше его половины) выполняет действие слева;
|
|
32
|
+
* влево дальше полного порога — последнее действие справа; иначе строка встаёт открытой или закрытой, бросок
|
|
33
|
+
* продолжается в своём направлении.
|
|
34
|
+
*/
|
|
35
|
+
function swipeRowRelease(release, g) {
|
|
36
|
+
const offset = clampOffset(release.offset, g);
|
|
37
|
+
const armed = armedAt(offset, g);
|
|
38
|
+
if (armed) return { kind: armed };
|
|
39
|
+
if (offset > 0 && g.hasStart && release.velocity >= .4 && offset >= startThreshold(g) / 2) return { kind: "start" };
|
|
40
|
+
if (g.endCount === 0) return {
|
|
41
|
+
kind: "rest",
|
|
42
|
+
open: false
|
|
43
|
+
};
|
|
44
|
+
return {
|
|
45
|
+
kind: "rest",
|
|
46
|
+
open: settleOpen({
|
|
47
|
+
offset: Math.min(0, offset),
|
|
48
|
+
velocity: release.velocity
|
|
49
|
+
}, { end: endOpenWidth(g) }) < 0
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The widths of the end actions at a pull of `drag` px (≥ 0): they share the space evenly, so they grow from slivers
|
|
54
|
+
* to their full width and on; once the full swipe is armed the last one takes nearly all of it and the others shrink
|
|
55
|
+
* to slivers.
|
|
56
|
+
* Ширины действий справа при протяжке на `drag` px: делят место поровну, поэтому растут от полосок до полной ширины и
|
|
57
|
+
* дальше; когда длинный свайп взведён, последнее занимает почти всё, остальные сжимаются в полоски.
|
|
58
|
+
*/
|
|
59
|
+
function endWidths(drag, g, armed, gap = 6) {
|
|
60
|
+
const n = g.endCount;
|
|
61
|
+
if (n === 0 || drag <= 0) return Array.from({ length: n }, () => 0);
|
|
62
|
+
const room = Math.max(0, drag - gap * n);
|
|
63
|
+
if (!armed) return Array.from({ length: n }, () => room / n);
|
|
64
|
+
const sliver = Math.min(28, room / n);
|
|
65
|
+
return Array.from({ length: n }, (_, i) => i === n - 1 ? room - sliver * (n - 1) : sliver);
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/swiperow/TaoxSwipeRow.vue?vue&type=script&setup=true&lang.ts
|
|
69
|
+
var _hoisted_1 = ["aria-label"];
|
|
70
|
+
var _hoisted_2 = {
|
|
71
|
+
key: 1,
|
|
72
|
+
class: "tx-swipe__label"
|
|
73
|
+
};
|
|
74
|
+
var _hoisted_3 = {
|
|
75
|
+
key: 1,
|
|
76
|
+
class: "tx-swipe__end",
|
|
77
|
+
"data-side": "end"
|
|
78
|
+
};
|
|
79
|
+
var _hoisted_4 = ["aria-label", "onClick"];
|
|
80
|
+
var _hoisted_5 = {
|
|
81
|
+
key: 1,
|
|
82
|
+
class: "tx-swipe__label"
|
|
83
|
+
};
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/swiperow/TaoxSwipeRow.vue
|
|
86
|
+
var TaoxSwipeRow_default = /* @__PURE__ */ defineComponent({
|
|
87
|
+
__name: "TaoxSwipeRow",
|
|
88
|
+
props: /*@__PURE__*/ mergeModels({
|
|
89
|
+
start: { default: void 0 },
|
|
90
|
+
end: { default: () => [] },
|
|
91
|
+
actionWidth: { default: 76 },
|
|
92
|
+
fullSwipe: {
|
|
93
|
+
type: Boolean,
|
|
94
|
+
default: true
|
|
95
|
+
},
|
|
96
|
+
mouse: {
|
|
97
|
+
type: Boolean,
|
|
98
|
+
default: false
|
|
99
|
+
},
|
|
100
|
+
disabled: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
default: false
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
"open": {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
default: false
|
|
108
|
+
},
|
|
109
|
+
"openModifiers": {}
|
|
110
|
+
}),
|
|
111
|
+
emits: /*@__PURE__*/ mergeModels(["action"], ["update:open"]),
|
|
112
|
+
setup(__props, { emit: __emit }) {
|
|
113
|
+
const props = __props;
|
|
114
|
+
const emit = __emit;
|
|
115
|
+
/** The end actions are shown. / Действия справа открыты. */
|
|
116
|
+
const open = useModel(__props, "open");
|
|
117
|
+
const root = ref(null);
|
|
118
|
+
const width = ref(320);
|
|
119
|
+
const dragging = ref(false);
|
|
120
|
+
const drag = ref(0);
|
|
121
|
+
const gone = ref(false);
|
|
122
|
+
const startShown = ref(false);
|
|
123
|
+
const geometry = computed(() => ({
|
|
124
|
+
width: width.value,
|
|
125
|
+
actionWidth: props.actionWidth,
|
|
126
|
+
endCount: props.end.length,
|
|
127
|
+
hasStart: Boolean(props.start),
|
|
128
|
+
fullSwipe: props.fullSwipe
|
|
129
|
+
}));
|
|
130
|
+
const rest = computed(() => {
|
|
131
|
+
if (gone.value) return -width.value;
|
|
132
|
+
if (startShown.value) return startThreshold(geometry.value);
|
|
133
|
+
return open.value ? -endOpenWidth(geometry.value) : 0;
|
|
134
|
+
});
|
|
135
|
+
const offset = computed(() => dragging.value ? drag.value : rest.value);
|
|
136
|
+
const armed = computed(() => dragging.value ? armedAt(drag.value, geometry.value) : null);
|
|
137
|
+
const widths = computed(() => endWidths(Math.max(0, -offset.value), geometry.value, armed.value === "full" || gone.value));
|
|
138
|
+
const lastEnd = computed(() => props.end[props.end.length - 1]);
|
|
139
|
+
watch(armed, (next) => {
|
|
140
|
+
if (next && typeof navigator !== "undefined") navigator.vibrate?.(8);
|
|
141
|
+
});
|
|
142
|
+
const tracker = new SwipeTracker("x");
|
|
143
|
+
let pointerId = null;
|
|
144
|
+
let swiped = false;
|
|
145
|
+
const sample = (e) => ({
|
|
146
|
+
x: e.clientX,
|
|
147
|
+
y: e.clientY,
|
|
148
|
+
t: e.timeStamp
|
|
149
|
+
});
|
|
150
|
+
function onDown(e) {
|
|
151
|
+
if (props.disabled || pointerId !== null || e.pointerType === "mouse" && (!props.mouse || e.button !== 0)) return;
|
|
152
|
+
pointerId = e.pointerId;
|
|
153
|
+
swiped = false;
|
|
154
|
+
startShown.value = false;
|
|
155
|
+
tracker.down(sample(e), rest.value);
|
|
156
|
+
}
|
|
157
|
+
function onMove(e) {
|
|
158
|
+
if (e.pointerId !== pointerId) return;
|
|
159
|
+
const step = tracker.move(sample(e));
|
|
160
|
+
if (step.intent !== "swipe") return;
|
|
161
|
+
if (!dragging.value) {
|
|
162
|
+
dragging.value = true;
|
|
163
|
+
try {
|
|
164
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
165
|
+
} catch {}
|
|
166
|
+
}
|
|
167
|
+
swiped = true;
|
|
168
|
+
drag.value = clampOffset(step.offset, geometry.value);
|
|
169
|
+
}
|
|
170
|
+
function onUp(e) {
|
|
171
|
+
if (e.pointerId !== pointerId) return;
|
|
172
|
+
const release = tracker.up(sample(e));
|
|
173
|
+
pointerId = null;
|
|
174
|
+
if (!release) {
|
|
175
|
+
dragging.value = false;
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const outcome = swipeRowRelease(release, geometry.value);
|
|
179
|
+
dragging.value = false;
|
|
180
|
+
if (outcome.kind === "start" && props.start) {
|
|
181
|
+
open.value = false;
|
|
182
|
+
emit("action", props.start.id);
|
|
183
|
+
} else if (outcome.kind === "full" && lastEnd.value) {
|
|
184
|
+
gone.value = true;
|
|
185
|
+
emit("action", lastEnd.value.id);
|
|
186
|
+
setTimeout(() => {
|
|
187
|
+
gone.value = false;
|
|
188
|
+
open.value = false;
|
|
189
|
+
}, 400);
|
|
190
|
+
} else if (outcome.kind === "rest") open.value = outcome.open;
|
|
191
|
+
}
|
|
192
|
+
function onCancel(e) {
|
|
193
|
+
if (e.pointerId !== pointerId) return;
|
|
194
|
+
tracker.cancel();
|
|
195
|
+
pointerId = null;
|
|
196
|
+
dragging.value = false;
|
|
197
|
+
}
|
|
198
|
+
function onClickCapture(e) {
|
|
199
|
+
if (swiped) {
|
|
200
|
+
e.stopPropagation();
|
|
201
|
+
e.preventDefault();
|
|
202
|
+
swiped = false;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
function run(action) {
|
|
206
|
+
open.value = false;
|
|
207
|
+
startShown.value = false;
|
|
208
|
+
emit("action", action.id);
|
|
209
|
+
}
|
|
210
|
+
function onFocusIn(e) {
|
|
211
|
+
const side = e.target.closest("[data-side]")?.dataset.side;
|
|
212
|
+
if (side === "end") open.value = true;
|
|
213
|
+
if (side === "start") startShown.value = true;
|
|
214
|
+
}
|
|
215
|
+
function onFocusOut(e) {
|
|
216
|
+
if (root.value?.contains(e.relatedTarget)) return;
|
|
217
|
+
startShown.value = false;
|
|
218
|
+
open.value = false;
|
|
219
|
+
}
|
|
220
|
+
function onOutside(e) {
|
|
221
|
+
if (!root.value?.contains(e.target)) open.value = false;
|
|
222
|
+
}
|
|
223
|
+
watch(open, (isOpen) => {
|
|
224
|
+
if (isOpen) document.addEventListener("pointerdown", onOutside, true);
|
|
225
|
+
else document.removeEventListener("pointerdown", onOutside, true);
|
|
226
|
+
});
|
|
227
|
+
let resize;
|
|
228
|
+
onMounted(() => {
|
|
229
|
+
if (!root.value) return;
|
|
230
|
+
width.value = root.value.clientWidth || width.value;
|
|
231
|
+
if (typeof ResizeObserver !== "undefined") {
|
|
232
|
+
resize = new ResizeObserver(() => width.value = root.value?.clientWidth || width.value);
|
|
233
|
+
resize.observe(root.value);
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
onBeforeUnmount(() => {
|
|
237
|
+
resize?.disconnect();
|
|
238
|
+
document.removeEventListener("pointerdown", onOutside, true);
|
|
239
|
+
});
|
|
240
|
+
const startWidth = computed(() => Math.max(0, offset.value));
|
|
241
|
+
const showLabel = (w) => w >= 56;
|
|
242
|
+
return (_ctx, _cache) => {
|
|
243
|
+
return openBlock(), createElementBlock("div", {
|
|
244
|
+
ref_key: "root",
|
|
245
|
+
ref: root,
|
|
246
|
+
class: normalizeClass(["tx-swipe", {
|
|
247
|
+
"tx-swipe--dragging": dragging.value,
|
|
248
|
+
"tx-swipe--armed-full": armed.value === "full" || gone.value
|
|
249
|
+
}]),
|
|
250
|
+
onFocusin: onFocusIn,
|
|
251
|
+
onFocusout: onFocusOut
|
|
252
|
+
}, [
|
|
253
|
+
__props.start ? (openBlock(), createElementBlock("div", {
|
|
254
|
+
key: 0,
|
|
255
|
+
class: "tx-swipe__start",
|
|
256
|
+
"data-side": "start",
|
|
257
|
+
style: normalizeStyle({ width: `${startWidth.value}px` })
|
|
258
|
+
}, [createElementVNode("button", {
|
|
259
|
+
type: "button",
|
|
260
|
+
class: normalizeClass(["tx-swipe__action tx-swipe__action--start", [unref(toneClass)(__props.start.tone ?? "neutral"), { "tx-swipe__action--armed": armed.value === "start" }]]),
|
|
261
|
+
"aria-label": __props.start.label,
|
|
262
|
+
onClick: _cache[0] || (_cache[0] = ($event) => run(__props.start))
|
|
263
|
+
}, [renderSlot(_ctx.$slots, "action", {
|
|
264
|
+
action: __props.start,
|
|
265
|
+
armed: armed.value === "start",
|
|
266
|
+
side: "start"
|
|
267
|
+
}, () => [__props.start.icon ? (openBlock(), createBlock(unref(TaoIcon), {
|
|
268
|
+
key: 0,
|
|
269
|
+
name: __props.start.icon,
|
|
270
|
+
size: 22
|
|
271
|
+
}, null, 8, ["name"])) : createCommentVNode("", true), showLabel(startWidth.value) ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(__props.start.label), 1)) : createCommentVNode("", true)])], 10, _hoisted_1)], 4)) : createCommentVNode("", true),
|
|
272
|
+
__props.end.length ? (openBlock(), createElementBlock("div", _hoisted_3, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.end, (action, i) => {
|
|
273
|
+
return openBlock(), createElementBlock("button", {
|
|
274
|
+
key: action.id,
|
|
275
|
+
type: "button",
|
|
276
|
+
class: normalizeClass(["tx-swipe__action", [unref(toneClass)(action.tone ?? "neutral"), { "tx-swipe__action--armed": i === __props.end.length - 1 && (armed.value === "full" || gone.value) }]]),
|
|
277
|
+
style: normalizeStyle({
|
|
278
|
+
width: `${widths.value[i]}px`,
|
|
279
|
+
opacity: Math.min(1, (widths.value[i] ?? 0) / 28)
|
|
280
|
+
}),
|
|
281
|
+
"aria-label": action.label,
|
|
282
|
+
onClick: ($event) => run(action)
|
|
283
|
+
}, [renderSlot(_ctx.$slots, "action", {
|
|
284
|
+
action,
|
|
285
|
+
armed: i === __props.end.length - 1 && armed.value === "full",
|
|
286
|
+
side: "end"
|
|
287
|
+
}, () => [action.icon ? (openBlock(), createBlock(unref(TaoIcon), {
|
|
288
|
+
key: 0,
|
|
289
|
+
name: action.icon,
|
|
290
|
+
size: 22
|
|
291
|
+
}, null, 8, ["name"])) : createCommentVNode("", true), showLabel(widths.value[i] ?? 0) ? (openBlock(), createElementBlock("span", _hoisted_5, toDisplayString(action.label), 1)) : createCommentVNode("", true)])], 14, _hoisted_4);
|
|
292
|
+
}), 128))])) : createCommentVNode("", true),
|
|
293
|
+
createElementVNode("div", {
|
|
294
|
+
class: "tx-swipe__front",
|
|
295
|
+
style: normalizeStyle({ transform: `translate3d(${offset.value}px, 0, 0)` }),
|
|
296
|
+
onPointerdown: onDown,
|
|
297
|
+
onPointermove: onMove,
|
|
298
|
+
onPointerup: onUp,
|
|
299
|
+
onPointercancel: onCancel,
|
|
300
|
+
onClickCapture
|
|
301
|
+
}, [renderSlot(_ctx.$slots, "default")], 36)
|
|
302
|
+
], 34);
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
//#endregion
|
|
307
|
+
export { FULL_SWIPE_RATIO, START_THRESHOLD_PX, TaoxSwipeRow_default as TaoxSwipeRow, armedAt, clampOffset, endOpenWidth, endWidths, fullThreshold, startThreshold, swipeRowRelease };
|
|
308
|
+
|
|
309
|
+
//# sourceMappingURL=swiperow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swiperow.js","names":["_useModel","_openBlock","_createElementBlock","_normalizeClass","_normalizeStyle","_createElementVNode","_unref","_renderSlot","_createBlock","_createCommentVNode","_toDisplayString","_Fragment","_renderList","_sfc_main"],"sources":["../src/swiperow/model.ts","../src/swiperow/TaoxSwipeRow.vue","../src/swiperow/TaoxSwipeRow.vue"],"sourcesContent":["import { settleOpen, SWIPE_FLING_PX_PER_MS, type SwipeRelease } from '../gestures';\n\n/**\n * An action of a swipe row. `tone` is a TaoUI tone (`neutral`, `danger`, `success`…), `icon` a TaoIcon name.\n * Действие свайп-строки. `tone` — тон TaoUI, `icon` — имя TaoIcon.\n */\nexport interface SwipeRowAction {\n id: string;\n label: string;\n icon?: string;\n tone?: 'accent' | 'neutral' | 'success' | 'danger' | 'warning' | 'info';\n}\n\n/**\n * The thresholds of the row, px or a share of its width.\n * Пороги строки, px или доля её ширины.\n */\nexport interface SwipeRowGeometry {\n /** The row width. / Ширина строки. */\n width: number;\n /** How wide each end action stands when the row is open. / Ширина каждого действия справа в открытой строке. */\n actionWidth: number;\n /** How many end actions. / Сколько действий справа. */\n endCount: number;\n /** Whether there is a start action. / Есть ли действие слева. */\n hasStart: boolean;\n /** Whether pulling far runs the last end action by itself. / Выполняет ли длинный свайп последнее действие сам. */\n fullSwipe: boolean;\n}\n\n/** Past this share of the width a pull to the end runs the last action. / После этой доли ширины длинный свайп выполняет последнее действие. */\nexport const FULL_SWIPE_RATIO = 0.6;\n/** A pull to the start runs its action past this many px (or a third of a narrow row). / Свайп вправо выполняет действие после стольких px. */\nexport const START_THRESHOLD_PX = 96;\n\nexport const startThreshold = (g: SwipeRowGeometry) => Math.min(START_THRESHOLD_PX, g.width / 3);\nexport const endOpenWidth = (g: SwipeRowGeometry) => g.actionWidth * g.endCount;\nexport const fullThreshold = (g: SwipeRowGeometry) => Math.max(endOpenWidth(g) + 24, g.width * FULL_SWIPE_RATIO);\n\n/**\n * Whether the row, at this offset, is past the point where releasing runs an action: `start`, `full` or null.\n * Пройдена ли при этом сдвиге точка, после которой отпускание выполняет действие: `start`, `full` или null.\n */\nexport function armedAt(offset: number, g: SwipeRowGeometry): 'start' | 'full' | null {\n if (offset > 0 && g.hasStart && offset >= startThreshold(g)) return 'start';\n if (offset < 0 && g.fullSwipe && g.endCount > 0 && -offset >= fullThreshold(g)) return 'full';\n return null;\n}\n\n/** How far the row may move: no further than there is something behind it. / Насколько строка может уехать. */\nexport function clampOffset(offset: number, g: SwipeRowGeometry): number {\n const right = g.hasStart ? g.width : 0;\n const left = g.endCount === 0 ? 0 : g.fullSwipe ? -g.width : -endOpenWidth(g) * 1.5;\n return Math.min(right, Math.max(left, offset));\n}\n\nexport type SwipeRowOutcome =\n | { kind: 'rest'; open: boolean } // the row comes to rest: open (the end actions shown) or closed\n | { kind: 'start' } // the start action runs, the row goes back\n | { kind: 'full' }; // the last end action runs\n\n/**\n * What a release does. A pull to the start past its threshold (or flung that way past half of it) runs the start\n * action; a pull to the end past the full threshold runs the last end action; otherwise the row rests open or closed,\n * a fling going on in its direction (`settleOpen`).\n * Что делает отпускание. Свайп вправо дальше порога (или брошенный туда дальше его половины) выполняет действие слева;\n * влево дальше полного порога — последнее действие справа; иначе строка встаёт открытой или закрытой, бросок\n * продолжается в своём направлении.\n */\nexport function swipeRowRelease(release: SwipeRelease, g: SwipeRowGeometry): SwipeRowOutcome {\n const offset = clampOffset(release.offset, g);\n const armed = armedAt(offset, g);\n if (armed) return { kind: armed };\n if (offset > 0 && g.hasStart && release.velocity >= SWIPE_FLING_PX_PER_MS && offset >= startThreshold(g) / 2) {\n return { kind: 'start' };\n }\n if (g.endCount === 0) return { kind: 'rest', open: false };\n const rest = settleOpen({ offset: Math.min(0, offset), velocity: release.velocity }, { end: endOpenWidth(g) });\n return { kind: 'rest', open: rest < 0 };\n}\n\n/**\n * The widths of the end actions at a pull of `drag` px (≥ 0): they share the space evenly, so they grow from slivers\n * to their full width and on; once the full swipe is armed the last one takes nearly all of it and the others shrink\n * to slivers.\n * Ширины действий справа при протяжке на `drag` px: делят место поровну, поэтому растут от полосок до полной ширины и\n * дальше; когда длинный свайп взведён, последнее занимает почти всё, остальные сжимаются в полоски.\n */\nexport function endWidths(drag: number, g: SwipeRowGeometry, armed: boolean, gap = 6): number[] {\n const n = g.endCount;\n if (n === 0 || drag <= 0) return Array.from({ length: n }, () => 0);\n const room = Math.max(0, drag - gap * n);\n if (!armed) return Array.from({ length: n }, () => room / n);\n const sliver = Math.min(28, room / n);\n return Array.from({ length: n }, (_, i) => (i === n - 1 ? room - sliver * (n - 1) : sliver));\n}\n","<script lang=\"ts\" setup>\nimport { TaoIcon, toneClass } from '@1337exp/taoui';\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';\nimport { SwipeTracker, type Sample } from '../gestures';\nimport { armedAt, clampOffset, endOpenWidth, endWidths, startThreshold, swipeRowRelease, type SwipeRowAction, type SwipeRowGeometry } from './model';\n\n// A row of a list that a finger slides sideways, as in a mail app. To the start (right): one action behind it, run on\n// release past its threshold, and the row comes back (read / unread). To the end (left): the actions grow out and the\n// row stays open on them; pulled far, the last one takes the row and runs on release (delete). The gesture (a swipe or\n// a scroll, the release speed, where to rest) is TaoUX's gestures; the actions are TaoUI icons and tones.\n// Строка списка, которую палец сдвигает вбок, как в почте. Вправо: одно действие позади, выполняется при отпускании\n// дальше порога, строка возвращается (прочитано / не прочитано). Влево: действия вырастают, и строка остаётся открытой\n// на них; если тянуть далеко, последнее занимает строку и выполняется при отпускании (удалить).\nconst props = withDefaults(\n defineProps<{\n /** The action behind the row on a pull to the start. / Действие позади строки при свайпе вправо. */\n start?: SwipeRowAction;\n /** The actions on a pull to the end, in order; the last one is the full swipe. / Действия при свайпе влево; последнее — длинный свайп. */\n end?: SwipeRowAction[];\n /** The width of each end action when the row is open, px. / Ширина каждого действия справа в открытой строке. */\n actionWidth?: number;\n /** Pulling far to the end runs the last action. / Длинный свайп влево выполняет последнее действие. */\n fullSwipe?: boolean;\n /** A mouse can drag it too (a touch screen always can). / Тянуть можно и мышью (палец может всегда). */\n mouse?: boolean;\n disabled?: boolean;\n }>(),\n { start: undefined, end: () => [], actionWidth: 76, fullSwipe: true, mouse: false, disabled: false },\n);\n\nconst emit = defineEmits<{\n /** An action was chosen: by a button, a pull past the threshold, or the full swipe. / Выбрано действие. */\n action: [id: string];\n}>();\n\n/** The end actions are shown. / Действия справа открыты. */\nconst open = defineModel<boolean>('open', { default: false });\n\ndefineSlots<{\n default?(): unknown;\n /** Your own face of an action. / Свой вид действия. */\n action?(props: { action: SwipeRowAction; armed: boolean; side: 'start' | 'end' }): unknown;\n}>();\n\nconst root = ref<HTMLElement | null>(null);\nconst width = ref(320);\nconst dragging = ref(false);\nconst drag = ref(0);\n// a moment after a full swipe: the row stays off to the side while the app removes it\n// миг после длинного свайпа: строка остаётся сдвинутой, пока приложение её убирает\nconst gone = ref(false);\nconst startShown = ref(false);\n\nconst geometry = computed<SwipeRowGeometry>(() => ({\n width: width.value,\n actionWidth: props.actionWidth,\n endCount: props.end.length,\n hasStart: Boolean(props.start),\n fullSwipe: props.fullSwipe,\n}));\n\nconst rest = computed(() => {\n if (gone.value) return -width.value;\n if (startShown.value) return startThreshold(geometry.value);\n return open.value ? -endOpenWidth(geometry.value) : 0;\n});\nconst offset = computed(() => (dragging.value ? drag.value : rest.value));\nconst armed = computed(() => (dragging.value ? armedAt(drag.value, geometry.value) : null));\nconst widths = computed(() => endWidths(Math.max(0, -offset.value), geometry.value, armed.value === 'full' || gone.value));\nconst lastEnd = computed(() => props.end[props.end.length - 1]);\n\n// a short buzz where the phone can, when an action becomes armed / короткая вибрация там, где телефон умеет\nwatch(armed, (next) => {\n if (next && typeof navigator !== 'undefined') navigator.vibrate?.(8);\n});\n\n//---]>\n// the gesture / жест\n\nconst tracker = new SwipeTracker('x');\nlet pointerId: number | null = null;\nlet swiped = false;\nconst sample = (e: PointerEvent): Sample => ({ x: e.clientX, y: e.clientY, t: e.timeStamp });\n\nfunction onDown(e: PointerEvent) {\n if (props.disabled || pointerId !== null || (e.pointerType === 'mouse' && (!props.mouse || e.button !== 0))) return;\n pointerId = e.pointerId;\n swiped = false;\n startShown.value = false;\n tracker.down(sample(e), rest.value);\n}\n\nfunction onMove(e: PointerEvent) {\n if (e.pointerId !== pointerId) return;\n const step = tracker.move(sample(e));\n if (step.intent !== 'swipe') return;\n if (!dragging.value) {\n dragging.value = true;\n try {\n (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);\n } catch {\n /* a pointer the browser does not know / неизвестный браузеру указатель */\n }\n }\n swiped = true;\n drag.value = clampOffset(step.offset, geometry.value);\n}\n\nfunction onUp(e: PointerEvent) {\n if (e.pointerId !== pointerId) return;\n const release = tracker.up(sample(e));\n pointerId = null;\n if (!release) {\n dragging.value = false;\n return;\n }\n const outcome = swipeRowRelease(release, geometry.value);\n dragging.value = false;\n if (outcome.kind === 'start' && props.start) {\n open.value = false;\n emit('action', props.start.id);\n } else if (outcome.kind === 'full' && lastEnd.value) {\n gone.value = true;\n emit('action', lastEnd.value.id);\n // the app removes the row; if it keeps it (an archive that failed), it comes back\n // приложение убирает строку; если оставит, она вернётся\n setTimeout(() => {\n gone.value = false;\n open.value = false;\n }, 400);\n } else if (outcome.kind === 'rest') {\n open.value = outcome.open;\n }\n}\n\nfunction onCancel(e: PointerEvent) {\n if (e.pointerId !== pointerId) return;\n tracker.cancel();\n pointerId = null;\n dragging.value = false;\n}\n\n// the end of a swipe also fires a click on the row: it must not open the item\n// конец свайпа даёт и click по строке: он не должен открывать элемент\nfunction onClickCapture(e: MouseEvent) {\n if (swiped) {\n e.stopPropagation();\n e.preventDefault();\n swiped = false;\n }\n}\n\nfunction run(action: SwipeRowAction) {\n open.value = false;\n startShown.value = false;\n emit('action', action.id);\n}\n\n//---]>\n// the keyboard: an action button that gets the focus shows its side\n// клавиатура: кнопка действия, получившая фокус, показывает свою сторону\n\nfunction onFocusIn(e: FocusEvent) {\n const side = (e.target as HTMLElement).closest<HTMLElement>('[data-side]')?.dataset.side;\n if (side === 'end') open.value = true;\n if (side === 'start') startShown.value = true;\n}\n\nfunction onFocusOut(e: FocusEvent) {\n if (root.value?.contains(e.relatedTarget as Node | null)) return;\n startShown.value = false;\n open.value = false;\n}\n\n// an open row closes on a touch outside it / открытая строка закрывается касанием вне её\nfunction onOutside(e: PointerEvent) {\n if (!root.value?.contains(e.target as Node)) open.value = false;\n}\nwatch(open, (isOpen) => {\n if (isOpen) document.addEventListener('pointerdown', onOutside, true);\n else document.removeEventListener('pointerdown', onOutside, true);\n});\n\nlet resize: ResizeObserver | undefined;\nonMounted(() => {\n if (!root.value) return;\n width.value = root.value.clientWidth || width.value;\n if (typeof ResizeObserver !== 'undefined') {\n resize = new ResizeObserver(() => (width.value = root.value?.clientWidth || width.value));\n resize.observe(root.value);\n }\n});\nonBeforeUnmount(() => {\n resize?.disconnect();\n document.removeEventListener('pointerdown', onOutside, true);\n});\n\nconst startWidth = computed(() => Math.max(0, offset.value));\nconst showLabel = (w: number) => w >= 56;\n</script>\n\n<template>\n <div\n ref=\"root\"\n class=\"tx-swipe\"\n :class=\"{ 'tx-swipe--dragging': dragging, 'tx-swipe--armed-full': armed === 'full' || gone }\"\n @focusin=\"onFocusIn\"\n @focusout=\"onFocusOut\"\n >\n <div v-if=\"start\" class=\"tx-swipe__start\" data-side=\"start\" :style=\"{ width: `${startWidth}px` }\">\n <button\n type=\"button\"\n class=\"tx-swipe__action tx-swipe__action--start\"\n :class=\"[toneClass(start.tone ?? 'neutral'), { 'tx-swipe__action--armed': armed === 'start' }]\"\n :aria-label=\"start.label\"\n @click=\"run(start)\"\n >\n <slot name=\"action\" :action=\"start\" :armed=\"armed === 'start'\" side=\"start\">\n <TaoIcon v-if=\"start.icon\" :name=\"start.icon\" :size=\"22\" />\n <span v-if=\"showLabel(startWidth)\" class=\"tx-swipe__label\">{{ start.label }}</span>\n </slot>\n </button>\n </div>\n\n <div v-if=\"end.length\" class=\"tx-swipe__end\" data-side=\"end\">\n <button\n v-for=\"(action, i) in end\"\n :key=\"action.id\"\n type=\"button\"\n class=\"tx-swipe__action\"\n :class=\"[toneClass(action.tone ?? 'neutral'), { 'tx-swipe__action--armed': i === end.length - 1 && (armed === 'full' || gone) }]\"\n :style=\"{ width: `${widths[i]}px`, opacity: Math.min(1, (widths[i] ?? 0) / 28) }\"\n :aria-label=\"action.label\"\n @click=\"run(action)\"\n >\n <slot name=\"action\" :action=\"action\" :armed=\"i === end.length - 1 && armed === 'full'\" side=\"end\">\n <TaoIcon v-if=\"action.icon\" :name=\"action.icon\" :size=\"22\" />\n <span v-if=\"showLabel(widths[i] ?? 0)\" class=\"tx-swipe__label\">{{ action.label }}</span>\n </slot>\n </button>\n </div>\n\n <div\n class=\"tx-swipe__front\"\n :style=\"{ transform: `translate3d(${offset}px, 0, 0)` }\"\n @pointerdown=\"onDown\"\n @pointermove=\"onMove\"\n @pointerup=\"onUp\"\n @pointercancel=\"onCancel\"\n @click.capture=\"onClickCapture\"\n >\n <slot />\n </div>\n </div>\n</template>\n\n<style>\n.tx-swipe {\n --tx-swipe-gap: 6px;\n --tx-swipe-radius: var(--tao-radius-panel, 12px);\n position: relative;\n overflow: hidden;\n border-radius: var(--tx-swipe-radius);\n}\n\n.tx-swipe__front {\n position: relative;\n z-index: 1;\n /* the page keeps the vertical scroll, the tracker takes the sideways pull / вертикаль — странице, вбок — трекеру */\n touch-action: pan-y;\n border-radius: inherit;\n background: var(--tao-color-surface-raised, #1f1f1f);\n transition: transform 0.22s ease;\n}\n\n.tx-swipe--dragging .tx-swipe__front {\n transition: none;\n}\n\n.tx-swipe__start,\n.tx-swipe__end {\n position: absolute;\n inset-block: 0;\n display: flex;\n gap: var(--tx-swipe-gap);\n}\n\n.tx-swipe__start {\n inset-inline-start: 0;\n padding-inline-end: var(--tx-swipe-gap);\n transition: width 0.22s ease;\n}\n\n.tx-swipe__end {\n inset-inline-end: 0;\n justify-content: flex-end;\n}\n\n.tx-swipe--dragging .tx-swipe__start {\n transition: none;\n}\n\n.tx-swipe__action {\n display: inline-flex;\n flex: none;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 4px;\n min-width: 0;\n height: 100%;\n padding: 0;\n overflow: hidden;\n border: 0;\n border-radius: var(--tx-swipe-radius);\n background: color-mix(in srgb, var(--tao-tone) 22%, var(--tao-color-surface-raised, #1f1f1f));\n color: var(--tao-tone-text);\n font: inherit;\n font-size: 13px;\n cursor: pointer;\n transition:\n width 0.15s ease,\n background-color 0.15s ease;\n}\n\n.tx-swipe--dragging .tx-swipe__end .tx-swipe__action {\n transition: background-color 0.15s ease;\n}\n\n/* the full swipe armed: the last action takes the row; the widths animate to it / длинный свайп взведён */\n.tx-swipe--armed-full .tx-swipe__end .tx-swipe__action {\n transition:\n width 0.15s ease,\n background-color 0.15s ease;\n}\n\n.tx-swipe__action--start {\n flex: 1;\n}\n\n.tx-swipe__action--armed {\n background: color-mix(in srgb, var(--tao-tone) 45%, var(--tao-color-surface-raised, #1f1f1f));\n color: var(--tao-color-text-strong);\n}\n\n.tx-swipe__action:focus-visible {\n outline: 2px solid var(--tao-color-accent);\n outline-offset: -2px;\n}\n\n.tx-swipe__label {\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tx-swipe__front,\n .tx-swipe__start,\n .tx-swipe__action {\n transition: none;\n }\n}\n</style>\n","<script lang=\"ts\" setup>\nimport { TaoIcon, toneClass } from '@1337exp/taoui';\nimport { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';\nimport { SwipeTracker, type Sample } from '../gestures';\nimport { armedAt, clampOffset, endOpenWidth, endWidths, startThreshold, swipeRowRelease, type SwipeRowAction, type SwipeRowGeometry } from './model';\n\n// A row of a list that a finger slides sideways, as in a mail app. To the start (right): one action behind it, run on\n// release past its threshold, and the row comes back (read / unread). To the end (left): the actions grow out and the\n// row stays open on them; pulled far, the last one takes the row and runs on release (delete). The gesture (a swipe or\n// a scroll, the release speed, where to rest) is TaoUX's gestures; the actions are TaoUI icons and tones.\n// Строка списка, которую палец сдвигает вбок, как в почте. Вправо: одно действие позади, выполняется при отпускании\n// дальше порога, строка возвращается (прочитано / не прочитано). Влево: действия вырастают, и строка остаётся открытой\n// на них; если тянуть далеко, последнее занимает строку и выполняется при отпускании (удалить).\nconst props = withDefaults(\n defineProps<{\n /** The action behind the row on a pull to the start. / Действие позади строки при свайпе вправо. */\n start?: SwipeRowAction;\n /** The actions on a pull to the end, in order; the last one is the full swipe. / Действия при свайпе влево; последнее — длинный свайп. */\n end?: SwipeRowAction[];\n /** The width of each end action when the row is open, px. / Ширина каждого действия справа в открытой строке. */\n actionWidth?: number;\n /** Pulling far to the end runs the last action. / Длинный свайп влево выполняет последнее действие. */\n fullSwipe?: boolean;\n /** A mouse can drag it too (a touch screen always can). / Тянуть можно и мышью (палец может всегда). */\n mouse?: boolean;\n disabled?: boolean;\n }>(),\n { start: undefined, end: () => [], actionWidth: 76, fullSwipe: true, mouse: false, disabled: false },\n);\n\nconst emit = defineEmits<{\n /** An action was chosen: by a button, a pull past the threshold, or the full swipe. / Выбрано действие. */\n action: [id: string];\n}>();\n\n/** The end actions are shown. / Действия справа открыты. */\nconst open = defineModel<boolean>('open', { default: false });\n\ndefineSlots<{\n default?(): unknown;\n /** Your own face of an action. / Свой вид действия. */\n action?(props: { action: SwipeRowAction; armed: boolean; side: 'start' | 'end' }): unknown;\n}>();\n\nconst root = ref<HTMLElement | null>(null);\nconst width = ref(320);\nconst dragging = ref(false);\nconst drag = ref(0);\n// a moment after a full swipe: the row stays off to the side while the app removes it\n// миг после длинного свайпа: строка остаётся сдвинутой, пока приложение её убирает\nconst gone = ref(false);\nconst startShown = ref(false);\n\nconst geometry = computed<SwipeRowGeometry>(() => ({\n width: width.value,\n actionWidth: props.actionWidth,\n endCount: props.end.length,\n hasStart: Boolean(props.start),\n fullSwipe: props.fullSwipe,\n}));\n\nconst rest = computed(() => {\n if (gone.value) return -width.value;\n if (startShown.value) return startThreshold(geometry.value);\n return open.value ? -endOpenWidth(geometry.value) : 0;\n});\nconst offset = computed(() => (dragging.value ? drag.value : rest.value));\nconst armed = computed(() => (dragging.value ? armedAt(drag.value, geometry.value) : null));\nconst widths = computed(() => endWidths(Math.max(0, -offset.value), geometry.value, armed.value === 'full' || gone.value));\nconst lastEnd = computed(() => props.end[props.end.length - 1]);\n\n// a short buzz where the phone can, when an action becomes armed / короткая вибрация там, где телефон умеет\nwatch(armed, (next) => {\n if (next && typeof navigator !== 'undefined') navigator.vibrate?.(8);\n});\n\n//---]>\n// the gesture / жест\n\nconst tracker = new SwipeTracker('x');\nlet pointerId: number | null = null;\nlet swiped = false;\nconst sample = (e: PointerEvent): Sample => ({ x: e.clientX, y: e.clientY, t: e.timeStamp });\n\nfunction onDown(e: PointerEvent) {\n if (props.disabled || pointerId !== null || (e.pointerType === 'mouse' && (!props.mouse || e.button !== 0))) return;\n pointerId = e.pointerId;\n swiped = false;\n startShown.value = false;\n tracker.down(sample(e), rest.value);\n}\n\nfunction onMove(e: PointerEvent) {\n if (e.pointerId !== pointerId) return;\n const step = tracker.move(sample(e));\n if (step.intent !== 'swipe') return;\n if (!dragging.value) {\n dragging.value = true;\n try {\n (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);\n } catch {\n /* a pointer the browser does not know / неизвестный браузеру указатель */\n }\n }\n swiped = true;\n drag.value = clampOffset(step.offset, geometry.value);\n}\n\nfunction onUp(e: PointerEvent) {\n if (e.pointerId !== pointerId) return;\n const release = tracker.up(sample(e));\n pointerId = null;\n if (!release) {\n dragging.value = false;\n return;\n }\n const outcome = swipeRowRelease(release, geometry.value);\n dragging.value = false;\n if (outcome.kind === 'start' && props.start) {\n open.value = false;\n emit('action', props.start.id);\n } else if (outcome.kind === 'full' && lastEnd.value) {\n gone.value = true;\n emit('action', lastEnd.value.id);\n // the app removes the row; if it keeps it (an archive that failed), it comes back\n // приложение убирает строку; если оставит, она вернётся\n setTimeout(() => {\n gone.value = false;\n open.value = false;\n }, 400);\n } else if (outcome.kind === 'rest') {\n open.value = outcome.open;\n }\n}\n\nfunction onCancel(e: PointerEvent) {\n if (e.pointerId !== pointerId) return;\n tracker.cancel();\n pointerId = null;\n dragging.value = false;\n}\n\n// the end of a swipe also fires a click on the row: it must not open the item\n// конец свайпа даёт и click по строке: он не должен открывать элемент\nfunction onClickCapture(e: MouseEvent) {\n if (swiped) {\n e.stopPropagation();\n e.preventDefault();\n swiped = false;\n }\n}\n\nfunction run(action: SwipeRowAction) {\n open.value = false;\n startShown.value = false;\n emit('action', action.id);\n}\n\n//---]>\n// the keyboard: an action button that gets the focus shows its side\n// клавиатура: кнопка действия, получившая фокус, показывает свою сторону\n\nfunction onFocusIn(e: FocusEvent) {\n const side = (e.target as HTMLElement).closest<HTMLElement>('[data-side]')?.dataset.side;\n if (side === 'end') open.value = true;\n if (side === 'start') startShown.value = true;\n}\n\nfunction onFocusOut(e: FocusEvent) {\n if (root.value?.contains(e.relatedTarget as Node | null)) return;\n startShown.value = false;\n open.value = false;\n}\n\n// an open row closes on a touch outside it / открытая строка закрывается касанием вне её\nfunction onOutside(e: PointerEvent) {\n if (!root.value?.contains(e.target as Node)) open.value = false;\n}\nwatch(open, (isOpen) => {\n if (isOpen) document.addEventListener('pointerdown', onOutside, true);\n else document.removeEventListener('pointerdown', onOutside, true);\n});\n\nlet resize: ResizeObserver | undefined;\nonMounted(() => {\n if (!root.value) return;\n width.value = root.value.clientWidth || width.value;\n if (typeof ResizeObserver !== 'undefined') {\n resize = new ResizeObserver(() => (width.value = root.value?.clientWidth || width.value));\n resize.observe(root.value);\n }\n});\nonBeforeUnmount(() => {\n resize?.disconnect();\n document.removeEventListener('pointerdown', onOutside, true);\n});\n\nconst startWidth = computed(() => Math.max(0, offset.value));\nconst showLabel = (w: number) => w >= 56;\n</script>\n\n<template>\n <div\n ref=\"root\"\n class=\"tx-swipe\"\n :class=\"{ 'tx-swipe--dragging': dragging, 'tx-swipe--armed-full': armed === 'full' || gone }\"\n @focusin=\"onFocusIn\"\n @focusout=\"onFocusOut\"\n >\n <div v-if=\"start\" class=\"tx-swipe__start\" data-side=\"start\" :style=\"{ width: `${startWidth}px` }\">\n <button\n type=\"button\"\n class=\"tx-swipe__action tx-swipe__action--start\"\n :class=\"[toneClass(start.tone ?? 'neutral'), { 'tx-swipe__action--armed': armed === 'start' }]\"\n :aria-label=\"start.label\"\n @click=\"run(start)\"\n >\n <slot name=\"action\" :action=\"start\" :armed=\"armed === 'start'\" side=\"start\">\n <TaoIcon v-if=\"start.icon\" :name=\"start.icon\" :size=\"22\" />\n <span v-if=\"showLabel(startWidth)\" class=\"tx-swipe__label\">{{ start.label }}</span>\n </slot>\n </button>\n </div>\n\n <div v-if=\"end.length\" class=\"tx-swipe__end\" data-side=\"end\">\n <button\n v-for=\"(action, i) in end\"\n :key=\"action.id\"\n type=\"button\"\n class=\"tx-swipe__action\"\n :class=\"[toneClass(action.tone ?? 'neutral'), { 'tx-swipe__action--armed': i === end.length - 1 && (armed === 'full' || gone) }]\"\n :style=\"{ width: `${widths[i]}px`, opacity: Math.min(1, (widths[i] ?? 0) / 28) }\"\n :aria-label=\"action.label\"\n @click=\"run(action)\"\n >\n <slot name=\"action\" :action=\"action\" :armed=\"i === end.length - 1 && armed === 'full'\" side=\"end\">\n <TaoIcon v-if=\"action.icon\" :name=\"action.icon\" :size=\"22\" />\n <span v-if=\"showLabel(widths[i] ?? 0)\" class=\"tx-swipe__label\">{{ action.label }}</span>\n </slot>\n </button>\n </div>\n\n <div\n class=\"tx-swipe__front\"\n :style=\"{ transform: `translate3d(${offset}px, 0, 0)` }\"\n @pointerdown=\"onDown\"\n @pointermove=\"onMove\"\n @pointerup=\"onUp\"\n @pointercancel=\"onCancel\"\n @click.capture=\"onClickCapture\"\n >\n <slot />\n </div>\n </div>\n</template>\n\n<style>\n.tx-swipe {\n --tx-swipe-gap: 6px;\n --tx-swipe-radius: var(--tao-radius-panel, 12px);\n position: relative;\n overflow: hidden;\n border-radius: var(--tx-swipe-radius);\n}\n\n.tx-swipe__front {\n position: relative;\n z-index: 1;\n /* the page keeps the vertical scroll, the tracker takes the sideways pull / вертикаль — странице, вбок — трекеру */\n touch-action: pan-y;\n border-radius: inherit;\n background: var(--tao-color-surface-raised, #1f1f1f);\n transition: transform 0.22s ease;\n}\n\n.tx-swipe--dragging .tx-swipe__front {\n transition: none;\n}\n\n.tx-swipe__start,\n.tx-swipe__end {\n position: absolute;\n inset-block: 0;\n display: flex;\n gap: var(--tx-swipe-gap);\n}\n\n.tx-swipe__start {\n inset-inline-start: 0;\n padding-inline-end: var(--tx-swipe-gap);\n transition: width 0.22s ease;\n}\n\n.tx-swipe__end {\n inset-inline-end: 0;\n justify-content: flex-end;\n}\n\n.tx-swipe--dragging .tx-swipe__start {\n transition: none;\n}\n\n.tx-swipe__action {\n display: inline-flex;\n flex: none;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 4px;\n min-width: 0;\n height: 100%;\n padding: 0;\n overflow: hidden;\n border: 0;\n border-radius: var(--tx-swipe-radius);\n background: color-mix(in srgb, var(--tao-tone) 22%, var(--tao-color-surface-raised, #1f1f1f));\n color: var(--tao-tone-text);\n font: inherit;\n font-size: 13px;\n cursor: pointer;\n transition:\n width 0.15s ease,\n background-color 0.15s ease;\n}\n\n.tx-swipe--dragging .tx-swipe__end .tx-swipe__action {\n transition: background-color 0.15s ease;\n}\n\n/* the full swipe armed: the last action takes the row; the widths animate to it / длинный свайп взведён */\n.tx-swipe--armed-full .tx-swipe__end .tx-swipe__action {\n transition:\n width 0.15s ease,\n background-color 0.15s ease;\n}\n\n.tx-swipe__action--start {\n flex: 1;\n}\n\n.tx-swipe__action--armed {\n background: color-mix(in srgb, var(--tao-tone) 45%, var(--tao-color-surface-raised, #1f1f1f));\n color: var(--tao-color-text-strong);\n}\n\n.tx-swipe__action:focus-visible {\n outline: 2px solid var(--tao-color-accent);\n outline-offset: -2px;\n}\n\n.tx-swipe__label {\n max-width: 100%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .tx-swipe__front,\n .tx-swipe__start,\n .tx-swipe__action {\n transition: none;\n }\n}\n</style>\n"],"mappings":";;;;;AA+BA,IAAa,mBAAmB;;AAEhC,IAAa,qBAAqB;AAElC,IAAa,kBAAkB,MAAwB,KAAK,IAAA,IAAwB,EAAE,QAAQ,CAAC;AAC/F,IAAa,gBAAgB,MAAwB,EAAE,cAAc,EAAE;AACvE,IAAa,iBAAiB,MAAwB,KAAK,IAAI,aAAa,CAAC,IAAI,IAAI,EAAE,QAAQ,gBAAgB;;;;;AAM/G,SAAgB,QAAQ,QAAgB,GAA8C;CAClF,IAAI,SAAS,KAAK,EAAE,YAAY,UAAU,eAAe,CAAC,GAAG,OAAO;CACpE,IAAI,SAAS,KAAK,EAAE,aAAa,EAAE,WAAW,KAAK,CAAC,UAAU,cAAc,CAAC,GAAG,OAAO;CACvF,OAAO;AACX;;AAGA,SAAgB,YAAY,QAAgB,GAA6B;CACrE,MAAM,QAAQ,EAAE,WAAW,EAAE,QAAQ;CACrC,MAAM,OAAO,EAAE,aAAa,IAAI,IAAI,EAAE,YAAY,CAAC,EAAE,QAAQ,CAAC,aAAa,C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