@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.
Files changed (163) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/esm/browser/components/account-menu.js +5 -1
  4. package/esm/browser/components/app-nav.d.ts +3 -1
  5. package/esm/browser/components/app-nav.js +10 -10
  6. package/esm/browser/components/app-shell-state.d.ts +1 -0
  7. package/esm/browser/components/app-shell-state.js +19 -0
  8. package/esm/browser/components/app-view.js +5 -7
  9. package/esm/browser/components/chat-home.js +3 -3
  10. package/esm/browser/components/chat-list-hooks.d.ts +2 -0
  11. package/esm/browser/components/chat-list-hooks.js +6 -0
  12. package/esm/browser/components/chat-list-row.js +2 -2
  13. package/esm/browser/components/chat-list.js +2 -2
  14. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  15. package/esm/browser/components/editor-actions.d.ts +10 -0
  16. package/esm/browser/components/editor-actions.js +13 -0
  17. package/esm/browser/components/editor-area.js +7 -3
  18. package/esm/browser/components/fold-text.d.ts +4 -2
  19. package/esm/browser/components/fold-text.js +5 -4
  20. package/esm/browser/components/host-view.d.ts +1 -1
  21. package/esm/browser/components/image-swipe.d.ts +20 -0
  22. package/esm/browser/components/image-swipe.js +75 -0
  23. package/esm/browser/components/image-viewer.d.ts +2 -2
  24. package/esm/browser/components/image-viewer.js +2 -2
  25. package/esm/browser/components/list-motion.d.ts +44 -0
  26. package/esm/browser/components/list-motion.js +197 -0
  27. package/esm/browser/components/message-user.js +5 -3
  28. package/esm/browser/components/partner-row.js +1 -1
  29. package/esm/browser/components/relay-services.d.ts +1 -1
  30. package/esm/browser/components/relay-services.js +11 -91
  31. package/esm/browser/components/said-text.d.ts +6 -2
  32. package/esm/browser/components/said-text.js +8 -2
  33. package/esm/browser/components/side-lists.d.ts +7 -0
  34. package/esm/browser/components/side-lists.js +16 -0
  35. package/esm/browser/components/sortable.js +15 -0
  36. package/esm/browser/components/workbench-tabs.d.ts +5 -2
  37. package/esm/browser/components/workbench-tabs.js +13 -6
  38. package/esm/browser/components/workbench-toggle.d.ts +5 -0
  39. package/esm/browser/components/workbench-toggle.js +10 -0
  40. package/esm/browser/extension/extension-view.d.ts +1 -1
  41. package/esm/browser/extension/web-api-contributions.d.ts +4 -12
  42. package/esm/browser/extension/web-api-editors.d.ts +32 -0
  43. package/esm/browser/extension/web-api-editors.js +2 -0
  44. package/esm/browser/extension/web-api-menus.d.ts +40 -0
  45. package/esm/browser/extension/web-api-menus.js +2 -0
  46. package/esm/browser/extension/web-extension-api.d.ts +9 -26
  47. package/esm/browser/extension/web-extension-context.js +5 -9
  48. package/esm/browser/extension/web-extension-protocol.d.ts +3 -1
  49. package/esm/browser/extension/web-extension-protocol.js +1 -0
  50. package/esm/browser/extension/web-extension-run.d.ts +5 -2
  51. package/esm/browser/extension/web-extension-run.js +15 -0
  52. package/esm/browser/extension/web-session-notices.js +8 -0
  53. package/esm/browser/i18n/locales.d.ts +5 -2
  54. package/esm/browser/i18n/messages-ja.js +6 -3
  55. package/esm/browser/i18n/messages-zh-tw.js +6 -3
  56. package/esm/browser/i18n/messages.d.ts +4 -1
  57. package/esm/browser/i18n/messages.js +13 -7
  58. package/esm/browser/notices/chime.d.ts +16 -0
  59. package/esm/browser/notices/chime.js +67 -0
  60. package/esm/browser/notices/session-notices.d.ts +8 -0
  61. package/esm/browser/notices/session-notices.js +23 -2
  62. package/esm/browser/partners/partners-view.js +4 -1
  63. package/esm/browser/share/shared-page.js +2 -1
  64. package/esm/browser/style/base.d.ts +1 -1
  65. package/esm/browser/style/base.js +7 -0
  66. package/esm/browser/style/chat-list.d.ts +1 -1
  67. package/esm/browser/style/chat-list.js +2 -0
  68. package/esm/browser/style/conversation.d.ts +1 -1
  69. package/esm/browser/style/conversation.js +2 -0
  70. package/esm/browser/style/device.js +5 -2
  71. package/esm/browser/style/layout.d.ts +1 -1
  72. package/esm/browser/style/layout.js +28 -6
  73. package/esm/browser/style/shared.d.ts +1 -1
  74. package/esm/browser/style/shared.js +1 -0
  75. package/esm/browser/style/shell.d.ts +1 -1
  76. package/esm/browser/style/shell.js +7 -2
  77. package/esm/browser/style/surfaces.d.ts +1 -1
  78. package/esm/browser/style/surfaces.js +1 -0
  79. package/esm/browser/util/image-swipe.d.ts +14 -3
  80. package/esm/browser/util/image-swipe.js +26 -3
  81. package/esm/browser/util/process.d.ts +5 -0
  82. package/esm/browser/util/process.js +22 -1
  83. package/lib/browser/components/account-menu.js +4 -0
  84. package/lib/browser/components/app-nav.d.ts +3 -1
  85. package/lib/browser/components/app-nav.js +8 -8
  86. package/lib/browser/components/app-shell-state.d.ts +1 -0
  87. package/lib/browser/components/app-shell-state.js +19 -0
  88. package/lib/browser/components/app-view.js +4 -6
  89. package/lib/browser/components/chat-home.js +3 -3
  90. package/lib/browser/components/chat-list-hooks.d.ts +2 -0
  91. package/lib/browser/components/chat-list-hooks.js +7 -0
  92. package/lib/browser/components/chat-list-row.js +2 -2
  93. package/lib/browser/components/chat-list.js +1 -1
  94. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  95. package/lib/browser/components/editor-actions.d.ts +11 -0
  96. package/lib/browser/components/editor-actions.js +50 -0
  97. package/lib/browser/components/editor-area.js +7 -3
  98. package/lib/browser/components/fold-text.d.ts +4 -2
  99. package/lib/browser/components/fold-text.js +5 -4
  100. package/lib/browser/components/host-view.d.ts +1 -1
  101. package/lib/browser/components/image-swipe.d.ts +20 -0
  102. package/lib/browser/components/image-swipe.js +75 -0
  103. package/lib/browser/components/image-viewer.d.ts +2 -2
  104. package/lib/browser/components/image-viewer.js +2 -2
  105. package/lib/browser/components/list-motion.d.ts +45 -0
  106. package/lib/browser/components/list-motion.js +234 -0
  107. package/lib/browser/components/message-user.js +5 -3
  108. package/lib/browser/components/partner-row.js +1 -1
  109. package/lib/browser/components/relay-services.d.ts +1 -1
  110. package/lib/browser/components/relay-services.js +9 -89
  111. package/lib/browser/components/said-text.d.ts +6 -2
  112. package/lib/browser/components/said-text.js +8 -2
  113. package/lib/browser/components/side-lists.d.ts +7 -0
  114. package/lib/browser/components/side-lists.js +16 -0
  115. package/lib/browser/components/sortable.js +15 -0
  116. package/lib/browser/components/workbench-tabs.d.ts +5 -2
  117. package/lib/browser/components/workbench-tabs.js +12 -5
  118. package/lib/browser/components/workbench-toggle.d.ts +5 -0
  119. package/lib/browser/components/workbench-toggle.js +11 -0
  120. package/lib/browser/extension/extension-view.d.ts +1 -1
  121. package/lib/browser/extension/web-api-contributions.d.ts +4 -12
  122. package/lib/browser/extension/web-api-editors.d.ts +33 -0
  123. package/lib/browser/extension/web-api-editors.js +3 -0
  124. package/lib/browser/extension/web-api-menus.d.ts +41 -0
  125. package/lib/browser/extension/web-api-menus.js +3 -0
  126. package/lib/browser/extension/web-extension-api.d.ts +9 -26
  127. package/lib/browser/extension/web-extension-context.js +5 -9
  128. package/lib/browser/extension/web-extension-protocol.d.ts +3 -1
  129. package/lib/browser/extension/web-extension-protocol.js +1 -0
  130. package/lib/browser/extension/web-extension-run.d.ts +5 -2
  131. package/lib/browser/extension/web-extension-run.js +15 -0
  132. package/lib/browser/extension/web-session-notices.js +8 -0
  133. package/lib/browser/i18n/locales.d.ts +5 -2
  134. package/lib/browser/i18n/messages-ja.js +6 -3
  135. package/lib/browser/i18n/messages-zh-tw.js +6 -3
  136. package/lib/browser/i18n/messages.d.ts +4 -1
  137. package/lib/browser/i18n/messages.js +13 -7
  138. package/lib/browser/notices/chime.d.ts +17 -0
  139. package/lib/browser/notices/chime.js +71 -0
  140. package/lib/browser/notices/session-notices.d.ts +8 -0
  141. package/lib/browser/notices/session-notices.js +23 -2
  142. package/lib/browser/partners/partners-view.js +4 -1
  143. package/lib/browser/share/shared-page.js +2 -1
  144. package/lib/browser/style/base.d.ts +1 -1
  145. package/lib/browser/style/base.js +7 -0
  146. package/lib/browser/style/chat-list.d.ts +1 -1
  147. package/lib/browser/style/chat-list.js +2 -0
  148. package/lib/browser/style/conversation.d.ts +1 -1
  149. package/lib/browser/style/conversation.js +2 -0
  150. package/lib/browser/style/device.js +5 -2
  151. package/lib/browser/style/layout.d.ts +1 -1
  152. package/lib/browser/style/layout.js +28 -6
  153. package/lib/browser/style/shared.d.ts +1 -1
  154. package/lib/browser/style/shared.js +1 -0
  155. package/lib/browser/style/shell.d.ts +1 -1
  156. package/lib/browser/style/shell.js +7 -2
  157. package/lib/browser/style/surfaces.d.ts +1 -1
  158. package/lib/browser/style/surfaces.js +1 -0
  159. package/lib/browser/util/image-swipe.d.ts +14 -3
  160. package/lib/browser/util/image-swipe.js +26 -3
  161. package/lib/browser/util/process.d.ts +5 -0
  162. package/lib/browser/util/process.js +22 -1
  163. package/package.json +7 -7
