@celljs/ta-web 4.23.0 → 4.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/esm/browser/assistant/assistant-chat-list.js +3 -1
  2. package/esm/browser/components/app-nav.d.ts +3 -1
  3. package/esm/browser/components/app-nav.js +10 -10
  4. package/esm/browser/components/app-shell-state.d.ts +1 -0
  5. package/esm/browser/components/app-shell-state.js +21 -1
  6. package/esm/browser/components/app-view.js +20 -14
  7. package/esm/browser/components/chat-home-util.d.ts +7 -0
  8. package/esm/browser/components/chat-home-util.js +10 -0
  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-util.d.ts +15 -3
  14. package/esm/browser/components/chat-list-util.js +26 -4
  15. package/esm/browser/components/chat-list.js +6 -5
  16. package/esm/browser/components/chat-seen.d.ts +4 -3
  17. package/esm/browser/components/chat-seen.js +6 -5
  18. package/esm/browser/components/chats-dot.d.ts +30 -0
  19. package/esm/browser/components/chats-dot.js +32 -0
  20. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  21. package/esm/browser/components/host-view.d.ts +1 -1
  22. package/esm/browser/components/list-motion.d.ts +44 -0
  23. package/esm/browser/components/list-motion.js +197 -0
  24. package/esm/browser/components/partner-row.js +1 -1
  25. package/esm/browser/components/settings-files.d.ts +7 -0
  26. package/esm/browser/components/settings-files.js +61 -0
  27. package/esm/browser/components/settings-more.js +2 -0
  28. package/esm/browser/components/side-lists.d.ts +7 -0
  29. package/esm/browser/components/side-lists.js +16 -0
  30. package/esm/browser/components/sortable.js +15 -0
  31. package/esm/browser/components/tool-view.js +23 -7
  32. package/esm/browser/components/workbench-tabs.d.ts +1 -0
  33. package/esm/browser/components/workbench-tabs.js +8 -3
  34. package/esm/browser/components/workbench-toggle.d.ts +5 -0
  35. package/esm/browser/components/workbench-toggle.js +10 -0
  36. package/esm/browser/extension/web-api-contributions.d.ts +2 -1
  37. package/esm/browser/extension/web-api-partners.d.ts +9 -1
  38. package/esm/browser/extension/web-view-util.d.ts +5 -0
  39. package/esm/browser/extension/web-view-util.js +8 -0
  40. package/esm/browser/i18n/locales.d.ts +10 -2
  41. package/esm/browser/i18n/messages-ja.js +9 -1
  42. package/esm/browser/i18n/messages-zh-tw.js +9 -1
  43. package/esm/browser/i18n/messages.d.ts +9 -1
  44. package/esm/browser/i18n/messages.js +18 -2
  45. package/esm/browser/partners/partners-util.d.ts +6 -0
  46. package/esm/browser/partners/partners-util.js +9 -0
  47. package/esm/browser/partners/partners-view.js +4 -1
  48. package/esm/browser/style/base.d.ts +1 -1
  49. package/esm/browser/style/base.js +5 -0
  50. package/esm/browser/style/chat-list.d.ts +1 -1
  51. package/esm/browser/style/chat-list.js +2 -0
  52. package/esm/browser/style/conversation.d.ts +1 -1
  53. package/esm/browser/style/conversation.js +3 -0
  54. package/esm/browser/style/device.js +4 -1
  55. package/esm/browser/style/layout.d.ts +1 -1
  56. package/esm/browser/style/layout.js +20 -6
  57. package/esm/browser/style/pages.d.ts +1 -1
  58. package/esm/browser/style/pages.js +8 -0
  59. package/esm/browser/style/shell.d.ts +1 -1
  60. package/esm/browser/style/shell.js +7 -2
  61. package/esm/browser/style/surfaces.d.ts +1 -1
  62. package/esm/browser/style/surfaces.js +1 -0
  63. package/esm/browser/util/process.d.ts +3 -1
  64. package/esm/browser/util/process.js +27 -0
  65. package/lib/browser/assistant/assistant-chat-list.js +3 -1
  66. package/lib/browser/components/app-nav.d.ts +3 -1
  67. package/lib/browser/components/app-nav.js +8 -8
  68. package/lib/browser/components/app-shell-state.d.ts +1 -0
  69. package/lib/browser/components/app-shell-state.js +21 -1
  70. package/lib/browser/components/app-view.js +19 -13
  71. package/lib/browser/components/chat-home-util.d.ts +7 -0
  72. package/lib/browser/components/chat-home-util.js +10 -0
  73. package/lib/browser/components/chat-home.js +3 -3
  74. package/lib/browser/components/chat-list-hooks.d.ts +2 -0
  75. package/lib/browser/components/chat-list-hooks.js +7 -0
  76. package/lib/browser/components/chat-list-row.js +2 -2
  77. package/lib/browser/components/chat-list-util.d.ts +15 -3
  78. package/lib/browser/components/chat-list-util.js +26 -4
  79. package/lib/browser/components/chat-list.js +5 -4
  80. package/lib/browser/components/chat-seen.d.ts +4 -3
  81. package/lib/browser/components/chat-seen.js +6 -5
  82. package/lib/browser/components/chats-dot.d.ts +31 -0
  83. package/lib/browser/components/chats-dot.js +68 -0
  84. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  85. package/lib/browser/components/host-view.d.ts +1 -1
  86. package/lib/browser/components/list-motion.d.ts +45 -0
  87. package/lib/browser/components/list-motion.js +234 -0
  88. package/lib/browser/components/partner-row.js +1 -1
  89. package/lib/browser/components/settings-files.d.ts +8 -0
  90. package/lib/browser/components/settings-files.js +97 -0
  91. package/lib/browser/components/settings-more.js +2 -0
  92. package/lib/browser/components/side-lists.d.ts +7 -0
  93. package/lib/browser/components/side-lists.js +16 -0
  94. package/lib/browser/components/sortable.js +15 -0
  95. package/lib/browser/components/tool-view.js +23 -7
  96. package/lib/browser/components/workbench-tabs.d.ts +1 -0
  97. package/lib/browser/components/workbench-tabs.js +7 -2
  98. package/lib/browser/components/workbench-toggle.d.ts +5 -0
  99. package/lib/browser/components/workbench-toggle.js +11 -0
  100. package/lib/browser/extension/web-api-contributions.d.ts +2 -1
  101. package/lib/browser/extension/web-api-partners.d.ts +9 -1
  102. package/lib/browser/extension/web-view-util.d.ts +5 -0
  103. package/lib/browser/extension/web-view-util.js +8 -0
  104. package/lib/browser/i18n/locales.d.ts +10 -2
  105. package/lib/browser/i18n/messages-ja.js +9 -1
  106. package/lib/browser/i18n/messages-zh-tw.js +9 -1
  107. package/lib/browser/i18n/messages.d.ts +9 -1
  108. package/lib/browser/i18n/messages.js +18 -2
  109. package/lib/browser/partners/partners-util.d.ts +6 -0
  110. package/lib/browser/partners/partners-util.js +9 -0
  111. package/lib/browser/partners/partners-view.js +4 -1
  112. package/lib/browser/style/base.d.ts +1 -1
  113. package/lib/browser/style/base.js +5 -0
  114. package/lib/browser/style/chat-list.d.ts +1 -1
  115. package/lib/browser/style/chat-list.js +2 -0
  116. package/lib/browser/style/conversation.d.ts +1 -1
  117. package/lib/browser/style/conversation.js +3 -0
  118. package/lib/browser/style/device.js +4 -1
  119. package/lib/browser/style/layout.d.ts +1 -1
  120. package/lib/browser/style/layout.js +20 -6
  121. package/lib/browser/style/pages.d.ts +1 -1
  122. package/lib/browser/style/pages.js +8 -0
  123. package/lib/browser/style/shell.d.ts +1 -1
  124. package/lib/browser/style/shell.js +7 -2
  125. package/lib/browser/style/surfaces.d.ts +1 -1
  126. package/lib/browser/style/surfaces.js +1 -0
  127. package/lib/browser/util/process.d.ts +3 -1
  128. package/lib/browser/util/process.js +27 -0
  129. 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
