@celljs/ta-web 4.9.0 → 4.10.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 (376) hide show
  1. package/README.en.md +4 -3
  2. package/README.md +4 -3
  3. package/esm/browser/assistant/assistant-chat-list.js +8 -2
  4. package/esm/browser/assistant/assistant-extension.d.ts +8 -1
  5. package/esm/browser/assistant/assistant-extension.js +33 -5
  6. package/esm/browser/assistant/assistant-protocol.d.ts +3 -1
  7. package/esm/browser/assistant/assistant-task-source.d.ts +2 -0
  8. package/esm/browser/assistant/assistant-task-source.js +2 -0
  9. package/esm/browser/assistant/assistant-task-util.d.ts +8 -0
  10. package/esm/browser/assistant/assistant-task-util.js +13 -3
  11. package/esm/browser/assistant/assistant-tasks.js +3 -2
  12. package/esm/browser/assistant/assistant-view.js +81 -56
  13. package/esm/browser/assistant/assistant.d.ts +30 -1
  14. package/esm/browser/assistant/assistant.js +89 -6
  15. package/esm/browser/assistant/task-views.d.ts +40 -6
  16. package/esm/browser/assistant/task-views.js +73 -21
  17. package/esm/browser/avatar/dino-avatar.d.ts +3 -4
  18. package/esm/browser/avatar/dino-avatar.js +4 -178
  19. package/esm/browser/avatar/dino-face.d.ts +19 -0
  20. package/esm/browser/avatar/dino-face.js +142 -0
  21. package/esm/browser/avatar/dino-geometry.d.ts +11 -0
  22. package/esm/browser/avatar/dino-geometry.js +38 -0
  23. package/esm/browser/avatar/dino-kinds.d.ts +15 -0
  24. package/esm/browser/avatar/dino-kinds.js +544 -0
  25. package/esm/browser/avatar/dino-motion.js +1 -1
  26. package/esm/browser/avatar/dino-shape.d.ts +80 -0
  27. package/esm/browser/avatar/dino-shape.js +113 -0
  28. package/esm/browser/avatar/dino-species.d.ts +1 -61
  29. package/esm/browser/avatar/dino-species.js +2 -653
  30. package/esm/browser/chat/chat-packages.d.ts +39 -0
  31. package/esm/browser/chat/chat-packages.js +70 -0
  32. package/esm/browser/chat/chat-protocol.d.ts +23 -1
  33. package/esm/browser/chat/chat-stores.d.ts +59 -0
  34. package/esm/browser/chat/chat-stores.js +121 -0
  35. package/esm/browser/chat/chat-util.d.ts +17 -0
  36. package/esm/browser/chat/chat-util.js +61 -0
  37. package/esm/browser/chat/chat-view.js +33 -12
  38. package/esm/browser/chat/chat.d.ts +31 -39
  39. package/esm/browser/chat/chat.js +226 -175
  40. package/esm/browser/components/access-view.js +1 -1
  41. package/esm/browser/components/account-menu.js +1 -1
  42. package/esm/browser/components/app-nav.d.ts +6 -3
  43. package/esm/browser/components/app-nav.js +19 -10
  44. package/esm/browser/components/app-shell-hooks.d.ts +47 -0
  45. package/esm/browser/components/app-shell-hooks.js +169 -0
  46. package/esm/browser/components/app-view.js +81 -172
  47. package/esm/browser/components/auth-view.js +1 -1
  48. package/esm/browser/components/chat-list.d.ts +20 -2
  49. package/esm/browser/components/chat-list.js +138 -22
  50. package/esm/browser/components/composer-box.d.ts +5 -5
  51. package/esm/browser/components/composer-box.js +111 -4
  52. package/esm/browser/components/composer.d.ts +7 -0
  53. package/esm/browser/components/composer.js +22 -14
  54. package/esm/browser/components/connection-bar.js +50 -17
  55. package/esm/browser/components/context-menu.d.ts +30 -4
  56. package/esm/browser/components/context-menu.js +199 -37
  57. package/esm/browser/components/conversation-scroll.d.ts +129 -6
  58. package/esm/browser/components/conversation-scroll.js +429 -109
  59. package/esm/browser/components/dino.js +1 -1
  60. package/esm/browser/components/earlier-messages.d.ts +2 -1
  61. package/esm/browser/components/earlier-messages.js +2 -17
  62. package/esm/browser/components/editor-area.d.ts +3 -1
  63. package/esm/browser/components/editor-area.js +6 -5
  64. package/esm/browser/components/empty-pictures.d.ts +0 -2
  65. package/esm/browser/components/empty-pictures.js +0 -16
  66. package/esm/browser/components/folder-picker.d.ts +5 -2
  67. package/esm/browser/components/folder-picker.js +30 -9
  68. package/esm/browser/components/held-talk.d.ts +28 -0
  69. package/esm/browser/components/held-talk.js +76 -0
  70. package/esm/browser/components/host-view.d.ts +1 -1
  71. package/esm/browser/components/host-view.js +1 -1
  72. package/esm/browser/components/icon.d.ts +2 -2
  73. package/esm/browser/components/icon.js +5 -6
  74. package/esm/browser/components/image-viewer.d.ts +124 -0
  75. package/esm/browser/components/image-viewer.js +397 -0
  76. package/esm/browser/components/lightbox.d.ts +11 -0
  77. package/esm/browser/components/lightbox.js +24 -0
  78. package/esm/browser/components/markdown.d.ts +6 -2
  79. package/esm/browser/components/markdown.js +24 -10
  80. package/esm/browser/components/media.js +1 -10
  81. package/esm/browser/components/message-footer.d.ts +16 -2
  82. package/esm/browser/components/message-footer.js +29 -12
  83. package/esm/browser/components/message-list.d.ts +24 -3
  84. package/esm/browser/components/message-list.js +149 -20
  85. package/esm/browser/components/message-menu.d.ts +3 -1
  86. package/esm/browser/components/message-menu.js +18 -3
  87. package/esm/browser/components/nav-places.d.ts +16 -1
  88. package/esm/browser/components/nav-places.js +12 -3
  89. package/esm/browser/components/phone-shell.d.ts +4 -1
  90. package/esm/browser/components/phone-shell.js +3 -1
  91. package/esm/browser/components/run-status.js +3 -3
  92. package/esm/browser/components/select-bar.d.ts +9 -0
  93. package/esm/browser/components/select-bar.js +24 -0
  94. package/esm/browser/components/session-settings.d.ts +6 -0
  95. package/esm/browser/components/session-settings.js +14 -1
  96. package/esm/browser/components/session-view.js +8 -4
  97. package/esm/browser/components/settings-choices.d.ts +35 -0
  98. package/esm/browser/components/settings-choices.js +117 -0
  99. package/esm/browser/components/settings-parts.d.ts +21 -0
  100. package/esm/browser/components/settings-parts.js +323 -0
  101. package/esm/browser/components/settings-view.d.ts +0 -6
  102. package/esm/browser/components/settings-view.js +4 -406
  103. package/esm/browser/components/swipe-row.d.ts +2 -2
  104. package/esm/browser/components/swipe-row.js +7 -3
  105. package/esm/browser/components/tool-view.js +14 -12
  106. package/esm/browser/components/voice-button.d.ts +1 -1
  107. package/esm/browser/components/voice-button.js +1 -1
  108. package/esm/browser/components/voice-talk.d.ts +43 -0
  109. package/esm/browser/components/voice-talk.js +222 -0
  110. package/esm/browser/components/workbench-view.js +1 -1
  111. package/esm/browser/device/device.d.ts +3 -0
  112. package/esm/browser/device/device.js +11 -1
  113. package/esm/browser/device/hold.d.ts +42 -0
  114. package/esm/browser/device/hold.js +136 -0
  115. package/esm/browser/device/launch-screen.d.ts +1 -1
  116. package/esm/browser/device/launch-screen.js +1 -1
  117. package/esm/browser/device/long-press.d.ts +2 -0
  118. package/esm/browser/device/long-press.js +16 -1
  119. package/esm/browser/device/pull-down.d.ts +4 -2
  120. package/esm/browser/device/pull-down.js +64 -76
  121. package/esm/browser/device/row-swipe.d.ts +35 -10
  122. package/esm/browser/device/row-swipe.js +149 -71
  123. package/esm/browser/device/shake-undo.d.ts +16 -0
  124. package/esm/browser/device/shake-undo.js +59 -0
  125. package/esm/browser/device/sheet-swipe.d.ts +118 -18
  126. package/esm/browser/device/sheet-swipe.js +406 -107
  127. package/esm/browser/extension/icons.js +2 -1
  128. package/esm/browser/extension/web-extension-api.d.ts +135 -2
  129. package/esm/browser/extension/web-extension-code.d.ts +6 -0
  130. package/esm/browser/extension/web-extension-code.js +24 -0
  131. package/esm/browser/extension/web-extension-protocol.d.ts +23 -1
  132. package/esm/browser/extension/web-extension-protocol.js +8 -0
  133. package/esm/browser/extension/web-extensions.d.ts +14 -1
  134. package/esm/browser/extension/web-extensions.js +128 -24
  135. package/esm/browser/extension/web-tasks.d.ts +9 -1
  136. package/esm/browser/extension/web-tasks.js +24 -0
  137. package/esm/browser/files/files-protocol.d.ts +25 -0
  138. package/esm/browser/files/files-protocol.js +2 -0
  139. package/esm/browser/files/files.d.ts +35 -0
  140. package/esm/browser/files/files.js +119 -0
  141. package/esm/browser/hooks.d.ts +3 -1
  142. package/esm/browser/hooks.js +8 -0
  143. package/esm/browser/i18n/locales.d.ts +29 -2
  144. package/esm/browser/i18n/messages.d.ts +28 -1
  145. package/esm/browser/i18n/messages.js +58 -4
  146. package/esm/browser/index.d.ts +6 -0
  147. package/esm/browser/index.js +6 -0
  148. package/esm/browser/notices/notices-protocol.d.ts +9 -1
  149. package/esm/browser/notices/notices.d.ts +2 -0
  150. package/esm/browser/notices/notices.js +20 -10
  151. package/esm/browser/offline/device-values.d.ts +55 -0
  152. package/esm/browser/offline/device-values.js +142 -0
  153. package/esm/browser/offline/kept-chats-protocol.d.ts +17 -0
  154. package/esm/browser/offline/kept-chats-protocol.js +2 -0
  155. package/esm/browser/offline/kept-chats.d.ts +47 -0
  156. package/esm/browser/offline/kept-chats.js +146 -0
  157. package/esm/browser/offline/offline-reads.d.ts +44 -0
  158. package/esm/browser/offline/offline-reads.js +107 -0
  159. package/esm/browser/settings/settings-protocol.d.ts +2 -0
  160. package/esm/browser/settings/settings-protocol.js +2 -0
  161. package/esm/browser/style/conversation.d.ts +1 -1
  162. package/esm/browser/style/conversation.js +57 -17
  163. package/esm/browser/style/device.js +43 -4
  164. package/esm/browser/style/layout.d.ts +1 -1
  165. package/esm/browser/style/layout.js +67 -15
  166. package/esm/browser/style/pages.d.ts +1 -1
  167. package/esm/browser/style/pages.js +2 -1
  168. package/esm/browser/style/shell.d.ts +1 -1
  169. package/esm/browser/style/shell.js +47 -3
  170. package/esm/browser/style/tasks.d.ts +1 -1
  171. package/esm/browser/style/tasks.js +2 -0
  172. package/esm/browser/util/frame.d.ts +5 -4
  173. package/esm/browser/util/frame.js +5 -4
  174. package/esm/browser/util/markdown.d.ts +18 -1
  175. package/esm/browser/util/markdown.js +119 -5
  176. package/esm/browser/util/process.d.ts +21 -0
  177. package/esm/browser/util/process.js +45 -1
  178. package/esm/browser/util/voice.d.ts +5 -2
  179. package/esm/browser/util/voice.js +6 -3
  180. package/esm/browser/util/zoom.d.ts +46 -0
  181. package/esm/browser/util/zoom.js +96 -0
  182. package/esm/browser/workbench-calls.d.ts +59 -0
  183. package/esm/browser/workbench-calls.js +141 -0
  184. package/esm/browser/workbench-protocol.d.ts +5 -1
  185. package/esm/browser/workbench-util.d.ts +68 -0
  186. package/esm/browser/workbench-util.js +145 -0
  187. package/esm/browser/workbench.d.ts +15 -42
  188. package/esm/browser/workbench.js +53 -167
  189. package/lib/browser/assistant/assistant-chat-list.js +8 -2
  190. package/lib/browser/assistant/assistant-extension.d.ts +8 -1
  191. package/lib/browser/assistant/assistant-extension.js +33 -5
  192. package/lib/browser/assistant/assistant-protocol.d.ts +3 -1
  193. package/lib/browser/assistant/assistant-task-source.d.ts +2 -0
  194. package/lib/browser/assistant/assistant-task-source.js +2 -0
  195. package/lib/browser/assistant/assistant-task-util.d.ts +8 -0
  196. package/lib/browser/assistant/assistant-task-util.js +13 -3
  197. package/lib/browser/assistant/assistant-tasks.js +2 -1
  198. package/lib/browser/assistant/assistant-view.js +78 -53
  199. package/lib/browser/assistant/assistant.d.ts +30 -1
  200. package/lib/browser/assistant/assistant.js +89 -6
  201. package/lib/browser/assistant/task-views.d.ts +40 -6
  202. package/lib/browser/assistant/task-views.js +74 -21
  203. package/lib/browser/avatar/dino-avatar.d.ts +3 -4
  204. package/lib/browser/avatar/dino-avatar.js +27 -202
  205. package/lib/browser/avatar/dino-face.d.ts +20 -0
  206. package/lib/browser/avatar/dino-face.js +148 -0
  207. package/lib/browser/avatar/dino-geometry.d.ts +12 -0
  208. package/lib/browser/avatar/dino-geometry.js +47 -0
  209. package/lib/browser/avatar/dino-kinds.d.ts +16 -0
  210. package/lib/browser/avatar/dino-kinds.js +547 -0
  211. package/lib/browser/avatar/dino-motion.js +2 -2
  212. package/lib/browser/avatar/dino-shape.d.ts +81 -0
  213. package/lib/browser/avatar/dino-shape.js +126 -0
  214. package/lib/browser/avatar/dino-species.d.ts +1 -61
  215. package/lib/browser/avatar/dino-species.js +34 -687
  216. package/lib/browser/chat/chat-packages.d.ts +40 -0
  217. package/lib/browser/chat/chat-packages.js +74 -0
  218. package/lib/browser/chat/chat-protocol.d.ts +23 -1
  219. package/lib/browser/chat/chat-stores.d.ts +60 -0
  220. package/lib/browser/chat/chat-stores.js +125 -0
  221. package/lib/browser/chat/chat-util.d.ts +18 -0
  222. package/lib/browser/chat/chat-util.js +64 -0
  223. package/lib/browser/chat/chat-view.js +33 -12
  224. package/lib/browser/chat/chat.d.ts +31 -39
  225. package/lib/browser/chat/chat.js +227 -176
  226. package/lib/browser/components/access-view.js +2 -2
  227. package/lib/browser/components/account-menu.js +2 -2
  228. package/lib/browser/components/app-nav.d.ts +6 -3
  229. package/lib/browser/components/app-nav.js +17 -8
  230. package/lib/browser/components/app-shell-hooks.d.ts +48 -0
  231. package/lib/browser/components/app-shell-hooks.js +211 -0
  232. package/lib/browser/components/app-view.js +89 -180
  233. package/lib/browser/components/auth-view.js +3 -3
  234. package/lib/browser/components/chat-list.d.ts +20 -2
  235. package/lib/browser/components/chat-list.js +137 -21
  236. package/lib/browser/components/composer-box.d.ts +5 -5
  237. package/lib/browser/components/composer-box.js +111 -4
  238. package/lib/browser/components/composer.d.ts +7 -0
  239. package/lib/browser/components/composer.js +22 -14
  240. package/lib/browser/components/connection-bar.js +48 -15
  241. package/lib/browser/components/context-menu.d.ts +30 -4
  242. package/lib/browser/components/context-menu.js +198 -36
  243. package/lib/browser/components/conversation-scroll.d.ts +129 -6
  244. package/lib/browser/components/conversation-scroll.js +431 -110
  245. package/lib/browser/components/dino.js +3 -3
  246. package/lib/browser/components/earlier-messages.d.ts +2 -1
  247. package/lib/browser/components/earlier-messages.js +2 -17
  248. package/lib/browser/components/editor-area.d.ts +3 -1
  249. package/lib/browser/components/editor-area.js +5 -4
  250. package/lib/browser/components/empty-pictures.d.ts +0 -2
  251. package/lib/browser/components/empty-pictures.js +0 -17
  252. package/lib/browser/components/folder-picker.d.ts +5 -2
  253. package/lib/browser/components/folder-picker.js +30 -9
  254. package/lib/browser/components/held-talk.d.ts +29 -0
  255. package/lib/browser/components/held-talk.js +79 -0
  256. package/lib/browser/components/host-view.d.ts +1 -1
  257. package/lib/browser/components/host-view.js +5 -5
  258. package/lib/browser/components/icon.d.ts +2 -2
  259. package/lib/browser/components/icon.js +7 -6
  260. package/lib/browser/components/image-viewer.d.ts +125 -0
  261. package/lib/browser/components/image-viewer.js +435 -0
  262. package/lib/browser/components/lightbox.d.ts +12 -0
  263. package/lib/browser/components/lightbox.js +60 -0
  264. package/lib/browser/components/markdown.d.ts +6 -2
  265. package/lib/browser/components/markdown.js +24 -10
  266. package/lib/browser/components/media.js +2 -11
  267. package/lib/browser/components/message-footer.d.ts +16 -2
  268. package/lib/browser/components/message-footer.js +31 -12
  269. package/lib/browser/components/message-list.d.ts +24 -3
  270. package/lib/browser/components/message-list.js +146 -16
  271. package/lib/browser/components/message-menu.d.ts +3 -1
  272. package/lib/browser/components/message-menu.js +17 -2
  273. package/lib/browser/components/nav-places.d.ts +16 -1
  274. package/lib/browser/components/nav-places.js +13 -3
  275. package/lib/browser/components/phone-shell.d.ts +4 -1
  276. package/lib/browser/components/phone-shell.js +3 -1
  277. package/lib/browser/components/run-status.js +3 -3
  278. package/lib/browser/components/select-bar.d.ts +10 -0
  279. package/lib/browser/components/select-bar.js +61 -0
  280. package/lib/browser/components/session-settings.d.ts +6 -0
  281. package/lib/browser/components/session-settings.js +14 -1
  282. package/lib/browser/components/session-view.js +7 -3
  283. package/lib/browser/components/settings-choices.d.ts +36 -0
  284. package/lib/browser/components/settings-choices.js +156 -0
  285. package/lib/browser/components/settings-parts.d.ts +22 -0
  286. package/lib/browser/components/settings-parts.js +359 -0
  287. package/lib/browser/components/settings-view.d.ts +0 -6
  288. package/lib/browser/components/settings-view.js +2 -405
  289. package/lib/browser/components/swipe-row.d.ts +2 -2
  290. package/lib/browser/components/swipe-row.js +7 -3
  291. package/lib/browser/components/tool-view.js +14 -12
  292. package/lib/browser/components/voice-button.d.ts +1 -1
  293. package/lib/browser/components/voice-button.js +1 -1
  294. package/lib/browser/components/voice-talk.d.ts +44 -0
  295. package/lib/browser/components/voice-talk.js +260 -0
  296. package/lib/browser/components/workbench-view.js +3 -3
  297. package/lib/browser/device/device.d.ts +3 -0
  298. package/lib/browser/device/device.js +11 -1
  299. package/lib/browser/device/hold.d.ts +43 -0
  300. package/lib/browser/device/hold.js +173 -0
  301. package/lib/browser/device/launch-screen.d.ts +1 -1
  302. package/lib/browser/device/launch-screen.js +1 -1
  303. package/lib/browser/device/long-press.d.ts +2 -0
  304. package/lib/browser/device/long-press.js +16 -1
  305. package/lib/browser/device/pull-down.d.ts +4 -2
  306. package/lib/browser/device/pull-down.js +63 -75
  307. package/lib/browser/device/row-swipe.d.ts +35 -10
  308. package/lib/browser/device/row-swipe.js +148 -70
  309. package/lib/browser/device/shake-undo.d.ts +17 -0
  310. package/lib/browser/device/shake-undo.js +63 -0
  311. package/lib/browser/device/sheet-swipe.d.ts +118 -18
  312. package/lib/browser/device/sheet-swipe.js +410 -108
  313. package/lib/browser/extension/icons.js +1 -0
  314. package/lib/browser/extension/web-extension-api.d.ts +135 -2
  315. package/lib/browser/extension/web-extension-code.d.ts +6 -0
  316. package/lib/browser/extension/web-extension-code.js +24 -0
  317. package/lib/browser/extension/web-extension-protocol.d.ts +23 -1
  318. package/lib/browser/extension/web-extension-protocol.js +9 -1
  319. package/lib/browser/extension/web-extensions.d.ts +14 -1
  320. package/lib/browser/extension/web-extensions.js +125 -21
  321. package/lib/browser/extension/web-tasks.d.ts +9 -1
  322. package/lib/browser/extension/web-tasks.js +24 -0
  323. package/lib/browser/files/files-protocol.d.ts +26 -0
  324. package/lib/browser/files/files-protocol.js +5 -0
  325. package/lib/browser/files/files.d.ts +36 -0
  326. package/lib/browser/files/files.js +122 -0
  327. package/lib/browser/hooks.d.ts +3 -1
  328. package/lib/browser/hooks.js +9 -0
  329. package/lib/browser/i18n/locales.d.ts +29 -2
  330. package/lib/browser/i18n/messages.d.ts +28 -1
  331. package/lib/browser/i18n/messages.js +58 -4
  332. package/lib/browser/index.d.ts +6 -0
  333. package/lib/browser/index.js +6 -0
  334. package/lib/browser/notices/notices-protocol.d.ts +9 -1
  335. package/lib/browser/notices/notices.d.ts +2 -0
  336. package/lib/browser/notices/notices.js +20 -10
  337. package/lib/browser/offline/device-values.d.ts +56 -0
  338. package/lib/browser/offline/device-values.js +148 -0
  339. package/lib/browser/offline/kept-chats-protocol.d.ts +18 -0
  340. package/lib/browser/offline/kept-chats-protocol.js +5 -0
  341. package/lib/browser/offline/kept-chats.d.ts +48 -0
  342. package/lib/browser/offline/kept-chats.js +149 -0
  343. package/lib/browser/offline/offline-reads.d.ts +45 -0
  344. package/lib/browser/offline/offline-reads.js +111 -0
  345. package/lib/browser/settings/settings-protocol.d.ts +2 -0
  346. package/lib/browser/settings/settings-protocol.js +2 -0
  347. package/lib/browser/style/conversation.d.ts +1 -1
  348. package/lib/browser/style/conversation.js +57 -17
  349. package/lib/browser/style/device.js +43 -4
  350. package/lib/browser/style/layout.d.ts +1 -1
  351. package/lib/browser/style/layout.js +67 -15
  352. package/lib/browser/style/pages.d.ts +1 -1
  353. package/lib/browser/style/pages.js +2 -1
  354. package/lib/browser/style/shell.d.ts +1 -1
  355. package/lib/browser/style/shell.js +47 -3
  356. package/lib/browser/style/tasks.d.ts +1 -1
  357. package/lib/browser/style/tasks.js +2 -0
  358. package/lib/browser/util/frame.d.ts +5 -4
  359. package/lib/browser/util/frame.js +5 -4
  360. package/lib/browser/util/markdown.d.ts +18 -1
  361. package/lib/browser/util/markdown.js +119 -5
  362. package/lib/browser/util/process.d.ts +21 -0
  363. package/lib/browser/util/process.js +46 -2
  364. package/lib/browser/util/voice.d.ts +5 -2
  365. package/lib/browser/util/voice.js +6 -3
  366. package/lib/browser/util/zoom.d.ts +47 -0
  367. package/lib/browser/util/zoom.js +99 -0
  368. package/lib/browser/workbench-calls.d.ts +60 -0
  369. package/lib/browser/workbench-calls.js +145 -0
  370. package/lib/browser/workbench-protocol.d.ts +5 -1
  371. package/lib/browser/workbench-util.d.ts +69 -0
  372. package/lib/browser/workbench-util.js +151 -0
  373. package/lib/browser/workbench.d.ts +15 -42
  374. package/lib/browser/workbench.js +74 -189
  375. package/package.json +10 -10
  376. package/public/launch.svg +46 -42