@@ -0,0 +1,197 @@
1
+ import * as React from 'react';
2
+ /** How long a row takes to slide to its new place, longer the farther it goes, and one new to come in. */
3
+ const MOVE_MS = 300;
4
+ const MOVE_MAX_MS = 460;
5
+ const IN_MS = 280;
6
+ /** Where no spring can be drawn (linear() of CSS): the curve of --ta-ease. */
7
+ const EASE = 'cubic-bezier(0.2, 0.8, 0.2, 1)';
8
+ /** How much the row going over the others is lifted, as a card picked up. */
9
+ const LIFT = 1.02;
10
+ /** More rows than this come or go at once (a search, a fold, the next page): they take their places without a motion. */
11
+ const MAX_CHANGED = 2;
12
+ /** The motion each row is in, cancelled when it moves again: it goes on from where it is seen. */
13
+ const moving = new WeakMap();
14
+ export var ListMotionUtil;
15
+ (function (ListMotionUtil) {
16
+ /**
17
+ * A spring as a CSS linear() curve: fast away, settling into its place with a slight give (about 2% past it), as
18
+ * the lists of iOS move. `damping` under 1 overshoots. Pure, for the tests.
19
+ */
20
+ function spring(damping = 0.78, stiffness = 10, steps = 32) {
21
+ const turn = stiffness * Math.sqrt(1 - damping * damping);
22
+ const at = (t) => 1 - Math.exp(-damping * stiffness * t) * (Math.cos(turn * t) + ((damping * stiffness) / turn) * Math.sin(turn * t));
23
+ const points = Array.from({ length: steps + 1 }, (_, index) => (index === steps ? 1 : at(index / steps)));
24
+ return `linear(${points.map(point => Number(point.toFixed(4))).join(', ')})`;
25
+ }
26
+ ListMotionUtil.spring = spring;
27
+ /** How long a row takes for `distance` pixels: a long way a little longer, never slow. */
28
+ function duration(distance) {
29
+ return Math.round(Math.min(MOVE_MAX_MS, MOVE_MS + Math.abs(distance) * 0.25));
30
+ }
31
+ ListMotionUtil.duration = duration;
32
+ /**
33
+ * Whether the rows whose keys were `before` and are `after`, in order, slide to their places: when some changed
34
+ * places, or one or two came or went among the others. Pure, for the tests.
35
+ */
36
+ function moves(before, after) {
37
+ const was = new Set(before);
38
+ const is = new Set(after);
39
+ const kept = after.filter(key => was.has(key));
40
+ if (kept.length === 0) {
41
+ return false;
42
+ }
43
+ const changed = after.length - kept.length + before.filter(key => !is.has(key)).length;
44
+ if (changed > MAX_CHANGED) {
45
+ return false;
46
+ }
47
+ const keptBefore = before.filter(key => is.has(key));
48
+ return changed > 0 || kept.some((key, index) => keptBefore[index] !== key);
49
+ }
50
+ ListMotionUtil.moves = moves;
51
+ /**
52
+ * The rows that go over the others on their way: those that changed places the most among the rows that stay
53
+ * (the one come to the top, pinned or let go), not those that only make room for it. Pure, for the tests.
54
+ */
55
+ function over(before, after) {
56
+ const is = new Set(after);
57
+ const was = new Map(before.filter(key => is.has(key)).map((key, index) => [key, index]));
58
+ const jumps = after.filter(key => was.has(key)).map((key, index) => [key, Math.abs(was.get(key) - index)]);
59
+ const most = Math.max(0, ...jumps.map(([, jump]) => jump));
60
+ return new Set(most > 0 ? jumps.filter(([, jump]) => jump === most).map(([key]) => key) : []);
61
+ }
62
+ ListMotionUtil.over = over;
63
+ /** Within the list's view, a row's height of margin around it: one out of sight takes its place at once. */
64
+ function seen(top, height, view) {
65
+ return top + height >= view.top - height && top <= view.bottom + height;
66
+ }
67
+ ListMotionUtil.seen = seen;
68
+ })(ListMotionUtil || (ListMotionUtil = {}));
69
+ export var ListMotion;
70
+ (function (ListMotion) {
71
+ let curve;
72
+ /** The spring where the page draws one, else the ease of Ta. */
73
+ function ease() {
74
+ curve !== null && curve !== void 0 ? curve : (curve = typeof CSS !== 'undefined' && CSS.supports('transition-timing-function', 'linear(0, 1)') ? ListMotionUtil.spring() : EASE);
75
+ return curve;
76
+ }
77
+ function calm() {
78
+ return typeof Element === 'undefined' || typeof Element.prototype.animate !== 'function' || document.documentElement.hasAttribute('data-reduce-motion');
79
+ }
80
+ ListMotion.calm = calm;
81
+ /** Stops the motion of `row`, which then lies where its place is. */
82
+ function stop(row) {
83
+ var _a;
84
+ (_a = moving.get(row)) === null || _a === void 0 ? void 0 : _a.cancel();
85
+ }
86
+ ListMotion.stop = stop;
87
+ /**
88
+ * Slides `row` from `from` (the top it was seen at, in the window) to where it lies now; `over` (`data-moving`),
89
+ * over the others it passes, as a card does.
90
+ */
91
+ function slide(row, from, now, over) {
92
+ const dy = from - now.top;
93
+ if (Math.abs(dy) < 1) {
94
+ return;
95
+ }
96
+ const timing = { duration: ListMotionUtil.duration(dy), easing: ease() };
97
+ if (!over) {
98
+ play(row, row.animate([{ transform: `translate3d(0, ${dy}px, 0)` }, { transform: 'none' }], timing));
99
+ return;
100
+ }
101
+ // Lifted as it leaves, with the shadow of what floats over the page, and set down in its place.
102
+ row.dataset.moving = '';
103
+ const shadow = getComputedStyle(row).getPropertyValue('--ta-shadow-pop').trim() || '0 8px 24px rgba(0, 0, 0, 0.14)';
104
+ play(row, row.animate([
105
+ { transform: `translate3d(0, ${dy}px, 0)`, boxShadow: '0 0 0 rgba(0, 0, 0, 0)' },
106
+ { transform: `translate3d(0, ${dy * 0.45}px, 0) scale(${LIFT})`, boxShadow: shadow, offset: 0.35 },
107
+ { transform: 'none', boxShadow: '0 0 0 rgba(0, 0, 0, 0)' },
108
+ ], timing));
109
+ }
110
+ ListMotion.slide = slide;
111
+ /** Brings `row`, new to the list, in: it drops into the room the others made. */
112
+ function enter(row) {
113
+ play(row, row.animate([
114
+ { opacity: 0, transform: 'translate3d(0, -10px, 0) scale(0.98)' },
115
+ { opacity: 1, transform: 'none' },
116
+ ], { duration: IN_MS, easing: ease(), fill: 'backwards' }));
117
+ }
118
+ ListMotion.enter = enter;
119
+ function play(row, animation) {
120
+ moving.set(row, animation);
121
+ const done = () => {
122
+ if (moving.get(row) === animation) {
123
+ moving.delete(row);
124
+ delete row.dataset.moving;
125
+ }
126
+ };
127
+ animation.onfinish = done;
128
+ animation.oncancel = done;
129
+ }
130
+ })(ListMotion || (ListMotion = {}));
131
+ function rowsOf(list) {
132
+ return [...list.querySelectorAll('[data-row]')];
133
+ }
134
+ /** Where the rows of `list` are seen now, by their key (`data-row`): the first of a key. */
135
+ function look(list) {
136
+ if (!(list === null || list === void 0 ? void 0 : list.isConnected) || ListMotion.calm()) {
137
+ return undefined;
138
+ }
139
+ const keys = [];
140
+ const tops = new Map();
141
+ for (const row of rowsOf(list)) {
142
+ const key = row.dataset.row;
143
+ if (!tops.has(key)) {
144
+ keys.push(key);
145
+ tops.set(key, row.getBoundingClientRect().top);
146
+ }
147
+ }
148
+ return { list, keys, tops };
149
+ }
150
+ /**
151
+ * The rows of `list` (those with `data-row`, its key, in whichever of its sections) slide to their new places when the
152
+ * list is drawn in another order, as a messenger's list does when a conversation comes to the top or is pinned; one or
153
+ * two new come in. Where they were is read as the list is drawn again, before the change reaches the page; a search,
154
+ * a fold or the next page, which change many rows at once, take their places at once, and so do rows out of sight.
155
+ */
156
+ export function useListMotion(list) {
157
+ const before = React.useRef(undefined);
158
+ // Read while drawing: the page still shows the rows as they were, and where they are seen (moving too).
159
+ before.current = look(list.current);
160
+ React.useLayoutEffect(() => {
161
+ const was = before.current;
162
+ const element = list.current;
163
+ before.current = undefined;
164
+ if (!was || was.list !== element || ListMotion.calm()) {
165
+ return;
166
+ }
167
+ const rows = rowsOf(element);
168
+ const keys = [...new Set(rows.map(row => row.dataset.row))];
169
+ if (!ListMotionUtil.moves(was.keys, keys)) {
170
+ return;
171
+ }
172
+ for (const row of rows) {
173
+ ListMotion.stop(row);
174
+ }
175
+ const box = element.getBoundingClientRect();
176
+ const over = ListMotionUtil.over(was.keys, keys);
177
+ const done = new Set();
178
+ for (const row of rows) {
179
+ const key = row.dataset.row;
180
+ if (done.has(key)) {
181
+ continue;
182
+ }
183
+ done.add(key);
184
+ const now = row.getBoundingClientRect();
185
+ const from = was.tops.get(key);
186
+ if (from === undefined) {
187
+ if (ListMotionUtil.seen(now.top, now.height, box)) {
188
+ ListMotion.enter(row);
189
+ }
190
+ }
191
+ else if (ListMotionUtil.seen(from, now.height, box) || ListMotionUtil.seen(now.top, now.height, box)) {
192
+ ListMotion.slide(row, from, now, over.has(key));
193
+ }
194
+ }
195
+ });
196
+ }
197
+ //# sourceMappingURL=list-motion.js.map
@@ -46,20 +46,22 @@ function TaskNote({ note }) {
46
46
  * `bubble` is the class of that bubble, which a conversation and the double have of their own.
47
47
  */
48
48
  export function UserSaid({ blocks, text, bubble = 'ta-bubble', timestamp }) {
49
+ // What a part of Ta wrote for the user is Markdown (TaMessageSource); what they typed shows as typed.
50
+ const markdown = !!TaMessageSource.of(MessageUtil.text(blocks));
49
51
  if (UserImageUtil.images(blocks).length === 0) {
50
52
  return text ? (React.createElement("div", { className: bubble },
51
- React.createElement(SaidText, { text: text }))) : null;
53
+ React.createElement(SaidText, { text: text, markdown: markdown }))) : null;
52
54
  }