@@ -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 }] : [];
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Whether the files of settings written by hand read (TaSettingsServer.checkFiles): pi and Ta leave out one that is
4
+ * not JSON, saying little, so a setting typed there seems to do nothing. Each that does not read says where it goes
5
+ * wrong, and opens there. Nothing from a Ta service of before, which cannot say.
6
+ */
7
+ export declare function SettingsFilesRow(): React.JSX.Element | null;
@@ -0,0 +1,61 @@
1
+ import { CircleAlert, CircleCheck, RefreshCw } from 'lucide-react';
2
+ import * as React from 'react';
3
+ import { useWorkbench } from '../hooks.js';
4
+ import { useT } from '../i18n/use-t.js';
5
+ import { LinkUtil } from '../util/link.js';
6
+ import { Icon, IconButton } from './icon.js';
7
+ import { OpenLink } from './link.js';
8
+ import { Row } from './settings-controls.js';
9
+ /** A path of the user's home as `~/…`. */
10
+ function shown(path, home) {
11
+ return home && path.startsWith(`${home}/`) ? `~${path.slice(home.length)}` : path;
12
+ }
13
+ /**
14
+ * Whether the files of settings written by hand read (TaSettingsServer.checkFiles): pi and Ta leave out one that is
15
+ * not JSON, saying little, so a setting typed there seems to do nothing. Each that does not read says where it goes
16
+ * wrong, and opens there. Nothing from a Ta service of before, which cannot say.
17
+ */
18
+ export function SettingsFilesRow() {
19
+ var _a;
20
+ var _b;
21
+ const t = useT();
22
+ const [workbench, bench] = useWorkbench();
23
+ const open = React.useContext(OpenLink);
24
+ const [files, setFiles] = React.useState();
25
+ const [checking, setChecking] = React.useState(false);
26
+ const check = React.useCallback(() => {
27
+ setChecking(true);
28
+ Promise.resolve()
29
+ .then(() => { var _a, _b; return (_b = (_a = bench.settings).checkFiles) === null || _b === void 0 ? void 0 : _b.call(_a); })
30
+ .then(next => setFiles(next !== null && next !== void 0 ? next : null), () => setFiles(null))
31
+ .finally(() => setChecking(false));
32
+ }, [bench]);
33
+ React.useEffect(check, [check]);
34
+ if (files === null) {
35
+ return null;
36
+ }
37
+ const home = (_a = workbench.server) === null || _a === void 0 ? void 0 : _a.home;
38
+ const problems = (_b = files === null || files === void 0 ? void 0 : files.problems) !== null && _b !== void 0 ? _b : [];
39
+ const description = !files
40
+ ? t('ta.settings.files.checking')
41
+ : problems.length
42
+ ? t('ta.settings.files.problems', { count: problems.length })
43
+ : t('ta.settings.files.ok', { count: files.checked.length });
44
+ return (React.createElement(Row, { label: t('ta.settings.files'), description: description, stacked: problems.length > 0 },
45
+ problems.length > 0 && (React.createElement("ul", { className: "ta-settings-files" }, problems.map(problem => {
46
+ var _a, _b;
47
+ const target = LinkUtil.codeReference(problem.line ? `${problem.file}:${problem.line}:${(_a = problem.column) !== null && _a !== void 0 ? _a : 1}` : problem.file);
48
+ return (React.createElement("li", { key: problem.file },
49
+ React.createElement(Icon, { icon: CircleAlert, size: 15, className: "ta-settings-files-icon" }),
50
+ target && open ? (React.createElement("button", { type: "button", className: "ta-link ta-mono", title: t('ta.link.openFile'), onClick: () => open(target, false) }, shown(problem.file, home))) : (React.createElement("code", null, shown(problem.file, home))),
51
+ React.createElement("span", { className: "ta-settings-files-why" }, problem.problem === 'object'
52
+ ? t('ta.settings.files.notObject')
53
+ : problem.line
54
+ ? t('ta.settings.files.notJsonAt', { line: problem.line, column: (_b = problem.column) !== null && _b !== void 0 ? _b : 1 })
55
+ : t('ta.settings.files.notJson'))));
56
+ }))),
57
+ React.createElement("span", { className: "ta-settings-files-tools" },
58
+ files && !problems.length && React.createElement(Icon, { icon: CircleCheck, size: 16, className: "ta-settings-files-ok" }),
59
+ React.createElement(IconButton, { icon: RefreshCw, label: t('ta.settings.files.check'), busy: checking, onClick: check }))));
60
+ }
61
+ //# sourceMappingURL=settings-files.js.map
@@ -16,6 +16,7 @@ import { RemoteHosts } from './remote-hosts.js';
16
16
  import { ServeRestartUtil, useRestartTa } from './serve-restart.js';
