@celljs/ta-web 4.46.2 → 4.47.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 (285) hide show
  1. package/esm/browser/account/account-side.d.ts +3 -3
  2. package/esm/browser/account/account-side.js +11 -21
  3. package/esm/browser/account/device-account.d.ts +8 -0
  4. package/esm/browser/account/device-account.js +20 -0
  5. package/esm/browser/chat/chat-protocol.d.ts +7 -0
  6. package/esm/browser/chat/chat-view.js +1 -1
  7. package/esm/browser/chat/chat.d.ts +1 -0
  8. package/esm/browser/chat/chat.js +15 -3
  9. package/esm/browser/chat/draft-model.d.ts +1 -1
  10. package/esm/browser/chat/draft-model.js +2 -2
  11. package/esm/browser/components/access-view.js +12 -10
  12. package/esm/browser/components/account-menu.d.ts +2 -0
  13. package/esm/browser/components/account-menu.js +11 -2
  14. package/esm/browser/components/account-view.js +9 -5
  15. package/esm/browser/components/app-nav.js +4 -1
  16. package/esm/browser/components/app-shell-state.d.ts +2 -0
  17. package/esm/browser/components/app-update-view.d.ts +2 -0
  18. package/esm/browser/components/app-update-view.js +37 -0
  19. package/esm/browser/components/app-view.js +33 -108
  20. package/esm/browser/components/auth-guide.d.ts +25 -0
  21. package/esm/browser/components/auth-guide.js +44 -0
  22. package/esm/browser/components/auth-view.d.ts +2 -0
  23. package/esm/browser/components/auth-view.js +30 -9
  24. package/esm/browser/components/chat-list-controls.d.ts +38 -0
  25. package/esm/browser/components/chat-list-controls.js +46 -0
  26. package/esm/browser/components/chat-list-hooks.d.ts +19 -0
  27. package/esm/browser/components/chat-list-hooks.js +52 -0
  28. package/esm/browser/components/chat-list-rows.d.ts +51 -0
  29. package/esm/browser/components/chat-list-rows.js +110 -0
  30. package/esm/browser/components/chat-list-sections.d.ts +36 -0
  31. package/esm/browser/components/chat-list-sections.js +72 -0
  32. package/esm/browser/components/chat-list.js +48 -221
  33. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  34. package/esm/browser/components/cloud-sign-in-view.js +4 -1
  35. package/esm/browser/components/custom-provider-util.d.ts +2 -0
  36. package/esm/browser/components/custom-provider-util.js +5 -0
  37. package/esm/browser/components/custom-provider-view.js +33 -12
  38. package/esm/browser/components/device-sign-in-page.js +4 -5
  39. package/esm/browser/components/discover-view.d.ts +8 -1
  40. package/esm/browser/components/discover-view.js +28 -3
  41. package/esm/browser/components/environment-view.js +60 -62
  42. package/esm/browser/components/extension-settings.js +1 -0
  43. package/esm/browser/components/first-steps-util.d.ts +29 -0
  44. package/esm/browser/components/first-steps-util.js +41 -0
  45. package/esm/browser/components/first-steps.d.ts +3 -0
  46. package/esm/browser/components/first-steps.js +36 -0
  47. package/esm/browser/components/host-view.d.ts +3 -3
  48. package/esm/browser/components/host-view.js +11 -11
  49. package/esm/browser/components/me-rows.d.ts +8 -1
  50. package/esm/browser/components/me-rows.js +3 -3
  51. package/esm/browser/components/me-view.js +1 -1
  52. package/esm/browser/components/message-user.js +6 -3
  53. package/esm/browser/components/model-picker.d.ts +5 -0
  54. package/esm/browser/components/model-picker.js +10 -1
  55. package/esm/browser/components/nav-places.d.ts +14 -0
  56. package/esm/browser/components/nav-places.js +11 -0
  57. package/esm/browser/components/phone-shell.d.ts +14 -0
  58. package/esm/browser/components/phone-shell.js +22 -0
  59. package/esm/browser/components/picture-dialog.js +4 -7
  60. package/esm/browser/components/profile-view.js +1 -1
  61. package/esm/browser/components/relay-services.js +4 -7
  62. package/esm/browser/components/relay-view-util.d.ts +5 -0
  63. package/esm/browser/components/relay-view-util.js +14 -0
  64. package/esm/browser/components/relay-view.js +40 -37
  65. package/esm/browser/components/scan-screen.js +5 -8
  66. package/esm/browser/components/screen-navigator.d.ts +9 -0
  67. package/esm/browser/components/screen-navigator.js +84 -0
  68. package/esm/browser/components/search-page.js +9 -2
  69. package/esm/browser/components/serve-value.d.ts +27 -0
  70. package/esm/browser/components/serve-value.js +61 -0
  71. package/esm/browser/components/serve-watch.d.ts +23 -0
  72. package/esm/browser/components/serve-watch.js +36 -0
  73. package/esm/browser/components/settings-choices.js +2 -0
  74. package/esm/browser/components/settings-controls.d.ts +15 -0
  75. package/esm/browser/components/settings-controls.js +13 -0
  76. package/esm/browser/components/settings-more.js +6 -4
  77. package/esm/browser/components/settings-parts.d.ts +3 -1
  78. package/esm/browser/components/settings-parts.js +3 -0
  79. package/esm/browser/components/settings-view.js +37 -11
  80. package/esm/browser/components/share-friends.js +3 -4
  81. package/esm/browser/components/share-sheet.js +3 -4
  82. package/esm/browser/components/tool-view.js +17 -3
  83. package/esm/browser/device/app-update.d.ts +62 -0
  84. package/esm/browser/device/app-update.js +144 -0
  85. package/esm/browser/extension/icons.js +2 -1
  86. package/esm/browser/extension/web-api-contributions.d.ts +6 -1
  87. package/esm/browser/extension/web-api-partners.d.ts +6 -0
  88. package/esm/browser/extension/web-api-spec.js +1 -0
  89. package/esm/browser/extension/web-home.js +9 -0
  90. package/esm/browser/extension/web-metrics.d.ts +3 -0
  91. package/esm/browser/extension/web-metrics.js +33 -22
  92. package/esm/browser/extension/web-pages.d.ts +3 -1
  93. package/esm/browser/extension/web-pages.js +1 -0
  94. package/esm/browser/gateway/console-agents.js +11 -15
  95. package/esm/browser/gateway/console-parts.d.ts +7 -4
  96. package/esm/browser/gateway/console-parts.js +11 -20
  97. package/esm/browser/gateway/console-trend.js +2 -2
  98. package/esm/browser/gateway/console-updates.js +6 -4
  99. package/esm/browser/gateway/console-view.js +6 -6
  100. package/esm/browser/i18n/en/account.d.ts +7 -0
  101. package/esm/browser/i18n/en/account.js +13 -6
  102. package/esm/browser/i18n/en/chat.d.ts +2 -0
  103. package/esm/browser/i18n/en/chat.js +2 -0
  104. package/esm/browser/i18n/en/discover.d.ts +3 -0
  105. package/esm/browser/i18n/en/discover.js +3 -0
  106. package/esm/browser/i18n/en/service.d.ts +6 -0
  107. package/esm/browser/i18n/en/service.js +6 -0
  108. package/esm/browser/i18n/en/settings.d.ts +3 -0
  109. package/esm/browser/i18n/en/settings.js +3 -0
  110. package/esm/browser/i18n/ja/account.js +13 -6
  111. package/esm/browser/i18n/ja/chat.js +2 -0
  112. package/esm/browser/i18n/ja/discover.js +3 -0
  113. package/esm/browser/i18n/ja/service.js +6 -0
  114. package/esm/browser/i18n/ja/settings.js +3 -0
  115. package/esm/browser/i18n/locales.d.ts +22 -1
  116. package/esm/browser/i18n/messages.d.ts +21 -0
  117. package/esm/browser/i18n/zh/account.js +13 -6
  118. package/esm/browser/i18n/zh/chat.js +2 -0
  119. package/esm/browser/i18n/zh/discover.js +3 -0
  120. package/esm/browser/i18n/zh/service.js +6 -0
  121. package/esm/browser/i18n/zh/settings.js +3 -0
  122. package/esm/browser/i18n/zh-tw/account.js +13 -6
  123. package/esm/browser/i18n/zh-tw/chat.js +2 -0
  124. package/esm/browser/i18n/zh-tw/discover.js +3 -0
  125. package/esm/browser/i18n/zh-tw/service.js +6 -0
  126. package/esm/browser/i18n/zh-tw/settings.js +3 -0
  127. package/esm/browser/notices/notices.d.ts +2 -0
  128. package/esm/browser/notices/notices.js +2 -0
  129. package/esm/browser/partners/group-picker.js +3 -4
  130. package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
  131. package/esm/browser/settings/settings-protocol.d.ts +5 -0
  132. package/esm/browser/settings/settings-protocol.js +2 -0
  133. package/esm/browser/style/chat-list.d.ts +1 -1
  134. package/esm/browser/style/chat-list.js +4 -3
  135. package/esm/browser/style/dialogs.d.ts +1 -1
  136. package/esm/browser/style/dialogs.js +7 -0
  137. package/esm/browser/style/pages.d.ts +1 -1
  138. package/esm/browser/style/pages.js +5 -3
  139. package/esm/browser/style/shell.d.ts +1 -1
  140. package/esm/browser/style/shell.js +1 -1
  141. package/esm/browser/util/tool.d.ts +5 -0
  142. package/esm/browser/util/tool.js +21 -3
  143. package/lib/browser/account/account-side.d.ts +3 -3
  144. package/lib/browser/account/account-side.js +11 -21
  145. package/lib/browser/account/device-account.d.ts +8 -0
  146. package/lib/browser/account/device-account.js +20 -0
  147. package/lib/browser/chat/chat-protocol.d.ts +7 -0
  148. package/lib/browser/chat/chat-view.js +1 -1
  149. package/lib/browser/chat/chat.d.ts +1 -0
  150. package/lib/browser/chat/chat.js +14 -2
  151. package/lib/browser/chat/draft-model.d.ts +1 -1
  152. package/lib/browser/chat/draft-model.js +2 -2
  153. package/lib/browser/components/access-view.js +12 -10
  154. package/lib/browser/components/account-menu.d.ts +2 -0
  155. package/lib/browser/components/account-menu.js +11 -2
  156. package/lib/browser/components/account-view.js +9 -5
  157. package/lib/browser/components/app-nav.js +3 -0
  158. package/lib/browser/components/app-shell-state.d.ts +2 -0
  159. package/lib/browser/components/app-update-view.d.ts +3 -0
  160. package/lib/browser/components/app-update-view.js +73 -0
  161. package/lib/browser/components/app-view.js +30 -105
  162. package/lib/browser/components/auth-guide.d.ts +26 -0
  163. package/lib/browser/components/auth-guide.js +47 -0
  164. package/lib/browser/components/auth-view.d.ts +2 -0
  165. package/lib/browser/components/auth-view.js +29 -8
  166. package/lib/browser/components/chat-list-controls.d.ts +39 -0
  167. package/lib/browser/components/chat-list-controls.js +86 -0
  168. package/lib/browser/components/chat-list-hooks.d.ts +19 -0
  169. package/lib/browser/components/chat-list-hooks.js +53 -0
  170. package/lib/browser/components/chat-list-rows.d.ts +52 -0
  171. package/lib/browser/components/chat-list-rows.js +147 -0
  172. package/lib/browser/components/chat-list-sections.d.ts +37 -0
  173. package/lib/browser/components/chat-list-sections.js +108 -0
  174. package/lib/browser/components/chat-list.js +44 -217
  175. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  176. package/lib/browser/components/cloud-sign-in-view.js +4 -1
  177. package/lib/browser/components/custom-provider-util.d.ts +2 -0
  178. package/lib/browser/components/custom-provider-util.js +5 -0
  179. package/lib/browser/components/custom-provider-view.js +32 -11
  180. package/lib/browser/components/device-sign-in-page.js +4 -5
  181. package/lib/browser/components/discover-view.d.ts +8 -1
  182. package/lib/browser/components/discover-view.js +27 -2
  183. package/lib/browser/components/environment-view.js +60 -62
  184. package/lib/browser/components/extension-settings.js +1 -0
  185. package/lib/browser/components/first-steps-util.d.ts +30 -0
  186. package/lib/browser/components/first-steps-util.js +44 -0
  187. package/lib/browser/components/first-steps.d.ts +4 -0
  188. package/lib/browser/components/first-steps.js +72 -0
  189. package/lib/browser/components/host-view.d.ts +3 -3
  190. package/lib/browser/components/host-view.js +11 -11
  191. package/lib/browser/components/me-rows.d.ts +8 -1
  192. package/lib/browser/components/me-rows.js +3 -3
  193. package/lib/browser/components/me-view.js +1 -1
  194. package/lib/browser/components/message-user.js +5 -2
  195. package/lib/browser/components/model-picker.d.ts +5 -0
  196. package/lib/browser/components/model-picker.js +10 -1
  197. package/lib/browser/components/nav-places.d.ts +14 -0
  198. package/lib/browser/components/nav-places.js +13 -1
  199. package/lib/browser/components/phone-shell.d.ts +14 -0
  200. package/lib/browser/components/phone-shell.js +23 -0
  201. package/lib/browser/components/picture-dialog.js +4 -7
  202. package/lib/browser/components/profile-view.js +1 -1
  203. package/lib/browser/components/relay-services.js +4 -7
  204. package/lib/browser/components/relay-view-util.d.ts +6 -0
  205. package/lib/browser/components/relay-view-util.js +17 -0
  206. package/lib/browser/components/relay-view.js +38 -35
  207. package/lib/browser/components/scan-screen.js +5 -8
  208. package/lib/browser/components/screen-navigator.d.ts +9 -0
  209. package/lib/browser/components/screen-navigator.js +85 -0
  210. package/lib/browser/components/search-page.js +8 -1
  211. package/lib/browser/components/serve-value.d.ts +28 -0
  212. package/lib/browser/components/serve-value.js +97 -0
  213. package/lib/browser/components/serve-watch.d.ts +24 -0
  214. package/lib/browser/components/serve-watch.js +39 -0
  215. package/lib/browser/components/settings-choices.js +2 -0
  216. package/lib/browser/components/settings-controls.d.ts +15 -0
  217. package/lib/browser/components/settings-controls.js +13 -0
  218. package/lib/browser/components/settings-more.js +6 -4
  219. package/lib/browser/components/settings-parts.d.ts +3 -1
  220. package/lib/browser/components/settings-parts.js +3 -0
  221. package/lib/browser/components/settings-view.js +36 -10
  222. package/lib/browser/components/share-friends.js +3 -4
  223. package/lib/browser/components/share-sheet.js +3 -4
  224. package/lib/browser/components/tool-view.js +17 -3
  225. package/lib/browser/device/app-update.d.ts +63 -0
  226. package/lib/browser/device/app-update.js +182 -0
  227. package/lib/browser/extension/icons.js +1 -0
  228. package/lib/browser/extension/web-api-contributions.d.ts +6 -1
  229. package/lib/browser/extension/web-api-partners.d.ts +6 -0
  230. package/lib/browser/extension/web-api-spec.js +1 -0
  231. package/lib/browser/extension/web-home.js +9 -0
  232. package/lib/browser/extension/web-metrics.d.ts +3 -0
  233. package/lib/browser/extension/web-metrics.js +32 -21
  234. package/lib/browser/extension/web-pages.d.ts +3 -1
  235. package/lib/browser/extension/web-pages.js +1 -0
  236. package/lib/browser/gateway/console-agents.js +10 -14
  237. package/lib/browser/gateway/console-parts.d.ts +7 -4
  238. package/lib/browser/gateway/console-parts.js +12 -21
  239. package/lib/browser/gateway/console-trend.js +1 -1
  240. package/lib/browser/gateway/console-updates.js +5 -3
  241. package/lib/browser/gateway/console-view.js +5 -5
  242. package/lib/browser/i18n/en/account.d.ts +7 -0
  243. package/lib/browser/i18n/en/account.js +13 -6
  244. package/lib/browser/i18n/en/chat.d.ts +2 -0
  245. package/lib/browser/i18n/en/chat.js +2 -0
  246. package/lib/browser/i18n/en/discover.d.ts +3 -0
  247. package/lib/browser/i18n/en/discover.js +3 -0
  248. package/lib/browser/i18n/en/service.d.ts +6 -0
  249. package/lib/browser/i18n/en/service.js +6 -0
  250. package/lib/browser/i18n/en/settings.d.ts +3 -0
  251. package/lib/browser/i18n/en/settings.js +3 -0
  252. package/lib/browser/i18n/ja/account.js +13 -6
  253. package/lib/browser/i18n/ja/chat.js +2 -0
  254. package/lib/browser/i18n/ja/discover.js +3 -0
  255. package/lib/browser/i18n/ja/service.js +6 -0
  256. package/lib/browser/i18n/ja/settings.js +3 -0
  257. package/lib/browser/i18n/locales.d.ts +22 -1
  258. package/lib/browser/i18n/messages.d.ts +21 -0
  259. package/lib/browser/i18n/zh/account.js +13 -6
  260. package/lib/browser/i18n/zh/chat.js +2 -0
  261. package/lib/browser/i18n/zh/discover.js +3 -0
  262. package/lib/browser/i18n/zh/service.js +6 -0
  263. package/lib/browser/i18n/zh/settings.js +3 -0
  264. package/lib/browser/i18n/zh-tw/account.js +13 -6
  265. package/lib/browser/i18n/zh-tw/chat.js +2 -0
  266. package/lib/browser/i18n/zh-tw/discover.js +3 -0
  267. package/lib/browser/i18n/zh-tw/service.js +6 -0
  268. package/lib/browser/i18n/zh-tw/settings.js +3 -0
  269. package/lib/browser/notices/notices.d.ts +2 -0
  270. package/lib/browser/notices/notices.js +3 -1
  271. package/lib/browser/partners/group-picker.js +3 -4
  272. package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
  273. package/lib/browser/settings/settings-protocol.d.ts +5 -0
  274. package/lib/browser/settings/settings-protocol.js +2 -0
  275. package/lib/browser/style/chat-list.d.ts +1 -1
  276. package/lib/browser/style/chat-list.js +4 -3
  277. package/lib/browser/style/dialogs.d.ts +1 -1
  278. package/lib/browser/style/dialogs.js +7 -0
  279. package/lib/browser/style/pages.d.ts +1 -1
  280. package/lib/browser/style/pages.js +5 -3
  281. package/lib/browser/style/shell.d.ts +1 -1
  282. package/lib/browser/style/shell.js +1 -1
  283. package/lib/browser/util/tool.d.ts +5 -0
  284. package/lib/browser/util/tool.js +21 -3
  285. package/package.json +7 -7
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { type ScreenPlace } from '../screen/screen-protocol.js';
3
+ import type { AppShellState } from './app-shell-state.js';
3
4
  /** What the shell knows of where it is, as AppShell renders: the navigator reads the latest. */