53
55
  // Many pictures stand on their own (folded, ImageStack, or unfolded), the words in a bubble of their own under them.
54
56
  if (UserImageUtil.images(blocks).length >= STACK_FROM) {
55
57
  return (React.createElement(React.Fragment, null,
56
58
  React.createElement(UserImages, { blocks: blocks, timestamp: timestamp }),
57
59
  text && (React.createElement("div", { className: bubble },
58
- React.createElement(SaidText, { text: text })))));
60
+ React.createElement(SaidText, { text: text, markdown: markdown })))));
59
61
  }
60
62
  return (React.createElement("div", { className: `${bubble} ta-bubble-media${text ? '' : ' ta-bubble-bare'}` },
61
63
  React.createElement(UserImages, { blocks: blocks, timestamp: timestamp }),
62
- text && React.createElement(SaidText, { text: text, className: "ta-bubble-text" })));
64
+ text && React.createElement(SaidText, { text: text, className: "ta-bubble-text", markdown: markdown })));
63
65
  }
64
66
  /**
65
67
  * Where a message of the user came from when not from what they typed (TaMessageSource): the package that sent it, as
@@ -39,7 +39,7 @@ export function PartnerRow({ partner, time, selected, open, pinned, onPin, }) {
39
39
  };
40
40
  const away = PartnerRowUtil.away(partner, !!onPin);
41
41
  const swipe = PartnerRowUtil.swipe(pin, info, away);
42
- return (React.createElement(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 => {
42
+ return (React.createElement(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 => {
43
43
  const own = partner.menu ? ChatHomeUtil.menu(partner.menu()) : [];
44
44
  const first = [{ label: t('ta.chat.open'), run: go }, ...(pin ? [pin] : []), ...(info ? [{ label: info.label, run: info.run }] : [])];
45
45
  const last = away ? [{ label: away.label, run: away.run, danger: true }] : [];
@@ -1,4 +1,4 @@
1
- import { type TaJoinedDeployment, type TaRelayFeature, type TaRelayProbe, type TaRelayService, type TaRelayTypeInfo } from '@celljs/ta-protocol';
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.js';
@@ -1,13 +1,12 @@
1
- import { TaPackageTextUtil, } from '@celljs/ta-protocol';
2
- import { Building2, Cloud, Database, ExternalLink, FileJson, Folder, GitBranch, HardDrive, Plus, Server, ShieldCheck, Trash2, } from 'lucide-react';
1
+ import { Building2, Cloud, Database, ExternalLink, FileJson, Folder, GitBranch, HardDrive, Plus, RefreshCw, Server, ShieldCheck, Trash2, } from 'lucide-react';
3
2
  import * as React from 'react';
4
3
  import { useNotices, useWorkbench } from '../hooks.js';
5
- import { useLanguage, useT } from '../i18n/use-t.js';
4
+ import { useT } from '../i18n/use-t.js';
6
5
  import { Icon, IconButton } from './icon.js';
7
6
  import { AddCloudHost } from './remote-hosts.js';
8
7
  import { Row } from './settings-controls.js';
9
- /** The features that go through a relay, in the order the settings list them. */
10
- const FEATURES = ['devices', 'share', 'rooms', 'sync'];
8
+ /** 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). */
9
+ const FEATURES = ['devices', 'share', 'rooms'];
11
10
  export var RelayServicesUtil;