17
17
  import { packageLabel, SETTINGS_GROUPS, SHORTCUTS, usePackages } from './settings-choices.js';
18
18
  import { EmptyRow, Keys, Row, row, Switch } from './settings-controls.js';
19
+ import { SettingsFilesRow } from './settings-files.js';
19
20
  import { SignInSetupSettings, useSignInConfig } from './sign-in-setup.js';
20
21
  /**
21
22
  * The sections besides those of the page and of pi's settings, each in its part (SectionEntry.group): the packages,
@@ -204,6 +205,7 @@ export function useMoreSections(onClose, onDialog) {
204
205
  t('ta.restart.button')))),
205
206
  ]
206
207
  : []),
208
+ row('settings-files', [t('ta.settings.files'), 'settings.json', 'models.json', 'JSON'], React.createElement(SettingsFilesRow, null)),
207
209
  row('cwd', [t('ta.settings.cwd'), workbench.server.cwd], React.createElement(Row, { label: t('ta.settings.cwd'), description: t('ta.settings.cwdDescription', { path: workbench.server.cwd }) },
208
210
  React.createElement("button", { type: "button", className: "ta-button", onClick: () => onDialog('directory') },
209
211
  React.createElement(Icon, { icon: FolderOpen, size: 15 }),
@@ -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);
@@ -25,7 +25,7 @@ function StatusDot({ status }) {
25
25
  return React.createElement("span", { className: `ta-status ta-status-${status}` });
26
26
  }
27
27
  /** One step in one line: a dot for its state and what it does; a click opens what it did. */