4
5
  export interface ShellPlaces {
5
6
  phone: boolean;
@@ -28,3 +29,11 @@ export interface ShellPlaces {
28
29
  * what the agent reads and where it goes. Called before AppShell returns anything else, as hooks are.
29
30
  */
30
31
  export declare function useScreenNavigator(): React.RefObject<ShellPlaces | undefined>;
32
+ /**
33
+ * Where the shell is and where it goes, as AppShell renders (docs/design/ta-app-use.md 3): what it sets on the ref of
34
+ * useScreenNavigator. `go` is how the shell closes the screen of a phone and picks a tab.
35
+ */
36
+ export declare function shellPlaces(shell: AppShellState, go: {
37
+ closeScreen(): void;
38
+ pickTab(id: string): void;
39
+ }): ShellPlaces;
@@ -1,6 +1,8 @@
1
1
  import { useInject } from '@celljs/react';
2
2
  import * as React from 'react';
3
+ import { WebLabelUtil } from '../extension/web-extension-protocol.js';
3
4
  import { ScreenUtil, TaScreen } from '../screen/screen-protocol.js';
5
+ import { DISCOVER, ME_TAB } from './nav-places.js';
4
6
  import { ScreenNavigatorUtil } from './screen-navigator-util.js';
5
7
  /**
6
8
  * The shell as TaScreen's navigator (docs/design/ta-app-use.md 3): what AppShell sets on the ref as it renders is
@@ -44,4 +46,86 @@ export function useScreenNavigator() {
44
46
  }, [screen]);
45
47
  return shell;
46
48
  }
49
+ /**
50
+ * Where the shell is and where it goes, as AppShell renders (docs/design/ta-app-use.md 3): what it sets on the ref of
51
+ * useScreenNavigator. `go` is how the shell closes the screen of a phone and picks a tab.
52
+ */
53
+ export function shellPlaces(shell, go) {
54
+ var _a;
55
+ const { t, phone, settingsShown, settings, setSettings, screenOpen, screenPage, tabView, tabPage, setTabPage, view, sideShown, lists, side, setSideId, navigation, openSettings, host, setNavOpen, sidebar, workbench, store, } = shell;
56
+ const { closeScreen, pickTab } = go;
57
+ const chatName = (entry) => entry.sessionName || entry.firstMessage || t('ta.chat.new');
58
+ const shownChat = store ? workbench.sessions.find(session => session.sessionId === store.sessionId) : undefined;
59
+ return {
60
+ phone,
61
+ where: ScreenNavigatorUtil.where({
62
+ settings: settingsShown ? (settings !== null && settings !== void 0 ? settings : '') : undefined,
63
+ page: phone ? (screenOpen ? screenPage : tabView) : tabPage === 'discover' ? undefined : view,
64
+ discover: tabPage === 'discover',
65
+ me: phone && !screenOpen && tabPage === 'me',
66
+ list: (phone ? !screenOpen && !tabView && !tabPage : sideShown) ? (_a = lists.find(entry => entry.id === side)) === null || _a === void 0 ? void 0 : _a.label : undefined,
67
+ chat: (phone ? screenOpen && !screenPage && settings === undefined : settings === undefined && tabPage !== 'discover' && !view)
68
+ ? shownChat
69
+ ? chatName(shownChat)
70
+ : t('ta.chat.new')
71
+ : undefined,
72
+ words: { settings: t('ta.settings'), discover: t('ta.discover'), me: t('ta.me') },
73
+ }),
74
+ places: [
75
+ ...lists.map(entry => ({ id: `list:${entry.id}`, title: entry.label })),
76
+ ...navigation.pages.map(page => ({
77
+ id: `page:${page.id}`,
78
+ title: WebLabelUtil.text(page.title),
79
+ })),
80
+ ...navigation.onOpen.map(page => ({ id: `page:${page.id}`, title: page.title })),
81
+ { id: 'discover', title: t('ta.discover') },
82
+ ...(phone ? [{ id: 'me', title: t('ta.me') }] : []),
83
+ { id: 'settings', title: t('ta.settings') },
84
+ ],
85
+ goPlace: place => {
86
+ const [kind, id = ''] = place.id.split(/:(.*)/s);
87
+ if (kind === 'settings') {
88
+ return openSettings();
89
+ }
90
+ if (kind === 'page') {
91
+ return host.showView(id);
92
+ }
93
+ if (phone) {
94
+ // The tabs are under the screen of a phone: what is over them slides away, as the back does.
95
+ if (screenOpen) {
96
+ closeScreen();
97
+ }
98
+ return pickTab(kind === 'list' ? id : kind === 'me' ? ME_TAB : DISCOVER);
99
+ }
100
+ setSettings(undefined);
101
+ setNavOpen(false);
102
+ if (kind === 'discover') {
103
+ setTabPage('discover');
104
+ return;
105
+ }
106
+ setTabPage(undefined);
107
+ setSideId(id);
108
+ if (view) {
109
+ host.showPage('');
110
+ }
111
+ sidebar.reveal();
112
+ },
113
+ showChat: async (target) => {
114
+ const switcher = host.sessionSwitcher();
115
+ if (!switcher) {
116
+ throw new Error('The page cannot show a conversation yet.');
117
+ }
118
+ const shown = switcher('sessionId' in target ? target.sessionId : { sessionFile: target.sessionFile });
119
+ host.showPage('');
120
+ await shown;
121
+ },
122
+ chats: [
123
+ ...workbench.sessions
124
+ .filter(session => !session.group)
125
+ .map(session => ({ name: chatName(session), sessionId: session.sessionId, sessionFile: session.sessionFile })),
126
+ ...workbench.saved.filter(saved => !saved.group).map(saved => ({ name: chatName(saved), sessionFile: saved.sessionFile })),
127
+ ],
128
+ openSettings,
129
+ };
130
+ }
47
131
  //# sourceMappingURL=screen-navigator.js.map
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  import { WebLabelUtil } from '../extension/web-extension-protocol.js';
4
4
  import { useWebExtensions } from '../hooks.js';
5
5
  import { useT } from '../i18n/use-t.js';
6
- import { useBusy } from './busy.js';
6
+ import { BusyMark, useBusy } from './busy.js';
7
7
  import { useContextMenu } from './context-menu.js';
8
8
  import { EmptyState } from './empty-state.js';
9
9
  import { LauncherSearchUtil } from './launcher-search-util.js';
@@ -66,8 +66,15 @@ const Row = React.memo(function Row({ item, query, onMenu, }) {
66
66
  React.createElement("span", { className: "ta-launcher-result-text" },
67
67
  React.createElement("span", { className: "ta-launcher-result-title" }, LauncherSearchUtil.marks(item.title, query).map((part, index) => part.match ? React.createElement("mark", { key: index }, part.text) : React.createElement(React.Fragment, { key: index }, part.text))),
68
68
  item.detail && React.createElement("span", { className: "ta-launcher-result-detail" }, item.detail))),
69
- item.action && (React.createElement("button", { type: "button", className: "ta-launcher-result-action", onClick: () => { var _a; return void ((_a = item.action) === null || _a === void 0 ? void 0 : _a.run()); } }, item.action.label))));
69
+ item.action && React.createElement(ResultAction, { action: item.action })));
70
70
  });
