@celljs/ta-web 4.24.0 → 4.24.1
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/esm/browser/components/app-nav.d.ts +3 -1
- package/esm/browser/components/app-nav.js +10 -10
- package/esm/browser/components/app-shell-state.d.ts +1 -0
- package/esm/browser/components/app-shell-state.js +19 -0
- package/esm/browser/components/app-view.js +5 -7
- package/esm/browser/components/chat-home.js +3 -3
- package/esm/browser/components/chat-list-hooks.d.ts +2 -0
- package/esm/browser/components/chat-list-hooks.js +6 -0
- package/esm/browser/components/chat-list-row.js +2 -2
- package/esm/browser/components/chat-list.js +2 -2
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/list-motion.d.ts +44 -0
- package/esm/browser/components/list-motion.js +197 -0
- package/esm/browser/components/partner-row.js +1 -1
- package/esm/browser/components/side-lists.d.ts +7 -0
- package/esm/browser/components/side-lists.js +16 -0
- package/esm/browser/components/sortable.js +15 -0
- package/esm/browser/components/workbench-tabs.d.ts +1 -0
- package/esm/browser/components/workbench-tabs.js +8 -3
- package/esm/browser/components/workbench-toggle.d.ts +5 -0
- package/esm/browser/components/workbench-toggle.js +10 -0
- package/esm/browser/i18n/locales.d.ts +1 -2
- package/esm/browser/i18n/messages-ja.js +0 -1
- package/esm/browser/i18n/messages-zh-tw.js +0 -1
- package/esm/browser/i18n/messages.d.ts +0 -1
- package/esm/browser/i18n/messages.js +0 -2
- package/esm/browser/partners/partners-view.js +4 -1
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +5 -0
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +2 -0
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +2 -0
- package/esm/browser/style/device.js +4 -1
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +20 -6
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +7 -2
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +1 -0
- package/lib/browser/components/app-nav.d.ts +3 -1
- package/lib/browser/components/app-nav.js +8 -8
- package/lib/browser/components/app-shell-state.d.ts +1 -0
- package/lib/browser/components/app-shell-state.js +19 -0
- package/lib/browser/components/app-view.js +4 -6
- package/lib/browser/components/chat-home.js +3 -3
- package/lib/browser/components/chat-list-hooks.d.ts +2 -0
- package/lib/browser/components/chat-list-hooks.js +7 -0
- package/lib/browser/components/chat-list-row.js +2 -2
- package/lib/browser/components/chat-list.js +1 -1
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/list-motion.d.ts +45 -0
- package/lib/browser/components/list-motion.js +234 -0
- package/lib/browser/components/partner-row.js +1 -1
- package/lib/browser/components/side-lists.d.ts +7 -0
- package/lib/browser/components/side-lists.js +16 -0
- package/lib/browser/components/sortable.js +15 -0
- package/lib/browser/components/workbench-tabs.d.ts +1 -0
- package/lib/browser/components/workbench-tabs.js +7 -2
- package/lib/browser/components/workbench-toggle.d.ts +5 -0
- package/lib/browser/components/workbench-toggle.js +11 -0
- package/lib/browser/i18n/locales.d.ts +1 -2
- package/lib/browser/i18n/messages-ja.js +0 -1
- package/lib/browser/i18n/messages-zh-tw.js +0 -1
- package/lib/browser/i18n/messages.d.ts +0 -1
- package/lib/browser/i18n/messages.js +0 -2
- package/lib/browser/partners/partners-view.js +4 -1
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +5 -0
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +2 -0
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +2 -0
- package/lib/browser/style/device.js +4 -1
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +20 -6
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +7 -2
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ListMotion = exports.ListMotionUtil = void 0;
|
|
37
|
+
exports.useListMotion = useListMotion;
|
|
38
|
+
const React = __importStar(require("react"));
|
|
39
|
+
/** How long a row takes to slide to its new place, longer the farther it goes, and one new to come in. */
|
|
40
|
+
const MOVE_MS = 300;
|
|
41
|
+
const MOVE_MAX_MS = 460;
|
|
42
|
+
const IN_MS = 280;
|
|
43
|
+
/** Where no spring can be drawn (linear() of CSS): the curve of --ta-ease. */
|
|
44
|
+
const EASE = 'cubic-bezier(0.2, 0.8, 0.2, 1)';
|
|
45
|
+
/** How much the row going over the others is lifted, as a card picked up. */
|
|
46
|
+
const LIFT = 1.02;
|
|
47
|
+
/** More rows than this come or go at once (a search, a fold, the next page): they take their places without a motion. */
|
|
48
|
+
const MAX_CHANGED = 2;
|
|
49
|
+
/** The motion each row is in, cancelled when it moves again: it goes on from where it is seen. */
|
|
50
|
+
const moving = new WeakMap();
|
|
51
|
+
var ListMotionUtil;
|
|
52
|
+
(function (ListMotionUtil) {
|
|
53
|
+
/**
|
|
54
|
+
* A spring as a CSS linear() curve: fast away, settling into its place with a slight give (about 2% past it), as
|
|
55
|
+
* the lists of iOS move. `damping` under 1 overshoots. Pure, for the tests.
|
|
56
|
+
*/
|
|
57
|
+
function spring(damping = 0.78, stiffness = 10, steps = 32) {
|
|
58
|
+
const turn = stiffness * Math.sqrt(1 - damping * damping);
|
|
59
|
+
const at = (t) => 1 - Math.exp(-damping * stiffness * t) * (Math.cos(turn * t) + ((damping * stiffness) / turn) * Math.sin(turn * t));
|
|
60
|
+
const points = Array.from({ length: steps + 1 }, (_, index) => (index === steps ? 1 : at(index / steps)));
|
|
61
|
+
return `linear(${points.map(point => Number(point.toFixed(4))).join(', ')})`;
|
|
62
|
+
}
|
|
63
|
+
ListMotionUtil.spring = spring;
|
|
64
|
+
/** How long a row takes for `distance` pixels: a long way a little longer, never slow. */
|
|
65
|
+
function duration(distance) {
|
|
66
|
+
return Math.round(Math.min(MOVE_MAX_MS, MOVE_MS + Math.abs(distance) * 0.25));
|
|
67
|
+
}
|
|
68
|
+
ListMotionUtil.duration = duration;
|
|
69
|
+
/**
|
|
70
|
+
* Whether the rows whose keys were `before` and are `after`, in order, slide to their places: when some changed
|
|
71
|
+
* places, or one or two came or went among the others. Pure, for the tests.
|
|
72
|
+
*/
|
|
73
|
+
function moves(before, after) {
|
|
74
|
+
const was = new Set(before);
|
|
75
|
+
const is = new Set(after);
|
|
76
|
+
const kept = after.filter(key => was.has(key));
|
|
77
|
+
if (kept.length === 0) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
const changed = after.length - kept.length + before.filter(key => !is.has(key)).length;
|
|
81
|
+
if (changed > MAX_CHANGED) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
const keptBefore = before.filter(key => is.has(key));
|
|
85
|
+
return changed > 0 || kept.some((key, index) => keptBefore[index] !== key);
|
|
86
|
+
}
|
|
87
|
+
ListMotionUtil.moves = moves;
|
|
88
|
+
/**
|
|
89
|
+
* The rows that go over the others on their way: those that changed places the most among the rows that stay
|
|
90
|
+
* (the one come to the top, pinned or let go), not those that only make room for it. Pure, for the tests.
|
|
91
|
+
*/
|
|
92
|
+
function over(before, after) {
|
|
93
|
+
const is = new Set(after);
|
|
94
|
+
const was = new Map(before.filter(key => is.has(key)).map((key, index) => [key, index]));
|
|
95
|
+
const jumps = after.filter(key => was.has(key)).map((key, index) => [key, Math.abs(was.get(key) - index)]);
|
|
96
|
+
const most = Math.max(0, ...jumps.map(([, jump]) => jump));
|
|
97
|
+
return new Set(most > 0 ? jumps.filter(([, jump]) => jump === most).map(([key]) => key) : []);
|
|
98
|
+
}
|
|
99
|
+
ListMotionUtil.over = over;
|
|
100
|
+
/** Within the list's view, a row's height of margin around it: one out of sight takes its place at once. */
|
|
101
|
+
function seen(top, height, view) {
|
|
102
|
+
return top + height >= view.top - height && top <= view.bottom + height;
|
|
103
|
+
}
|
|
104
|
+
ListMotionUtil.seen = seen;
|
|
105
|
+
})(ListMotionUtil || (exports.ListMotionUtil = ListMotionUtil = {}));
|
|
106
|
+
var ListMotion;
|
|
107
|
+
(function (ListMotion) {
|
|
108
|
+
let curve;
|
|
109
|
+
/** The spring where the page draws one, else the ease of Ta. */
|
|
110
|
+
function ease() {
|
|
111
|
+
curve !== null && curve !== void 0 ? curve : (curve = typeof CSS !== 'undefined' && CSS.supports('transition-timing-function', 'linear(0, 1)') ? ListMotionUtil.spring() : EASE);
|
|
112
|
+
return curve;
|
|
113
|
+
}
|
|
114
|
+
function calm() {
|
|
115
|
+
return typeof Element === 'undefined' || typeof Element.prototype.animate !== 'function' || document.documentElement.hasAttribute('data-reduce-motion');
|
|
116
|
+
}
|
|
117
|
+
ListMotion.calm = calm;
|
|
118
|
+
/** Stops the motion of `row`, which then lies where its place is. */
|
|
119
|
+
function stop(row) {
|
|
120
|
+
var _a;
|
|
121
|
+
(_a = moving.get(row)) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
122
|
+
}
|
|
123
|
+
ListMotion.stop = stop;
|
|
124
|
+
/**
|
|
125
|
+
* Slides `row` from `from` (the top it was seen at, in the window) to where it lies now; `over` (`data-moving`),
|
|
126
|
+
* over the others it passes, as a card does.
|
|
127
|
+
*/
|
|
128
|
+
function slide(row, from, now, over) {
|
|
129
|
+
const dy = from - now.top;
|
|
130
|
+
if (Math.abs(dy) < 1) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const timing = { duration: ListMotionUtil.duration(dy), easing: ease() };
|
|
134
|
+
if (!over) {
|
|
135
|
+
play(row, row.animate([{ transform: `translate3d(0, ${dy}px, 0)` }, { transform: 'none' }], timing));
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
// Lifted as it leaves, with the shadow of what floats over the page, and set down in its place.
|
|
139
|
+
row.dataset.moving = '';
|
|
140
|
+
const shadow = getComputedStyle(row).getPropertyValue('--ta-shadow-pop').trim() || '0 8px 24px rgba(0, 0, 0, 0.14)';
|
|
141
|
+
play(row, row.animate([
|
|
142
|
+
{ transform: `translate3d(0, ${dy}px, 0)`, boxShadow: '0 0 0 rgba(0, 0, 0, 0)' },
|
|
143
|
+
{ transform: `translate3d(0, ${dy * 0.45}px, 0) scale(${LIFT})`, boxShadow: shadow, offset: 0.35 },
|
|
144
|
+
{ transform: 'none', boxShadow: '0 0 0 rgba(0, 0, 0, 0)' },
|
|
145
|
+
], timing));
|
|
146
|
+
}
|
|
147
|
+
ListMotion.slide = slide;
|
|
148
|
+
/** Brings `row`, new to the list, in: it drops into the room the others made. */
|
|
149
|
+
function enter(row) {
|
|
150
|
+
play(row, row.animate([
|
|
151
|
+
{ opacity: 0, transform: 'translate3d(0, -10px, 0) scale(0.98)' },
|
|
152
|
+
{ opacity: 1, transform: 'none' },
|
|
153
|
+
], { duration: IN_MS, easing: ease(), fill: 'backwards' }));
|
|
154
|
+
}
|
|
155
|
+
ListMotion.enter = enter;
|
|
156
|
+
function play(row, animation) {
|
|
157
|
+
moving.set(row, animation);
|
|
158
|
+
const done = () => {
|
|
159
|
+
if (moving.get(row) === animation) {
|
|
160
|
+
moving.delete(row);
|
|
161
|
+
delete row.dataset.moving;
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
animation.onfinish = done;
|
|
165
|
+
animation.oncancel = done;
|
|
166
|
+
}
|
|
167
|
+
})(ListMotion || (exports.ListMotion = ListMotion = {}));
|
|
168
|
+
function rowsOf(list) {
|
|
169
|
+
return [...list.querySelectorAll('[data-row]')];
|
|
170
|
+
}
|
|
171
|
+
/** Where the rows of `list` are seen now, by their key (`data-row`): the first of a key. */
|
|
172
|
+
function look(list) {
|
|
173
|
+
if (!(list === null || list === void 0 ? void 0 : list.isConnected) || ListMotion.calm()) {
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
const keys = [];
|
|
177
|
+
const tops = new Map();
|
|
178
|
+
for (const row of rowsOf(list)) {
|
|
179
|
+
const key = row.dataset.row;
|
|
180
|
+
if (!tops.has(key)) {
|
|
181
|
+
keys.push(key);
|
|
182
|
+
tops.set(key, row.getBoundingClientRect().top);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return { list, keys, tops };
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* The rows of `list` (those with `data-row`, its key, in whichever of its sections) slide to their new places when the
|
|
189
|
+
* list is drawn in another order, as a messenger's list does when a conversation comes to the top or is pinned; one or
|
|
190
|
+
* two new come in. Where they were is read as the list is drawn again, before the change reaches the page; a search,
|
|
191
|
+
* a fold or the next page, which change many rows at once, take their places at once, and so do rows out of sight.
|
|
192
|
+
*/
|
|
193
|
+
function useListMotion(list) {
|
|
194
|
+
const before = React.useRef(undefined);
|
|
195
|
+
// Read while drawing: the page still shows the rows as they were, and where they are seen (moving too).
|
|
196
|
+
before.current = look(list.current);
|
|
197
|
+
React.useLayoutEffect(() => {
|
|
198
|
+
const was = before.current;
|
|
199
|
+
const element = list.current;
|
|
200
|
+
before.current = undefined;
|
|
201
|
+
if (!was || was.list !== element || ListMotion.calm()) {
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const rows = rowsOf(element);
|
|
205
|
+
const keys = [...new Set(rows.map(row => row.dataset.row))];
|
|
206
|
+
if (!ListMotionUtil.moves(was.keys, keys)) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
for (const row of rows) {
|
|
210
|
+
ListMotion.stop(row);
|
|
211
|
+
}
|
|
212
|
+
const box = element.getBoundingClientRect();
|
|
213
|
+
const over = ListMotionUtil.over(was.keys, keys);
|
|
214
|
+
const done = new Set();
|
|
215
|
+
for (const row of rows) {
|
|
216
|
+
const key = row.dataset.row;
|
|
217
|
+
if (done.has(key)) {
|
|
218
|
+
continue;
|
|
219
|
+
}
|
|
220
|
+
done.add(key);
|
|
221
|
+
const now = row.getBoundingClientRect();
|
|
222
|
+
const from = was.tops.get(key);
|
|
223
|
+
if (from === undefined) {
|
|
224
|
+
if (ListMotionUtil.seen(now.top, now.height, box)) {
|
|
225
|
+
ListMotion.enter(row);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
else if (ListMotionUtil.seen(from, now.height, box) || ListMotionUtil.seen(now.top, now.height, box)) {
|
|
229
|
+
ListMotion.slide(row, from, now, over.has(key));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
//# sourceMappingURL=list-motion.js.map
|
|
@@ -75,7 +75,7 @@ function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
|
|
|
75
75
|
};
|
|
76
76
|
const away = partner_row_util_1.PartnerRowUtil.away(partner, !!onPin);
|
|
77
77
|
const swipe = partner_row_util_1.PartnerRowUtil.swipe(pin, info, away);
|
|
78
|
-
return (React.createElement(swipe_row_1.SwipeRow, { as: "li", className: `ta-chat-row ta-partner-row${selected ? ' ta-selected' : ''}`, "data-unseen": unseen && !asks ? '' : undefined, "data-asks": asks ? '' : undefined, actions: swipe.length ? swipe : undefined, overlay: menu, onContextMenu: event => {
|
|
78
|
+
return (React.createElement(swipe_row_1.SwipeRow, { as: "li", className: `ta-chat-row ta-partner-row${selected ? ' ta-selected' : ''}`, "data-row": partner.key, "data-unseen": unseen && !asks ? '' : undefined, "data-asks": asks ? '' : undefined, actions: swipe.length ? swipe : undefined, overlay: menu, onContextMenu: event => {
|
|
79
79
|
const own = partner.menu ? chat_home_util_1.ChatHomeUtil.menu(partner.menu()) : [];
|
|
80
80
|
const first = [{ label: t('ta.chat.open'), run: go }, ...(pin ? [pin] : []), ...(info ? [{ label: info.label, run: info.run }] : [])];
|
|
81
81
|
const last = away ? [{ label: away.label, run: away.run, danger: true }] : [];
|
|
@@ -46,5 +46,12 @@ export declare namespace SideListUtil {
|
|
|
46
46
|
function pushesOver(tab: WebViewEntry | undefined): boolean;
|
|
47
47
|
/** The list picked again hides the sidebar (or the drawer); another shows. */
|
|
48
48
|
function pick(id: string, { side, drawer, shown }: SideListState): SideListPick;
|
|
49
|
+
/**
|
|
50
|
+
* Whether a double click in the sidebar was on a row of a list (a conversation, the double, an agent, a friend, a
|
|
51
|
+
* group chat, of Ta or of an extension): what a row opens is a button or a link in an item of the list (`li`, a
|
|
52
|
+
* SwipeRow) or one that marks the item shown (`aria-current`), never a field, a button of a head, nor an action
|
|
53
|
+
* a swipe shows behind a row.
|
|
54
|
+
*/
|
|
55
|
+
function isRow(target: EventTarget | null): boolean;
|
|
49
56
|
}
|
|
50
57
|
//# sourceMappingURL=side-lists.d.ts.map
|
|
@@ -55,5 +55,21 @@ var SideListUtil;
|
|
|
55
55
|
return again && shown ? 'hide' : 'show';
|
|
56
56
|
}
|
|
57
57
|
SideListUtil.pick = pick;
|
|
58
|
+
/**
|
|
59
|
+
* Whether a double click in the sidebar was on a row of a list (a conversation, the double, an agent, a friend, a
|
|
60
|
+
* group chat, of Ta or of an extension): what a row opens is a button or a link in an item of the list (`li`, a
|
|
61
|
+
* SwipeRow) or one that marks the item shown (`aria-current`), never a field, a button of a head, nor an action
|
|
62
|
+
* a swipe shows behind a row.
|
|
63
|
+
*/
|
|
64
|
+
function isRow(target) {
|
|
65
|
+
var _a;
|
|
66
|
+
const element = target;
|
|
67
|
+
const opener = (_a = element === null || element === void 0 ? void 0 : element.closest) === null || _a === void 0 ? void 0 : _a.call(element, 'button, a, [role="button"]');
|
|
68
|
+
if (!opener || opener.closest('.ta-swipe-actions')) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
return opener.hasAttribute('aria-current') || !!opener.closest('li, .ta-swipe-row');
|
|
72
|
+
}
|
|
73
|
+
SideListUtil.isRow = isRow;
|
|
58
74
|
})(SideListUtil || (exports.SideListUtil = SideListUtil = {}));
|
|
59
75
|
//# sourceMappingURL=side-lists.js.map
|
|
@@ -38,6 +38,7 @@ exports.useSortable = useSortable;
|
|
|
38
38
|
const React = __importStar(require("react"));
|
|
39
39
|
const react_dom_1 = require("react-dom");
|
|
40
40
|
const device_1 = require("../device/device");
|
|
41
|
+
const list_motion_1 = require("./list-motion");
|
|
41
42
|
/** Where a row dragged to `center` goes among rows whose centers are `centers` (the dragged one at `from`). Pure, for the tests. */
|
|
42
43
|
var SortUtil;
|
|
43
44
|
(function (SortUtil) {
|
|
@@ -105,6 +106,9 @@ function useSortable(list, onMove) {
|
|
|
105
106
|
handle.removeEventListener('pointermove', onPointerMove);
|
|
106
107
|
handle.removeEventListener('pointerup', onPointerUp);
|
|
107
108
|
handle.removeEventListener('pointercancel', onPointerUp);
|
|
109
|
+
// Where each is seen as the finger lets go: those that made room are there already, the one dragged
|
|
110
|
+
// slides from the finger into its place, as the rows of any list do (ListMotion).
|
|
111
|
+
const seen = rows.map(row => row.getBoundingClientRect().top);
|
|
108
112
|
// In the frame the rows take their places: none jumps back first.
|
|
109
113
|
(0, react_dom_1.flushSync)(() => {
|
|
110
114
|
if (to !== from) {
|
|
@@ -112,9 +116,20 @@ function useSortable(list, onMove) {
|
|
|
112
116
|
}
|
|
113
117
|
});
|
|
114
118
|
for (const row of rows) {
|
|
119
|
+
// Not by their transition: from where they were moved to, they are in their places.
|
|
120
|
+
row.style.transition = 'none';
|
|
115
121
|
row.style.removeProperty('transform');
|
|
116
122
|
}
|
|
117
123
|
delete dragged.dataset.sorting;
|
|
124
|
+
const calm = list_motion_1.ListMotion.calm();
|
|
125
|
+
rows.forEach((row, index) => {
|
|
126
|
+
// Read before the transition is back: the change of place is taken without it.
|
|
127
|
+
const now = row.getBoundingClientRect();
|
|
128
|
+
if (!calm) {
|
|
129
|
+
list_motion_1.ListMotion.slide(row, seen[index], now, row === dragged);
|
|
130
|
+
}
|
|
131
|
+
row.style.removeProperty('transition');
|
|
132
|
+
});
|
|
118
133
|
};
|
|
119
134
|
handle.addEventListener('pointermove', onPointerMove);
|
|
120
135
|
handle.addEventListener('pointerup', onPointerUp);
|
|
@@ -17,6 +17,7 @@ export interface WorkbenchTabsProps {
|
|
|
17
17
|
cwd?: string;
|
|
18
18
|
/** Whether the workbench takes the place of the conversation too; none on narrow screens, where it always does. */
|
|
19
19
|
maximized?: boolean;
|
|
20
|
+
/** Maximizes or restores the workbench: its button, or a double click on a tab. */
|
|
20
21
|
onMaximize?(): void;
|
|
21
22
|
}
|
|
22
23
|
export declare function ViewGlyph({ view, size }: {
|
|
@@ -156,7 +156,12 @@ function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView,
|
|
|
156
156
|
const Glyph = editor.icon;
|
|
157
157
|
const selected = editor.id === active;
|
|
158
158
|
return (React.createElement("div", { key: editor.id, className: `ta-editor-tab ${selected ? 'ta-active' : ''} ${editor.preview ? 'ta-preview' : ''} ${editor.dirty ? 'ta-dirty' : ''}`, title: title },
|
|
159
|
-
React.createElement("button", { type: "button", role: "tab", "aria-selected": selected, className: "ta-editor-tab-button", onClick: () => onShow(editor.id), onDoubleClick: () =>
|
|
159
|
+
React.createElement("button", { type: "button", role: "tab", "aria-selected": selected, className: "ta-editor-tab-button", onClick: () => onShow(editor.id), onDoubleClick: () => {
|
|
160
|
+
if (editor.preview) {
|
|
161
|
+
onPin(editor.id);
|
|
162
|
+
}
|
|
163
|
+
onMaximize === null || onMaximize === void 0 ? void 0 : onMaximize();
|
|
164
|
+
}, onAuxClick: event => event.button === 1 && onClose([editor.id]), onContextMenu: event => openMenu(event, menuFor(editor)) },
|
|
160
165
|
Glyph && React.createElement(Glyph, { size: 14 }),
|
|
161
166
|
React.createElement("span", null, title)),
|
|
162
167
|
React.createElement(CloseTab, { editor: editor, title: title, onClose: () => onClose([editor.id]), onContextMenu: event => openMenu(event, menuFor(editor)) })));
|
|
@@ -164,7 +169,7 @@ function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView,
|
|
|
164
169
|
views.length > 0 && React.createElement(OpenMenu, { views: views, onOpenView: onOpenView, cwd: cwd }),
|
|
165
170
|
menu,
|
|
166
171
|
React.createElement("div", { className: "ta-workbench-actions" },
|
|
167
|
-
onMaximize &&
|
|
172
|
+
maximized && onMaximize && React.createElement(icon_1.IconButton, { icon: lucide_react_1.Minimize2, label: t('ta.workbench.restore'), className: "ta-wide-only", onClick: onMaximize }),
|
|
168
173
|
React.createElement(icon_1.IconButton, { icon: icon_1.SidebarRight, label: t('ta.panel.hide'), onClick: onHide }))));
|
|
169
174
|
}
|
|
170
175
|
/**
|
|
@@ -10,4 +10,9 @@ export declare const WorkbenchToggleContext: React.Context<WorkbenchToggleState
|
|
|
10
10
|
* hidden: once shown, the same button on top of the workbench hides it.
|
|
11
11
|
*/
|
|
12
12
|
export declare function WorkbenchToggle(): React.JSX.Element | null;
|
|
13
|
+
/** The sidebar of a wide screen: a double click on a row of its lists also shows or hides the workbench. */
|
|
14
|
+
export declare function SidebarPane({ style, children }: {
|
|
15
|
+
style: React.CSSProperties;
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
}): React.JSX.Element;
|
|
13
18
|
//# sourceMappingURL=workbench-toggle.d.ts.map
|
|
@@ -35,9 +35,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.WorkbenchToggleContext = void 0;
|
|
37
37
|
exports.WorkbenchToggle = WorkbenchToggle;
|
|
38
|
+
exports.SidebarPane = SidebarPane;
|
|
38
39
|
const React = __importStar(require("react"));
|
|
39
40
|
const use_t_1 = require("../i18n/use-t");
|
|
40
41
|
const icon_1 = require("./icon");
|
|
42
|
+
const side_lists_1 = require("./side-lists");
|
|
41
43
|
exports.WorkbenchToggleContext = React.createContext(undefined);
|
|
42
44
|
/**
|
|
43
45
|
* The button that shows the workbench, for the head of the conversation or of a page. Only while it is
|
|
@@ -51,4 +53,13 @@ function WorkbenchToggle() {
|
|
|
51
53
|
}
|
|
52
54
|
return React.createElement(icon_1.IconButton, { icon: icon_1.SidebarRight, label: t('ta.panel.show'), onClick: state.toggle });
|
|
53
55
|
}
|
|
56
|
+
/** The sidebar of a wide screen: a double click on a row of its lists also shows or hides the workbench. */
|
|
57
|
+
function SidebarPane({ style, children }) {
|
|
58
|
+
const state = React.useContext(exports.WorkbenchToggleContext);
|
|
59
|
+
return (React.createElement("div", { className: "ta-sidebar", style: style, onDoubleClick: event => {
|
|
60
|
+
if (state && side_lists_1.SideListUtil.isRow(event.target)) {
|
|
61
|
+
state.toggle();
|
|
62
|
+
}
|
|
63
|
+
} }, children));
|
|
64
|
+
}
|
|
54
65
|
//# sourceMappingURL=workbench-toggle.js.map
|