@celljs/ta-web 4.24.0 → 4.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/components/account-menu.js +5 -1
- 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/editor-actions.d.ts +10 -0
- package/esm/browser/components/editor-actions.js +13 -0
- package/esm/browser/components/editor-area.js +7 -3
- package/esm/browser/components/fold-text.d.ts +4 -2
- package/esm/browser/components/fold-text.js +5 -4
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/image-swipe.d.ts +20 -0
- package/esm/browser/components/image-swipe.js +75 -0
- package/esm/browser/components/image-viewer.d.ts +2 -2
- package/esm/browser/components/image-viewer.js +2 -2
- package/esm/browser/components/list-motion.d.ts +44 -0
- package/esm/browser/components/list-motion.js +197 -0
- package/esm/browser/components/message-user.js +5 -3
- package/esm/browser/components/partner-row.js +1 -1
- package/esm/browser/components/relay-services.d.ts +1 -1
- package/esm/browser/components/relay-services.js +11 -91
- package/esm/browser/components/said-text.d.ts +6 -2
- package/esm/browser/components/said-text.js +8 -2
- 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 +5 -2
- package/esm/browser/components/workbench-tabs.js +13 -6
- package/esm/browser/components/workbench-toggle.d.ts +5 -0
- package/esm/browser/components/workbench-toggle.js +10 -0
- package/esm/browser/extension/extension-view.d.ts +1 -1
- package/esm/browser/extension/web-api-contributions.d.ts +4 -12
- package/esm/browser/extension/web-api-editors.d.ts +32 -0
- package/esm/browser/extension/web-api-editors.js +2 -0
- package/esm/browser/extension/web-api-menus.d.ts +40 -0
- package/esm/browser/extension/web-api-menus.js +2 -0
- package/esm/browser/extension/web-extension-api.d.ts +9 -26
- package/esm/browser/extension/web-extension-context.js +5 -9
- package/esm/browser/extension/web-extension-protocol.d.ts +3 -1
- package/esm/browser/extension/web-extension-protocol.js +1 -0
- package/esm/browser/extension/web-extension-run.d.ts +5 -2
- package/esm/browser/extension/web-extension-run.js +15 -0
- package/esm/browser/extension/web-session-notices.js +8 -0
- package/esm/browser/i18n/locales.d.ts +5 -2
- package/esm/browser/i18n/messages-ja.js +6 -3
- package/esm/browser/i18n/messages-zh-tw.js +6 -3
- package/esm/browser/i18n/messages.d.ts +4 -1
- package/esm/browser/i18n/messages.js +13 -7
- package/esm/browser/notices/chime.d.ts +16 -0
- package/esm/browser/notices/chime.js +67 -0
- package/esm/browser/notices/session-notices.d.ts +8 -0
- package/esm/browser/notices/session-notices.js +23 -2
- package/esm/browser/partners/partners-view.js +4 -1
- package/esm/browser/share/shared-page.js +2 -1
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +7 -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 +5 -2
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/layout.js +28 -6
- package/esm/browser/style/shared.d.ts +1 -1
- package/esm/browser/style/shared.js +1 -0
- 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/esm/browser/util/image-swipe.d.ts +14 -3
- package/esm/browser/util/image-swipe.js +26 -3
- package/esm/browser/util/process.d.ts +5 -0
- package/esm/browser/util/process.js +22 -1
- package/lib/browser/components/account-menu.js +4 -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/editor-actions.d.ts +11 -0
- package/lib/browser/components/editor-actions.js +50 -0
- package/lib/browser/components/editor-area.js +7 -3
- package/lib/browser/components/fold-text.d.ts +4 -2
- package/lib/browser/components/fold-text.js +5 -4
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/image-swipe.d.ts +20 -0
- package/lib/browser/components/image-swipe.js +75 -0
- package/lib/browser/components/image-viewer.d.ts +2 -2
- package/lib/browser/components/image-viewer.js +2 -2
- package/lib/browser/components/list-motion.d.ts +45 -0
- package/lib/browser/components/list-motion.js +234 -0
- package/lib/browser/components/message-user.js +5 -3
- package/lib/browser/components/partner-row.js +1 -1
- package/lib/browser/components/relay-services.d.ts +1 -1
- package/lib/browser/components/relay-services.js +9 -89
- package/lib/browser/components/said-text.d.ts +6 -2
- package/lib/browser/components/said-text.js +8 -2
- 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 +5 -2
- package/lib/browser/components/workbench-tabs.js +12 -5
- package/lib/browser/components/workbench-toggle.d.ts +5 -0
- package/lib/browser/components/workbench-toggle.js +11 -0
- package/lib/browser/extension/extension-view.d.ts +1 -1
- package/lib/browser/extension/web-api-contributions.d.ts +4 -12
- package/lib/browser/extension/web-api-editors.d.ts +33 -0
- package/lib/browser/extension/web-api-editors.js +3 -0
- package/lib/browser/extension/web-api-menus.d.ts +41 -0
- package/lib/browser/extension/web-api-menus.js +3 -0
- package/lib/browser/extension/web-extension-api.d.ts +9 -26
- package/lib/browser/extension/web-extension-context.js +5 -9
- package/lib/browser/extension/web-extension-protocol.d.ts +3 -1
- package/lib/browser/extension/web-extension-protocol.js +1 -0
- package/lib/browser/extension/web-extension-run.d.ts +5 -2
- package/lib/browser/extension/web-extension-run.js +15 -0
- package/lib/browser/extension/web-session-notices.js +8 -0
- package/lib/browser/i18n/locales.d.ts +5 -2
- package/lib/browser/i18n/messages-ja.js +6 -3
- package/lib/browser/i18n/messages-zh-tw.js +6 -3
- package/lib/browser/i18n/messages.d.ts +4 -1
- package/lib/browser/i18n/messages.js +13 -7
- package/lib/browser/notices/chime.d.ts +17 -0
- package/lib/browser/notices/chime.js +71 -0
- package/lib/browser/notices/session-notices.d.ts +8 -0
- package/lib/browser/notices/session-notices.js +23 -2
- package/lib/browser/partners/partners-view.js +4 -1
- package/lib/browser/share/shared-page.js +2 -1
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +7 -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 +5 -2
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/layout.js +28 -6
- package/lib/browser/style/shared.d.ts +1 -1
- package/lib/browser/style/shared.js +1 -0
- 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/lib/browser/util/image-swipe.d.ts +14 -3
- package/lib/browser/util/image-swipe.js +26 -3
- package/lib/browser/util/process.d.ts +5 -0
- package/lib/browser/util/process.js +22 -1
- 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
|
|
@@ -89,20 +89,22 @@ function TaskNote({ note }) {
|
|
|
89
89
|
* `bubble` is the class of that bubble, which a conversation and the double have of their own.
|
|
90
90
|
*/
|
|
91
91
|
function UserSaid({ blocks, text, bubble = 'ta-bubble', timestamp }) {
|
|
92
|
+
// What a part of Ta wrote for the user is Markdown (TaMessageSource); what they typed shows as typed.
|
|
93
|
+
const markdown = !!ta_protocol_1.TaMessageSource.of(message_1.MessageUtil.text(blocks));
|
|
92
94
|
if (message_images_1.UserImageUtil.images(blocks).length === 0) {
|
|
93
95
|
return text ? (React.createElement("div", { className: bubble },
|
|
94
|
-
React.createElement(said_text_1.SaidText, { text: text }))) : null;
|
|
96
|
+
React.createElement(said_text_1.SaidText, { text: text, markdown: markdown }))) : null;
|
|
95
97
|
}
|
|
96
98
|
// Many pictures stand on their own (folded, ImageStack, or unfolded), the words in a bubble of their own under them.
|
|
97
99
|
if (message_images_1.UserImageUtil.images(blocks).length >= message_images_1.STACK_FROM) {
|
|
98
100
|
return (React.createElement(React.Fragment, null,
|
|
99
101
|
React.createElement(message_images_1.UserImages, { blocks: blocks, timestamp: timestamp }),
|
|
100
102
|
text && (React.createElement("div", { className: bubble },
|
|
101
|
-
React.createElement(said_text_1.SaidText, { text: text })))));
|
|
103
|
+
React.createElement(said_text_1.SaidText, { text: text, markdown: markdown })))));
|
|
102
104
|
}
|
|
103
105
|
return (React.createElement("div", { className: `${bubble} ta-bubble-media${text ? '' : ' ta-bubble-bare'}` },
|
|
104
106
|
React.createElement(message_images_1.UserImages, { blocks: blocks, timestamp: timestamp }),
|
|
105
|
-
text && React.createElement(said_text_1.SaidText, { text: text, className: "ta-bubble-text" })));
|
|
107
|
+
text && React.createElement(said_text_1.SaidText, { text: text, className: "ta-bubble-text", markdown: markdown })));
|
|
106
108
|
}
|
|
107
109
|
/**
|
|
108
110
|
* Where a message of the user came from when not from what they typed (TaMessageSource): the package that sent it, as
|
|
@@ -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 }] : [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TaJoinedDeployment, TaRelayFeature, TaRelayProbe, TaRelayService, TaRelayTypeInfo } from '@celljs/ta-protocol';
|
|
2
2
|
import { type LucideIcon } from 'lucide-react';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useT } from '../i18n/use-t';
|
|
@@ -35,7 +35,6 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.RelayServicesUtil = void 0;
|
|
37
37
|
exports.RelayServices = RelayServices;
|
|
38
|
-
const ta_protocol_1 = require("@celljs/ta-protocol");
|
|
39
38
|
const lucide_react_1 = require("lucide-react");
|
|
40
39
|
const React = __importStar(require("react"));
|
|
41
40
|
const hooks_1 = require("../hooks");
|
|
@@ -43,8 +42,8 @@ const use_t_1 = require("../i18n/use-t");
|
|
|
43
42
|
const icon_1 = require("./icon");
|
|
44
43
|
const remote_hosts_1 = require("./remote-hosts");
|
|
45
44
|
const settings_controls_1 = require("./settings-controls");
|
|
46
|
-
/** The features that go through a relay, in the order the settings list them. */
|
|
47
|
-
const FEATURES = ['devices', 'share', 'rooms'
|
|
45
|
+
/** The features that go through a relay, in the order the settings list them; where sync goes is chosen in its own settings (ta-sync). */
|
|
46
|
+
const FEATURES = ['devices', 'share', 'rooms'];
|
|
48
47
|
var RelayServicesUtil;
|
|
49
48
|
(function (RelayServicesUtil) {
|
|
50
49
|
/** What a service is called: the official relay, its name, else its host or its folder. */
|
|
@@ -153,7 +152,7 @@ var RelayServicesUtil;
|
|
|
153
152
|
* made before (a device, a room, a link) stays on its relay when the choice changes.
|
|
154
153
|
*/
|
|
155
154
|
function RelayServices() {
|
|
156
|
-
var _a
|
|
155
|
+
var _a;
|
|
157
156
|
const t = (0, use_t_1.useT)();
|
|
158
157
|
const [workbench, bench] = (0, hooks_1.useWorkbench)();
|
|
159
158
|
const [, notices] = (0, hooks_1.useNotices)();
|
|
@@ -161,8 +160,6 @@ function RelayServices() {
|
|
|
161
160
|
const [probes, setProbes] = React.useState({});
|
|
162
161
|
const [url, setUrl] = React.useState('');
|
|
163
162
|
const [busy, setBusy] = React.useState();
|
|
164
|
-
const [form, setForm] = React.useState();
|
|
165
|
-
const language = (0, use_t_1.useLanguage)();
|
|
166
163
|
const read = React.useCallback(async () => {
|
|
167
164
|
const listed = await bench.relay.listRelays();
|
|
168
165
|
setRelays(listed);
|
|
@@ -197,33 +194,19 @@ function RelayServices() {
|
|
|
197
194
|
await read().catch(() => undefined);
|
|
198
195
|
}
|
|
199
196
|
};
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
const value = text.trim();
|
|
203
|
-
const id = /^[/~]/.test(value) ? await bench.relay.addFolder(value, name) : await bench.relay.addRelay(value);
|
|
197
|
+
const add = (text = url) => run('add', async () => {
|
|
198
|
+
const id = await bench.relay.addRelay(text.trim());
|
|
204
199
|
setUrl('');
|
|
205
200
|
const probe = await bench.relay.probeRelay(id);
|
|
206
201
|
setProbes(before => ({ ...before, [id]: probe }));
|
|
207
202
|
});
|
|
208
|
-
/** A drive found here: its folder added, and sync goes there. */
|
|
209
|
-
const takeDrive = (drive) => run(`drive:${drive.path}`, async () => {
|
|
210
|
-
const id = await bench.relay.addFolder(drive.path, drive.name);
|
|
211
|
-
setRelays(await bench.relay.chooseRelay('sync', id));
|
|
212
|
-
const probe = await bench.relay.probeRelay(id);
|
|
213
|
-
setProbes(before => ({ ...before, [id]: probe }));
|
|
214
|
-
});
|
|
215
|
-
/** A store just added: sync goes there. */
|
|
216
|
-
const stored = async (id) => {
|
|
217
|
-
setRelays(await bench.relay.chooseRelay('sync', id));
|
|
218
|
-
setForm(undefined);
|
|
219
|
-
const probe = await bench.relay.probeRelay(id);
|
|
220
|
-
setProbes(before => ({ ...before, [id]: probe }));
|
|
221
|
-
};
|
|
222
203
|
if (!relays) {
|
|
223
204
|
return null;
|
|
224
205
|
}
|
|
225
206
|
const used = new Set(Object.values(relays.use));
|
|
226
207
|
const types = (_a = relays.types) !== null && _a !== void 0 ? _a : [];
|
|
208
|
+
// Folders and stores are places of sync, chosen and removed there.
|
|
209
|
+
const shown = relays.relays.filter(relay => relay.type === 'ta-relay');
|
|
227
210
|
return (React.createElement(React.Fragment, null,
|
|
228
211
|
React.createElement(Deployment, { relays: relays, changed: listed => {
|
|
229
212
|
var _a;
|
|
@@ -238,22 +221,9 @@ function RelayServices() {
|
|
|
238
221
|
React.createElement("select", { className: "ta-input ta-select", "aria-label": t(`ta.relays.feature.${feature}`), disabled: busy !== undefined, value: (_a = relays.use[feature]) !== null && _a !== void 0 ? _a : '', onChange: event => void run(feature, async () => setRelays(await bench.relay.chooseRelay(feature, event.target.value || null))) }, relays.relays
|
|
239
222
|
.filter(relay => RelayServicesUtil.serves(relay, feature) || relays.use[feature] === relay.id)
|
|
240
223
|
.map(relay => (React.createElement("option", { key: relay.id, value: relay.id }, RelayServicesUtil.label(relay, t))))))); }),
|
|
241
|
-
|
|
224
|
+
shown.map(relay => { var _a; return (React.createElement(settings_controls_1.Row, { key: relay.id, icon: RelayServicesUtil.icon(relay, types), label: RelayServicesUtil.label(relay, t), description: React.createElement("span", { className: "ta-remote-state" },
|
|
242
225
|
React.createElement("span", { className: `ta-remote-light${((_a = probes[relay.id]) === null || _a === void 0 ? void 0 : _a.online) ? ' ta-on' : ''}` }),
|
|
243
226
|
RelayServicesUtil.line(relay, probes[relay.id], t)) }, !relay.builtin && relay.id !== 'relay-json' && !used.has(relay.id) && (React.createElement(icon_1.IconButton, { icon: lucide_react_1.Trash2, label: t('ta.relays.remove', { name: RelayServicesUtil.label(relay, t) }), disabled: busy !== undefined, onClick: () => void run(relay.id, () => bench.relay.removeRelay(relay.id)) })))); }),
|
|
244
|
-
((_b = relays.drives) !== null && _b !== void 0 ? _b : []).map(drive => (React.createElement(settings_controls_1.Row, { key: drive.path, icon: lucide_react_1.Cloud, label: t('ta.relays.drive', { name: drive.name }), description: t('ta.relays.driveHint', { path: drive.path }) },
|
|
245
|
-
React.createElement("button", { type: "button", className: `ta-button${busy === `drive:${drive.path}` ? ' ta-busy' : ''}`, disabled: busy !== undefined, onClick: () => void takeDrive(drive) },
|
|
246
|
-
busy === `drive:${drive.path}` && React.createElement("span", { className: "ta-spinner ta-busy-mark" }),
|
|
247
|
-
React.createElement("span", null, t('ta.relays.driveUse')))))),
|
|
248
|
-
types.map(type => {
|
|
249
|
-
var _a;
|
|
250
|
-
const title = (_a = ta_protocol_1.TaPackageTextUtil.pick(type.title, language)) !== null && _a !== void 0 ? _a : type.type;
|
|
251
|
-
const open = form === type.type;
|
|
252
|
-
return (React.createElement(React.Fragment, { key: `type:${type.type}` },
|
|
253
|
-
React.createElement(settings_controls_1.Row, { icon: RelayServicesUtil.iconNamed(type.icon), label: t('ta.relays.storeType', { name: title }), description: ta_protocol_1.TaPackageTextUtil.pick(type.hint, language) }, !open && (React.createElement("button", { type: "button", className: "ta-button", disabled: busy !== undefined, onClick: () => setForm(type.type) }, t('ta.relays.storeOpen')))),
|
|
254
|
-
open && (React.createElement(settings_controls_1.Row, { label: "", stacked: true },
|
|
255
|
-
React.createElement(StoreForm, { type: type, title: title, close: () => setForm(undefined), added: stored })))));
|
|
256
|
-
}),
|
|
257
227
|
React.createElement(settings_controls_1.Row, { label: t('ta.relays.add'), description: t('ta.relays.addHint'), stacked: true },
|
|
258
228
|
React.createElement("form", { className: "ta-trusted-add", onSubmit: event => {
|
|
259
229
|
event.preventDefault();
|
|
@@ -264,6 +234,7 @@ function RelayServices() {
|
|
|
264
234
|
busy === 'add' ? React.createElement("span", { className: "ta-spinner ta-busy-mark" }) : React.createElement(icon_1.Icon, { icon: lucide_react_1.Plus, size: 14 }),
|
|
265
235
|
" ",
|
|
266
236
|
t('ta.relays.addButton')))),
|
|
237
|
+
React.createElement(settings_controls_1.Row, { icon: lucide_react_1.RefreshCw, label: t('ta.relays.syncElsewhere'), description: t('ta.relays.syncElsewhereHint') }),
|
|
267
238
|
React.createElement(settings_controls_1.Row, { icon: lucide_react_1.FileJson, label: t('ta.relays.file'), description: React.createElement("span", { className: "ta-path" }, relays.file) })));
|
|
268
239
|
}
|
|
269
240
|
/**
|
|
@@ -339,55 +310,4 @@ function Deployment({ relays, changed }) {
|
|
|
339
310
|
t('ta.deploy.open')),
|
|
340
311
|
clouds && !added && React.createElement(remote_hosts_1.AddCloudHost, { url: gateway, name: RelayServicesUtil.cloudName(gateway), onAdded: readClouds }))))));
|
|
341
312
|
}
|
|
342
|
-
/**
|
|
343
|
-
* The form of a type of service a package registered (WebDAV, S3, git): its fields as the package said, secrets as
|
|
344
|
-
* passwords, and a name. Ta tries the store before it adds it; then sync goes there.
|
|
345
|
-
*/
|
|
346
|
-
function StoreForm({ type, title, close, added }) {
|
|
347
|
-
const t = (0, use_t_1.useT)();
|
|
348
|
-
const language = (0, use_t_1.useLanguage)();
|
|
349
|
-
const [, bench] = (0, hooks_1.useWorkbench)();
|
|
350
|
-
const [, notices] = (0, hooks_1.useNotices)();
|
|
351
|
-
const [values, setValues] = React.useState({});
|
|
352
|
-
const [name, setName] = React.useState('');
|
|
353
|
-
const [busy, setBusy] = React.useState(false);
|
|
354
|
-
const missing = type.options.some(option => { var _a; return !option.optional && !((_a = values[option.key]) === null || _a === void 0 ? void 0 : _a.trim()); });
|
|
355
|
-
const submit = async () => {
|
|
356
|
-
setBusy(true);
|
|
357
|
-
try {
|
|
358
|
-
const given = Object.fromEntries(Object.entries(values).map(([key, value]) => [key, value.trim()]));
|
|
359
|
-
await added(await bench.relay.addStore(type.type, given, name.trim() || title));
|
|
360
|
-
}
|
|
361
|
-
catch (error) {
|
|
362
|
-
notices.error(error);
|
|
363
|
-
}
|
|
364
|
-
finally {
|
|
365
|
-
setBusy(false);
|
|
366
|
-
}
|
|
367
|
-
};
|
|
368
|
-
return (React.createElement("form", { className: "ta-store-form", onSubmit: event => {
|
|
369
|
-
event.preventDefault();
|
|
370
|
-
void submit();
|
|
371
|
-
} },
|
|
372
|
-
type.options.map(option => { var _a, _b; return (React.createElement("label", { key: option.key, className: "ta-store-field" },
|
|
373
|
-
React.createElement("span", { className: "ta-store-field-label" }, (_a = ta_protocol_1.TaPackageTextUtil.pick(option.label, language)) !== null && _a !== void 0 ? _a : option.key,
|
|
374
|
-
option.optional && React.createElement("span", { className: "ta-store-field-optional" }, t('ta.relays.optional'))),
|
|
375
|
-
React.createElement("input", { className: "ta-input", type: option.secret ? 'password' : 'text', autoComplete: option.secret ? 'new-password' : 'off', spellCheck: false, placeholder: option.placeholder, value: (_b = values[option.key]) !== null && _b !== void 0 ? _b : '', onChange: event => {
|
|
376
|
-
const value = event.target.value;
|
|
377
|
-
setValues(before => ({ ...before, [option.key]: value }));
|
|
378
|
-
} }))); }),
|
|
379
|
-
React.createElement("label", { className: "ta-store-field" },
|
|
380
|
-
React.createElement("span", { className: "ta-store-field-label" },
|
|
381
|
-
t('ta.relays.storeName'),
|
|
382
|
-
React.createElement("span", { className: "ta-store-field-optional" }, t('ta.relays.optional'))),
|
|
383
|
-
React.createElement("input", { className: "ta-input", value: name, placeholder: title, spellCheck: false, onChange: event => setName(event.target.value) })),
|
|
384
|
-
React.createElement("p", { className: "ta-store-form-note" },
|
|
385
|
-
React.createElement(icon_1.Icon, { icon: lucide_react_1.ShieldCheck, size: 13 }),
|
|
386
|
-
React.createElement("span", null, t('ta.relays.storeNote'))),
|
|
387
|
-
React.createElement("div", { className: "ta-store-form-actions" },
|
|
388
|
-
React.createElement("button", { type: "button", className: "ta-button", disabled: busy, onClick: close }, t('ta.cancel')),
|
|
389
|
-
React.createElement("button", { type: "submit", className: `ta-button ta-primary${busy ? ' ta-busy' : ''}`, disabled: missing || busy },
|
|
390
|
-
busy && React.createElement("span", { className: "ta-spinner ta-busy-mark" }),
|
|
391
|
-
React.createElement("span", null, t('ta.relays.storeAdd'))))));
|
|
392
|
-
}
|
|
393
313
|
//# sourceMappingURL=relay-services.js.map
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* What the user wrote, in their bubble: the quote it starts with (QuoteUtil) set apart above the rest, as WeChat's.
|
|
4
|
+
* What a part of Ta wrote for them (`markdown`) is drawn as Markdown.
|
|
5
|
+
*/
|
|
6
|
+
export declare function SaidText({ text, className, markdown }: {
|
|
4
7
|
text: string;
|
|
5
8
|
className?: string;
|
|
9
|
+
markdown?: boolean;
|
|
6
10
|
}): React.JSX.Element;
|
|
7
11
|
//# sourceMappingURL=said-text.d.ts.map
|
|
@@ -37,8 +37,14 @@ exports.SaidText = SaidText;
|
|
|
37
37
|
const React = __importStar(require("react"));
|
|
38
38
|
const quote_1 = require("../util/quote");
|
|
39
39
|
const fold_text_1 = require("./fold-text");
|
|
40
|
-
/**
|
|
41
|
-
|
|
40
|
+
/**
|
|
41
|
+
* What the user wrote, in their bubble: the quote it starts with (QuoteUtil) set apart above the rest, as WeChat's.
|
|
42
|
+
* What a part of Ta wrote for them (`markdown`) is drawn as Markdown.
|
|
43
|
+
*/
|
|
44
|
+
function SaidText({ text, className, markdown }) {
|
|
45
|
+
if (markdown) {
|
|
46
|
+
return React.createElement(fold_text_1.FoldText, { text: text, className: className, markdown: true });
|
|
47
|
+
}
|
|
42
48
|
const { quote, rest } = quote_1.QuoteUtil.split(text);
|
|
43
49
|
if (!quote) {
|
|
44
50
|
return React.createElement(fold_text_1.FoldText, { text: text, className: className });
|
|
@@ -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,7 +17,10 @@ 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;
|
|
22
|
+
/** Where the tab shown puts its tools (ui.EditorActions), before those of the workbench. */
|
|
23
|
+
actionsRef?(element: HTMLElement | null): void;
|
|
21
24
|
}
|
|
22
25
|
export declare function ViewGlyph({ view, size }: {
|
|
23
26
|
view: WebViewEntry;
|
|
@@ -27,13 +30,13 @@ export declare function ViewGlyph({ view, size }: {
|
|
|
27
30
|
* The tabs of a wide workbench, as those of a browser or an editor: the one shown is a card joined to what it
|
|
28
31
|
* shows, the others lie on the strip with a line between them, `+` follows the last one.
|
|
29
32
|
*/
|
|
30
|
-
export declare function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd, maximized, onMaximize }: WorkbenchTabsProps): React.JSX.Element;
|
|
33
|
+
export declare function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd, maximized, onMaximize, actionsRef }: WorkbenchTabsProps): React.JSX.Element;
|
|
31
34
|
/**
|
|
32
35
|
* The head of the workbench on a phone, as a browser's there: back to the conversation, the tab shown with how
|
|
33
36
|
* many are open, which opens the list of them (TabSwitcher), and `+`. A row of tabs a finger scrolls and
|
|
34
37
|
* closes by their small crosses is neither seen nor hit well on a phone.
|
|
35
38
|
*/
|
|
36
|
-
export declare function CompactHead({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd }: WorkbenchTabsProps): React.JSX.Element;
|
|
39
|
+
export declare function CompactHead({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd, actionsRef }: WorkbenchTabsProps): React.JSX.Element;
|
|
37
40
|
/** The tabs open on a phone, as rows of a finger's height under its head: a tap shows one, its cross closes it, a long press opens its menu. */
|
|
38
41
|
export declare function TabSwitcher({ editors, active, onShow, onClose, onMenu, onDismiss, }: Pick<WorkbenchTabsProps, 'editors' | 'active' | 'onShow' | 'onClose'> & {
|
|
39
42
|
onMenu(event: React.MouseEvent, editor: WebEditorEntry): void;
|
|
@@ -137,7 +137,7 @@ function CloseTab({ editor, title, onClose, onContextMenu, }) {
|
|
|
137
137
|
* The tabs of a wide workbench, as those of a browser or an editor: the one shown is a card joined to what it
|
|
138
138
|
* shows, the others lie on the strip with a line between them, `+` follows the last one.
|
|
139
139
|
*/
|
|
140
|
-
function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd, maximized, onMaximize }) {
|
|
140
|
+
function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd, maximized, onMaximize, actionsRef }) {
|
|
141
141
|
const t = (0, use_t_1.useT)();
|
|
142
142
|
const [menu, openMenu] = (0, context_menu_1.useContextMenu)();
|
|
143
143
|
const menuFor = useTabMenu(editors, onClose, onPin);
|
|
@@ -155,16 +155,22 @@ function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView,
|
|
|
155
155
|
const title = web_extension_protocol_1.WebLabelUtil.text(editor.title);
|
|
156
156
|
const Glyph = editor.icon;
|
|
157
157
|
const selected = editor.id === active;
|
|
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: () =>
|
|
158
|
+
return (React.createElement("div", { key: editor.id, className: `ta-editor-tab ${selected ? 'ta-active' : ''} ${editor.preview ? 'ta-preview' : ''} ${editor.dirty ? 'ta-dirty' : ''}`, title: editor.tooltip ? web_extension_protocol_1.WebLabelUtil.text(editor.tooltip) : title },
|
|
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)) })));
|
|
163
168
|
})),
|
|
164
169
|
views.length > 0 && React.createElement(OpenMenu, { views: views, onOpenView: onOpenView, cwd: cwd }),
|
|
165
170
|
menu,
|
|
171
|
+
React.createElement("div", { className: "ta-editor-actions", ref: actionsRef }),
|
|
166
172
|
React.createElement("div", { className: "ta-workbench-actions" },
|
|
167
|
-
onMaximize &&
|
|
173
|
+
maximized && onMaximize && React.createElement(icon_1.IconButton, { icon: lucide_react_1.Minimize2, label: t('ta.workbench.restore'), className: "ta-wide-only", onClick: onMaximize }),
|
|
168
174
|
React.createElement(icon_1.IconButton, { icon: icon_1.SidebarRight, label: t('ta.panel.hide'), onClick: onHide }))));
|
|
169
175
|
}
|
|
170
176
|
/**
|
|
@@ -172,7 +178,7 @@ function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView,
|
|
|
172
178
|
* many are open, which opens the list of them (TabSwitcher), and `+`. A row of tabs a finger scrolls and
|
|
173
179
|
* closes by their small crosses is neither seen nor hit well on a phone.
|
|
174
180
|
*/
|
|
175
|
-
function CompactHead({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd }) {
|
|
181
|
+
function CompactHead({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd, actionsRef }) {
|
|
176
182
|
const t = (0, use_t_1.useT)();
|
|
177
183
|
const [open, setOpen] = React.useState(false);
|
|
178
184
|
const [menu, openMenu] = (0, context_menu_1.useContextMenu)();
|
|
@@ -198,6 +204,7 @@ function CompactHead({ editors, active, views, onShow, onClose, onPin, onOpenVie
|
|
|
198
204
|
React.createElement("span", { className: "ta-workbench-switch-title" }, title),
|
|
199
205
|
editors.length > 1 && React.createElement("span", { className: "ta-workbench-count" }, editors.length),
|
|
200
206
|
React.createElement(lucide_react_1.ChevronDown, { className: "ta-workbench-switch-caret", size: 15, strokeWidth: 1.8, "aria-hidden": "true" }))) : (React.createElement("span", { className: "ta-workbench-title" }, title)),
|
|
207
|
+
React.createElement("div", { className: "ta-editor-actions", ref: actionsRef }),
|
|
201
208
|
views.length > 0 && React.createElement(OpenMenu, { views: views, onOpenView: onOpenView, cwd: cwd, align: "end" })),
|
|
202
209
|
menu,
|
|
203
210
|
open && (React.createElement(TabSwitcher, { editors: editors, active: active, onShow: id => {
|
|
@@ -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
|