12
11
  (function (RelayServicesUtil) {
13
12
  /** What a service is called: the official relay, its name, else its host or its folder. */
@@ -116,7 +115,7 @@ export var RelayServicesUtil;
116
115
  * made before (a device, a room, a link) stays on its relay when the choice changes.
117
116
  */
118
117
  export function RelayServices() {
119
- var _a, _b;
118
+ var _a;
120
119
  const t = useT();
121
120
  const [workbench, bench] = useWorkbench();
122
121
  const [, notices] = useNotices();
@@ -124,8 +123,6 @@ export function RelayServices() {
124
123
  const [probes, setProbes] = React.useState({});
125
124
  const [url, setUrl] = React.useState('');
126
125
  const [busy, setBusy] = React.useState();
127
- const [form, setForm] = React.useState();
128
- const language = useLanguage();
129
126
  const read = React.useCallback(async () => {
130
127
  const listed = await bench.relay.listRelays();
131
128
  setRelays(listed);
@@ -160,33 +157,19 @@ export function RelayServices() {
160
157
  await read().catch(() => undefined);
161
158
  }
162
159
  };
163
- /** An address adds a relay, a path (`/…`, `~/…`) a folder. */
164
- const add = (text = url, name) => run('add', async () => {
165
- const value = text.trim();
166
- const id = /^[/~]/.test(value) ? await bench.relay.addFolder(value, name) : await bench.relay.addRelay(value);
160
+ const add = (text = url) => run('add', async () => {
161
+ const id = await bench.relay.addRelay(text.trim());
167
162
  setUrl('');
168
163
  const probe = await bench.relay.probeRelay(id);
169
164
  setProbes(before => ({ ...before, [id]: probe }));
170
165
  });
171
- /** A drive found here: its folder added, and sync goes there. */
172
- const takeDrive = (drive) => run(`drive:${drive.path}`, async () => {
173
- const id = await bench.relay.addFolder(drive.path, drive.name);
174
- setRelays(await bench.relay.chooseRelay('sync', id));
175
- const probe = await bench.relay.probeRelay(id);
176
- setProbes(before => ({ ...before, [id]: probe }));
177
- });
178
- /** A store just added: sync goes there. */
179
- const stored = async (id) => {
180
- setRelays(await bench.relay.chooseRelay('sync', id));
181
- setForm(undefined);
182
- const probe = await bench.relay.probeRelay(id);
183
- setProbes(before => ({ ...before, [id]: probe }));
184
- };
185
166
  if (!relays) {
186
167
  return null;
187
168
  }
188
169
  const used = new Set(Object.values(relays.use));
189
170
  const types = (_a = relays.types) !== null && _a !== void 0 ? _a : [];
171
+ // Folders and stores are places of sync, chosen and removed there.
172
+ const shown = relays.relays.filter(relay => relay.type === 'ta-relay');
190
173
  return (React.createElement(React.Fragment, null,
191
174
  React.createElement(Deployment, { relays: relays, changed: listed => {
192
175
  var _a;
@@ -201,22 +184,9 @@ export function RelayServices() {
201
184
  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
202
185
  .filter(relay => RelayServicesUtil.serves(relay, feature) || relays.use[feature] === relay.id)
203
186
  .map(relay => (React.createElement("option", { key: relay.id, value: relay.id }, RelayServicesUtil.label(relay, t))))))); }),
204
- relays.relays.map(relay => { var _a; return (React.createElement(Row, { key: relay.id, icon: RelayServicesUtil.icon(relay, types), label: RelayServicesUtil.label(relay, t), description: React.createElement("span", { className: "ta-remote-state" },
187
+ shown.map(relay => { var _a; return (React.createElement(Row, { key: relay.id, icon: RelayServicesUtil.icon(relay, types), label: RelayServicesUtil.label(relay, t), description: React.createElement("span", { className: "ta-remote-state" },
205
188
  React.createElement("span", { className: `ta-remote-light${((_a = probes[relay.id]) === null || _a === void 0 ? void 0 : _a.online) ? ' ta-on' : ''}` }),
206
189
  RelayServicesUtil.line(relay, probes[relay.id], t)) }, !relay.builtin && relay.id !== 'relay-json' && !used.has(relay.id) && (React.createElement(IconButton, { icon: Trash2, label: t('ta.relays.remove', { name: RelayServicesUtil.label(relay, t) }), disabled: busy !== undefined, onClick: () => void run(relay.id, () => bench.relay.removeRelay(relay.id)) })))); }),
207
- ((_b = relays.drives) !== null && _b !== void 0 ? _b : []).map(drive => (React.createElement(Row, { key: drive.path, icon: Cloud, label: t('ta.relays.drive', { name: drive.name }), description: t('ta.relays.driveHint', { path: drive.path }) },
208
- React.createElement("button", { type: "button", className: `ta-button${busy === `drive:${drive.path}` ? ' ta-busy' : ''}`, disabled: busy !== undefined, onClick: () => void takeDrive(drive) },
209
- busy === `drive:${drive.path}` && React.createElement("span", { className: "ta-spinner ta-busy-mark" }),
210
- React.createElement("span", null, t('ta.relays.driveUse')))))),
211
- types.map(type => {
212
- var _a;
213
- const title = (_a = TaPackageTextUtil.pick(type.title, language)) !== null && _a !== void 0 ? _a : type.type;
214
- const open = form === type.type;
215
- return (React.createElement(React.Fragment, { key: `type:${type.type}` },
216
- React.createElement(Row, { icon: RelayServicesUtil.iconNamed(type.icon), label: t('ta.relays.storeType', { name: title }), description: 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')))),
217
- open && (React.createElement(Row, { label: "", stacked: true },
218
- React.createElement(StoreForm, { type: type, title: title, close: () => setForm(undefined), added: stored })))));
219
- }),
220
190
  React.createElement(Row, { label: t('ta.relays.add'), description: t('ta.relays.addHint'), stacked: true },
221
191
  React.createElement("form", { className: "ta-trusted-add", onSubmit: event => {
222
192
  event.preventDefault();
@@ -227,6 +197,7 @@ export function RelayServices() {
227
197
  busy === 'add' ? React.createElement("span", { className: "ta-spinner ta-busy-mark" }) : React.createElement(Icon, { icon: Plus, size: 14 }),
228
198
  " ",
229
199
  t('ta.relays.addButton')))),
200
+ React.createElement(Row, { icon: RefreshCw, label: t('ta.relays.syncElsewhere'), description: t('ta.relays.syncElsewhereHint') }),
230
201
  React.createElement(Row, { icon: FileJson, label: t('ta.relays.file'), description: React.createElement("span", { className: "ta-path" }, relays.file) })));
231
202
  }
232
203
  /**
@@ -302,55 +273,4 @@ function Deployment({ relays, changed }) {
302
273
  t('ta.deploy.open')),
303
274
  clouds && !added && React.createElement(AddCloudHost, { url: gateway, name: RelayServicesUtil.cloudName(gateway), onAdded: readClouds }))))));
304
275
  }
305
- /**
306
- * The form of a type of service a package registered (WebDAV, S3, git): its fields as the package said, secrets as
307
- * passwords, and a name. Ta tries the store before it adds it; then sync goes there.
308
- */
309
- function StoreForm({ type, title, close, added }) {
310
- const t = useT();
311
- const language = useLanguage();
312
- const [, bench] = useWorkbench();
313
- const [, notices] = useNotices();
314
- const [values, setValues] = React.useState({});
315
- const [name, setName] = React.useState('');
316
- const [busy, setBusy] = React.useState(false);
317
- const missing = type.options.some(option => { var _a; return !option.optional && !((_a = values[option.key]) === null || _a === void 0 ? void 0 : _a.trim()); });
318
- const submit = async () => {
319
- setBusy(true);
320
- try {
321
- const given = Object.fromEntries(Object.entries(values).map(([key, value]) => [key, value.trim()]));
322
- await added(await bench.relay.addStore(type.type, given, name.trim() || title));
323
- }
324
- catch (error) {
325
- notices.error(error);
326
- }
327
- finally {
328
- setBusy(false);
329
- }
330
- };
331
- return (React.createElement("form", { className: "ta-store-form", onSubmit: event => {
332
- event.preventDefault();
333
- void submit();
334
- } },
335
- type.options.map(option => { var _a, _b; return (React.createElement("label", { key: option.key, className: "ta-store-field" },
336
- React.createElement("span", { className: "ta-store-field-label" }, (_a = TaPackageTextUtil.pick(option.label, language)) !== null && _a !== void 0 ? _a : option.key,
337
- option.optional && React.createElement("span", { className: "ta-store-field-optional" }, t('ta.relays.optional'))),
338
- 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 => {
339
- const value = event.target.value;
340
- setValues(before => ({ ...before, [option.key]: value }));
341
- } }))); }),
342
- React.createElement("label", { className: "ta-store-field" },
343
- React.createElement("span", { className: "ta-store-field-label" },
344
- t('ta.relays.storeName'),
345
- React.createElement("span", { className: "ta-store-field-optional" }, t('ta.relays.optional'))),
346
- React.createElement("input", { className: "ta-input", value: name, placeholder: title, spellCheck: false, onChange: event => setName(event.target.value) })),
347
- React.createElement("p", { className: "ta-store-form-note" },
348
- React.createElement(Icon, { icon: ShieldCheck, size: 13 }),
349
- React.createElement("span", null, t('ta.relays.storeNote'))),
350
- React.createElement("div", { className: "ta-store-form-actions" },
351
- React.createElement("button", { type: "button", className: "ta-button", disabled: busy, onClick: close }, t('ta.cancel')),
352
- React.createElement("button", { type: "submit", className: `ta-button ta-primary${busy ? ' ta-busy' : ''}`, disabled: missing || busy },
353
- busy && React.createElement("span", { className: "ta-spinner ta-busy-mark" }),
354
- React.createElement("span", null, t('ta.relays.storeAdd'))))));
355
- }
356
276
  //# sourceMappingURL=relay-services.js.map
@@ -1,6 +1,10 @@
1
1
  import * as React from 'react';
2
- /** What the user wrote, in their bubble: the quote it starts with (QuoteUtil) set apart above the rest, as WeChat's. */
3
- export declare function SaidText({ text, className }: {
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;
@@ -1,8 +1,14 @@
1
1
  import * as React from 'react';
2
2
  import { QuoteUtil } from '../util/quote.js';
3
3
  import { FoldText } from './fold-text.js';
4
- /** What the user wrote, in their bubble: the quote it starts with (QuoteUtil) set apart above the rest, as WeChat's. */
5
- export function SaidText({ text, className }) {
4
+ /**
5
+ * What the user wrote, in their bubble: the quote it starts with (QuoteUtil) set apart above the rest, as WeChat's.
6
+ * What a part of Ta wrote for them (`markdown`) is drawn as Markdown.
7
+ */
8
+ export function SaidText({ text, className, markdown }) {
9
+ if (markdown) {
10
+ return React.createElement(FoldText, { text: text, className: className, markdown: true });
11
+ }
6
12
  const { quote, rest } = QuoteUtil.split(text);
7
13
  if (!quote) {
8
14
  return React.createElement(FoldText, { text: text, className: className });
@@ -46,4 +46,11 @@ 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
  }
@@ -52,5 +52,21 @@ export var SideListUtil;
52
52
  return again && shown ? 'hide' : 'show';
53
53
  }
54
54
  SideListUtil.pick = pick;
55
+ /**
56
+ * Whether a double click in the sidebar was on a row of a list (a conversation, the double, an agent, a friend, a
57
+ * 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
58
+ * SwipeRow) or one that marks the item shown (`aria-current`), never a field, a button of a head, nor an action
59
+ * a swipe shows behind a row.
60
+ */
61
+ function isRow(target) {
62
+ var _a;
63
+ const element = target;
64
+ 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"]');
65
+ if (!opener || opener.closest('.ta-swipe-actions')) {
66
+ return false;
67
+ }
68
+ return opener.hasAttribute('aria-current') || !!opener.closest('li, .ta-swipe-row');
69
+ }
70
+ SideListUtil.isRow = isRow;
55
71
  })(SideListUtil || (SideListUtil = {}));
56
72
  //# sourceMappingURL=side-lists.js.map
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { flushSync } from 'react-dom';
3
3
  import { nativePlugin } from '../device/device.js';
4
+ import { ListMotion } from './list-motion.js';
4
5
  /** Where a row dragged to `center` goes among rows whose centers are `centers` (the dragged one at `from`). Pure, for the tests. */
5
6
  export var SortUtil;
6
7
  (function (SortUtil) {
@@ -68,6 +69,9 @@ export function useSortable(list, onMove) {
68
69
  handle.removeEventListener('pointermove', onPointerMove);
69
70
  handle.removeEventListener('pointerup', onPointerUp);
70
71
  handle.removeEventListener('pointercancel', onPointerUp);
72
+ // Where each is seen as the finger lets go: those that made room are there already, the one dragged
73
+ // slides from the finger into its place, as the rows of any list do (ListMotion).
74
+ const seen = rows.map(row => row.getBoundingClientRect().top);
71
75
  // In the frame the rows take their places: none jumps back first.
72
76
  flushSync(() => {
73
77
  if (to !== from) {
@@ -75,9 +79,20 @@ export function useSortable(list, onMove) {
75
79
  }
76
80
  });
77
81
  for (const row of rows) {
82
+ // Not by their transition: from where they were moved to, they are in their places.
83
+ row.style.transition = 'none';
78
84
  row.style.removeProperty('transform');
79
85
  }
80
86
  delete dragged.dataset.sorting;
87
+ const calm = ListMotion.calm();
88
+ rows.forEach((row, index) => {
89
+ // Read before the transition is back: the change of place is taken without it.
90
+ const now = row.getBoundingClientRect();
91
+ if (!calm) {
92
+ ListMotion.slide(row, seen[index], now, row === dragged);
93
+ }
94
+ row.style.removeProperty('transition');
95
+ });
81
96
  };
82
97
  handle.addEventListener('pointermove', onPointerMove);
83
98
  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;
@@ -1,4 +1,4 @@
1
- import { ChevronDown, ChevronLeft, Folder, Maximize2, Minimize2, PanelTop, Plus, X } from 'lucide-react';
1
+ import { ChevronDown, ChevronLeft, Folder, Minimize2, PanelTop, Plus, X } from 'lucide-react';
2
2
  import * as React from 'react';
3
3
  import { WebLabelUtil } from '../extension/web-extension-protocol.js';
4
4
  import { useT } from '../i18n/use-t.js';
@@ -98,7 +98,7 @@ function CloseTab({ editor, title, onClose, onContextMenu, }) {
98
98
  * The tabs of a wide workbench, as those of a browser or an editor: the one shown is a card joined to what it
99
99
  * shows, the others lie on the strip with a line between them, `+` follows the last one.
100
100
  */
101
- export function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd, maximized, onMaximize }) {
101
+ export function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd, maximized, onMaximize, actionsRef }) {
102
102
  const t = useT();
103
103
  const [menu, openMenu] = useContextMenu();
104
104
  const menuFor = useTabMenu(editors, onClose, onPin);
@@ -116,16 +116,22 @@ export function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpe
116
116
  const title = WebLabelUtil.text(editor.title);
117
117
  const Glyph = editor.icon;
118
118
  const selected = editor.id === active;
119
- return (React.createElement("div", { key: editor.id, className: `ta-editor-tab ${selected ? 'ta-active' : ''} ${editor.preview ? 'ta-preview' : ''} ${editor.dirty ? 'ta-dirty' : ''}`, title: title },
120
- React.createElement("button", { type: "button", role: "tab", "aria-selected": selected, className: "ta-editor-tab-button", onClick: () => onShow(editor.id), onDoubleClick: () => onPin(editor.id), onAuxClick: event => event.button === 1 && onClose([editor.id]), onContextMenu: event => openMenu(event, menuFor(editor)) },
119
+ 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 ? WebLabelUtil.text(editor.tooltip) : title },
120
+ React.createElement("button", { type: "button", role: "tab", "aria-selected": selected, className: "ta-editor-tab-button", onClick: () => onShow(editor.id), onDoubleClick: () => {
121
+ if (editor.preview) {
122
+ onPin(editor.id);
123
+ }
124
+ onMaximize === null || onMaximize === void 0 ? void 0 : onMaximize();
125
+ }, onAuxClick: event => event.button === 1 && onClose([editor.id]), onContextMenu: event => openMenu(event, menuFor(editor)) },
121
126
  Glyph && React.createElement(Glyph, { size: 14 }),
122
127
  React.createElement("span", null, title)),
123
128
  React.createElement(CloseTab, { editor: editor, title: title, onClose: () => onClose([editor.id]), onContextMenu: event => openMenu(event, menuFor(editor)) })));
124
129
  })),
125
130
  views.length > 0 && React.createElement(OpenMenu, { views: views, onOpenView: onOpenView, cwd: cwd }),
126
131
  menu,
132
+ React.createElement("div", { className: "ta-editor-actions", ref: actionsRef }),
127
133
  React.createElement("div", { className: "ta-workbench-actions" },
128
- onMaximize && (React.createElement(IconButton, { icon: maximized ? Minimize2 : Maximize2, label: t(maximized ? 'ta.workbench.restore' : 'ta.workbench.maximize'), className: "ta-wide-only", "aria-pressed": maximized, onClick: onMaximize })),
134
+ maximized && onMaximize && React.createElement(IconButton, { icon: Minimize2, label: t('ta.workbench.restore'), className: "ta-wide-only", onClick: onMaximize }),
129
135
  React.createElement(IconButton, { icon: SidebarRight, label: t('ta.panel.hide'), onClick: onHide }))));
130
136
  }
131
137
  /**
@@ -133,7 +139,7 @@ export function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpe
133
139
  * many are open, which opens the list of them (TabSwitcher), and `+`. A row of tabs a finger scrolls and
134
140
  * closes by their small crosses is neither seen nor hit well on a phone.
135
141
  */
136
- export function CompactHead({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd }) {
142
+ export function CompactHead({ editors, active, views, onShow, onClose, onPin, onOpenView, onHide, cwd, actionsRef }) {
137
143
  const t = useT();
138
144
  const [open, setOpen] = React.useState(false);
139
145
  const [menu, openMenu] = useContextMenu();
@@ -159,6 +165,7 @@ export function CompactHead({ editors, active, views, onShow, onClose, onPin, on
159
165
  React.createElement("span", { className: "ta-workbench-switch-title" }, title),
160
166
  editors.length > 1 && React.createElement("span", { className: "ta-workbench-count" }, editors.length),
161
167
  React.createElement(ChevronDown, { className: "ta-workbench-switch-caret", size: 15, strokeWidth: 1.8, "aria-hidden": "true" }))) : (React.createElement("span", { className: "ta-workbench-title" }, title)),
168
+ React.createElement("div", { className: "ta-editor-actions", ref: actionsRef }),
162
169
  views.length > 0 && React.createElement(OpenMenu, { views: views, onOpenView: onOpenView, cwd: cwd, align: "end" })),
163
170
  menu,
164
171
  open && (React.createElement(TabSwitcher, { editors: editors, active: active, onShow: id => {
@@ -10,3 +10,8 @@ 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;
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { useT } from '../i18n/use-t.js';
3
3
  import { IconButton, SidebarRight } from './icon.js';
4
+ import { SideListUtil } from './side-lists.js';
4
5
  export const WorkbenchToggleContext = React.createContext(undefined);
5
6
  /**
6
7
  * The button that shows the workbench, for the head of the conversation or of a page. Only while it is
@@ -14,4 +15,13 @@ export function WorkbenchToggle() {
14
15
  }
15
16
  return React.createElement(IconButton, { icon: SidebarRight, label: t('ta.panel.show'), onClick: state.toggle });
16
17
  }
18
+ /** The sidebar of a wide screen: a double click on a row of its lists also shows or hides the workbench. */
19
+ export function SidebarPane({ style, children }) {
20
+ const state = React.useContext(WorkbenchToggleContext);
21
+ return (React.createElement("div", { className: "ta-sidebar", style: style, onDoubleClick: event => {
22
+ if (state && SideListUtil.isRow(event.target)) {
23
+ state.toggle();
24
+ }
25
+ } }, children));
26
+ }
17
27
  //# sourceMappingURL=workbench-toggle.js.map