71
+ /** The button beside a result (WebSearchItem.action): it turns until what it does is done, a second tap doing nothing. */
72
+ function ResultAction({ action }) {
73
+ const [busy, run] = useBusy();
74
+ return (React.createElement("button", { type: "button", className: busy ? 'ta-launcher-result-action ta-busy' : 'ta-launcher-result-action', onClick: () => void run(() => action.run()).catch(() => undefined) },
75
+ React.createElement(BusyMark, { busy: busy }),
76
+ action.label));
77
+ }
71
78
  /** Asks for the next page when the end of a section comes into view. */
72
79
  function MoreSentinel({ onMore }) {
73
80
  const ref = React.useRef(null);
@@ -0,0 +1,27 @@
1
+ import * as React from 'react';
2
+ export interface ServeValueOptions<T> {
3
+ /** What it is of: read anew (and shown empty meanwhile) when it changes. */
4
+ key?: unknown;
5
+ /** The topics of TaServeChanges (ta serve's, or its gateway's) that tell it changed. */
6
+ topics?: readonly string[];
7
+ /** Another that tells it changed: what the page keeps itself (the account of the app's own device). */
8
+ changes?: (listener: () => void) => () => void;
9
+ /** Read again every so many ms while shown: only for what the server cannot know (a service elsewhere). */
10
+ every?: number;
11
+ /** What to show of the next read, given what shows: the one before when the same, not drawn again for nothing. */
12
+ same?: (previous: T | undefined, next: T) => T | undefined;
13
+ }
14
+ /**
15
+ * What a page shows of ta serve itself (docs: AGENTS.md "What a page shows of a host is told, not polled"), as
16
+ * `ui.useHost` is for a package's host: read now, again as soon as ta serve tells one of `topics` changed
17
+ * (TaClient.onHostChanged of TaServeChanges.NAME), as the connection comes back and as a hidden page shows; never while
18
+ * hidden. A ta serve of before tells nothing: what it shows is read again as the page shows and after what the user did.
19
+ * Without `load`, nothing is read.
20
+ */
21
+ export declare function useServeValue<T>(load: (() => Promise<T>) | undefined, options?: ServeValueOptions<T>): {
22
+ value: T | undefined;
23
+ failed: unknown;
24
+ read: () => Promise<void>;
25
+ readAt: number | undefined;
26
+ set: React.Dispatch<React.SetStateAction<T | undefined>>;
27
+ };
@@ -0,0 +1,61 @@
1
+ import * as React from 'react';
2
+ import { useWorkbench } from '../hooks.js';
3
+ import { ServeWatch } from './serve-watch.js';
4
+ /**
5
+ * What a page shows of ta serve itself (docs: AGENTS.md "What a page shows of a host is told, not polled"), as
6
+ * `ui.useHost` is for a package's host: read now, again as soon as ta serve tells one of `topics` changed
7
+ * (TaClient.onHostChanged of TaServeChanges.NAME), as the connection comes back and as a hidden page shows; never while
8
+ * hidden. A ta serve of before tells nothing: what it shows is read again as the page shows and after what the user did.
9
+ * Without `load`, nothing is read.
10
+ */
11
+ export function useServeValue(load, options = {}) {
12
+ var _a;
13
+ const [, bench] = useWorkbench();
14
+ const [value, setValue] = React.useState();
15
+ const [failed, setFailed] = React.useState();
16
+ const [readAt, setReadAt] = React.useState();
17
+ const current = React.useRef({ load, options });
18
+ current.current = { load, options };
19
+ /** Of which `key`, while shown: a read of one before, or after the page went, is not shown. */
20
+ const generation = React.useRef(0);
21
+ const read = React.useCallback(async () => {
22
+ const reading = current.current.load;
23
+ if (!reading) {
24
+ return;
25
+ }
26
+ const at = generation.current;
27
+ try {
28
+ const next = await reading();
29
+ if (at === generation.current) {
30
+ const same = current.current.options.same;
31
+ setValue(previous => (same ? same(previous, next) : next));
32
+ setFailed(undefined);
33
+ setReadAt(Date.now());
34
+ }
35
+ }
36
+ catch (error) {
37
+ if (at === generation.current) {
38
+ setFailed(error);
39
+ }
40
+ }
41
+ }, []);
42
+ const enabled = !!load;
43
+ const { key, topics, changes, every } = options;
44
+ const topicsKey = (_a = topics === null || topics === void 0 ? void 0 : topics.join('\n')) !== null && _a !== void 0 ? _a : '';
45
+ // biome-ignore lint/correctness/useExhaustiveDependencies: read anew whenever what is read changes
46
+ React.useEffect(() => {
47
+ generation.current++;
48
+ if (!enabled) {
49
+ return;
50
+ }
51
+ setValue(undefined);
52
+ void read();
53
+ const stop = ServeWatch.start({ server: bench, topics: topicsKey ? topicsKey.split('\n') : [], changes, every, read: () => void read() });
54
+ return () => {
55
+ generation.current++;
56
+ stop();
57
+ };
58
+ }, [enabled, key, topicsKey, changes, every, bench, read]);
59
+ return { value, failed, read, readAt, set: setValue };
60
+ }
61
+ //# sourceMappingURL=serve-value.js.map
@@ -0,0 +1,23 @@
1
+ import type { TaWorkbench } from '../workbench-protocol.js';
2
+ /** Whether the page is seen, and when it shows again: the document's, but in a test. */
3
+ export interface PageShown {
4
+ shown(): boolean;
5
+ onShow(listener: () => void): () => void;
6
+ }
7
+ /** When what useServeValue shows is read again; what `start` returns stops it. */
8
+ export declare namespace ServeWatch {
9
+ interface Options {
10
+ server: Pick<TaWorkbench, 'onHostChanged' | 'onReconnect'>;
11
+ topics: readonly string[];
12
+ changes?: (listener: () => void) => () => void;
13
+ every?: number;
14
+ read(): void;
15
+ page?: PageShown;
16
+ }
17
+ /**
18
+ * Reads again as ta serve tells one of `topics` changed, as `changes` tells, as the connection comes back, and as
19
+ * the page shows again (what was told while it was hidden; all of it from a ta serve of before, which tells
20
+ * nothing); every `every` ms too while it is seen. Never while it is hidden.
21
+ */
22
+ function start({ server, topics, changes, every, read, page }: Options): () => void;
23
+ }
@@ -0,0 +1,36 @@
1
+ import { TaServeChanges } from '@celljs/ta-protocol';
2
+ const DOCUMENT_SHOWN = {
3
+ shown: () => document.visibilityState !== 'hidden',
4
+ onShow: listener => {
5
+ const changed = () => document.visibilityState !== 'hidden' && listener();
6
+ document.addEventListener('visibilitychange', changed);
7
+ return () => document.removeEventListener('visibilitychange', changed);
8
+ },
9
+ };
10
+ /** When what useServeValue shows is read again; what `start` returns stops it. */
11
+ export var ServeWatch;
12
+ (function (ServeWatch) {
13
+ /**
14
+ * Reads again as ta serve tells one of `topics` changed, as `changes` tells, as the connection comes back, and as
15
+ * the page shows again (what was told while it was hidden; all of it from a ta serve of before, which tells
16
+ * nothing); every `every` ms too while it is seen. Never while it is hidden.
17
+ */
18
+ function start({ server, topics, changes, every, read, page = DOCUMENT_SHOWN }) {
19
+ const again = () => page.shown() && read();
20
+ const stops = [
21
+ server.onHostChanged((name, told) => name === TaServeChanges.NAME && told.some(topic => topics.includes(topic)) && again()),
22
+ server.onReconnect(again),
23
+ page.onShow(read),
24
+ ...(changes ? [changes(again)] : []),
25
+ ];
26
+ const timer = every ? setInterval(again, every) : undefined;
27
+ return () => {
28
+ for (const stop of stops) {
29
+ stop();
30
+ }
31
+ clearInterval(timer);
32
+ };
33
+ }
34
+ ServeWatch.start = start;
35
+ })(ServeWatch || (ServeWatch = {}));
36
+ //# sourceMappingURL=serve-watch.js.map
@@ -87,6 +87,8 @@ export function navigationRows(navigation, t) {
87
87
  return t(navigation.setting.pinned.includes(id) ? 'ta.settings.navigation.overflow' : 'ta.settings.navigation.folded');
88
88
  };
89
89
  return [
90
+ row('all-features', [t('ta.settings.allFeatures'), t('ta.settings.allFeaturesHint'), t('ta.discover.all')], React.createElement(Row, { label: t('ta.settings.allFeatures'), description: t('ta.settings.allFeaturesHint') },
91
+ React.createElement(Switch, { label: t('ta.settings.allFeatures'), checked: !navigation.first, onChange: navigation.showAll }))),
90
92
  ...navigation.pages.map(page => {
91
93
  const title = WebLabelUtil.text(page.title);
92
94
  return row(`navigation:${page.id}`, [title, t('ta.settings.navigation')], React.createElement(Row, { label: title, description: where(page.id) },
@@ -65,6 +65,21 @@ export declare namespace SettingsViewUtil {
65
65
  }, P extends {
66
66
  sections: S[];
67
67
  }>(parts: P[], query: string): P[];
68
+ /**
69
+ * The sections most people look for (`tier` common, docs/design/ta-simple.md 4.2), in their parts; the parts left.
70
+ * The others are a row away (More settings), and the search finds them.
71
+ */
72
+ function common<S extends {
73
+ tier?: string;
74
+ }, P extends {
75
+ sections: S[];
76
+ }>(parts: P[]): P[];
77
+ /** How many sections `common` leaves out. */
78
+ function hidden(parts: readonly {
79
+ sections: readonly {
80
+ tier?: string;
81
+ }[];
82
+ }[]): number;
68
83
  /**
69
84
  * The sections in their parts, in the order of `groups`: a section without a group in the first, those of a part by
70
85
  * `order` (default 0), in the order given for the same; parts without a section left out.
@@ -70,6 +70,19 @@ export var SettingsViewUtil;
70
70
  .filter(part => part.sections.length > 0);
71
71
  }
72
72
  SettingsViewUtil.filter = filter;
73
+ /**
74
+ * The sections most people look for (`tier` common, docs/design/ta-simple.md 4.2), in their parts; the parts left.
75
+ * The others are a row away (More settings), and the search finds them.
76
+ */
77
+ function common(parts) {
78
+ return parts.map(part => ({ ...part, sections: part.sections.filter(entry => entry.tier === 'common') })).filter(part => part.sections.length > 0);
79
+ }
80
+ SettingsViewUtil.common = common;
81
+ /** How many sections `common` leaves out. */
82
+ function hidden(parts) {
83
+ return parts.reduce((count, part) => count + part.sections.filter(entry => entry.tier !== 'common').length, 0);
84
+ }
85
+ SettingsViewUtil.hidden = hidden;
73
86
  /**
74
87
  * The sections in their parts, in the order of `groups`: a section without a group in the first, those of a part by
75
88
  * `order` (default 0), in the order given for the same; parts without a section left out.
@@ -58,7 +58,8 @@ export function useMoreSections(onDialog) {
58
58
  danger: true,
59
59
  });
60
60
  if (confirmed) {
61
- void run(`remove:${pkg.id}`, () => packageList.remove(pkg), t('ta.packages.removed', { name: pkg.name }));
61
+ await packageList.remove(pkg);
62
+ notices.notify(t('ta.packages.removed', { name: pkg.name }), { level: 'success' });
62
63
  }
63
64
  };
64
65
  const toggleBuiltin = (name, on) => {
@@ -97,7 +98,7 @@ export function useMoreSections(onDialog) {
97
98
  return row(`package:${pkg.id}`, [title, summary, pkg.name, t('ta.packages')], React.createElement(Row, { icon: icon, label: title, description: error
98
99
  ? t('ta.packages.failed', { error })
99
100
  : [summary, t(pkg.scope === 'project' ? 'ta.packages.scope.project' : 'ta.packages.scope.user')].filter(Boolean).join(' · ') },
100
- React.createElement(IconButton, { icon: Trash2, label: t('ta.packages.remove'), busy: busy === `remove:${pkg.id}`, disabled: waits(`remove:${pkg.id}`), onClick: () => void remove(pkg) }),
101
+ React.createElement(IconButton, { icon: Trash2, label: t('ta.packages.remove'), busy: busy === `remove:${pkg.id}`, disabled: waits(`remove:${pkg.id}`), onClick: () => void run(`remove:${pkg.id}`, () => remove(pkg)) }),
101
102
  React.createElement(Switch, { label: title, checked: pkg.enabled, disabled: waits(`toggle:${pkg.id}`), onChange: on => run(`toggle:${pkg.id}`, () => packageList.toggle(pkg, on)) })));
102
103
  }),
103
104
  ...(packages.length === 0
@@ -222,6 +223,7 @@ export function useMoreSections(onDialog) {
222
223
  title: t('ta.settings.about'),
223
224
  icon: Info,
224
225
  order: 1000,
226
+ tier: 'common',
225
227
  rows: workbench.server
226
228
  ? [
227
229
  row('version', [t('ta.settings.version'), 'version'], React.createElement(Row, { label: t('ta.settings.version'), description: restartTa.update
@@ -231,8 +233,8 @@ export function useMoreSections(onDialog) {
231
233
  ...(restartTa.can
232
234
  ? [
233
235
  row('restart', [t('ta.restart'), t('ta.restart.description'), 'restart', 'update'], React.createElement(Row, { label: t('ta.restart'), description: t('ta.restart.description') },
234
- React.createElement("button", { type: "button", className: `ta-button${restartTa.update || restartTa.release ? ' ta-primary' : ''}`, disabled: restartTa.restarting || ((_a = restartTa.release) === null || _a === void 0 ? void 0 : _a.installing), onClick: () => void (restartTa.release && !restartTa.update ? restartTa.install() : restartTa.restart()) },
235
- restartTa.restarting || ((_b = restartTa.release) === null || _b === void 0 ? void 0 : _b.installing) ? (React.createElement("span", { className: "ta-spinner" })) : (React.createElement(Icon, { icon: RotateCw, size: 15 })),
236
+ React.createElement("button", { type: "button", className: `ta-button${restartTa.update || restartTa.release ? ' ta-primary' : ''}`, disabled: restartTa.restarting || ((_a = restartTa.release) === null || _a === void 0 ? void 0 : _a.installing) || waits('restart'), onClick: () => void run('restart', () => (restartTa.release && !restartTa.update ? restartTa.install() : restartTa.restart())) },
237
+ busy === 'restart' || restartTa.restarting || ((_b = restartTa.release) === null || _b === void 0 ? void 0 : _b.installing) ? (React.createElement("span", { className: "ta-spinner" })) : (React.createElement(Icon, { icon: RotateCw, size: 15 })),
236
238
  ' ',
237
239
  t(restartTa.release && !restartTa.update ? 'ta.release.install' : 'ta.restart.button')))),
238
240
  ]
@@ -1,4 +1,4 @@
1
- import { type TaSettingsScope } from '@celljs/ta-protocol';
1
+ import { type TaSettingsScope, type TaTier } from '@celljs/ta-protocol';
2
2
  import * as React from 'react';
3
3
  import type { WebSettingsGroup } from '../extension/web-extension-api.js';
4
4
  import type { Glyph } from './icon.js';
@@ -14,6 +14,8 @@ export interface SectionEntry {
14
14
  order?: number;
15
15
  /** A setting of pi's files, of the user or of the project: under the scope of its part (Part.lead). */
16
16
  scoped?: boolean;
17
+ /** `common`: shown from the start; the others under More settings (SettingsViewUtil.common). */
18
+ tier?: TaTier;
17
19
  }
18
20
  export interface Part {
19
21
  id: string;
@@ -39,6 +39,7 @@ export function useParts(scope, onScope, onDialog) {
39
39
  id: 'appearance',
40
40
  title: t('ta.settings.appearance'),
41
41
  icon: Palette,
42
+ tier: 'common',
42
43
  rows: [
43
44
  row('theme', [t('ta.settings.theme'), 'theme'], React.createElement(Row, { label: t('ta.settings.theme'), stacked: true },
44
45
  React.createElement(Segmented, { label: t('ta.settings.theme'), value: settings.theme, choices: THEMES, onChange: theme => store.update({ theme }) }))),
@@ -72,6 +73,7 @@ export function useParts(scope, onScope, onDialog) {
72
73
  id: 'language',
73
74
  title: t('ta.settings.language'),
74
75
  icon: Languages,
76
+ tier: 'common',
75
77
  // A phone has no room for five names side by side: a row each, as its own settings have them.
76
78
  rows: handheld
77
79
  ? LANGUAGES.map(choice => {
@@ -185,6 +187,7 @@ export function useParts(scope, onScope, onDialog) {
185
187
  icon: (_a = GROUP_ICONS[group.id]) !== null && _a !== void 0 ? _a : Wrench,
186
188
  group: 'ta',
187
189
  scoped: true,
190
+ ...(group.id === 'model' ? { tier: 'common' } : {}),
188
191
  rows: snapshot
189
192
  ? group.keys.flatMap(key => {
190
193
  const spec = AgentSettingsUtil.spec(key);
@@ -1,6 +1,8 @@
1
- import { ChevronLeft, Menu, Search, X } from 'lucide-react';
1
+ import { ChevronLeft, Menu, Search, Settings2, X } from 'lucide-react';
2
2
  import * as React from 'react';
3
3
  import { useDevice } from '../device/device.js';
4
+ import { WebMetrics } from '../extension/web-metrics.js';
5
+ import { useSettings } from '../hooks.js';
4
6
  import { useT } from '../i18n/use-t.js';
5
7
  import { ScreenUtil } from '../screen/screen-protocol.js';
6
8
  import { useScreenPart } from '../screen/use-screen-part.js';
@@ -27,6 +29,15 @@ export function SettingsView({ section, onClose, onMenu, onBack }) {
27
29
  const [dialog, setDialog] = React.useState();
28
30
  const closeDialog = React.useCallback(() => setDialog(undefined), []);
29
31
  const parts = useParts(scope, setScope, setDialog);
32
+ const [{ settings }] = useSettings();
33
+ // The sections most people look for first, the others a row away (docs/design/ta-simple.md 4.2); all of them for a
34
+ // search, for one asked for that is not of those, and for one who has every feature shown.
35
+ const [more, setMore] = React.useState(false);
36
+ React.useEffect(() => { var _a; return (_a = WebMetrics.current) === null || _a === void 0 ? void 0 : _a.own(more ? 'page:settings-more' : 'page:settings'); }, [more]);
37
+ const asked = section !== undefined && parts.some(part => part.sections.some(entry => entry.id === section && entry.tier !== 'common'));
38
+ const all = settings.allFeatures || more || asked || !!query.trim();
39
+ const shownParts = all ? parts : SettingsViewUtil.common(parts);
40
+ const onMore = all || SettingsViewUtil.hidden(parts) === 0 ? undefined : () => setMore(true);
30
41
  // What an agent reads of the settings and where it goes in them (docs/design/ta-app-use.md 3); the rows are read as they show.
31
42
  useScreenPart({
32
43
  id: 'settings',
@@ -40,6 +51,9 @@ export function SettingsView({ section, onClose, onMenu, onBack }) {
40
51
  var _a;
41
52
  var _b, _c;
42
53
  const entry = parts.flatMap(part => part.sections).find(candidate => candidate.id === id);
54
+ if (entry && entry.tier !== 'common' && !all) {
55
+ setMore(true);
56
+ }
43
57
  const root = document.querySelector('[data-ta-part="settings"]');
44
58
  const link = (_b = root === null || root === void 0 ? void 0 : root.querySelector(`[data-ta-item="${CSS.escape(id !== null && id !== void 0 ? id : '')}"]`)) !== null && _b !== void 0 ? _b : [...((_c = root === null || root === void 0 ? void 0 : root.querySelectorAll('.ta-list-main')) !== null && _c !== void 0 ? _c : [])].find(button => { var _a; return ((_a = button.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === (entry === null || entry === void 0 ? void 0 : entry.title); });
45
59
  if (link) {
@@ -62,11 +76,17 @@ export function SettingsView({ section, onClose, onMenu, onBack }) {
62
76
  React.createElement(Icon, { icon: Search, size: 14 }),
63
77
  React.createElement("input", { value: query, placeholder: t('ta.settings.search'), "aria-label": t('ta.settings.search'), onChange: event => setQuery(event.target.value) }),
64
78
  query && React.createElement(IconButton, { icon: X, label: t('ta.close'), onClick: () => setQuery('') })));
65
- const props = { parts, query, search, section };
79
+ const props = { parts: shownParts, query, search, section, onMore };
66
80
  return (React.createElement("section", { className: "ta-settings-page", "aria-label": t('ta.settings'), ...ScreenUtil.part('settings') },
67
81
  handheld ? React.createElement(PhoneSettings, { ...props, onBack: onBack !== null && onBack !== void 0 ? onBack : onClose }) : React.createElement(WideSettings, { ...props, onClose: onClose, onMenu: onMenu, onBack: onBack }),
68
82
  dialog === 'directory' && React.createElement(WorkingDirectoryPicker, { onClose: closeDialog })));
69
83
  }
84
+ /** The row under the sections that shows the others. */
85
+ function MoreRow({ onMore }) {
86
+ const t = useT();
87
+ return (React.createElement(ListGroup, null,
88
+ React.createElement(ListRow, { icon: Settings2, label: t('ta.settings.more'), onClick: onMore })));
89
+ }
70
90
  /** The rows of a section, in a card. */
71
91
  function SectionRows({ entry }) {
72
92
  return entry.rows.length > 0 ? (React.createElement("div", { className: "ta-setting-card" }, entry.rows.map(candidate => (React.createElement(React.Fragment, { key: candidate.key }, candidate.node))))) : null;
@@ -77,7 +97,7 @@ function SectionRows({ entry }) {
77
97
  * packages, the settings of ta) and grows, until the user scrolls; marked on the left even when the page
78
98
  * cannot scroll it to the top.
79
99
  */
80
- function WideSettings({ parts, query, search, section, onClose, onMenu, onBack }) {
100
+ function WideSettings({ parts, query, search, section, onMore, onClose, onMenu, onBack }) {
81
101
  const t = useT();
82
102
  const [active, setActive] = React.useState(section !== null && section !== void 0 ? section : 'appearance');
83
103
  const scroller = React.useRef(null);
@@ -149,11 +169,15 @@ function WideSettings({ parts, query, search, section, onClose, onMenu, onBack }
149
169
  search,
150
170
  onMenu && React.createElement(IconButton, { icon: X, label: t('ta.close'), onClick: onClose })),
151
171
  React.createElement("div", { className: "ta-settings-body" },
152
- React.createElement("nav", { className: "ta-settings-toc", "aria-label": t('ta.settings') }, shown.map(part => (React.createElement("div", { key: part.id, className: "ta-settings-toc-part" },
153
- React.createElement("button", { type: "button", className: "ta-settings-toc-group", onClick: () => go(part.sections[0].id, 'smooth') }, part.title),
154
- part.sections.map(entry => (React.createElement("button", { key: entry.id, type: "button", className: `ta-settings-toc-item${active === entry.id ? ' ta-active' : ''}`, "aria-current": active === entry.id || undefined, onClick: () => go(entry.id, 'smooth'), ...ScreenUtil.item(entry.id) },
155
- React.createElement(Icon, { icon: entry.icon, size: 14 }),
156
- React.createElement("span", { className: "ta-ellipsis" }, entry.title)))))))),
172
+ React.createElement("nav", { className: "ta-settings-toc", "aria-label": t('ta.settings') },
173
+ shown.map(part => (React.createElement("div", { key: part.id, className: "ta-settings-toc-part" },
174
+ React.createElement("button", { type: "button", className: "ta-settings-toc-group", onClick: () => go(part.sections[0].id, 'smooth') }, part.title),
175
+ part.sections.map(entry => (React.createElement("button", { key: entry.id, type: "button", className: `ta-settings-toc-item${active === entry.id ? ' ta-active' : ''}`, "aria-current": active === entry.id || undefined, onClick: () => go(entry.id, 'smooth'), ...ScreenUtil.item(entry.id) },
176
+ React.createElement(Icon, { icon: entry.icon, size: 14 }),
177
+ React.createElement("span", { className: "ta-ellipsis" }, entry.title))))))),
178
+ onMore && (React.createElement("button", { type: "button", className: "ta-settings-toc-item", onClick: onMore },
179
+ React.createElement(Icon, { icon: Settings2, size: 14 }),
180
+ React.createElement("span", { className: "ta-ellipsis" }, t('ta.settings.more'))))),
157
181
  React.createElement("div", { className: "ta-settings-scroll", ref: scroller, onScroll: onScroll },
158
182
  React.createElement("div", { className: "ta-settings-content", ref: content },
159
183
  shown.length === 0 && React.createElement(EmptyState, { title: t('ta.settings.noMatch', { query: query.trim() }) }),
@@ -166,7 +190,8 @@ function WideSettings({ parts, query, search, section, onClose, onMenu, onBack }
166
190
  React.createElement(Icon, { icon: entry.icon, size: 13 }),
167
191
  " ",
168
192
  entry.title),
169
- React.createElement(SectionRows, { entry: entry })))); })))))))));
193
+ React.createElement(SectionRows, { entry: entry })))); })))),
194
+ onMore && React.createElement(MoreRow, { onMore: onMore }))))));
170
195
  }