@@ -121,8 +121,10 @@ function tick() {
121
121
  }
122
122
  /**
123
123
  * Lets a finger pull the launcher down over the first tab while `enabled`. As useSheetSwipe: transforms and
124
- * opacities only, and the listener that may hold a move back is there only for a touch that may be a pull. A
125
- * pull down is decided on the first move (iOS lets a scroll that started go on), only at the top of the list.
124
+ * opacities only, the listener that may hold a move back there only for a touch that may be a pull, the finger
125
+ * followed on what it touched (SwipeFinger), and let go it slides on at once as on a spring (SwipeSettle), the
126
+ * state following. A pull down is decided on the first move (iOS lets a scroll that started go on), only at
127
+ * the top of the list.
126
128
  */
127
129
  function usePullDown(options) {
128
130
  const latest = React.useRef(options);
@@ -140,51 +142,18 @@ function usePullDown(options) {
140
142
  const settle = new sheet_swipe_1.SwipeSettle();
141
143
  // The strip that shows while open, with the safe area under it, as the style sizes it.
142
144
  const peekOf = () => { var _a; return ((_a = document.querySelector(latest.current.peek)) === null || _a === void 0 ? void 0 : _a.offsetHeight) || PullUtil.PEEK_PX; };
143
- const paint = (offset) => {
144
- if (!moved) {
145
- return;
146
- }
147
- const p = PullUtil.progress(offset, moved.height, moved.peek);
148
- moved.sheet.style.transform = `translate3d(0, ${offset}px, 0)`;
149
- if (moved.reveal) {
150
- moved.reveal.style.opacity = String(p);
151
- moved.reveal.style.transform = `translate3d(0, ${(p - 1) * 36}px, 0) scale(${0.94 + 0.06 * p})`;
152
- }
153
- };
154
- const release = (elements) => {
155
- var _a, _b;
156
- delete root.dataset.pull;
157
- elements === null || elements === void 0 ? void 0 : elements.sheet.style.removeProperty('transform');
158
- (_a = elements === null || elements === void 0 ? void 0 : elements.reveal) === null || _a === void 0 ? void 0 : _a.style.removeProperty('transform');
159
- (_b = elements === null || elements === void 0 ? void 0 : elements.reveal) === null || _b === void 0 ? void 0 : _b.style.removeProperty('opacity');
145
+ const reveal = (offset, height, peek) => {
146
+ const p = PullUtil.progress(offset, height, peek);
147
+ return { opacity: p, transform: `translate3d(0, ${(p - 1) * 36}px, 0) scale(${0.94 + 0.06 * p})` };
160
148
  };
161
- const stop = () => {
162
- document.removeEventListener('touchmove', onMove);
149
+ const reset = () => {
163
150
  start = undefined;
164
- };
165
- const onStart = (event) => {
166
- const current = latest.current;
167
151
  claimed = undefined;
168
- const touch = event.touches[0];
169
- const target = event.target instanceof Node ? event.target : null;
170
- const area = target
171
- ? [...document.querySelectorAll(current.open ? current.closeArea : current.area)].find(element => element.contains(target))
172
- : undefined;
173
- const inside = !!area;
174
- const free = inside && !editable(event.target) && (current.open ? atEnd(event.target, area) : atTop(event.target, area));
175
- if (event.touches.length === 1 && touch && free) {
176
- start = { x: touch.clientX, y: touch.clientY, t: event.timeStamp };
177
- velocity.start(start);
178
- document.addEventListener('touchmove', onMove, { passive: false });
179
- }
180
- else {
181
- stop();
182
- }
152
+ moved = undefined;
183
153
  };
184
- const onMove = (event) => {
154
+ const onMove = (event, touch) => {
185
155
  const current = latest.current;
186
- const touch = event.touches[0];
187
- if (!start || !touch || claimed === false) {
156
+ if (!start || claimed === false) {
188
157
  return;
189
158
  }
190
159
  const dy = touch.clientY - start.y;
@@ -197,17 +166,12 @@ function usePullDown(options) {
197
166
  }
198
167
  return;
199
168
  }
200
- if (!claimed) {
201
- stop();
202
- return;
203
- }
204
- const sheet = document.querySelector(current.sheet);
169
+ const sheet = claimed ? document.querySelector(current.sheet) : null;
205
170
  if (!sheet) {
206
171
  claimed = false;
207
- stop();
172
+ finger.stop();
208
173
  return;
209
174
  }
210
- settle.clear();
211
175
  moved = {
212
176
  sheet,
213
177
  reveal: document.querySelector(current.reveal),
@@ -216,6 +180,7 @@ function usePullDown(options) {
216
180
  passed: current.open,
217
181
  offset: 0,
218
182
  };
183
+ settle.hold([moved.sheet, moved.reveal]);
219
184
  // Not data-sheet-drag: the sheets off the screen (the screen, the board) stay hidden.
220
185
  root.dataset.pull = '';
221
186
  }
@@ -230,39 +195,62 @@ function usePullDown(options) {
230
195
  tick();
231
196
  }
232
197
  moved.passed = passed || current.open;
233
- paint(moved.offset);
198
+ moved.sheet.style.transform = `translate3d(0, ${moved.offset}px, 0)`;
199
+ if (moved.reveal) {
200
+ const { opacity, transform } = reveal(moved.offset, moved.height, moved.peek);
201
+ moved.reveal.style.opacity = String(opacity);
202
+ moved.reveal.style.transform = transform;
203
+ }
234
204
  };
235
- const onEnd = (event) => {
236
- var _a, _b;
237
- const current = latest.current;
205
+ const onEnd = (event, touch) => {
238
206
  if (start && claimed && moved) {
239
- const end = event.changedTouches[0];
240
- velocity.add({ x: (_a = end === null || end === void 0 ? void 0 : end.clientX) !== null && _a !== void 0 ? _a : start.x, y: (_b = end === null || end === void 0 ? void 0 : end.clientY) !== null && _b !== void 0 ? _b : start.y, t: event.timeStamp });
241
- const speed = velocity.speed;
242
- const open = PullUtil.settle(moved.offset, moved.height, current.open, speed, moved.peek);
243
- const rest = open ? moved.height - moved.peek : 0;
244
- const ms = sheet_swipe_1.SwipeUtil.duration(rest - moved.offset, speed, PullUtil.SETTLE_MS);
245
- current.setOpen(open);
246
- const elements = moved;
247
- requestAnimationFrame(() => {
248
- settle.run(ms, [elements.sheet, elements.reveal], [elements.reveal]);
249
- release(elements);
250
- });
207
+ const current = latest.current;
208
+ if (touch) {
209
+ velocity.add({ x: touch.clientX, y: touch.clientY, t: event.timeStamp });
210
+ }
211
+ const speed = touch ? velocity.speed : 0;
212
+ const { sheet, height, peek, offset } = moved;
213
+ const open = PullUtil.settle(offset, height, current.open, speed, peek);
214
+ const rest = open ? height - peek : 0;
215
+ const motion = sheet_swipe_1.SwipeUtil.motion(offset, rest, speed, PullUtil.SETTLE_MS, [0, height - peek]);
216
+ settle.run(motion, [
217
+ { element: sheet, transform: `translate3d(0, ${rest}px, 0)` },
218
+ { element: moved.reveal, ...reveal(rest, height, peek) },
219
+ ], () => latest.current.open === open, () => delete root.dataset.pull);
220
+ (0, sheet_swipe_1.afterLetGo)(open, () => latest.current);
221
+ }
222
+ reset();
223
+ };
224
+ const finger = new sheet_swipe_1.SwipeFinger({ move: onMove, end: onEnd }, true);
225
+ const onStart = (event) => {
226
+ const current = latest.current;
227
+ // Another finger beside the one that pulls changes nothing.
228
+ if (finger.down && !finger.follow(event, document)) {
229
+ return;
230
+ }
231
+ finger.stop();
232
+ reset();
233
+ const touch = event.touches[0];
234
+ const target = event.target instanceof Node ? event.target : null;
235
+ const area = target
236
+ ? [...document.querySelectorAll(current.open ? current.closeArea : current.area)].find(element => element.contains(target))
237
+ : undefined;
238
+ const free = !!area && !editable(event.target) && (current.open ? atEnd(event.target, area) : atTop(event.target, area));
239
+ if (touch && free && finger.follow(event, document)) {
240
+ start = { x: touch.clientX, y: touch.clientY, t: event.timeStamp };
241
+ velocity.start(start);
251
242
  }
252
- moved = undefined;
253
- claimed = undefined;
254
- stop();
255
243
  };
256
244
  document.addEventListener('touchstart', onStart, { passive: true });
257
- document.addEventListener('touchend', onEnd, { passive: true });
258
- document.addEventListener('touchcancel', onEnd, { passive: true });
259
245
  return () => {
260
246
  document.removeEventListener('touchstart', onStart);
261
- document.removeEventListener('touchend', onEnd);
262
- document.removeEventListener('touchcancel', onEnd);
263
- stop();
264
- release(moved);
265
- settle.clear();
247
+ finger.stop();
248
+ // A list still under the finger goes back to where it rests; one sliding on finishes its slide.
249
+ if (moved) {
250
+ delete root.dataset.pull;
251
+ settle.finish();
252
+ }
253
+ reset();
266
254
  };
267
255
  }, [enabled]);
268
256
  }
@@ -5,23 +5,48 @@ import * as React from 'react';
5
5
  * anywhere else, or another row opened. Pure, for the tests.
6
6
  */
7
7
  export declare namespace RowSwipeUtil {
8
- /** Past the actions, the row follows the finger this much, as a list pulled past its end. */
9
- const STRETCH = 0.3;
8
+ /** Past the actions, the row follows the finger this much at first, then less and less, as a list of iOS pulled past its end. */
9
+ const RUBBER = 0.55;
10
10
  /** How long its style slides the row (style/device.ts). */
11
11
  const SETTLE_MS = 300;
12
- /** Where the row is, from 0 (closed) to `-width` (its actions shown), when the finger moved `dx`. */
13
- function offset(dx: number, width: number, open: boolean): number;
14
- /** Whether it stays open, let go at `speed` (pixels a millisecond, SwipeVelocity) after moving `dx`. */
15
- function settle(dx: number, width: number, open: boolean, speed: number): boolean;
12
+ /** How far past its actions it ever goes, however far the finger: less than what the actions fill past their edge (style/device.ts). */
13
+ const BEYOND_PX = 100;
14
+ /** Told a swipe, the row catches up with the finger over this much of its way, not at once. */
15
+ const CATCH_PX = 40;
16
+ /** Let go, where it is headed is where it would be this much later at the finger's speed: a short quick swipe opens it too. */
17
+ const PROJECT_MS = 150;
18
+ /** Where the row is, from 0 (closed) to `-width` (its actions shown) and a little past, the finger at `x` (where it took the row, and how far it moved since). */
19
+ function offset(x: number, width: number): number;
20
+ /** Where the finger would be for the row at `offset`: the other way from `offset`, so that a row taken past its actions does not jump. */
21
+ function finger(offset: number, width: number): number;
22
+ /** Whether it stays open, let go at `offset` at `speed` (pixels a millisecond, SwipeVelocity): flicked, the way it was; else where it is headed. */
23
+ function settle(offset: number, width: number, speed: number): boolean;
24
+ /**
25
+ * How far the finger has moved the row, `dx` since the move was told a swipe, `lag` before (the few pixels
26
+ * that told it): from where it was, without a jump, a little faster than the finger until it is where the
27
+ * finger says (CATCH_PX), as if it had followed it from the start.
28
+ */
29
+ function follow(dx: number, lag: number): number;
30
+ /**
31
+ * How far each action is pushed to the right of where it rests, the row at `offset`: they come out with the
32
+ * row's edge, as iOS's, the first one at it, the others spread over what is shown (`share`, 1 - its index
33
+ * of how many there are: 1 for the first, less for those after).
34
+ */
35
+ function shift(offset: number, width: number, share: number): number;
16
36
  /** Whether the move so far is the row's (more sideways than down, to the left unless open); undefined until it is told. */
17
37
  function claims(dx: number, dy: number, open: boolean): boolean | undefined;
18
38
  }
19
39
  /**
20
40
  * Lets a finger swipe the row of `ref` (a SwipeRow) while `enabled`: its content moves over its actions, whose
21
- * width is the way to go, and slides on at the speed the finger left it. Its listeners are passive (the row has
22
- * `touch-action: pan-y`), so the list scrolls on the compositor; each move only sets a transform. The style says
23
- * where an open row rests (`data-swiped`); the row clips what slides out of it only while it is moved, open or
24
- * on its way back (`data-swipe-clip`), so that a menu of the row is not cut at its edges.
41
+ * width is the way to go, and they come out with its edge (RowSwipeUtil.shift); let go, all slide on as on a
42
+ * spring from the speed the finger left them (SwipeSettle). The row sets off from where the move is told a swipe
43
+ * and catches up with the finger (RowSwipeUtil.follow), so it never jumps under it; past its actions it stretches less and
44
+ * less. Open, it closes when the finger scrolls the list from it, or holds it for its menu. Its
45
+ * listeners are passive (the row has `touch-action: pan-y`), so the list scrolls on the compositor; each move
46
+ * only sets a transform. The finger is followed on what it touched (SwipeFinger), so that a row drawn again
47
+ * under it does not stop half way. The style says where an open row rests (`data-swiped`); the row clips
48
+ * what slides out of it only while it is moved, open or on its way back (`data-swipe-clip`), so that a menu
49
+ * of the row is not cut at its edges.
25
50
  */
26
51
  export declare function useRowSwipe(ref: React.RefObject<HTMLElement | null>, enabled: boolean): [boolean, () => void];
27
52
  //# sourceMappingURL=row-swipe.d.ts.map
@@ -44,27 +44,64 @@ const sheet_swipe_1 = require("./sheet-swipe");
44
44
  */
45
45
  var RowSwipeUtil;
46
46
  (function (RowSwipeUtil) {
47
- /** Past the actions, the row follows the finger this much, as a list pulled past its end. */
48
- RowSwipeUtil.STRETCH = 0.3;
47
+ /** Past the actions, the row follows the finger this much at first, then less and less, as a list of iOS pulled past its end. */
48
+ RowSwipeUtil.RUBBER = 0.55;
49
49
  /** How long its style slides the row (style/device.ts). */
50
50
  RowSwipeUtil.SETTLE_MS = 300;
51
- /** Where the row is, from 0 (closed) to `-width` (its actions shown), when the finger moved `dx`. */
52
- function offset(dx, width, open) {
53
- const x = (open ? -width : 0) + dx;
51
+ /** How far past its actions it ever goes, however far the finger: less than what the actions fill past their edge (style/device.ts). */
52
+ RowSwipeUtil.BEYOND_PX = 100;
53
+ /** Told a swipe, the row catches up with the finger over this much of its way, not at once. */
54
+ RowSwipeUtil.CATCH_PX = 40;
55
+ /** Let go, where it is headed is where it would be this much later at the finger's speed: a short quick swipe opens it too. */
56
+ RowSwipeUtil.PROJECT_MS = 150;
57
+ /** Where the row is, from 0 (closed) to `-width` (its actions shown) and a little past, the finger at `x` (where it took the row, and how far it moved since). */
58
+ function offset(x, width) {
54
59
  if (x > 0) {
55
60
  return 0;
56
61
  }
57
- return x < -width ? -width + (x + width) * RowSwipeUtil.STRETCH : x;
62
+ if (x >= -width) {
63
+ return x;
64
+ }
65
+ // The rubber band of iOS: as fast as RUBBER at first, never as far as BEYOND_PX; its slope has no kink past the start.
66
+ const past = -width - x;
67
+ return -width - RowSwipeUtil.BEYOND_PX * (1 - 1 / ((past * RowSwipeUtil.RUBBER) / RowSwipeUtil.BEYOND_PX + 1));
58
68
  }
59
69
  RowSwipeUtil.offset = offset;
60
- /** Whether it stays open, let go at `speed` (pixels a millisecond, SwipeVelocity) after moving `dx`. */
61
- function settle(dx, width, open, speed) {
70
+ /** Where the finger would be for the row at `offset`: the other way from `offset`, so that a row taken past its actions does not jump. */
71
+ function finger(offset, width) {
72
+ if (offset >= -width) {
73
+ return offset;
74
+ }
75
+ const past = Math.min(-width - offset, RowSwipeUtil.BEYOND_PX - 0.01);
76
+ return -width - (RowSwipeUtil.BEYOND_PX / RowSwipeUtil.RUBBER) * (1 / (1 - past / RowSwipeUtil.BEYOND_PX) - 1);
77
+ }
78
+ RowSwipeUtil.finger = finger;
79
+ /** Whether it stays open, let go at `offset` at `speed` (pixels a millisecond, SwipeVelocity): flicked, the way it was; else where it is headed. */
80
+ function settle(offset, width, speed) {
62
81
  if (Math.abs(speed) > sheet_swipe_1.SwipeUtil.FLICK) {
63
82
  return speed < 0;
64
83
  }
65
- return offset(dx, width, open) < -width / 2;
84
+ return offset + speed * RowSwipeUtil.PROJECT_MS < -width / 2;
66
85
  }
67
86
  RowSwipeUtil.settle = settle;
87
+ /**
88
+ * How far the finger has moved the row, `dx` since the move was told a swipe, `lag` before (the few pixels
89
+ * that told it): from where it was, without a jump, a little faster than the finger until it is where the
90
+ * finger says (CATCH_PX), as if it had followed it from the start.
91
+ */
92
+ function follow(dx, lag) {
93
+ return dx + lag * Math.min(1, Math.abs(dx) / RowSwipeUtil.CATCH_PX);
94
+ }
95
+ RowSwipeUtil.follow = follow;
96
+ /**
97
+ * How far each action is pushed to the right of where it rests, the row at `offset`: they come out with the
98
+ * row's edge, as iOS's, the first one at it, the others spread over what is shown (`share`, 1 - its index
99
+ * of how many there are: 1 for the first, less for those after).
100
+ */
101
+ function shift(offset, width, share) {
102
+ return (width + offset) * share;
103
+ }
104
+ RowSwipeUtil.shift = shift;
68
105
  /** Whether the move so far is the row's (more sideways than down, to the left unless open); undefined until it is told. */
69
106
  function claims(dx, dy, open) {
70
107
  if (Math.hypot(dx, dy) < sheet_swipe_1.SwipeUtil.SLOP_PX) {
@@ -78,15 +115,27 @@ var RowSwipeUtil;
78
115
  let opened;
79
116
  /** What slides in a row (SwipeRow): its content, over its actions. */
80
117
  const CONTENT = ':scope > .ta-swipe-content';
81
- const ACTIONS = ':scope > .ta-swipe-actions';
118
+ const ACTION = ':scope > .ta-swipe-actions > .ta-swipe-action';
82
119
  /** A tap: from the finger down to its click, at most. */
83
120
  const TAP_MS = 600;
121
+ /** Where each of `buttons` is, the row at `offset` (RowSwipeUtil.shift). */
122
+ function actionTargets(buttons, offset, width) {
123
+ return buttons.map((element, index) => ({
124
+ element,
125
+ transform: `translate3d(${RowSwipeUtil.shift(offset, width, 1 - index / buttons.length)}px, 0, 0)`,
126
+ }));
127
+ }
84
128
  /**
85
129
  * Lets a finger swipe the row of `ref` (a SwipeRow) while `enabled`: its content moves over its actions, whose
86
- * width is the way to go, and slides on at the speed the finger left it. Its listeners are passive (the row has
87
- * `touch-action: pan-y`), so the list scrolls on the compositor; each move only sets a transform. The style says
88
- * where an open row rests (`data-swiped`); the row clips what slides out of it only while it is moved, open or
89
- * on its way back (`data-swipe-clip`), so that a menu of the row is not cut at its edges.
130
+ * width is the way to go, and they come out with its edge (RowSwipeUtil.shift); let go, all slide on as on a
131
+ * spring from the speed the finger left them (SwipeSettle). The row sets off from where the move is told a swipe
132
+ * and catches up with the finger (RowSwipeUtil.follow), so it never jumps under it; past its actions it stretches less and
133
+ * less. Open, it closes when the finger scrolls the list from it, or holds it for its menu. Its
134
+ * listeners are passive (the row has `touch-action: pan-y`), so the list scrolls on the compositor; each move
135
+ * only sets a transform. The finger is followed on what it touched (SwipeFinger), so that a row drawn again
136
+ * under it does not stop half way. The style says where an open row rests (`data-swiped`); the row clips
137
+ * what slides out of it only while it is moved, open or on its way back (`data-swipe-clip`), so that a menu
138
+ * of the row is not cut at its edges.
90
139
  */
91
140
  function useRowSwipe(ref, enabled) {
92
141
  const [open, setOpen] = React.useState(false);
@@ -99,15 +148,12 @@ function useRowSwipe(ref, enabled) {
99
148
  return;
100
149
  }
101
150
  let start;
151
+ let last;
102
152
  let claimed;
103
153
  let moved;
104
154
  let unclip;
105
155
  const velocity = new sheet_swipe_1.SwipeVelocity();
106
156
  const settle = new sheet_swipe_1.SwipeSettle();
107
- const release = (element) => {
108
- delete row.dataset.swiping;
109
- element === null || element === void 0 ? void 0 : element.style.removeProperty('transform');
110
- };
111
157
  const clip = (on, after = 0) => {
112
158
  clearTimeout(unclip);
113
159
  if (on) {
@@ -117,38 +163,38 @@ function useRowSwipe(ref, enabled) {
117
163
  unclip = setTimeout(() => delete row.dataset.swipeClip, after);
118
164
  }
119
165
  };
120
- const onStart = (event) => {
121
- const touch = event.touches[0];
122
- claimed = undefined;
123
- // A swipe from the edge a sheet comes from is the sheet's (useSheetSwipe's edgeOver), not the row's.
124
- const side = document.documentElement.dataset.edgeSwipe;
125
- const edge = !!touch && (side === 'right' ? touch.clientX >= window.innerWidth - sheet_swipe_1.SwipeUtil.EDGE_PX : side === 'left' && touch.clientX <= sheet_swipe_1.SwipeUtil.EDGE_PX);
126
- start = event.touches.length === 1 && touch && !edge ? { x: touch.clientX, y: touch.clientY, t: event.timeStamp } : undefined;
127
- if (start) {
128
- velocity.start(start);
129
- }
130
- };
131
- const onMove = (event) => {
132
- var _a;
133
- var _b;
134
- const touch = event.touches[0];
135
- if (!start || !touch || claimed === false) {
166
+ const onMove = (event, touch) => {
167
+ if (!start || claimed === false) {
136
168
  return;
137
169
  }
138
- const dx = touch.clientX - start.x;
139
170
  if (claimed === undefined) {
140
- claimed = RowSwipeUtil.claims(dx, touch.clientY - start.y, state.current);
141
- if (!claimed) {
171
+ claimed = RowSwipeUtil.claims(touch.clientX - start.x, touch.clientY - start.y, state.current);
172
+ if (claimed === undefined) {
142
173
  return;
143
174
  }
144
175
  const element = row.querySelector(CONTENT);
145
- const width = (_b = (_a = row.querySelector(ACTIONS)) === null || _a === void 0 ? void 0 : _a.offsetWidth) !== null && _b !== void 0 ? _b : 0;
146
- if (!element || !width) {
176
+ const buttons = [...row.querySelectorAll(ACTION)];
177
+ // The way to go is what the actions fill (their box spans the row, to clip them: style/device.ts).
178
+ const width = buttons.reduce((sum, button) => sum + button.offsetWidth, 0);
179
+ if (!claimed || !element || !width) {
147
180
  claimed = false;
181
+ finger.stop();
182
+ // Open, a scroll from it closes it, as a touch elsewhere does.
183
+ if (state.current) {
184
+ close();
185
+ }
148
186
  return;
149
187
  }
150
- moved = { content: element, width };
151
- settle.clear();
188
+ // From where it is (at rest, or still sliding), and from where the finger is now.
189
+ moved = {
190
+ content: element,
191
+ buttons,
192
+ width,
193
+ from: RowSwipeUtil.finger((0, sheet_swipe_1.translated)(element), width),
194
+ x: touch.clientX,
195
+ lag: touch.clientX - start.x,
196
+ };
197
+ settle.hold([element, ...buttons]);
152
198
  clip(true);
153
199
  row.dataset.swiping = '';
154
200
  if (opened && opened !== handle) {
@@ -156,38 +202,73 @@ function useRowSwipe(ref, enabled) {
156
202
  }
157
203
  }
158
204
  if (moved) {
159
- velocity.add({ x: touch.clientX, y: touch.clientY, t: event.timeStamp });
160
- moved.content.style.transform = `translate3d(${RowSwipeUtil.offset(dx, moved.width, state.current)}px, 0, 0)`;
205
+ last = { x: touch.clientX, y: touch.clientY, t: event.timeStamp };
206
+ velocity.add(last);
207
+ const x = RowSwipeUtil.offset(moved.from + RowSwipeUtil.follow(touch.clientX - moved.x, moved.lag), moved.width);
208
+ moved.content.style.transform = `translate3d(${x}px, 0, 0)`;
209
+ for (const { element, transform } of actionTargets(moved.buttons, x, moved.width)) {
210
+ element.style.transform = transform;
211
+ }
161
212
  }
162
213
  };
163
- const onEnd = (event) => {
164
- var _a, _b;
214
+ const onEnd = (event, touch) => {
165
215
  if (start && moved) {
166
- const end = event.changedTouches[0];
167
- const x = (_a = end === null || end === void 0 ? void 0 : end.clientX) !== null && _a !== void 0 ? _a : start.x;
168
- velocity.add({ x, y: (_b = end === null || end === void 0 ? void 0 : end.clientY) !== null && _b !== void 0 ? _b : start.y, t: event.timeStamp });
169
- const speed = velocity.speed;
170
- const next = RowSwipeUtil.settle(x - start.x, moved.width, state.current, speed);
171
- const from = RowSwipeUtil.offset(x - start.x, moved.width, state.current);
172
- const ms = sheet_swipe_1.SwipeUtil.duration((next ? -moved.width : 0) - from, speed, RowSwipeUtil.SETTLE_MS);
173
- show(next, ms);
174
- // Released in the frame the row takes its place, so that it slides on from where the finger left it, at its speed.
175
- const element = moved.content;
176
- requestAnimationFrame(() => {
177
- settle.run(ms, [element]);
178
- release(element);
179
- });
216
+ const end = touch ? { x: touch.clientX, y: touch.clientY, t: event.timeStamp } : (last !== null && last !== void 0 ? last : start);
217
+ if (touch) {
218
+ velocity.add(end);
219
+ }
220
+ // Taken by the system (a call, the app put away), it goes to the nearer side, not the way it was going.
221
+ const speed = touch && event.type !== 'touchcancel' ? velocity.speed : 0;
222
+ const { content, buttons, width } = moved;
223
+ const from = RowSwipeUtil.offset(moved.from + RowSwipeUtil.follow(end.x - moved.x, moved.lag), width);
224
+ // Where it ends is told by where the finger is, which the row may not have caught up with yet.
225
+ const next = RowSwipeUtil.settle(RowSwipeUtil.offset(moved.from + end.x - start.x, width), width, speed);
226
+ const rest = next ? -width : 0;
227
+ // Stretched past its actions, the row went slower than the finger: it goes back as fast as it went.
228
+ const along = from < -width ? speed * RowSwipeUtil.RUBBER : speed;
229
+ const motion = sheet_swipe_1.SwipeUtil.motion(from, rest, along, RowSwipeUtil.SETTLE_MS, [-width - RowSwipeUtil.BEYOND_PX, 0]);
230
+ settle.run(motion, [{ element: content, transform: `translate3d(${rest}px, 0, 0)` }, ...actionTargets(buttons, rest, width)], () => state.current === next, () => delete row.dataset.swiping);
231
+ show(next, motion.ms);
180
232
  }
181
233
  start = undefined;
234
+ last = undefined;
182
235
  moved = undefined;
183
236
  };
184
- const handle = { close: () => show(false) };
185
- closer.current = handle.close;
237
+ const finger = new sheet_swipe_1.SwipeFinger({ move: onMove, end: onEnd });
238
+ const onStart = (event) => {
239
+ // Another finger beside the one that swipes it changes nothing.
240
+ if (finger.down && !finger.follow(event, row)) {
241
+ return;
242
+ }
243
+ finger.stop();
244
+ const touch = event.touches[0];
245
+ claimed = undefined;
246
+ // A swipe from the edge a sheet comes from is the sheet's (useSheetSwipe's edgeOver), not the row's.
247
+ const side = document.documentElement.dataset.edgeSwipe;
248
+ const edge = !!touch && (side === 'right' ? touch.clientX >= window.innerWidth - sheet_swipe_1.SwipeUtil.EDGE_PX : side === 'left' && touch.clientX <= sheet_swipe_1.SwipeUtil.EDGE_PX);
249
+ start = touch && !edge && finger.follow(event, row) ? { x: touch.clientX, y: touch.clientY, t: event.timeStamp } : undefined;
250
+ if (start) {
251
+ velocity.start(start);
252
+ }
253
+ };
254
+ // Closed while it still slides (a tap on it, or elsewhere), it goes back from where it is.
255
+ const close = () => {
256
+ settle.release();
257
+ show(false);
258
+ };
259
+ // Held for its menu (LongPress), it closes first, as the menu is of the row, not of its actions.
260
+ const onMenu = () => {
261
+ if (state.current) {
262
+ close();
263
+ }
264
+ };
265
+ const handle = { close };
266
+ closer.current = close;
186
267
  // Open, a touch anywhere else closes it, and that is all the tap does, as in WeChat; a tap on the row too (SwipeRow).
187
268
  let swallowUntil = 0;
188
269
  const onOutside = (event) => {
189
270
  if (!row.contains(event.target)) {
190
- show(false);
271
+ close();
191
272
  swallowUntil = event.timeStamp + TAP_MS;
192
273
  document.addEventListener('click', swallow, true);
193
274
  }
@@ -215,14 +296,11 @@ function useRowSwipe(ref, enabled) {
215
296
  }
216
297
  };
217
298
  row.addEventListener('touchstart', onStart, { passive: true });
218
- row.addEventListener('touchmove', onMove, { passive: true });
219
- row.addEventListener('touchend', onEnd, { passive: true });
220
- row.addEventListener('touchcancel', onEnd, { passive: true });
299
+ row.addEventListener('contextmenu', onMenu);
221
300
  return () => {
222
301
  row.removeEventListener('touchstart', onStart);
223
- row.removeEventListener('touchmove', onMove);
224
- row.removeEventListener('touchend', onEnd);
225
- row.removeEventListener('touchcancel', onEnd);
302
+ row.removeEventListener('contextmenu', onMenu);
303
+ finger.stop();
226
304
  document.removeEventListener('touchstart', onOutside);
227
305
  document.removeEventListener('click', swallow, true);
228
306
  if (opened === handle) {
@@ -230,8 +308,8 @@ function useRowSwipe(ref, enabled) {
230
308
  }
231
309
  clearTimeout(unclip);
232
310
  delete row.dataset.swipeClip;
233
- settle.clear();
234
- release(moved === null || moved === void 0 ? void 0 : moved.content);
311
+ delete row.dataset.swiping;
312
+ settle.finish();
235
313
  closer.current = () => setOpen(false);
236
314
  };
237
315
  }, [ref, enabled]);
@@ -0,0 +1,17 @@
1
+ /** What the app's web view gives the page to tell it whether a shake may offer to undo (TaBridgeViewController of apps/ta-mobile). */
2
+ export interface ShakeUndoBridge {
3
+ postMessage(undo: boolean): void;
4
+ }
5
+ export declare namespace ShakeUndoUtil {
6
+ /** A field of text being edited that has text in it: what a shake may undo is there to see. */
7
+ function hasText(element: Element | null): boolean;
8
+ }
9
+ /**
10
+ * Shake to Undo in the Ta app on iOS only while a field being edited has text in it. The web view keeps what
11
+ * was typed and sent, or typed and put away, to undo: the system would offer to undo it with the field empty,
12
+ * or on a page without a field. The page tells the app when that changes: focus, typing, the selection, and
13
+ * after a key, a tap or a finger let go, which may have the page empty a field itself (a message sent) with no
14
+ * event of the field. Returns how to stop.
15
+ */
16
+ export declare function startShakeUndo(doc: Document, bridge: ShakeUndoBridge): () => void;
17
+ //# sourceMappingURL=shake-undo.d.ts.map