28
- function ToolRow({ name, args, status, trailing, details, count = 0 }) {
28
+ function ToolRow({ name, args, status, trailing, details, count = 0, times = 1 }) {
29
29
  const t = useT();
30
30
  const [open, setOpen] = React.useState(false);
31
31
  const summary = ToolUtil.summary(name, args, React.useContext(ToolRenderers));
@@ -38,6 +38,9 @@ function ToolRow({ name, args, status, trailing, details, count = 0 }) {
38
38
  React.createElement(ToolIcon, { size: 18 })))),
39
39
  summary.target && (React.createElement("span", { className: summary.titled ? 'ta-tool-verb ta-tool-title-text' : `ta-tool-target ${summary.code ? 'ta-mono' : ''}` }, summary.target)),
40
40
  count > 1 && React.createElement("span", { className: "ta-tool-count" }, t('ta.process.steps', { count })),
41
+ times > 1 && (React.createElement("span", { className: "ta-tool-count", title: t('ta.process.timesTitle', { count: times }) },
42
+ "\u00D7",
43
+ times)),
41
44
  React.createElement(Icon, { icon: ChevronRight, size: 13, className: "ta-tool-chevron" })));
42
45
  return (React.createElement("div", { className: `ta-tool ta-tool-${status}` },
43
46
  React.createElement("div", { className: "ta-tool-line" },
@@ -88,13 +91,13 @@ function same(a, b) {
88
91
  export const ActView = React.memo(Act, (previous, next) => {
89
92
  const a = previous.act;
90
93
  const b = next.act;
91
- if (a.call !== b.call || !same(a.nested, b.nested) || a.thoughts.join('\0') !== b.thoughts.join('\0')) {
94
+ if (a.call !== b.call || !same(a.nested, b.nested) || !same(a.earlier, b.earlier) || a.thoughts.join('\0') !== b.thoughts.join('\0')) {
92
95
  return false;
93
96
  }
94
97
  if (b.call.name === 'codemode' && previous.runs !== next.runs) {
95
98
  return false;
96
99
  }
97
- return [b.call, ...b.nested].every(call => {
100
+ return [b.call, ...b.nested, ...b.earlier].every(call => {
98
101
  var _a;
99
102
  const id = (_a = call.id) !== null && _a !== void 0 ? _a : '';
100
103
  return previous.runs[id] === next.runs[id] && previous.results.get(id) === next.results.get(id);
@@ -102,8 +105,9 @@ export const ActView = React.memo(Act, (previous, next) => {
102
105
  });
103
106
  function Act({ act, results, runs }) {
104
107
  var _a;
108
+ var _b;
105
109
  const { id = '', name = '', arguments: raw } = act.call;
106
- const args = (_a = raw) !== null && _a !== void 0 ? _a : {};
110
+ const args = (_b = raw) !== null && _b !== void 0 ? _b : {};
107
111
  const run = id ? runs[id] : undefined;
108
112
  const output = MessageUtil.output(run, id ? results.get(id) : undefined);
109
113
  const status = MessageUtil.status(run, output);
@@ -113,10 +117,22 @@ function Act({ act, results, runs }) {
113
117
  }
114
118
  const own = details(name, args, output, status);
115
119
  if (!act.nested.length) {
116
- const body = thoughts || own ? (React.createElement(React.Fragment, null,
120
+ // The same call made more than once in a row: what each did, the earliest first.
121
+ const all = act.earlier.length
122
+ ? [
123
+ ...act.earlier.map(call => {
124
+ var _a, _b;
125
+ const key = (_a = call.id) !== null && _a !== void 0 ? _a : '';
126
+ const earlier = MessageUtil.output(runs[key], results.get(key));
127
+ return { key, shown: details(name, (_b = call.arguments) !== null && _b !== void 0 ? _b : {}, earlier, MessageUtil.status(runs[key], earlier)) };
128
+ }),
129
+ { key: id, shown: own },
130
+ ].filter(each => each.shown)
131
+ : [];
132
+ const body = thoughts || own || all.length ? (React.createElement(React.Fragment, null,
117
133
  thoughts,
118
- own)) : undefined;
119
- return React.createElement(ToolRow, { name: name, args: args, status: status, details: body });
134
+ all.length > 1 ? (React.createElement("div", { className: "ta-tool-repeats" }, all.map(each => (React.createElement(React.Fragment, { key: each.key }, each.shown))))) : (own || ((_a = all[0]) === null || _a === void 0 ? void 0 : _a.shown)))) : undefined;
135
+ return React.createElement(ToolRow, { name: name, args: args, status: status, details: body, times: act.earlier.length + 1 });
120
136
  }
121
137
  // The script of another agent and the calls it made: one line, which opens to the calls, then the script.
122
138
  const steps = act.nested.map(call => {
@@ -17,6 +17,7 @@ export interface WorkbenchTabsProps {
17
17
  cwd?: string;
18
18
  /** Whether the workbench takes the place of the conversation too; none on narrow screens, where it always does. */
19
19
  maximized?: boolean;
20
+ /** Maximizes or restores the workbench: its button, or a double click on a tab. */
20
21
  onMaximize?(): void;
21
22
  }
22
23
  export declare function ViewGlyph({ view, size }: {
@@ -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';
@@ -117,7 +117,12 @@ export function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpe
117
117
  const Glyph = editor.icon;
118
118
  const selected = editor.id === active;
119
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)) },
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)) })));
@@ -125,7 +130,7 @@ export function TabStrip({ editors, active, views, onShow, onClose, onPin, onOpe
125
130
  views.length > 0 && React.createElement(OpenMenu, { views: views, onOpenView: onOpenView, cwd: cwd }),
126
131
  menu,
127
132
  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 })),
133
+ maximized && onMaximize && React.createElement(IconButton, { icon: Minimize2, label: t('ta.workbench.restore'), className: "ta-wide-only", onClick: onMaximize }),
129
134
  React.createElement(IconButton, { icon: SidebarRight, label: t('ta.panel.hide'), onClick: onHide }))));
130
135
  }
131
136
  /**
@@ -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
@@ -161,7 +161,8 @@ export interface WebView {
161
161
  group?: WebPageGroup;
162
162
  /**
163
163
  * `false`: a page only shown by something else (a room of its kind, a link, a row of its settings), never in the
164
- * navigation nor under Discover. Newer than some Ta apps.
164
+ * navigation nor under Discover; a panel only opened by something else (the info of the chat shown), never among
165
+ * the tools the workbench's + lists. Newer than some Ta apps.
165
166
  */
166
167
  navigation?: boolean;
167
168
  /** A page: the line a list shows under its name, as a messenger does — the last thing said there, and when. */
@@ -52,8 +52,16 @@ export interface WebPartner {
52
52
  }
53
53
  /** The conversation with a partner. */
54
54
  export interface WebPartnerChat {
55
- /** A conversation of pi (an agent's): the double's list has its row already, this only names whose it is. */
55
+ /**
56
+ * A conversation of pi (an agent's): the double's list has its row, once its session closed too; this names whose
57
+ * it is.
58
+ */
56
59
  sessionFile?: string;
60
+ /**
61
+ * With {@link sessionFile}, `Date.now()` time up to which what it said there was seen elsewhere (an agent's answers
62
+ * in a group chat, which the user read there): no amber dot for it in the double's list. Newer than some Ta apps.
63
+ */
64
+ seenAt?: number;
57
65
  /** What was said last, with who said it where it is not the partner. */
58
66
  last?: string;
59
67
  /** `Date.now()` time of it: where the conversation is in the double's list. */
@@ -10,6 +10,11 @@ export declare namespace WebExtensionUtil {
10
10
  export declare namespace WebViewUtil {
11
11
  /** The tab a `panel` view opens as. */
12
12
  function editorId(viewId: string): string;
13
+ /**
14
+ * The tools the workbench's + and its empty state list: its `panel` views, but those only opened by something else
15
+ * (`navigation: false`, as the info of the chat shown), which would be there twice or with nothing to show.
16
+ */
17
+ function tools<T extends Pick<WebViewEntry, 'location' | 'navigation'>>(views: readonly T[]): T[];
13
18
  /** The page shown last in this tab of the browser: another tab may show another. */
14
19
  const PAGE: StateSpec<string>;
15
20
  /** The tools open in the workbench, for the user in any browser: the workbench is one for the whole page. */
@@ -36,6 +36,14 @@ export var WebViewUtil;
36
36
  return `view:${viewId}`;
37
37
  }
38
38
  WebViewUtil.editorId = editorId;
39
+ /**
40
+ * The tools the workbench's + and its empty state list: its `panel` views, but those only opened by something else
41
+ * (`navigation: false`, as the info of the chat shown), which would be there twice or with nothing to show.
42
+ */
43
+ function tools(views) {
44
+ return views.filter(view => view.location === 'panel' && view.navigation !== false);
45
+ }
46
+ WebViewUtil.tools = tools;
39
47
  /** The page shown last in this tab of the browser: another tab may show another. */
40
48
  WebViewUtil.PAGE = { key: 'page', tier: 'tab', initial: '', parse: StateUtil.string };
41
49
  /** The tools open in the workbench, for the user in any browser: the workbench is one for the whole page. */