171
196
  /** A page of a phone: its head, with the way back and its title, over a list. */
172
197
  function PhonePage({ title, onBack, children }) {
@@ -192,7 +217,7 @@ function PhoneSection({ part, entry, onBack }) {
192
217
  * section tapped pushed over it as a page of its own; a search lists the rows that match in place. A section
193
218
  * Me opened (the theme, the language, about) is that page alone, and back goes to Me.
194
219
  */
195
- function PhoneSettings({ parts, query, search, section, onBack }) {
220
+ function PhoneSettings({ parts, query, search, section, onMore, onBack }) {
196
221
  const t = useT();
197
222
  /** The section pushed over the list, kept while it slides away. */
198
223
  const [pushed, setPushed] = React.useState();
@@ -221,7 +246,8 @@ function PhoneSettings({ parts, query, search, section, onBack }) {
221
246
  React.createElement(SectionRows, { entry: entry })))))
222
247
  : parts.map(part => (React.createElement("section", { key: part.id, className: "ta-settings-phone-group", "aria-label": part.title },
223
248
  React.createElement("h2", { className: "ta-settings-phone-caption" }, part.title),
224
- React.createElement(ListGroup, null, part.sections.map(entry => (React.createElement(ListRow, { key: entry.id, icon: entry.icon, label: entry.title, onClick: () => setPushed({ id: entry.id, open: true }) })))))))));
249
+ React.createElement(ListGroup, null, part.sections.map(entry => (React.createElement(ListRow, { key: entry.id, icon: entry.icon, label: entry.title, onClick: () => setPushed({ id: entry.id, open: true }) }))))))),
250
+ !query.trim() && onMore && React.createElement(MoreRow, { onMore: onMore })));
225
251
  return React.createElement(PhoneStack, { base: list, top: top && React.createElement(PhoneSection, { ...top, onBack: close }), open: !!top && !!(pushed === null || pushed === void 0 ? void 0 : pushed.open), onClose: close });
