@celljs/ta-web 4.42.0 → 4.43.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 (314) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/esm/browser/apps/web-apps.d.ts +4 -0
  4. package/esm/browser/apps/web-apps.js +14 -3
  5. package/esm/browser/assistant/ta-hearing.d.ts +85 -0
  6. package/esm/browser/assistant/ta-hearing.js +272 -0
  7. package/esm/browser/components/auth-view.js +1 -1
  8. package/esm/browser/components/board.js +9 -1
  9. package/esm/browser/components/clipboard-link-host.d.ts +2 -0
  10. package/esm/browser/components/clipboard-link-host.js +27 -0
  11. package/esm/browser/components/cloud-network.js +1 -1
  12. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  13. package/esm/browser/components/custom-provider-advanced.js +8 -8
  14. package/esm/browser/components/custom-provider-view.js +12 -12
  15. package/esm/browser/components/empty-state.d.ts +2 -1
  16. package/esm/browser/components/empty-state.js +6 -2
  17. package/esm/browser/components/folder-picker.js +2 -2
  18. package/esm/browser/components/gallery.js +8 -9
  19. package/esm/browser/components/hearing-host.d.ts +5 -0
  20. package/esm/browser/components/hearing-host.js +58 -0
  21. package/esm/browser/components/host-view.d.ts +1 -1
  22. package/esm/browser/components/link-dialog.js +4 -0
  23. package/esm/browser/components/loading.d.ts +3 -2
  24. package/esm/browser/components/loading.js +7 -3
  25. package/esm/browser/components/markdown.d.ts +3 -1
  26. package/esm/browser/components/markdown.js +10 -5
  27. package/esm/browser/components/media.d.ts +10 -4
  28. package/esm/browser/components/media.js +60 -14
  29. package/esm/browser/components/people-picker.d.ts +17 -0
  30. package/esm/browser/components/people-picker.js +129 -0
  31. package/esm/browser/components/relay-view.js +1 -1
  32. package/esm/browser/components/settings-parts.js +2 -0
  33. package/esm/browser/components/share-dialog.d.ts +2 -2
  34. package/esm/browser/components/share-dialog.js +7 -4
  35. package/esm/browser/components/share-friends.js +3 -10
  36. package/esm/browser/components/share-item-sheet.d.ts +12 -0
  37. package/esm/browser/components/share-item-sheet.js +39 -0
  38. package/esm/browser/components/share-sheet.d.ts +9 -2
  39. package/esm/browser/components/share-sheet.js +5 -4
  40. package/esm/browser/components/sign-in-setup.js +4 -4
  41. package/esm/browser/components/trusted-domains.js +1 -1
  42. package/esm/browser/components/view-room.d.ts +25 -0
  43. package/esm/browser/components/view-room.js +136 -0
  44. package/esm/browser/components/voice-services.js +6 -6
  45. package/esm/browser/device/device-protocol.d.ts +9 -6
  46. package/esm/browser/device/device-protocol.js +7 -4
  47. package/esm/browser/device/launch-screen.d.ts +11 -1
  48. package/esm/browser/device/launch-screen.js +22 -4
  49. package/esm/browser/extension/share-sheet-compat.d.ts +2 -0
  50. package/esm/browser/extension/share-sheet-compat.js +12 -2
  51. package/esm/browser/extension/web-api-code.d.ts +11 -0
  52. package/esm/browser/extension/web-api-components.d.ts +8 -1
  53. package/esm/browser/extension/web-api-contributions.d.ts +30 -1
  54. package/esm/browser/extension/web-api-desktop.d.ts +2 -1
  55. package/esm/browser/extension/web-api-file-views.d.ts +38 -0
  56. package/esm/browser/extension/web-api-file-views.js +2 -0
  57. package/esm/browser/extension/web-api-host.d.ts +47 -0
  58. package/esm/browser/extension/web-api-host.js +3 -0
  59. package/esm/browser/extension/web-api-menus.d.ts +46 -0
  60. package/esm/browser/extension/web-api-partners.d.ts +58 -1
  61. package/esm/browser/extension/web-api-spec.js +7 -0
  62. package/esm/browser/extension/web-extension-api.d.ts +10 -10
  63. package/esm/browser/extension/web-extension-context.d.ts +2 -8
  64. package/esm/browser/extension/web-extension-context.js +14 -39
  65. package/esm/browser/extension/web-extension-marks.d.ts +10 -0
  66. package/esm/browser/extension/web-extension-marks.js +29 -0
  67. package/esm/browser/extension/web-extension-protocol.d.ts +11 -1
  68. package/esm/browser/extension/web-extension-protocol.js +3 -0
  69. package/esm/browser/extension/web-extension-run.d.ts +15 -2
  70. package/esm/browser/extension/web-extension-run.js +77 -0
  71. package/esm/browser/extension/web-extensions-running.d.ts +5 -1
  72. package/esm/browser/extension/web-extensions-running.js +16 -0
  73. package/esm/browser/extension/web-extensions.d.ts +2 -1
  74. package/esm/browser/extension/web-extensions.js +3 -0
  75. package/esm/browser/extension/web-home.js +3 -1
  76. package/esm/browser/extension/web-host-values.d.ts +66 -0
  77. package/esm/browser/extension/web-host-values.js +191 -0
  78. package/esm/browser/extension/web-hosts.d.ts +7 -2
  79. package/esm/browser/extension/web-hosts.js +16 -4
  80. package/esm/browser/extension/web-share-ui.d.ts +7 -0
  81. package/esm/browser/extension/web-share-ui.js +15 -0
  82. package/esm/browser/extension/web-share.d.ts +18 -0
  83. package/esm/browser/extension/web-share.js +42 -0
  84. package/esm/browser/i18n/en/chat.d.ts +10 -0
  85. package/esm/browser/i18n/en/chat.js +10 -0
  86. package/esm/browser/i18n/en/common.d.ts +18 -0
  87. package/esm/browser/i18n/en/common.js +18 -0
  88. package/esm/browser/i18n/en/discover.d.ts +7 -0
  89. package/esm/browser/i18n/en/discover.js +7 -0
  90. package/esm/browser/i18n/en/settings.d.ts +2 -0
  91. package/esm/browser/i18n/en/settings.js +2 -0
  92. package/esm/browser/i18n/ja/chat.js +10 -0
  93. package/esm/browser/i18n/ja/common.js +18 -0
  94. package/esm/browser/i18n/ja/discover.js +7 -0
  95. package/esm/browser/i18n/ja/settings.js +2 -0
  96. package/esm/browser/i18n/locales.d.ts +38 -1
  97. package/esm/browser/i18n/messages.d.ts +37 -0
  98. package/esm/browser/i18n/zh/chat.js +10 -0
  99. package/esm/browser/i18n/zh/common.js +18 -0
  100. package/esm/browser/i18n/zh/discover.js +7 -0
  101. package/esm/browser/i18n/zh/settings.js +2 -0
  102. package/esm/browser/i18n/zh-tw/chat.js +10 -0
  103. package/esm/browser/i18n/zh-tw/common.js +18 -0
  104. package/esm/browser/i18n/zh-tw/discover.js +7 -0
  105. package/esm/browser/i18n/zh-tw/settings.js +2 -0
  106. package/esm/browser/launch-art/art-palette.d.ts +41 -0
  107. package/esm/browser/launch-art/art-palette.js +72 -0
  108. package/esm/browser/launch-art/cyclic-automaton.d.ts +45 -0
  109. package/esm/browser/launch-art/cyclic-automaton.js +176 -0
  110. package/esm/browser/launch-art/fractal-tree.d.ts +43 -0
  111. package/esm/browser/launch-art/fractal-tree.js +48 -0
  112. package/esm/browser/launch-art/launch-art.d.ts +98 -0
  113. package/esm/browser/launch-art/launch-art.js +420 -0
  114. package/esm/browser/launch-art/launch-sky.d.ts +66 -0
  115. package/esm/browser/launch-art/launch-sky.js +153 -0
  116. package/esm/browser/links/clipboard-links.d.ts +89 -0
  117. package/esm/browser/links/clipboard-links.js +303 -0
  118. package/esm/browser/links/link-text.d.ts +29 -0
  119. package/esm/browser/links/link-text.js +97 -0
  120. package/esm/browser/links/links-protocol.d.ts +12 -1
  121. package/esm/browser/links/links.d.ts +8 -2
  122. package/esm/browser/links/links.js +33 -3
  123. package/esm/browser/markdown/code-renderers.d.ts +4 -0
  124. package/esm/browser/markdown/code-renderers.js +4 -0
  125. package/esm/browser/partners/group-picker.js +23 -29
  126. package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
  127. package/esm/browser/sandbox/work/work-senses.js +1 -1
  128. package/esm/browser/settings/settings-protocol.d.ts +2 -0
  129. package/esm/browser/settings/settings-protocol.js +2 -0
  130. package/esm/browser/style/base.d.ts +1 -1
  131. package/esm/browser/style/base.js +10 -6
  132. package/esm/browser/style/chat-list.d.ts +1 -1
  133. package/esm/browser/style/chat-list.js +28 -15
  134. package/esm/browser/style/conversation-column.d.ts +1 -1
  135. package/esm/browser/style/conversation.d.ts +1 -1
  136. package/esm/browser/style/conversation.js +2 -2
  137. package/esm/browser/style/dialogs.d.ts +1 -1
  138. package/esm/browser/style/dialogs.js +2 -5
  139. package/esm/browser/style/forms.d.ts +5 -0
  140. package/esm/browser/style/forms.js +65 -0
  141. package/esm/browser/style/layout.d.ts +1 -1
  142. package/esm/browser/style/pages.d.ts +1 -1
  143. package/esm/browser/style/pages.js +14 -24
  144. package/esm/browser/style/phone.d.ts +1 -1
  145. package/esm/browser/style/shared.d.ts +1 -1
  146. package/esm/browser/style/shell.d.ts +1 -1
  147. package/esm/browser/style/shell.js +1 -6
  148. package/esm/browser/style/surfaces.d.ts +1 -1
  149. package/esm/browser/style/surfaces.js +0 -6
  150. package/esm/browser/style/tasks.d.ts +1 -1
  151. package/esm/browser/style.js +2 -0
  152. package/esm/browser/util/voice.d.ts +18 -0
  153. package/esm/browser/util/voice.js +111 -3
  154. package/esm/browser/workbench-protocol.d.ts +2 -0
  155. package/esm/browser/workbench-services.d.ts +2 -0
  156. package/esm/browser/workbench-services.js +5 -0
  157. package/esm/browser/workbench.js +5 -0
  158. package/lib/browser/apps/web-apps.d.ts +4 -0
  159. package/lib/browser/apps/web-apps.js +14 -3
  160. package/lib/browser/assistant/ta-hearing.d.ts +86 -0
  161. package/lib/browser/assistant/ta-hearing.js +277 -0
  162. package/lib/browser/components/auth-view.js +1 -1
  163. package/lib/browser/components/board.js +9 -1
  164. package/lib/browser/components/clipboard-link-host.d.ts +3 -0
  165. package/lib/browser/components/clipboard-link-host.js +63 -0
  166. package/lib/browser/components/cloud-network.js +1 -1
  167. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  168. package/lib/browser/components/custom-provider-advanced.js +8 -8
  169. package/lib/browser/components/custom-provider-view.js +12 -12
  170. package/lib/browser/components/empty-state.d.ts +2 -1
  171. package/lib/browser/components/empty-state.js +6 -2
  172. package/lib/browser/components/folder-picker.js +2 -2
  173. package/lib/browser/components/gallery.js +7 -8
  174. package/lib/browser/components/hearing-host.d.ts +6 -0
  175. package/lib/browser/components/hearing-host.js +94 -0
  176. package/lib/browser/components/host-view.d.ts +1 -1
  177. package/lib/browser/components/link-dialog.js +4 -0
  178. package/lib/browser/components/loading.d.ts +3 -2
  179. package/lib/browser/components/loading.js +7 -3
  180. package/lib/browser/components/markdown.d.ts +3 -1
  181. package/lib/browser/components/markdown.js +9 -4
  182. package/lib/browser/components/media.d.ts +10 -4
  183. package/lib/browser/components/media.js +61 -14
  184. package/lib/browser/components/people-picker.d.ts +18 -0
  185. package/lib/browser/components/people-picker.js +166 -0
  186. package/lib/browser/components/relay-view.js +1 -1
  187. package/lib/browser/components/settings-parts.js +2 -0
  188. package/lib/browser/components/share-dialog.d.ts +2 -2
  189. package/lib/browser/components/share-dialog.js +7 -4
  190. package/lib/browser/components/share-friends.js +3 -10
  191. package/lib/browser/components/share-item-sheet.d.ts +13 -0
  192. package/lib/browser/components/share-item-sheet.js +75 -0
  193. package/lib/browser/components/share-sheet.d.ts +9 -2
  194. package/lib/browser/components/share-sheet.js +5 -3
  195. package/lib/browser/components/sign-in-setup.js +4 -4
  196. package/lib/browser/components/trusted-domains.js +1 -1
  197. package/lib/browser/components/view-room.d.ts +26 -0
  198. package/lib/browser/components/view-room.js +173 -0
  199. package/lib/browser/components/voice-services.js +6 -6
  200. package/lib/browser/device/device-protocol.d.ts +9 -6
  201. package/lib/browser/device/device-protocol.js +7 -4
  202. package/lib/browser/device/launch-screen.d.ts +11 -1
  203. package/lib/browser/device/launch-screen.js +22 -4
  204. package/lib/browser/extension/share-sheet-compat.d.ts +2 -0
  205. package/lib/browser/extension/share-sheet-compat.js +13 -2
  206. package/lib/browser/extension/web-api-code.d.ts +11 -0
  207. package/lib/browser/extension/web-api-components.d.ts +8 -1
  208. package/lib/browser/extension/web-api-contributions.d.ts +30 -1
  209. package/lib/browser/extension/web-api-desktop.d.ts +2 -1
  210. package/lib/browser/extension/web-api-file-views.d.ts +39 -0
  211. package/lib/browser/extension/web-api-file-views.js +3 -0
  212. package/lib/browser/extension/web-api-host.d.ts +48 -0
  213. package/lib/browser/extension/web-api-host.js +4 -0
  214. package/lib/browser/extension/web-api-menus.d.ts +46 -0
  215. package/lib/browser/extension/web-api-partners.d.ts +58 -1
  216. package/lib/browser/extension/web-api-spec.js +7 -0
  217. package/lib/browser/extension/web-extension-api.d.ts +10 -10
  218. package/lib/browser/extension/web-extension-context.d.ts +2 -8
  219. package/lib/browser/extension/web-extension-context.js +14 -39
  220. package/lib/browser/extension/web-extension-marks.d.ts +11 -0
  221. package/lib/browser/extension/web-extension-marks.js +65 -0
  222. package/lib/browser/extension/web-extension-protocol.d.ts +11 -1
  223. package/lib/browser/extension/web-extension-protocol.js +3 -0
  224. package/lib/browser/extension/web-extension-run.d.ts +15 -2
  225. package/lib/browser/extension/web-extension-run.js +77 -0
  226. package/lib/browser/extension/web-extensions-running.d.ts +5 -1
  227. package/lib/browser/extension/web-extensions-running.js +16 -0
  228. package/lib/browser/extension/web-extensions.d.ts +2 -1
  229. package/lib/browser/extension/web-extensions.js +3 -0
  230. package/lib/browser/extension/web-home.js +3 -1
  231. package/lib/browser/extension/web-host-values.d.ts +67 -0
  232. package/lib/browser/extension/web-host-values.js +229 -0
  233. package/lib/browser/extension/web-hosts.d.ts +7 -2
  234. package/lib/browser/extension/web-hosts.js +16 -4
  235. package/lib/browser/extension/web-share-ui.d.ts +8 -0
  236. package/lib/browser/extension/web-share-ui.js +51 -0
  237. package/lib/browser/extension/web-share.d.ts +19 -0
  238. package/lib/browser/extension/web-share.js +45 -0
  239. package/lib/browser/i18n/en/chat.d.ts +10 -0
  240. package/lib/browser/i18n/en/chat.js +10 -0
  241. package/lib/browser/i18n/en/common.d.ts +18 -0
  242. package/lib/browser/i18n/en/common.js +18 -0
  243. package/lib/browser/i18n/en/discover.d.ts +7 -0
  244. package/lib/browser/i18n/en/discover.js +7 -0
  245. package/lib/browser/i18n/en/settings.d.ts +2 -0
  246. package/lib/browser/i18n/en/settings.js +2 -0
  247. package/lib/browser/i18n/ja/chat.js +10 -0
  248. package/lib/browser/i18n/ja/common.js +18 -0
  249. package/lib/browser/i18n/ja/discover.js +7 -0
  250. package/lib/browser/i18n/ja/settings.js +2 -0
  251. package/lib/browser/i18n/locales.d.ts +38 -1
  252. package/lib/browser/i18n/messages.d.ts +37 -0
  253. package/lib/browser/i18n/zh/chat.js +10 -0
  254. package/lib/browser/i18n/zh/common.js +18 -0
  255. package/lib/browser/i18n/zh/discover.js +7 -0
  256. package/lib/browser/i18n/zh/settings.js +2 -0
  257. package/lib/browser/i18n/zh-tw/chat.js +10 -0
  258. package/lib/browser/i18n/zh-tw/common.js +18 -0
  259. package/lib/browser/i18n/zh-tw/discover.js +7 -0
  260. package/lib/browser/i18n/zh-tw/settings.js +2 -0
  261. package/lib/browser/launch-art/art-palette.d.ts +42 -0
  262. package/lib/browser/launch-art/art-palette.js +76 -0
  263. package/lib/browser/launch-art/cyclic-automaton.d.ts +46 -0
  264. package/lib/browser/launch-art/cyclic-automaton.js +180 -0
  265. package/lib/browser/launch-art/fractal-tree.d.ts +44 -0
  266. package/lib/browser/launch-art/fractal-tree.js +52 -0
  267. package/lib/browser/launch-art/launch-art.d.ts +99 -0
  268. package/lib/browser/launch-art/launch-art.js +424 -0
  269. package/lib/browser/launch-art/launch-sky.d.ts +67 -0
  270. package/lib/browser/launch-art/launch-sky.js +157 -0
  271. package/lib/browser/links/clipboard-links.d.ts +90 -0
  272. package/lib/browser/links/clipboard-links.js +308 -0
  273. package/lib/browser/links/link-text.d.ts +30 -0
  274. package/lib/browser/links/link-text.js +100 -0
  275. package/lib/browser/links/links-protocol.d.ts +12 -1
  276. package/lib/browser/links/links.d.ts +8 -2
  277. package/lib/browser/links/links.js +33 -3
  278. package/lib/browser/markdown/code-renderers.d.ts +4 -0
  279. package/lib/browser/markdown/code-renderers.js +5 -1
  280. package/lib/browser/partners/group-picker.js +23 -29
  281. package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
  282. package/lib/browser/sandbox/work/work-senses.js +1 -1
  283. package/lib/browser/settings/settings-protocol.d.ts +2 -0
  284. package/lib/browser/settings/settings-protocol.js +2 -0
  285. package/lib/browser/style/base.d.ts +1 -1
  286. package/lib/browser/style/base.js +10 -6
  287. package/lib/browser/style/chat-list.d.ts +1 -1
  288. package/lib/browser/style/chat-list.js +28 -15
  289. package/lib/browser/style/conversation-column.d.ts +1 -1
  290. package/lib/browser/style/conversation.d.ts +1 -1
  291. package/lib/browser/style/conversation.js +2 -2
  292. package/lib/browser/style/dialogs.d.ts +1 -1
  293. package/lib/browser/style/dialogs.js +2 -5
  294. package/lib/browser/style/forms.d.ts +6 -0
  295. package/lib/browser/style/forms.js +68 -0
  296. package/lib/browser/style/layout.d.ts +1 -1
  297. package/lib/browser/style/pages.d.ts +1 -1
  298. package/lib/browser/style/pages.js +14 -24
  299. package/lib/browser/style/phone.d.ts +1 -1
  300. package/lib/browser/style/shared.d.ts +1 -1
  301. package/lib/browser/style/shell.d.ts +1 -1
  302. package/lib/browser/style/shell.js +1 -6
  303. package/lib/browser/style/surfaces.d.ts +1 -1
  304. package/lib/browser/style/surfaces.js +0 -6
  305. package/lib/browser/style/tasks.d.ts +1 -1
  306. package/lib/browser/style.js +2 -0
  307. package/lib/browser/util/voice.d.ts +18 -0
  308. package/lib/browser/util/voice.js +111 -3
  309. package/lib/browser/workbench-protocol.d.ts +2 -0
  310. package/lib/browser/workbench-services.d.ts +2 -0
  311. package/lib/browser/workbench-services.js +5 -0
  312. package/lib/browser/workbench.js +5 -0
  313. package/package.json +8 -8
  314. package/public/launch.svg +3 -3