226
252
  }
227
253
  //# sourceMappingURL=settings-view.js.map
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { useT } from '../i18n/use-t.js';
3
+ import { useBusy } from './busy.js';
3
4
  import { Face } from './face.js';
4
5
  import { PeoplePicker } from './people-picker.js';
5
6
  /** The friends of this Ta, once read; undefined while read, or where they cannot be. */
@@ -83,16 +84,14 @@ export function FriendSends({ sent }) {
83
84
  export function ShareToFriends({ rooms, notices, friends, link, title, onDone, }) {
84
85
  const t = useT();
85
86
  const [chosen, setChosen] = React.useState([]);
86
- const [busy, setBusy] = React.useState(false);
87
+ const [busy, run] = useBusy();
87
88
  const send = async () => {
88
- setBusy(true);
89
89
  try {
90
90
  await rooms.sendToFriends(chosen, { link, title });
91
91
  onDone(true);
92
92
  }
93
93
  catch (reason) {
94
94
  notices.error(reason);
95
- setBusy(false);
96
95
  }
97
96
  };
98
97
  const people = friends.map(friend => ({ key: friend.id, name: friend.name, seed: friend.id, look: friend.look, online: friend.online }));
@@ -100,7 +99,7 @@ export function ShareToFriends({ rooms, notices, friends, link, title, onDone, }
100
99
  React.createElement(PeoplePicker, { people: people, value: chosen, onChange: setChosen, disabled: busy }),
101
100
  React.createElement("div", { className: "ta-share-friends-actions" },
102
101
  React.createElement("button", { type: "button", className: "ta-button", onClick: () => onDone() }, t('ta.cancel')),
103
- React.createElement("button", { type: "button", className: `ta-button ta-primary${busy ? ' ta-busy' : ''}`, disabled: busy || chosen.length === 0, onClick: () => void send() },
102
+ React.createElement("button", { type: "button", className: `ta-button ta-primary${busy ? ' ta-busy' : ''}`, disabled: busy || chosen.length === 0, onClick: () => void run(send) },
104
103
  busy && React.createElement("span", { className: "ta-spinner ta-busy-mark" }),
105
104
  React.createElement("span", null, chosen.length ? t('ta.share.sendN', { n: chosen.length }) : t('ta.share.pickFriends'))))));
106
105
  }
@@ -2,6 +2,7 @@ import { Check, Copy, KeyRound, RefreshCw, Send, Share2 } from 'lucide-react';
2
2
  import * as React from 'react';
3
3
  import { shareMessage } from '../extension/share-sheet-compat.js';
4
4
  import { useT } from '../i18n/use-t.js';
5
+ import { useBusy } from './busy.js';
5
6
  import { EmptyState } from './empty-state.js';
6
7
  import { QrView } from './qr-view.js';
7
8
  import { FriendSends, ShareToFriends, useFriendSends, useShareFriends } from './share-friends.js';
@@ -29,7 +30,7 @@ export function Tile({ icon: Icon, label, onClick, disabled }) {
29
30
  export function ShareSheet({ title, link, error, face, name, gets, invite, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, onRoomEvent, }) {
30
31
  const t = useT();
31
32
  const [copied, copy] = useCopied();
32
- const [stopping, setStopping] = React.useState(false);
33
+ const [stopping, run] = useBusy();
33
34
  const [picking, setPicking] = React.useState(false);
34
35
  const friends = useShareFriends(rooms);
35
36
  const [sends, setSends] = React.useState(0);
@@ -40,14 +41,12 @@ export function ShareSheet({ title, link, error, face, name, gets, invite, notes
40
41
  if (!onStop || (stop && !(await notices.confirm({ title: stop.title, message: stop.message, confirmLabel: t('ta.share.stop'), danger: true })))) {
41
42
  return;
42
43
  }
43
- setStopping(true);
44
44
  try {
45
45
  await onStop();
46
46
  onClose();
47
47
  }
48
48
  catch (reason) {
49
49
  notices.error(reason);
50
- setStopping(false);
51
50
  }
52
51
  };
53
52
  const lines = (notes !== null && notes !== void 0 ? notes : []).filter((line) => !!line);
@@ -81,7 +80,7 @@ export function ShareSheet({ title, link, error, face, name, gets, invite, notes
81
80
  !picking && React.createElement(FriendSends, { sent: sent }),
82
81
  children,
83
82
  lines.length > 0 && (React.createElement("div", { className: "ta-share-notes" }, lines.map(line => (React.createElement("p", { key: line }, line))))),
84
- onStop && link && (React.createElement("button", { type: "button", className: `ta-share-stop${stopping ? ' ta-busy' : ''}`, disabled: stopping, onClick: () => void end() },
83
+ onStop && link && (React.createElement("button", { type: "button", className: `ta-share-stop${stopping ? ' ta-busy' : ''}`, disabled: stopping, onClick: () => void run(end) },
85
84
  stopping && React.createElement("span", { className: "ta-spinner ta-busy-mark" }),
86
85
  React.createElement("span", null, t('ta.share.stop')))))))));
87
86
  }