@@ -0,0 +1,129 @@
1
+ import { Check, Search } from 'lucide-react';
2
+ import * as React from 'react';
3
+ import { useT } from '../i18n/use-t.js';
4
+ import { EmptyState } from './empty-state.js';
5
+ import { Face, GroupFace } from './face.js';
6
+ import { Icon } from './icon.js';
7
+ import { Loading } from './loading.js';
8
+ import { SelectCheck } from './select-bar.js';
9
+ export var PeoplePickerUtil;
10
+ (function (PeoplePickerUtil) {
11
+ /** Those with every word of `query`, in any case, in their name, tag, line, heading or keywords. */
12
+ function filter(people, query) {
13
+ const words = query.toLowerCase().split(/\s+/).filter(Boolean);
14
+ if (!words.length) {
15
+ return [...people];
16
+ }
17
+ return people.filter(person => {
18
+ const text = [person.name, person.tag, person.detail, person.section, person.keywords].filter(Boolean).join(' ').toLowerCase();
19
+ return words.every(word => text.includes(word));
20
+ });
21
+ }
22
+ PeoplePickerUtil.filter = filter;
23
+ /** Under their headings, each heading once, in the order the first of it comes. */
24
+ function sections(people) {
25
+ const sections = [];
26
+ for (const person of people) {
27
+ const section = sections.find(each => each.title === person.section);
28
+ if (section) {
29
+ section.people.push(person);
30
+ }
31
+ else {
32
+ sections.push({ title: person.section, people: [person] });
33
+ }
34
+ }
35
+ return sections;
36
+ }
37
+ PeoplePickerUtil.sections = sections;
38
+ /** What is picked once `key` is tapped: in or out of several, in place of the one before alone. */
39
+ function toggle(value, key, single) {
40
+ if (single) {
41
+ return [key];
42
+ }
43
+ return value.includes(key) ? value.filter(each => each !== key) : [...value, key];
44
+ }
45
+ PeoplePickerUtil.toggle = toggle;
46
+ /** Whether a tap does nothing on it: it is fixed, or there are as many as may be and it is not one of them. */
47
+ function locked(person, value, max) {
48
+ return !!person.disabled || (max !== undefined && value.length >= max && !value.includes(person.key));
49
+ }
50
+ PeoplePickerUtil.locked = locked;
51
+ })(PeoplePickerUtil || (PeoplePickerUtil = {}));
52
+ /** How large a face is in a row, and among those picked in the box. */
53
+ const FACE = 36;
54
+ const CHIP = 28;
55
+ /**
56
+ * Its face as the lists draw it: its own picture (drawn at 36 px, scaled into a chip), the faces of a group chat, else
57
+ * that of its seed; whether it is online only in its row.
58
+ */
59
+ function PersonFace({ person, size = FACE }) {
60
+ var _a;
61
+ var _b;
62
+ if (person.avatar) {
63
+ return (React.createElement("span", { className: "ta-picker-face", style: { width: size, height: size }, "aria-hidden": "true" },
64
+ React.createElement("span", { style: size === FACE ? undefined : { transform: `scale(${size / FACE})` } }, person.avatar)));
65
+ }
66
+ if ((_a = person.members) === null || _a === void 0 ? void 0 : _a.length) {
67
+ return React.createElement(GroupFace, { members: person.members, size: size });
68
+ }
69
+ const online = size === FACE ? person.online : undefined;
70
+ return React.createElement(Face, { seed: (_b = person.seed) !== null && _b !== void 0 ? _b : person.key, face: person.face, look: person.look, double: person.double, online: online, size: size });
71
+ }
72
+ /** The one way to pick people of Ta (WebPeoplePickerProps; web extensions `ui.PeoplePicker`). */
73
+ export function PeoplePicker({ people, value, onChange, single, max, disabled, placeholder, empty, emptyHint }) {
74
+ const t = useT();
75
+ const [query, setQuery] = React.useState('');
76
+ if (!people) {
77
+ return React.createElement(Loading, { compact: true });
78
+ }
79
+ if (people.length === 0) {
80
+ return React.createElement(EmptyState, { compact: true, title: empty !== null && empty !== void 0 ? empty : t('ta.people.none'), hint: emptyHint });
81
+ }
82
+ const shown = PeoplePickerUtil.filter(people, query);
83
+ const picked = single ? [] : value.map(key => people.find(person => person.key === key)).filter(person => !!person);
84
+ const tap = (person) => {
85
+ if (!disabled && !PeoplePickerUtil.locked(person, value, max)) {
86
+ onChange(PeoplePickerUtil.toggle(value, person.key, single));
87
+ }
88
+ };
89
+ const label = placeholder !== null && placeholder !== void 0 ? placeholder : t('ta.people.search');
90
+ return (React.createElement("div", { className: "ta-picker" },
91
+ React.createElement("label", { className: "ta-picker-search" },
92
+ picked.length === 0 && React.createElement(Icon, { icon: Search, size: 14 }),
93
+ picked.map(person => (React.createElement("button", { key: person.key, type: "button", className: "ta-picker-chip", title: person.disabled ? person.name : t('ta.people.leaveOut', { name: person.name }), "aria-label": t('ta.people.leaveOut', { name: person.name }), disabled: disabled || person.disabled, onClick: event => {
94
+ event.preventDefault();
95
+ tap(person);
96
+ } },
97
+ React.createElement(PersonFace, { person: person, size: CHIP })))),
98
+ React.createElement("input", { value: query, placeholder: label, "aria-label": label, onChange: event => setQuery(event.target.value), onKeyDown: event => {
99
+ // The one found is taken by Enter, as a search of a messenger's picker.
100
+ if (event.key === 'Enter' && shown.length === 1) {
101
+ event.preventDefault();
102
+ tap(shown[0]);
103
+ setQuery('');
104
+ }
105
+ else if (event.key === 'Backspace' && !query && picked.length) {
106
+ const last = picked[picked.length - 1];
107
+ if (!last.disabled) {
108
+ tap(last);
109
+ }
110
+ }
111
+ } })),
112
+ React.createElement("div", { className: "ta-picker-list" },
113
+ shown.length === 0 && React.createElement(EmptyState, { compact: true, title: t('ta.people.noMatch') }),
114
+ PeoplePickerUtil.sections(shown).map(section => { var _a; return (React.createElement("div", { key: (_a = section.title) !== null && _a !== void 0 ? _a : '', className: "ta-picker-section" },
115
+ section.title && React.createElement("div", { className: "ta-picker-heading" }, section.title),
116
+ section.people.map(person => {
117
+ const on = value.includes(person.key);
118
+ return (React.createElement("button", { key: person.key, type: "button", "aria-pressed": on, className: "ta-picker-row", disabled: disabled || PeoplePickerUtil.locked(person, value, max), onClick: () => tap(person) },
119
+ !single && React.createElement(SelectCheck, { checked: on, disabled: PeoplePickerUtil.locked(person, value, max) && !on }),
120
+ React.createElement(PersonFace, { person: person }),
121
+ React.createElement("span", { className: "ta-picker-text" },
122
+ React.createElement("span", { className: "ta-picker-line" },
123
+ React.createElement("span", { className: "ta-picker-name" }, person.name),
124
+ person.tag && React.createElement("span", { className: "ta-picker-tag" }, person.tag)),
125
+ person.detail && React.createElement("span", { className: "ta-picker-detail" }, person.detail)),
126
+ single && on && React.createElement(Icon, { icon: Check, size: 16, className: "ta-picker-check" })));
127
+ }))); }))));
128
+ }
129
+ //# sourceMappingURL=people-picker.js.map
@@ -108,7 +108,7 @@ export function RelayDialog({ onClose }) {
108
108
  React.createElement(RelayPicture, null),
109
109
  React.createElement("p", null, t('ta.relay.hint')),
110
110
  React.createElement("div", { className: "ta-relay-form" },
111
- React.createElement("label", { className: "ta-field ta-field-small" },
111
+ React.createElement("label", { className: "ta-field" },
112
112
  React.createElement(Smartphone, { size: 15, strokeWidth: 1.75, "aria-hidden": "true" }),
113
113
  React.createElement("input", { placeholder: t('ta.relay.phone'), value: name, onChange: event => setName(event.target.value) })),
114
114
  React.createElement("button", { type: "button", className: busy ? 'ta-button ta-primary ta-busy' : 'ta-button ta-primary', "aria-busy": busy || undefined, disabled: !info, onClick: () => void pair() },
@@ -96,6 +96,8 @@ export function useParts(scope, onScope, onDialog) {
96
96
  // After the notices and who answers others, before what is kept.
97
97
  order: 30,
98
98
  rows: [
99
+ row('clipboard-links', [t('ta.settings.clipboardLinks'), t('ta.settings.clipboardLinksHint')], React.createElement(Row, { label: t('ta.settings.clipboardLinks'), description: t('ta.settings.clipboardLinksHint') },
100
+ React.createElement(Switch, { label: t('ta.settings.clipboardLinks'), checked: settings.clipboardLinks, onChange: clipboardLinks => store.update({ clipboardLinks }) }))),
99
101
  row('trusted-domains', [t('ta.settings.trustedDomains'), t('ta.settings.trustedDomainsHint'), ...settings.trustedDomains], React.createElement(TrustedDomains, null)),
100
102
  ],
101
103
  },
@@ -8,5 +8,5 @@ export declare function ShareDialog({ target, onClose }: {
8
8
  target: WebShareTarget;
9
9
  onClose(): void;
10
10
  }): React.JSX.Element;
11
- /** The share asked for by a web extension, over the page. */
12
- export declare function ShareHost(): React.JSX.Element | null;
11
+ /** The share asked for by a web extension, over the page: an extension handed on, or the share sheet of something. */
12
+ export declare function ShareHost(): React.JSX.Element;
@@ -3,6 +3,7 @@ import * as React from 'react';
3
3
  import { useNotices, useWebExtensions, useWorkbench } from '../hooks.js';
4
4
  import { useT } from '../i18n/use-t.js';
5
5
  import { ShareLinkUtil } from '../util/share-link.js';
6
+ import { ShareItemSheet } from './share-item-sheet.js';
6
7
  import { ShareSheet } from './share-sheet.js';
7
8
  /** The link of an extension: of its source when it is published, else of the relay, made by this computer. */
8
9
  function useShared(target) {
@@ -37,12 +38,14 @@ export function ShareDialog({ target, onClose }) {
37
38
  const [shared, error] = useShared(target);
38
39
  const packageId = target.packageId;
39
40
  const days = (shared === null || shared === void 0 ? void 0 : shared.relayed) ? Math.max(1, Math.round((shared.expiresAt - Date.now()) / 86400000)) : 0;
40
- return (React.createElement(ShareSheet, { title: t('ta.share.title', { name: target.title }), link: shared === null || shared === void 0 ? void 0 : shared.link, error: error === undefined ? undefined : error || t('ta.share.cannot'), face: React.createElement(Package, { size: 22 }), name: target.title, gets: t('ta.share.extensionGets'), notes: [(shared === null || shared === void 0 ? void 0 : shared.relayed) ? t('ta.share.relayed', { days, size: Math.round(shared.maxBytes / 1024 / 1024) }) : t('ta.share.published')], onStop: (shared === null || shared === void 0 ? void 0 : shared.relayed) && packageId ? () => bench.relay.unsharePackage(packageId) : undefined, stop: { title: t('ta.share.stopTitle', { name: target.title }), message: t('ta.share.stopHint') }, onClose: onClose, notices: notices, rooms: bench.rooms }));
41
+ return (React.createElement(ShareSheet, { title: t('ta.share.title', { name: target.title }), link: shared === null || shared === void 0 ? void 0 : shared.link, error: error === undefined ? undefined : error || t('ta.share.cannot'), face: React.createElement(Package, { size: 22 }), name: target.title, gets: t('ta.share.extensionGets'), invite: t('ta.share.extensionInvite', { name: target.title }), notes: [(shared === null || shared === void 0 ? void 0 : shared.relayed) ? t('ta.share.relayed', { days, size: Math.round(shared.maxBytes / 1024 / 1024) }) : t('ta.share.published')], onStop: (shared === null || shared === void 0 ? void 0 : shared.relayed) && packageId ? () => bench.relay.unsharePackage(packageId) : undefined, stop: { title: t('ta.share.stopTitle', { name: target.title }), message: t('ta.share.stopHint') }, onClose: onClose, notices: notices, rooms: bench.rooms }));
41
42
  }
42
- /** The share asked for by a web extension, over the page. */
43
+ /** The share asked for by a web extension, over the page: an extension handed on, or the share sheet of something. */
43
44
  export function ShareHost() {
44
45
  var _a, _b;
45
- const [{ sharing }, host] = useWebExtensions();
46
- return sharing ? React.createElement(ShareDialog, { key: (_b = (_a = sharing.packageId) !== null && _a !== void 0 ? _a : sharing.source) !== null && _b !== void 0 ? _b : sharing.title, target: sharing, onClose: () => host.share(undefined) }) : null;
46
+ const [{ sharing, sharingItem, shareWays }, host] = useWebExtensions();
47
+ return (React.createElement(React.Fragment, null,
48
+ sharing && React.createElement(ShareDialog, { key: (_b = (_a = sharing.packageId) !== null && _a !== void 0 ? _a : sharing.source) !== null && _b !== void 0 ? _b : sharing.title, target: sharing, onClose: () => host.share(undefined) }),
49
+ sharingItem && React.createElement(ShareItemSheet, { item: sharingItem, ways: shareWays, onClose: () => host.shareItem(undefined) })));
47
50
  }
48
51
  //# sourceMappingURL=share-dialog.js.map
@@ -1,7 +1,6 @@
1
- import { Check } from 'lucide-react';
2
1
  import * as React from 'react';
3
2
  import { useT } from '../i18n/use-t.js';
4
- import { Face } from './face.js';
3
+ import { PeoplePicker } from './people-picker.js';
5
4
  /** The friends of this Ta, once read; undefined while read, or where they cannot be. */
6
5
  export function useShareFriends(rooms) {
7
6
  const [friends, setFriends] = React.useState();
@@ -38,15 +37,9 @@ export function ShareToFriends({ rooms, notices, friends, link, title, onDone, }
38
37
  setBusy(false);
39
38
  }
40
39
  };
40
+ const people = friends.map(friend => ({ key: friend.id, name: friend.name, seed: friend.id, look: friend.look, online: friend.online }));
41
41
  return (React.createElement("div", { className: "ta-share-friends" },
42
- React.createElement("ul", { className: "ta-share-friend-list" }, friends.map(friend => {
43
- const on = chosen.includes(friend.id);
44
- return (React.createElement("li", { key: friend.id },
45
- React.createElement("button", { type: "button", className: `ta-share-friend${on ? ' ta-on' : ''}`, "aria-pressed": on, onClick: () => setChosen(on ? chosen.filter(id => id !== friend.id) : [...chosen, friend.id]) },
46
- React.createElement(Face, { seed: friend.id, look: friend.look, size: 36, online: friend.online }),
47
- React.createElement("span", { className: "ta-share-friend-name" }, friend.name),
48
- React.createElement("span", { className: "ta-share-friend-check" }, on && React.createElement(Check, { size: 14 })))));
49
- })),
42
+ React.createElement(PeoplePicker, { people: people, value: chosen, onChange: setChosen, disabled: busy }),
50
43
  React.createElement("div", { className: "ta-share-friends-actions" },
51
44
  React.createElement("button", { type: "button", className: "ta-button", onClick: onDone }, t('ta.cancel')),
52
45
  React.createElement("button", { type: "button", className: `ta-button ta-primary${busy ? ' ta-busy' : ''}`, disabled: busy || chosen.length === 0, onClick: () => void send() },
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import type { WebShareItem, WebShareWay } from '../extension/web-api-menus.js';
3
+ /**
4
+ * The share sheet of something (WebExtensionUI.share, docs/design/ta-links.md 4.2): what goes, as the other will see
5
+ * it, over a row of the ways that take it (registerShareWay: send to friends and group chats, post to Moments, a link).
6
+ * A way picked, the sheet closes and the way shows what it needs; the one place sharing starts, whatever is shared.
7
+ */
8
+ export declare function ShareItemSheet({ item, ways, onClose }: {
9
+ item: WebShareItem;
10
+ ways: readonly WebShareWay[];
11
+ onClose(): void;
12
+ }): React.JSX.Element;
@@ -0,0 +1,39 @@
1
+ import { Sparkles } from 'lucide-react';
2
+ import * as React from 'react';
3
+ import { WEB_ICONS } from '../extension/icons.js';
4
+ import { WebShareUtil } from '../extension/web-share.js';
5
+ import { useNotices } from '../hooks.js';
6
+ import { useT } from '../i18n/use-t.js';
7
+ import { EmptyState } from './empty-state.js';
8
+ import { Tile } from './share-sheet.js';
9
+ import { WebDialog } from './web-dialog.js';
10
+ /**
11
+ * The share sheet of something (WebExtensionUI.share, docs/design/ta-links.md 4.2): what goes, as the other will see
12
+ * it, over a row of the ways that take it (registerShareWay: send to friends and group chats, post to Moments, a link).
13
+ * A way picked, the sheet closes and the way shows what it needs; the one place sharing starts, whatever is shared.
14
+ */
15
+ export function ShareItemSheet({ item, ways, onClose }) {
16
+ var _a;
17
+ const t = useT();
18
+ const [, notices] = useNotices();
19
+ const taking = WebShareUtil.ways(ways, item);
20
+ const Icon = (_a = WEB_ICONS[WebShareUtil.icon(item)]) !== null && _a !== void 0 ? _a : Sparkles;
21
+ const name = WebShareUtil.name(item) || t('ta.share.thing');
22
+ const pick = (way) => {
23
+ onClose();
24
+ Promise.resolve()
25
+ .then(() => way.share(item))
26
+ .catch(reason => notices.error(reason));
27
+ };
28
+ return (React.createElement(WebDialog, { title: t('ta.share.titled', { name }), onClose: onClose },
29
+ React.createElement("div", { className: "ta-share" },
30
+ React.createElement("div", { className: "ta-share-card" },
31
+ React.createElement("div", { className: "ta-share-who" },
32
+ React.createElement("span", { className: "ta-share-face" },
33
+ React.createElement(Icon, { size: 22 })),
34
+ React.createElement("span", { className: "ta-share-who-text" },
35
+ React.createElement("strong", { className: "ta-share-name" }, name),
36
+ React.createElement("span", { className: "ta-share-gets" }, item.kind === 'file' ? t('ta.share.itemFile') : t('ta.share.itemWork'))))),
37
+ taking.length ? (React.createElement("div", { className: "ta-share-tiles" }, taking.map(way => (React.createElement(Tile, { key: way.key, icon: way.icon, label: WebShareUtil.label(way), onClick: () => pick(way) }))))) : (React.createElement(EmptyState, { title: t('ta.share.noWay'), compact: true })))));
38
+ }
39
+ //# sourceMappingURL=share-item-sheet.js.map
@@ -1,7 +1,14 @@
1
1
  import type { TaRoomServer } from '@celljs/ta-protocol';
2
2
  import * as React from 'react';
3
- import type { WebShareSheetProps } from '../extension/web-extension-api.js';
3
+ import type { WebIcon, WebShareSheetProps } from '../extension/web-extension-api.js';
4
4
  import type { TaNotices } from '../notices/notices-protocol.js';
5
+ /** One of the actions under the code, as the share sheets of phones: a round icon over a word. */
6
+ export declare function Tile({ icon: Icon, label, onClick, disabled }: {
7
+ icon: WebIcon;
8
+ label: string;
9
+ onClick(): void;
10
+ disabled?: boolean;
11
+ }): React.JSX.Element;
5
12
  /**
6
13
  * The sheet everything shared goes out from (`ui.ShareSheet`, docs/design/ta-links.md 4): who or what goes and what
7
14
  * the other gets over its code, the link, and the actions in one row: Send to Ta friends, Copy, the system's other apps
@@ -12,4 +19,4 @@ export interface ShareSheetServices {
12
19
  notices: TaNotices;
13
20
  rooms: TaRoomServer;
14
21
  }
15
- export declare function ShareSheet({ title, link, error, face, name, gets, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, }: WebShareSheetProps & ShareSheetServices): React.JSX.Element;
22
+ export declare function ShareSheet({ title, link, error, face, name, gets, invite, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, }: WebShareSheetProps & ShareSheetServices): React.JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { Check, Copy, KeyRound, RefreshCw, Send, Share2 } from 'lucide-react';
2
2
  import * as React from 'react';
3
+ import { shareMessage } from '../extension/share-sheet-compat.js';
3
4
  import { useT } from '../i18n/use-t.js';
4
5
  import { EmptyState } from './empty-state.js';
5
6
  import { QrView } from './qr-view.js';
@@ -19,13 +20,13 @@ function useCopied() {
19
20
  return [copied, copy];
20
21
  }
21
22
  /** One of the actions under the code, as the share sheets of phones: a round icon over a word. */
22
- function Tile({ icon: Icon, label, onClick, disabled }) {
23
+ export function Tile({ icon: Icon, label, onClick, disabled }) {
23
24
  return (React.createElement("button", { type: "button", className: "ta-share-tile", disabled: disabled, onClick: onClick },
24
25
  React.createElement("span", { className: "ta-share-tile-icon" },
25
26
  React.createElement(Icon, { size: 20 })),
26
27
  React.createElement("span", { className: "ta-share-tile-label" }, label)));
27
28
  }
28
- export function ShareSheet({ title, link, error, face, name, gets, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, }) {
29
+ export function ShareSheet({ title, link, error, face, name, gets, invite, notes, password, own, onRenew, onStop, stop, onClose, children, notices, rooms, }) {
29
30
  const t = useT();
30
31
  const [copied, copy] = useCopied();
31
32
  const [stopping, setStopping] = React.useState(false);
@@ -67,8 +68,8 @@ export function ShareSheet({ title, link, error, face, name, gets, notes, passwo
67
68
  React.createElement("button", { type: "button", className: "ta-button", onClick: () => copy(password, 'password') }, copied === 'password' ? t('ta.share.copied') : t('ta.share.copyPassword')))),
68
69
  picking && link && friends ? (React.createElement(ShareToFriends, { rooms: rooms, notices: notices, friends: friends, link: link, title: name || title, onDone: () => setPicking(false) })) : (React.createElement("div", { className: "ta-share-tiles" },
69
70
  canFriends && React.createElement(Tile, { icon: Send, label: t('ta.share.friends'), disabled: !link, onClick: () => setPicking(true) }),
70
- React.createElement(Tile, { icon: copied === 'link' ? Check : Copy, label: copied === 'link' ? t('ta.share.copied') : t('ta.share.copy'), disabled: !link, onClick: () => link && copy(link, 'link') }),
71
- canSend && (React.createElement(Tile, { icon: Share2, label: t('ta.share.apps'), disabled: !link, onClick: () => link && void navigator.share({ title: name || title, url: link }).catch(() => undefined) })),
71
+ React.createElement(Tile, { icon: copied === 'link' ? Check : Copy, label: copied === 'link' ? t('ta.share.copied') : t('ta.share.copy'), disabled: !link, onClick: () => link && copy(shareMessage(invite, link), 'link') }),
72
+ canSend && (React.createElement(Tile, { icon: Share2, label: t('ta.share.apps'), disabled: !link, onClick: () => link && void navigator.share({ title: name || title, text: invite, url: link }).catch(() => undefined) })),
72
73
  onRenew && React.createElement(Tile, { icon: RefreshCw, label: t('ta.share.renew'), disabled: !link, onClick: onRenew }))),
73
74
  children,
74
75
  lines.length > 0 && (React.createElement("div", { className: "ta-share-notes" }, lines.map(line => (React.createElement("p", { key: line }, line))))),
@@ -37,19 +37,19 @@ function SetupForm({ setup, onSave, onCancel }) {
37
37
  const [busy, setBusy] = React.useState(false);
38
38
  const set = (id, value) => setValues(current => ({ ...current, [id]: value }));
39
39
  const missing = shape.fields.some(field => { var _a; return !field.optional && !((_a = values[field.id]) === null || _a === void 0 ? void 0 : _a.trim()); }) || (!setup.secret && !((_a = values[shape.secret]) === null || _a === void 0 ? void 0 : _a.trim()));
40
- return (React.createElement("form", { className: "ta-sign-in-form", onSubmit: event => {
40
+ return (React.createElement("form", { className: "ta-form", onSubmit: event => {
41
41
  event.preventDefault();
42
42
  setBusy(true);
43
43
  void onSave(values).finally(() => setBusy(false));
44
44
  } },
45
- [...shape.fields, { id: shape.secret, secret: true }].map(field => { var _a; return (React.createElement("label", { key: field.id, className: "ta-sign-in-field" },
46
- React.createElement("span", null, t(`ta.signInSetup.field.${field.id}`)),
45
+ [...shape.fields, { id: shape.secret, secret: true }].map(field => { var _a; return (React.createElement("label", { key: field.id, className: "ta-form-item" },
46
+ React.createElement("span", { className: "ta-form-label" }, t(`ta.signInSetup.field.${field.id}`)),
47
47
  React.createElement("input", { className: "ta-input", type: 'secret' in field ? 'password' : 'text', value: (_a = values[field.id]) !== null && _a !== void 0 ? _a : '', placeholder: 'secret' in field && setup.secret
48
48
  ? t('ta.signInSetup.secretKept')
49
49
  : 'optional' in field && field.optional
50
50
  ? t('ta.signInSetup.optional')
51
51
  : '', autoComplete: "off", spellCheck: false, autoCapitalize: "off", onChange: event => set(field.id, event.target.value) }))); }),
52
- React.createElement("div", { className: "ta-sign-in-actions" },
52
+ React.createElement("div", { className: "ta-form-actions" },
53
53
  React.createElement("button", { type: "button", className: "ta-button", disabled: busy, onClick: onCancel }, t('ta.cancel')),
54
54
  React.createElement("button", { type: "submit", className: `ta-button ta-primary${busy ? ' ta-busy' : ''}`, disabled: busy || missing }, t('ta.signInSetup.save')))));
55
55
  }
@@ -23,7 +23,7 @@ export function TrustedDomains() {
23
23
  };
24
24
  return (React.createElement(React.Fragment, null,
25
25
  React.createElement(Row, { label: t('ta.settings.trustedDomains'), description: t('ta.settings.trustedDomainsHint'), stacked: true },
26
- React.createElement("form", { className: "ta-trusted-add", onSubmit: event => {
26
+ React.createElement("form", { className: "ta-trusted-add ta-form-inline", onSubmit: event => {
27
27
  event.preventDefault();
28
28
  add();
29
29
  } },
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * The room of a Loading or an EmptyState that is not `compact`: the rest of the view it is in, from its top to the
4
+ * bottom of what shows it, less what comes under it, so that it sits in the middle of what is left however the page
5
+ * around it is laid out. A column of flex that gives it room already (`flex: 1` in base.ts) is left to do so; where its
6
+ * parent is not one (a block an extension wraps it in, a body that is no column of flex) it takes the room itself,
7
+ * rather than each page having to make every box above it a column of flex. It keeps its own height in a reply, in a
8
+ * box drawn as one (a card: rounded, with a background, a border or a shadow) and beside something (a cell of a grid).
9
+ */
10
+ export declare namespace ViewRoom {
11
+ interface Measure {
12
+ /** Its height as laid out, before any room of its own. */
13
+ height: number;
14
+ /** The height of what it holds (or its min-height): more than that, its parent gives it room. */
15
+ natural: number;
16
+ /** From its top to the bottom of the view, less what comes under it. */
17
+ room: number;
18
+ }
19
+ /** The min-height it takes, or undefined where it keeps the height it has. */
20
+ function height({ height, natural, room }: Measure): number | undefined;
21
+ /** Keeps the room of the element while the view and what is around it change; the function stops it. */
22
+ function keep(element: HTMLElement): () => void;
23
+ }
24
+ /** Gives the element its room in the view (ViewRoom) while `on`. */
25
+ export declare function useViewRoom(ref: React.RefObject<HTMLElement | null>, on: boolean): void;
@@ -0,0 +1,136 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * The room of a Loading or an EmptyState that is not `compact`: the rest of the view it is in, from its top to the
4
+ * bottom of what shows it, less what comes under it, so that it sits in the middle of what is left however the page
5
+ * around it is laid out. A column of flex that gives it room already (`flex: 1` in base.ts) is left to do so; where its
6
+ * parent is not one (a block an extension wraps it in, a body that is no column of flex) it takes the room itself,
7
+ * rather than each page having to make every box above it a column of flex. It keeps its own height in a reply, in a
8
+ * box drawn as one (a card: rounded, with a background, a border or a shadow) and beside something (a cell of a grid).
9
+ */
10
+ export var ViewRoom;
11
+ (function (ViewRoom) {
12
+ /** The min-height it takes, or undefined where it keeps the height it has. */
13
+ function height({ height, natural, room }) {
14
+ if (height > natural + 1) {
15
+ return undefined;
16
+ }
17
+ return room > height + 1 ? Math.floor(room) : undefined;
18
+ }
19
+ ViewRoom.height = height;
20
+ /** Keeps the room of the element while the view and what is around it change; the function stops it. */
21
+ function keep(element) {
22
+ const view = viewOf(element);
23
+ if (element.closest('.ta-message') || boxed(element, view)) {
24
+ return () => undefined;
25
+ }
26
+ let frame = 0;
27
+ const measure = () => {
28
+ frame = 0;
29
+ const taken = room(element, view);
30
+ const next = taken === undefined ? '' : `${taken}px`;
31
+ if (element.style.minHeight !== next) {
32
+ element.style.minHeight = next;
33
+ }
34
+ };
35
+ const later = () => {
36
+ if (!frame) {
37
+ frame = requestAnimationFrame(measure);
38
+ }
39
+ };
40
+ measure();
41
+ const observer = typeof ResizeObserver === 'function' ? new ResizeObserver(later) : undefined;
42
+ observer === null || observer === void 0 ? void 0 : observer.observe(view !== null && view !== void 0 ? view : document.documentElement);
43
+ if (element.parentElement && element.parentElement !== view) {
44
+ observer === null || observer === void 0 ? void 0 : observer.observe(element.parentElement);
45
+ }
46
+ window.addEventListener('resize', later);
47
+ return () => {
48
+ observer === null || observer === void 0 ? void 0 : observer.disconnect();
49
+ window.removeEventListener('resize', later);
50
+ cancelAnimationFrame(frame);
51
+ element.style.minHeight = '';
52
+ };
53
+ }
54
+ ViewRoom.keep = keep;
55
+ function room(element, view) {
56
+ element.style.minHeight = '';
57
+ const rect = element.getBoundingClientRect();
58
+ let after = 0;
59
+ for (let node = element; node.parentElement && node !== view; node = node.parentElement) {
60
+ const parent = node.parentElement;
61
+ if (parent === view) {
62
+ break;
63
+ }
64
+ const box = node.getBoundingClientRect();
65
+ let bottom = box.bottom;
66
+ for (const sibling of Array.from(parent.children)) {
67
+ if (sibling === node || !inFlow(sibling)) {
68
+ continue;
69
+ }
70
+ const other = sibling.getBoundingClientRect();
71
+ if (other.height === 0 && other.width === 0) {
72
+ continue;
73
+ }
74
+ if (other.top < box.bottom - 1 && other.bottom > box.top + 1) {
75
+ return undefined;
76
+ }
77
+ if (other.top >= box.bottom - 1) {
78
+ bottom = Math.max(bottom, other.bottom);
79
+ }
80
+ }
81
+ const style = getComputedStyle(parent);
82
+ after += bottom - box.bottom + px(style.paddingBottom) + px(style.borderBottomWidth);
83
+ }
84
+ const end = view ? viewBottom(view) : window.innerHeight;
85
+ return height({ height: rect.height, natural: natural(element, rect.height), room: Math.min(end, window.innerHeight) - rect.top - after });
86
+ }
87
+ function natural(element, laid) {
88
+ const style = getComputedStyle(element);
89
+ const children = Array.from(element.children).filter(inFlow);
90
+ if (!children.length) {
91
+ return Math.max(px(style.minHeight), laid);
92
+ }
93
+ const top = Math.min(...children.map(child => child.getBoundingClientRect().top));
94
+ const bottom = Math.max(...children.map(child => child.getBoundingClientRect().bottom));
95
+ const content = bottom - top + px(style.paddingTop) + px(style.paddingBottom) + px(style.borderTopWidth) + px(style.borderBottomWidth);
96
+ return Math.max(px(style.minHeight), content);
97
+ }
98
+ function viewOf(element) {
99
+ for (let node = element.parentElement; node && node !== document.body && node !== document.documentElement; node = node.parentElement) {
100
+ const overflow = getComputedStyle(node).overflowY;
101
+ if (overflow !== 'visible') {
102
+ return node;
103
+ }
104
+ }
105
+ return undefined;
106
+ }
107
+ function viewBottom(view) {
108
+ const style = getComputedStyle(view);
109
+ return view.getBoundingClientRect().top + view.clientTop + view.clientHeight - px(style.paddingBottom);
110
+ }
111
+ function boxed(element, view) {
112
+ for (let node = element.parentElement; node && node !== view && node !== document.body; node = node.parentElement) {
113
+ const style = getComputedStyle(node);
114
+ if (px(style.borderTopLeftRadius) <= 0) {
115
+ continue;
116
+ }
117
+ const filled = !/^(transparent|rgba\(0, 0, 0, 0\))$/.test(style.backgroundColor);
118
+ if (filled || px(style.borderTopWidth) > 0 || style.boxShadow !== 'none') {
119
+ return true;
120
+ }
121
+ }
122
+ return false;
123
+ }
124
+ function inFlow(element) {
125
+ const style = getComputedStyle(element);
126
+ return style.display !== 'none' && style.position !== 'absolute' && style.position !== 'fixed';
127
+ }
128
+ function px(value) {
129
+ return Number.parseFloat(value) || 0;
130
+ }
131
+ })(ViewRoom || (ViewRoom = {}));
132
+ /** Gives the element its room in the view (ViewRoom) while `on`. */
133
+ export function useViewRoom(ref, on) {
134
+ React.useLayoutEffect(() => (on && ref.current ? ViewRoom.keep(ref.current) : undefined), [on, ref]);
135
+ }
136
+ //# sourceMappingURL=view-room.js.map
@@ -141,17 +141,17 @@ function VoiceForm({ type, title, service, close, added, }) {
141
141
  event.preventDefault();
142
142
  void submit();
143
143
  } },
144
- type.options.map(option => { var _a, _b; return (React.createElement("label", { key: option.key, className: "ta-store-field" },
145
- React.createElement("span", { className: "ta-store-field-label" }, (_a = TaPackageTextUtil.pick(option.label, language)) !== null && _a !== void 0 ? _a : option.key,
146
- option.optional && React.createElement("span", { className: "ta-store-field-optional" }, t('ta.voices.optional'))),
144
+ type.options.map(option => { var _a, _b; return (React.createElement("label", { key: option.key, className: "ta-form-item" },
145
+ React.createElement("span", { className: "ta-form-label" }, (_a = TaPackageTextUtil.pick(option.label, language)) !== null && _a !== void 0 ? _a : option.key,
146
+ option.optional && React.createElement("span", { className: "ta-form-optional" }, t('ta.voices.optional'))),
147
147
  React.createElement("input", { className: "ta-input", type: option.secret ? 'password' : 'text', autoComplete: option.secret ? 'new-password' : 'off', spellCheck: false, placeholder: service && option.secret ? t('ta.voices.keepSecret') : option.placeholder, value: (_b = values[option.key]) !== null && _b !== void 0 ? _b : '', onChange: event => {
148
148
  const value = event.target.value;
149
149
  setValues(before => ({ ...before, [option.key]: value }));
150
150
  } }))); }),
151
- React.createElement("label", { className: "ta-store-field" },
152
- React.createElement("span", { className: "ta-store-field-label" },
151
+ React.createElement("label", { className: "ta-form-item" },
152
+ React.createElement("span", { className: "ta-form-label" },
153
153
  t('ta.voices.name'),
154
- React.createElement("span", { className: "ta-store-field-optional" }, t('ta.voices.optional'))),
154
+ React.createElement("span", { className: "ta-form-optional" }, t('ta.voices.optional'))),
155
155
  React.createElement("input", { className: "ta-input", value: name, placeholder: title, spellCheck: false, onChange: event => setName(event.target.value) })),
156
156
  React.createElement("p", { className: "ta-store-form-note" },
157
157
  React.createElement(Icon, { icon: ShieldCheck, size: 13 }),
@@ -21,14 +21,17 @@ export interface DeviceState {
21
21
  * (`@media ${DeviceMedia.COMPACT}`) and for the code (DeviceState). Never write a width of the layout elsewhere.
22
22
  */
23
23
  export declare namespace DeviceMedia {
24
- /** The main pointer is a finger. */
25
- const TOUCH = "(pointer: coarse)";
24
+ /**
25
+ * The main pointer is a finger. Or a pen: a screen that also takes a stylus is a fine pointer to Chrome on Android
26
+ * (phones with a pen, the emulator), but no pointer of it hovers, as none of a computer's fails to.
27
+ */
28
+ const TOUCH = "(pointer: coarse), (hover: none)";
26
29
  /** A phone held sideways: as wide as a small tablet, but low. */
27
- const LOW = "(max-height: 500px) and (pointer: coarse)";
28
- const COMPACT = "(max-width: 860px), (max-height: 500px) and (pointer: coarse)";
30
+ const LOW = "(max-height: 500px) and (pointer: coarse), (max-height: 500px) and (hover: none)";
31
+ const COMPACT = "(max-width: 860px), (max-height: 500px) and (pointer: coarse), (max-height: 500px) and (hover: none)";
29
32
  /** The workbench beside the conversation too: a window of a computer, or a tablet wide enough (13" sideways) that the conversation keeps its room beside the sidebar. */
30
- const EXPANDED = "(min-width: 1100px) and (pointer: fine), (min-width: 1300px)";
31
- const HANDHELD = "(max-width: 599px), (max-height: 500px) and (pointer: coarse)";
33
+ const EXPANDED = "(min-width: 1100px) and (pointer: fine) and (hover: hover), (min-width: 1300px)";
34
+ const HANDHELD = "(max-width: 599px), (max-height: 500px) and (pointer: coarse), (max-height: 500px) and (hover: none)";
32
35
  }
33
36
  /**
34
37
  * How the page moves with the on-screen keyboard of the Ta app on iOS (DeviceObserver, style/shell.ts):
@@ -4,13 +4,16 @@
4
4
  */
5
5
  export var DeviceMedia;
6
6
  (function (DeviceMedia) {
7
- /** The main pointer is a finger. */
8
- DeviceMedia.TOUCH = '(pointer: coarse)';
7
+ /**
8
+ * The main pointer is a finger. Or a pen: a screen that also takes a stylus is a fine pointer to Chrome on Android
9
+ * (phones with a pen, the emulator), but no pointer of it hovers, as none of a computer's fails to.
10
+ */
11
+ DeviceMedia.TOUCH = '(pointer: coarse), (hover: none)';
9
12
  /** A phone held sideways: as wide as a small tablet, but low. */
10
- DeviceMedia.LOW = '(max-height: 500px) and (pointer: coarse)';
13
+ DeviceMedia.LOW = '(max-height: 500px) and (pointer: coarse), (max-height: 500px) and (hover: none)';
11
14
  DeviceMedia.COMPACT = `(max-width: 860px), ${DeviceMedia.LOW}`;
12
15
  /** The workbench beside the conversation too: a window of a computer, or a tablet wide enough (13" sideways) that the conversation keeps its room beside the sidebar. */
13
- DeviceMedia.EXPANDED = '(min-width: 1100px) and (pointer: fine), (min-width: 1300px)';
16
+ DeviceMedia.EXPANDED = '(min-width: 1100px) and (pointer: fine) and (hover: hover), (min-width: 1300px)';
14
17
  DeviceMedia.HANDHELD = `(max-width: 599px), ${DeviceMedia.LOW}`;
15
18
  })(DeviceMedia || (DeviceMedia = {}));
16
19
  /**