@soxa-ui/plugins 0.0.0-stage → 0.3.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (630) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +125 -2
  3. package/dist/base/base.class.d.ts +54 -0
  4. package/dist/base/base.class.js +69 -0
  5. package/dist/base/bundle.class.d.ts +25 -0
  6. package/dist/base/bundle.class.js +68 -0
  7. package/dist/base/index.d.ts +3 -0
  8. package/dist/base/types.d.ts +147 -0
  9. package/dist/custom/accordion/header.d.ts +19 -0
  10. package/dist/custom/accordion/header.js +38 -0
  11. package/dist/custom/accordion/index.d.ts +2 -0
  12. package/dist/custom/accordion/item-ids/index.d.ts +1 -0
  13. package/dist/custom/accordion/item-ids/item-ids.plugin.d.ts +24 -0
  14. package/dist/custom/accordion/item-ids/item-ids.plugin.js +44 -0
  15. package/dist/custom/action/action.plugin.d.ts +178 -0
  16. package/dist/custom/action/action.plugin.js +339 -0
  17. package/dist/custom/action/index.d.ts +2 -0
  18. package/dist/custom/action/types.d.ts +65 -0
  19. package/dist/custom/calendar/ids/ids.plugin.d.ts +25 -0
  20. package/dist/custom/calendar/ids/ids.plugin.js +44 -0
  21. package/dist/custom/calendar/ids/index.d.ts +1 -0
  22. package/dist/custom/calendar/index.d.ts +5 -0
  23. package/dist/custom/calendar/keyboard/index.d.ts +2 -0
  24. package/dist/custom/calendar/keyboard/keyboard.plugin.d.ts +114 -0
  25. package/dist/custom/calendar/keyboard/keyboard.plugin.js +249 -0
  26. package/dist/custom/calendar/keyboard/types.d.ts +16 -0
  27. package/dist/custom/calendar/names/index.d.ts +1 -0
  28. package/dist/custom/calendar/names/names.plugin.d.ts +24 -0
  29. package/dist/custom/calendar/names/names.plugin.js +45 -0
  30. package/dist/custom/calendar/parts.d.ts +58 -0
  31. package/dist/custom/calendar/parts.js +119 -0
  32. package/dist/custom/calendar/pointer/index.d.ts +2 -0
  33. package/dist/custom/calendar/pointer/pointer.plugin.d.ts +58 -0
  34. package/dist/custom/calendar/pointer/pointer.plugin.js +144 -0
  35. package/dist/custom/calendar/pointer/types.d.ts +6 -0
  36. package/dist/custom/calendar/stop.d.ts +20 -0
  37. package/dist/custom/calendar/stop.js +32 -0
  38. package/dist/custom/calendar/types.d.ts +16 -0
  39. package/dist/custom/clearable/index.d.ts +1 -0
  40. package/dist/custom/clearable/names/index.d.ts +1 -0
  41. package/dist/custom/clearable/names/names.plugin.d.ts +24 -0
  42. package/dist/custom/clearable/names/names.plugin.js +29 -0
  43. package/dist/custom/collection/bundles.plugin.d.ts +55 -0
  44. package/dist/custom/collection/bundles.plugin.js +100 -0
  45. package/dist/custom/collection/collection-bundles-access.plugin.d.ts +29 -0
  46. package/dist/custom/collection/collection-bundles-access.plugin.js +44 -0
  47. package/dist/custom/collection/collection-elements.plugin.d.ts +55 -0
  48. package/dist/custom/collection/collection-elements.plugin.js +100 -0
  49. package/dist/custom/collection/index.d.ts +4 -0
  50. package/dist/custom/collection/leaving-focus.d.ts +119 -0
  51. package/dist/custom/collection/leaving-focus.js +164 -0
  52. package/dist/custom/collection/reachable.d.ts +14 -0
  53. package/dist/custom/collection/reachable.js +18 -0
  54. package/dist/custom/collection/types.d.ts +14 -0
  55. package/dist/custom/component-view/aria.plugin.d.ts +102 -0
  56. package/dist/custom/component-view/aria.plugin.js +190 -0
  57. package/dist/custom/component-view/index.d.ts +2 -0
  58. package/dist/custom/component-view/types.d.ts +62 -0
  59. package/dist/custom/date-input/clipboard/clipboard.plugin.d.ts +41 -0
  60. package/dist/custom/date-input/clipboard/clipboard.plugin.js +98 -0
  61. package/dist/custom/date-input/clipboard/index.d.ts +2 -0
  62. package/dist/custom/date-input/clipboard/types.d.ts +6 -0
  63. package/dist/custom/date-input/ids/ids.plugin.d.ts +21 -0
  64. package/dist/custom/date-input/ids/ids.plugin.js +28 -0
  65. package/dist/custom/date-input/ids/index.d.ts +1 -0
  66. package/dist/custom/date-input/index.d.ts +6 -0
  67. package/dist/custom/date-input/keyboard/index.d.ts +2 -0
  68. package/dist/custom/date-input/keyboard/keyboard.plugin.d.ts +54 -0
  69. package/dist/custom/date-input/keyboard/keyboard.plugin.js +154 -0
  70. package/dist/custom/date-input/keyboard/types.d.ts +9 -0
  71. package/dist/custom/date-input/parts.d.ts +49 -0
  72. package/dist/custom/date-input/parts.js +127 -0
  73. package/dist/custom/date-input/pointer/index.d.ts +2 -0
  74. package/dist/custom/date-input/pointer/pointer.plugin.d.ts +51 -0
  75. package/dist/custom/date-input/pointer/pointer.plugin.js +141 -0
  76. package/dist/custom/date-input/pointer/types.d.ts +6 -0
  77. package/dist/custom/date-input/touch/index.d.ts +2 -0
  78. package/dist/custom/date-input/touch/touch.plugin.d.ts +100 -0
  79. package/dist/custom/date-input/touch/touch.plugin.js +276 -0
  80. package/dist/custom/date-input/touch/types.d.ts +6 -0
  81. package/dist/custom/date-input/types.d.ts +6 -0
  82. package/dist/custom/date-picker/field.d.ts +20 -0
  83. package/dist/custom/date-picker/field.js +27 -0
  84. package/dist/custom/date-picker/focus/focus.plugin.d.ts +56 -0
  85. package/dist/custom/date-picker/focus/focus.plugin.js +81 -0
  86. package/dist/custom/date-picker/focus/index.d.ts +2 -0
  87. package/dist/custom/date-picker/focus/types.d.ts +3 -0
  88. package/dist/custom/date-picker/ids/ids.plugin.d.ts +19 -0
  89. package/dist/custom/date-picker/ids/ids.plugin.js +28 -0
  90. package/dist/custom/date-picker/ids/index.d.ts +1 -0
  91. package/dist/custom/date-picker/index.d.ts +5 -0
  92. package/dist/custom/date-picker/names/index.d.ts +2 -0
  93. package/dist/custom/date-picker/names/names.plugin.d.ts +33 -0
  94. package/dist/custom/date-picker/names/names.plugin.js +80 -0
  95. package/dist/custom/date-picker/names/types.d.ts +12 -0
  96. package/dist/custom/date-picker/trigger/index.d.ts +2 -0
  97. package/dist/custom/date-picker/trigger/trigger.plugin.d.ts +37 -0
  98. package/dist/custom/date-picker/trigger/trigger.plugin.js +69 -0
  99. package/dist/custom/date-picker/trigger/types.d.ts +3 -0
  100. package/dist/custom/dialog/ids/ids.plugin.d.ts +15 -0
  101. package/dist/custom/dialog/ids/ids.plugin.js +28 -0
  102. package/dist/custom/dialog/ids/index.d.ts +1 -0
  103. package/dist/custom/dialog/index.d.ts +3 -0
  104. package/dist/custom/dialog/layout/index.d.ts +3 -0
  105. package/dist/custom/dialog/layout/layout.plugin.d.ts +42 -0
  106. package/dist/custom/dialog/layout/layout.plugin.js +78 -0
  107. package/dist/custom/dialog/layout/offset-event.d.ts +35 -0
  108. package/dist/custom/dialog/layout/offset-event.js +44 -0
  109. package/dist/custom/dialog/layout/types.d.ts +12 -0
  110. package/dist/custom/dialog/names/index.d.ts +1 -0
  111. package/dist/custom/dialog/names/names.plugin.d.ts +13 -0
  112. package/dist/custom/dialog/names/names.plugin.js +17 -0
  113. package/dist/custom/dismiss/dismiss.plugin.d.ts +174 -0
  114. package/dist/custom/dismiss/dismiss.plugin.js +287 -0
  115. package/dist/custom/dismiss/index.d.ts +2 -0
  116. package/dist/custom/dismiss/types.d.ts +59 -0
  117. package/dist/custom/drag-and-drop/drag.plugin.d.ts +87 -0
  118. package/dist/custom/drag-and-drop/drag.plugin.js +310 -0
  119. package/dist/custom/drag-and-drop/index.d.ts +2 -0
  120. package/dist/custom/drag-and-drop/types.d.ts +13 -0
  121. package/dist/custom/drawer/index.d.ts +1 -0
  122. package/dist/custom/drawer/layout/index.d.ts +2 -0
  123. package/dist/custom/drawer/layout/layout.plugin.d.ts +17 -0
  124. package/dist/custom/drawer/layout/layout.plugin.js +22 -0
  125. package/dist/custom/drawer/layout/types.d.ts +3 -0
  126. package/dist/custom/element/element.plugin.d.ts +35 -0
  127. package/dist/custom/element/element.plugin.js +58 -0
  128. package/dist/custom/element/index.d.ts +2 -0
  129. package/dist/custom/element/types.d.ts +18 -0
  130. package/dist/custom/field/ids/ids.plugin.d.ts +64 -0
  131. package/dist/custom/field/ids/ids.plugin.js +126 -0
  132. package/dist/custom/field/ids/index.d.ts +2 -0
  133. package/dist/custom/field/ids/types.d.ts +28 -0
  134. package/dist/custom/field/index.d.ts +1 -0
  135. package/dist/custom/frame/anchor/anchor.plugin.d.ts +483 -0
  136. package/dist/custom/frame/anchor/anchor.plugin.js +820 -0
  137. package/dist/custom/frame/anchor/index.d.ts +2 -0
  138. package/dist/custom/frame/anchor/types.d.ts +83 -0
  139. package/dist/custom/frame/index.d.ts +2 -0
  140. package/dist/custom/frame/layout/index.d.ts +2 -0
  141. package/dist/custom/frame/layout/layout.plugin.d.ts +24 -0
  142. package/dist/custom/frame/layout/layout.plugin.js +65 -0
  143. package/dist/custom/frame/layout/types.d.ts +5 -0
  144. package/dist/custom/icon/index.d.ts +2 -0
  145. package/dist/custom/icon/layout.plugin.d.ts +21 -0
  146. package/dist/custom/icon/layout.plugin.js +51 -0
  147. package/dist/custom/icon/types.d.ts +5 -0
  148. package/dist/custom/id/id.plugin.d.ts +32 -0
  149. package/dist/custom/id/id.plugin.js +42 -0
  150. package/dist/custom/id/index.d.ts +2 -0
  151. package/dist/custom/id/types.d.ts +6 -0
  152. package/dist/custom/index.d.ts +42 -0
  153. package/dist/custom/input/field.d.ts +16 -0
  154. package/dist/custom/input/field.js +27 -0
  155. package/dist/custom/input/index.d.ts +3 -0
  156. package/dist/custom/input/input.plugin.d.ts +12 -0
  157. package/dist/custom/input/input.plugin.js +46 -0
  158. package/dist/custom/input/types.d.ts +2 -0
  159. package/dist/custom/input-bool/index.d.ts +2 -0
  160. package/dist/custom/input-bool/input-bool.plugin.d.ts +30 -0
  161. package/dist/custom/input-bool/input-bool.plugin.js +77 -0
  162. package/dist/custom/input-bool/types.d.ts +5 -0
  163. package/dist/custom/input-control/index.d.ts +2 -0
  164. package/dist/custom/input-control/input-control.plugin.d.ts +12 -0
  165. package/dist/custom/input-control/input-control.plugin.js +40 -0
  166. package/dist/custom/input-control/types.d.ts +2 -0
  167. package/dist/custom/item-group/ids/ids.plugin.d.ts +19 -0
  168. package/dist/custom/item-group/ids/ids.plugin.js +32 -0
  169. package/dist/custom/item-group/ids/index.d.ts +1 -0
  170. package/dist/custom/item-group/index.d.ts +1 -0
  171. package/dist/custom/label/index.d.ts +1 -0
  172. package/dist/custom/label/nested-warn/index.d.ts +1 -0
  173. package/dist/custom/label/nested-warn/nested-warn.plugin.d.ts +21 -0
  174. package/dist/custom/label/nested-warn/nested-warn.plugin.js +41 -0
  175. package/dist/custom/list/height/height.plugin.d.ts +129 -0
  176. package/dist/custom/list/height/height.plugin.js +272 -0
  177. package/dist/custom/list/height/index.d.ts +2 -0
  178. package/dist/custom/list/height/types.d.ts +10 -0
  179. package/dist/custom/list/index.d.ts +7 -0
  180. package/dist/custom/list/item/index.d.ts +2 -0
  181. package/dist/custom/list/item/item.plugin.d.ts +25 -0
  182. package/dist/custom/list/item/item.plugin.js +46 -0
  183. package/dist/custom/list/item/types.d.ts +5 -0
  184. package/dist/custom/list/keyboard/index.d.ts +2 -0
  185. package/dist/custom/list/keyboard/keyboard.plugin.d.ts +133 -0
  186. package/dist/custom/list/keyboard/keyboard.plugin.js +199 -0
  187. package/dist/custom/list/keyboard/types.d.ts +3 -0
  188. package/dist/custom/list/navigation/index.d.ts +2 -0
  189. package/dist/custom/list/navigation/navigation.plugin.d.ts +262 -0
  190. package/dist/custom/list/navigation/navigation.plugin.js +402 -0
  191. package/dist/custom/list/navigation/types.d.ts +25 -0
  192. package/dist/custom/list/newly-selected.d.ts +17 -0
  193. package/dist/custom/list/newly-selected.js +22 -0
  194. package/dist/custom/list/option-ids/index.d.ts +1 -0
  195. package/dist/custom/list/option-ids/option-ids.plugin.d.ts +29 -0
  196. package/dist/custom/list/option-ids/option-ids.plugin.js +43 -0
  197. package/dist/custom/list/row.d.ts +50 -0
  198. package/dist/custom/list/row.js +99 -0
  199. package/dist/custom/list/scroll/index.d.ts +2 -0
  200. package/dist/custom/list/scroll/scroll.plugin.d.ts +132 -0
  201. package/dist/custom/list/scroll/scroll.plugin.js +286 -0
  202. package/dist/custom/list/scroll/types.d.ts +21 -0
  203. package/dist/custom/list/typeahead.d.ts +53 -0
  204. package/dist/custom/list/typeahead.js +58 -0
  205. package/dist/custom/menu/focus/focus.plugin.d.ts +61 -0
  206. package/dist/custom/menu/focus/focus.plugin.js +105 -0
  207. package/dist/custom/menu/focus/index.d.ts +2 -0
  208. package/dist/custom/menu/focus/types.d.ts +2 -0
  209. package/dist/custom/menu/hover/hover.plugin.d.ts +99 -0
  210. package/dist/custom/menu/hover/hover.plugin.js +235 -0
  211. package/dist/custom/menu/hover/index.d.ts +2 -0
  212. package/dist/custom/menu/hover/types.d.ts +2 -0
  213. package/dist/custom/menu/ids/ids.plugin.d.ts +29 -0
  214. package/dist/custom/menu/ids/ids.plugin.js +46 -0
  215. package/dist/custom/menu/ids/index.d.ts +1 -0
  216. package/dist/custom/menu/index.d.ts +11 -0
  217. package/dist/custom/menu/keyboard/index.d.ts +2 -0
  218. package/dist/custom/menu/keyboard/keyboard.plugin.d.ts +41 -0
  219. package/dist/custom/menu/keyboard/keyboard.plugin.js +68 -0
  220. package/dist/custom/menu/keyboard/types.d.ts +2 -0
  221. package/dist/custom/menu/navigation/index.d.ts +2 -0
  222. package/dist/custom/menu/navigation/navigation.plugin.d.ts +116 -0
  223. package/dist/custom/menu/navigation/navigation.plugin.js +222 -0
  224. package/dist/custom/menu/navigation/types.d.ts +2 -0
  225. package/dist/custom/menu/nested-layer.d.ts +13 -0
  226. package/dist/custom/menu/nested-layer.js +20 -0
  227. package/dist/custom/menu/pointer/index.d.ts +2 -0
  228. package/dist/custom/menu/pointer/pointer.plugin.d.ts +45 -0
  229. package/dist/custom/menu/pointer/pointer.plugin.js +95 -0
  230. package/dist/custom/menu/pointer/strategies/context.strategy.d.ts +70 -0
  231. package/dist/custom/menu/pointer/strategies/context.strategy.js +170 -0
  232. package/dist/custom/menu/pointer/strategies/index.d.ts +3 -0
  233. package/dist/custom/menu/pointer/strategies/press.strategy.d.ts +23 -0
  234. package/dist/custom/menu/pointer/strategies/press.strategy.js +33 -0
  235. package/dist/custom/menu/pointer/strategies/types.d.ts +49 -0
  236. package/dist/custom/menu/pointer/types.d.ts +2 -0
  237. package/dist/custom/menu/popover-item-focus/focus.plugin.d.ts +54 -0
  238. package/dist/custom/menu/popover-item-focus/focus.plugin.js +70 -0
  239. package/dist/custom/menu/popover-item-focus/index.d.ts +2 -0
  240. package/dist/custom/menu/popover-item-focus/types.d.ts +10 -0
  241. package/dist/custom/menu/popover-item-keyboard/index.d.ts +2 -0
  242. package/dist/custom/menu/popover-item-keyboard/keyboard.plugin.d.ts +43 -0
  243. package/dist/custom/menu/popover-item-keyboard/keyboard.plugin.js +79 -0
  244. package/dist/custom/menu/popover-item-keyboard/types.d.ts +2 -0
  245. package/dist/custom/menu/popup-ids/ids.plugin.d.ts +27 -0
  246. package/dist/custom/menu/popup-ids/ids.plugin.js +47 -0
  247. package/dist/custom/menu/popup-ids/index.d.ts +1 -0
  248. package/dist/custom/menu/submenu-focus/focus.plugin.d.ts +53 -0
  249. package/dist/custom/menu/submenu-focus/focus.plugin.js +84 -0
  250. package/dist/custom/menu/submenu-focus/index.d.ts +2 -0
  251. package/dist/custom/menu/submenu-focus/types.d.ts +10 -0
  252. package/dist/custom/menu/submenu-keyboard/index.d.ts +2 -0
  253. package/dist/custom/menu/submenu-keyboard/keyboard.plugin.d.ts +43 -0
  254. package/dist/custom/menu/submenu-keyboard/keyboard.plugin.js +74 -0
  255. package/dist/custom/menu/submenu-keyboard/types.d.ts +2 -0
  256. package/dist/custom/number-input/index.d.ts +5 -0
  257. package/dist/custom/number-input/keyboard/index.d.ts +2 -0
  258. package/dist/custom/number-input/keyboard/keyboard.plugin.d.ts +36 -0
  259. package/dist/custom/number-input/keyboard/keyboard.plugin.js +80 -0
  260. package/dist/custom/number-input/keyboard/types.d.ts +3 -0
  261. package/dist/custom/number-input/names/index.d.ts +1 -0
  262. package/dist/custom/number-input/names/names.plugin.d.ts +17 -0
  263. package/dist/custom/number-input/names/names.plugin.js +24 -0
  264. package/dist/custom/number-input/parts.d.ts +21 -0
  265. package/dist/custom/number-input/parts.js +39 -0
  266. package/dist/custom/number-input/stepper/index.d.ts +2 -0
  267. package/dist/custom/number-input/stepper/stepper.plugin.d.ts +59 -0
  268. package/dist/custom/number-input/stepper/stepper.plugin.js +166 -0
  269. package/dist/custom/number-input/stepper/types.d.ts +19 -0
  270. package/dist/custom/number-input/touch/index.d.ts +2 -0
  271. package/dist/custom/number-input/touch/touch.plugin.d.ts +25 -0
  272. package/dist/custom/number-input/touch/touch.plugin.js +53 -0
  273. package/dist/custom/number-input/touch/types.d.ts +3 -0
  274. package/dist/custom/number-input/types.d.ts +8 -0
  275. package/dist/custom/number-input/typing/index.d.ts +2 -0
  276. package/dist/custom/number-input/typing/types.d.ts +6 -0
  277. package/dist/custom/number-input/typing/typing.plugin.d.ts +47 -0
  278. package/dist/custom/number-input/typing/typing.plugin.js +149 -0
  279. package/dist/custom/overlay/focus/focus.plugin.d.ts +150 -0
  280. package/dist/custom/overlay/focus/focus.plugin.js +242 -0
  281. package/dist/custom/overlay/focus/index.d.ts +1 -0
  282. package/dist/custom/overlay/hide-outside/hide-outside.plugin.d.ts +84 -0
  283. package/dist/custom/overlay/hide-outside/hide-outside.plugin.js +187 -0
  284. package/dist/custom/overlay/hide-outside/index.d.ts +2 -0
  285. package/dist/custom/overlay/hide-outside/marks.d.ts +19 -0
  286. package/dist/custom/overlay/hide-outside/marks.js +43 -0
  287. package/dist/custom/overlay/hide-outside/types.d.ts +17 -0
  288. package/dist/custom/overlay/index.d.ts +9 -0
  289. package/dist/custom/overlay/modal-focus/index.d.ts +1 -0
  290. package/dist/custom/overlay/modal-focus/modal-focus.plugin.d.ts +72 -0
  291. package/dist/custom/overlay/modal-focus/modal-focus.plugin.js +109 -0
  292. package/dist/custom/overlay/modal-ids/index.d.ts +1 -0
  293. package/dist/custom/overlay/modal-ids/modal-ids.plugin.d.ts +21 -0
  294. package/dist/custom/overlay/modal-ids/modal-ids.plugin.js +30 -0
  295. package/dist/custom/overlay/modal-layout/index.d.ts +2 -0
  296. package/dist/custom/overlay/modal-layout/modal-layout.plugin.d.ts +66 -0
  297. package/dist/custom/overlay/modal-layout/modal-layout.plugin.js +119 -0
  298. package/dist/custom/overlay/modal-layout/types.d.ts +13 -0
  299. package/dist/custom/overlay/modal-names/index.d.ts +1 -0
  300. package/dist/custom/overlay/modal-names/modal-names.plugin.d.ts +14 -0
  301. package/dist/custom/overlay/modal-names/modal-names.plugin.js +17 -0
  302. package/dist/custom/overlay/open-state.d.ts +12 -0
  303. package/dist/custom/overlay/open-state.js +42 -0
  304. package/dist/custom/overlay/scroll-lock/index.d.ts +2 -0
  305. package/dist/custom/overlay/scroll-lock/lock.d.ts +17 -0
  306. package/dist/custom/overlay/scroll-lock/lock.js +83 -0
  307. package/dist/custom/overlay/scroll-lock/scroll-lock.plugin.d.ts +78 -0
  308. package/dist/custom/overlay/scroll-lock/scroll-lock.plugin.js +134 -0
  309. package/dist/custom/overlay/scroll-lock/types.d.ts +17 -0
  310. package/dist/custom/overlay/swipe/index.d.ts +2 -0
  311. package/dist/custom/overlay/swipe/swipe.plugin.d.ts +150 -0
  312. package/dist/custom/overlay/swipe/swipe.plugin.js +432 -0
  313. package/dist/custom/overlay/swipe/types.d.ts +62 -0
  314. package/dist/custom/overlay/types.d.ts +40 -0
  315. package/dist/custom/pagination/current.d.ts +24 -0
  316. package/dist/custom/pagination/current.js +34 -0
  317. package/dist/custom/pagination/focus/focus.plugin.d.ts +57 -0
  318. package/dist/custom/pagination/focus/focus.plugin.js +106 -0
  319. package/dist/custom/pagination/focus/index.d.ts +2 -0
  320. package/dist/custom/pagination/focus/types.d.ts +8 -0
  321. package/dist/custom/pagination/index.d.ts +3 -0
  322. package/dist/custom/pagination/names/index.d.ts +1 -0
  323. package/dist/custom/pagination/names/names.plugin.d.ts +15 -0
  324. package/dist/custom/pagination/names/names.plugin.js +19 -0
  325. package/dist/custom/popover/focus/focus.plugin.d.ts +69 -0
  326. package/dist/custom/popover/focus/focus.plugin.js +107 -0
  327. package/dist/custom/popover/focus/index.d.ts +2 -0
  328. package/dist/custom/popover/focus/types.d.ts +2 -0
  329. package/dist/custom/popover/ids/ids.plugin.d.ts +18 -0
  330. package/dist/custom/popover/ids/ids.plugin.js +27 -0
  331. package/dist/custom/popover/ids/index.d.ts +1 -0
  332. package/dist/custom/popover/index.d.ts +4 -0
  333. package/dist/custom/popover/names/index.d.ts +1 -0
  334. package/dist/custom/popover/names/names.plugin.d.ts +7 -0
  335. package/dist/custom/popover/names/names.plugin.js +10 -0
  336. package/dist/custom/popover/pointer/index.d.ts +2 -0
  337. package/dist/custom/popover/pointer/pointer.plugin.d.ts +35 -0
  338. package/dist/custom/popover/pointer/pointer.plugin.js +65 -0
  339. package/dist/custom/popover/pointer/types.d.ts +2 -0
  340. package/dist/custom/radio-group/checked/checked.plugin.d.ts +45 -0
  341. package/dist/custom/radio-group/checked/checked.plugin.js +81 -0
  342. package/dist/custom/radio-group/checked/index.d.ts +1 -0
  343. package/dist/custom/radio-group/index.d.ts +3 -0
  344. package/dist/custom/radio-group/name/index.d.ts +1 -0
  345. package/dist/custom/radio-group/name/name.plugin.d.ts +21 -0
  346. package/dist/custom/radio-group/name/name.plugin.js +39 -0
  347. package/dist/custom/radio-group/stop.d.ts +17 -0
  348. package/dist/custom/radio-group/stop.js +30 -0
  349. package/dist/custom/rating/hover/hover.plugin.d.ts +36 -0
  350. package/dist/custom/rating/hover/hover.plugin.js +71 -0
  351. package/dist/custom/rating/hover/index.d.ts +2 -0
  352. package/dist/custom/rating/hover/types.d.ts +7 -0
  353. package/dist/custom/rating/index.d.ts +3 -0
  354. package/dist/custom/rating/names/index.d.ts +1 -0
  355. package/dist/custom/rating/names/names.plugin.d.ts +25 -0
  356. package/dist/custom/rating/names/names.plugin.js +45 -0
  357. package/dist/custom/rating/validity/index.d.ts +2 -0
  358. package/dist/custom/rating/validity/types.d.ts +7 -0
  359. package/dist/custom/rating/validity/validity.plugin.d.ts +48 -0
  360. package/dist/custom/rating/validity/validity.plugin.js +91 -0
  361. package/dist/custom/ready/index.d.ts +1 -0
  362. package/dist/custom/ready/ready.plugin.d.ts +14 -0
  363. package/dist/custom/ready/ready.plugin.js +28 -0
  364. package/dist/custom/scroller/index.d.ts +2 -0
  365. package/dist/custom/scroller/names/index.d.ts +1 -0
  366. package/dist/custom/scroller/names/names.plugin.d.ts +11 -0
  367. package/dist/custom/scroller/names/names.plugin.js +15 -0
  368. package/dist/custom/scroller/viewport/edges.d.ts +34 -0
  369. package/dist/custom/scroller/viewport/edges.js +29 -0
  370. package/dist/custom/scroller/viewport/focus.d.ts +39 -0
  371. package/dist/custom/scroller/viewport/focus.js +61 -0
  372. package/dist/custom/scroller/viewport/index.d.ts +6 -0
  373. package/dist/custom/scroller/viewport/stop.d.ts +24 -0
  374. package/dist/custom/scroller/viewport/stop.js +34 -0
  375. package/dist/custom/scroller/viewport/types.d.ts +31 -0
  376. package/dist/custom/scroller/viewport/viewport.plugin.d.ts +163 -0
  377. package/dist/custom/scroller/viewport/viewport.plugin.js +352 -0
  378. package/dist/custom/select/backspace/backspace.plugin.d.ts +50 -0
  379. package/dist/custom/select/backspace/backspace.plugin.js +125 -0
  380. package/dist/custom/select/backspace/index.d.ts +2 -0
  381. package/dist/custom/select/backspace/types.d.ts +2 -0
  382. package/dist/custom/select/editable/editable.plugin.d.ts +193 -0
  383. package/dist/custom/select/editable/editable.plugin.js +347 -0
  384. package/dist/custom/select/editable/index.d.ts +2 -0
  385. package/dist/custom/select/editable/types.d.ts +6 -0
  386. package/dist/custom/select/ids/ids.plugin.d.ts +22 -0
  387. package/dist/custom/select/ids/ids.plugin.js +31 -0
  388. package/dist/custom/select/ids/index.d.ts +1 -0
  389. package/dist/custom/select/index.d.ts +5 -0
  390. package/dist/custom/select/keyboard/index.d.ts +2 -0
  391. package/dist/custom/select/keyboard/keyboard.plugin.d.ts +125 -0
  392. package/dist/custom/select/keyboard/keyboard.plugin.js +205 -0
  393. package/dist/custom/select/keyboard/strategies/base.strategy.d.ts +37 -0
  394. package/dist/custom/select/keyboard/strategies/base.strategy.js +81 -0
  395. package/dist/custom/select/keyboard/strategies/editable.strategy.d.ts +16 -0
  396. package/dist/custom/select/keyboard/strategies/editable.strategy.js +20 -0
  397. package/dist/custom/select/keyboard/strategies/index.d.ts +4 -0
  398. package/dist/custom/select/keyboard/strategies/select-only.strategy.d.ts +13 -0
  399. package/dist/custom/select/keyboard/strategies/select-only.strategy.js +59 -0
  400. package/dist/custom/select/keyboard/strategies/types.d.ts +29 -0
  401. package/dist/custom/select/keyboard/types.d.ts +18 -0
  402. package/dist/custom/select/pointer/index.d.ts +2 -0
  403. package/dist/custom/select/pointer/pointer.plugin.d.ts +59 -0
  404. package/dist/custom/select/pointer/pointer.plugin.js +104 -0
  405. package/dist/custom/select/pointer/types.d.ts +2 -0
  406. package/dist/custom/skeleton/index.d.ts +2 -0
  407. package/dist/custom/skeleton/layout.plugin.d.ts +18 -0
  408. package/dist/custom/skeleton/layout.plugin.js +47 -0
  409. package/dist/custom/skeleton/types.d.ts +5 -0
  410. package/dist/custom/slide/direction.d.ts +30 -0
  411. package/dist/custom/slide/direction.js +75 -0
  412. package/dist/custom/slide/index.d.ts +4 -0
  413. package/dist/custom/slide/keyboard/index.d.ts +2 -0
  414. package/dist/custom/slide/keyboard/keyboard.plugin.d.ts +46 -0
  415. package/dist/custom/slide/keyboard/keyboard.plugin.js +106 -0
  416. package/dist/custom/slide/keyboard/types.d.ts +6 -0
  417. package/dist/custom/slide/parts.d.ts +7 -0
  418. package/dist/custom/slide/parts.js +26 -0
  419. package/dist/custom/slide/pointer/index.d.ts +2 -0
  420. package/dist/custom/slide/pointer/pointer.plugin.d.ts +100 -0
  421. package/dist/custom/slide/pointer/pointer.plugin.js +268 -0
  422. package/dist/custom/slide/pointer/strategies/base.strategy.d.ts +16 -0
  423. package/dist/custom/slide/pointer/strategies/base.strategy.js +23 -0
  424. package/dist/custom/slide/pointer/strategies/hold.strategy.d.ts +28 -0
  425. package/dist/custom/slide/pointer/strategies/hold.strategy.js +48 -0
  426. package/dist/custom/slide/pointer/strategies/index.d.ts +7 -0
  427. package/dist/custom/slide/pointer/strategies/magnet.strategy.d.ts +11 -0
  428. package/dist/custom/slide/pointer/strategies/magnet.strategy.js +17 -0
  429. package/dist/custom/slide/pointer/strategies/none.strategy.d.ts +7 -0
  430. package/dist/custom/slide/pointer/strategies/none.strategy.js +9 -0
  431. package/dist/custom/slide/pointer/strategies/plateau.strategy.d.ts +24 -0
  432. package/dist/custom/slide/pointer/strategies/plateau.strategy.js +81 -0
  433. package/dist/custom/slide/pointer/strategies/points.d.ts +16 -0
  434. package/dist/custom/slide/pointer/strategies/points.js +32 -0
  435. package/dist/custom/slide/pointer/strategies/settle.strategy.d.ts +11 -0
  436. package/dist/custom/slide/pointer/strategies/settle.strategy.js +17 -0
  437. package/dist/custom/slide/pointer/strategies/types.d.ts +57 -0
  438. package/dist/custom/slide/pointer/types.d.ts +46 -0
  439. package/dist/custom/slide/types.d.ts +14 -0
  440. package/dist/custom/table/column-ids/column-ids.plugin.d.ts +26 -0
  441. package/dist/custom/table/column-ids/column-ids.plugin.js +36 -0
  442. package/dist/custom/table/column-ids/index.d.ts +1 -0
  443. package/dist/custom/table/column-names/column-names.plugin.d.ts +18 -0
  444. package/dist/custom/table/column-names/column-names.plugin.js +24 -0
  445. package/dist/custom/table/column-names/index.d.ts +1 -0
  446. package/dist/custom/table/column-reorder/column-reorder.plugin.d.ts +169 -0
  447. package/dist/custom/table/column-reorder/column-reorder.plugin.js +465 -0
  448. package/dist/custom/table/column-reorder/index.d.ts +2 -0
  449. package/dist/custom/table/column-reorder/types.d.ts +81 -0
  450. package/dist/custom/table/column-resize/column-resize.plugin.d.ts +96 -0
  451. package/dist/custom/table/column-resize/column-resize.plugin.js +271 -0
  452. package/dist/custom/table/column-resize/index.d.ts +2 -0
  453. package/dist/custom/table/column-resize/types.d.ts +38 -0
  454. package/dist/custom/table/grid/grid.plugin.d.ts +119 -0
  455. package/dist/custom/table/grid/grid.plugin.js +356 -0
  456. package/dist/custom/table/grid/index.d.ts +2 -0
  457. package/dist/custom/table/grid/types.d.ts +22 -0
  458. package/dist/custom/table/index.d.ts +8 -0
  459. package/dist/custom/table/layout/index.d.ts +2 -0
  460. package/dist/custom/table/layout/layout.plugin.d.ts +52 -0
  461. package/dist/custom/table/layout/layout.plugin.js +122 -0
  462. package/dist/custom/table/layout/types.d.ts +7 -0
  463. package/dist/custom/table/names/index.d.ts +2 -0
  464. package/dist/custom/table/names/names.plugin.d.ts +18 -0
  465. package/dist/custom/table/names/names.plugin.js +31 -0
  466. package/dist/custom/table/names/types.d.ts +6 -0
  467. package/dist/custom/table/row-ids/index.d.ts +1 -0
  468. package/dist/custom/table/row-ids/row-ids.plugin.d.ts +21 -0
  469. package/dist/custom/table/row-ids/row-ids.plugin.js +28 -0
  470. package/dist/custom/tabs/active-tab/active-tab.plugin.d.ts +42 -0
  471. package/dist/custom/tabs/active-tab/active-tab.plugin.js +103 -0
  472. package/dist/custom/tabs/active-tab/index.d.ts +2 -0
  473. package/dist/custom/tabs/active-tab/types.d.ts +17 -0
  474. package/dist/custom/tabs/content-warn/content-warn.plugin.d.ts +21 -0
  475. package/dist/custom/tabs/content-warn/content-warn.plugin.js +41 -0
  476. package/dist/custom/tabs/content-warn/index.d.ts +1 -0
  477. package/dist/custom/tabs/index.d.ts +7 -0
  478. package/dist/custom/tabs/item-ids/index.d.ts +1 -0
  479. package/dist/custom/tabs/item-ids/item-ids.plugin.d.ts +60 -0
  480. package/dist/custom/tabs/item-ids/item-ids.plugin.js +94 -0
  481. package/dist/custom/tabs/item-names/index.d.ts +1 -0
  482. package/dist/custom/tabs/item-names/item-names.plugin.d.ts +17 -0
  483. package/dist/custom/tabs/item-names/item-names.plugin.js +23 -0
  484. package/dist/custom/tabs/keyboard/index.d.ts +2 -0
  485. package/dist/custom/tabs/keyboard/keyboard.plugin.d.ts +105 -0
  486. package/dist/custom/tabs/keyboard/keyboard.plugin.js +206 -0
  487. package/dist/custom/tabs/keyboard/types.d.ts +6 -0
  488. package/dist/custom/tabs/layout/index.d.ts +2 -0
  489. package/dist/custom/tabs/layout/layout.plugin.d.ts +37 -0
  490. package/dist/custom/tabs/layout/layout.plugin.js +81 -0
  491. package/dist/custom/tabs/layout/types.d.ts +4 -0
  492. package/dist/custom/tabs/parts.d.ts +15 -0
  493. package/dist/custom/tabs/parts.js +21 -0
  494. package/dist/custom/tabs/tab.d.ts +29 -0
  495. package/dist/custom/tabs/tab.js +44 -0
  496. package/dist/custom/tags/index.d.ts +4 -0
  497. package/dist/custom/tags/item-names/index.d.ts +1 -0
  498. package/dist/custom/tags/item-names/item-names.plugin.d.ts +12 -0
  499. package/dist/custom/tags/item-names/item-names.plugin.js +18 -0
  500. package/dist/custom/tags/keyboard/index.d.ts +2 -0
  501. package/dist/custom/tags/keyboard/keyboard.plugin.d.ts +133 -0
  502. package/dist/custom/tags/keyboard/keyboard.plugin.js +253 -0
  503. package/dist/custom/tags/keyboard/types.d.ts +6 -0
  504. package/dist/custom/tags/scroll/index.d.ts +2 -0
  505. package/dist/custom/tags/scroll/scroll.plugin.d.ts +68 -0
  506. package/dist/custom/tags/scroll/scroll.plugin.js +120 -0
  507. package/dist/custom/tags/scroll/types.d.ts +6 -0
  508. package/dist/custom/tags/tag.d.ts +41 -0
  509. package/dist/custom/tags/tag.js +66 -0
  510. package/dist/custom/textarea/autoresize/autoresize.plugin.d.ts +70 -0
  511. package/dist/custom/textarea/autoresize/autoresize.plugin.js +176 -0
  512. package/dist/custom/textarea/autoresize/index.d.ts +2 -0
  513. package/dist/custom/textarea/autoresize/types.d.ts +6 -0
  514. package/dist/custom/textarea/ids/ids.plugin.d.ts +26 -0
  515. package/dist/custom/textarea/ids/ids.plugin.js +44 -0
  516. package/dist/custom/textarea/ids/index.d.ts +1 -0
  517. package/dist/custom/textarea/index.d.ts +3 -0
  518. package/dist/custom/textarea/names/index.d.ts +2 -0
  519. package/dist/custom/textarea/names/names.plugin.d.ts +33 -0
  520. package/dist/custom/textarea/names/names.plugin.js +65 -0
  521. package/dist/custom/textarea/names/types.d.ts +8 -0
  522. package/dist/custom/toasts/cascade/cascade.plugin.d.ts +81 -0
  523. package/dist/custom/toasts/cascade/cascade.plugin.js +214 -0
  524. package/dist/custom/toasts/cascade/index.d.ts +2 -0
  525. package/dist/custom/toasts/cascade/types.d.ts +15 -0
  526. package/dist/custom/toasts/index.d.ts +7 -0
  527. package/dist/custom/toasts/item-names/index.d.ts +1 -0
  528. package/dist/custom/toasts/item-names/item-names.plugin.d.ts +12 -0
  529. package/dist/custom/toasts/item-names/item-names.plugin.js +18 -0
  530. package/dist/custom/toasts/keyboard/index.d.ts +2 -0
  531. package/dist/custom/toasts/keyboard/keyboard.plugin.d.ts +57 -0
  532. package/dist/custom/toasts/keyboard/keyboard.plugin.js +136 -0
  533. package/dist/custom/toasts/keyboard/types.d.ts +6 -0
  534. package/dist/custom/toasts/layout/index.d.ts +2 -0
  535. package/dist/custom/toasts/layout/layout.plugin.d.ts +23 -0
  536. package/dist/custom/toasts/layout/layout.plugin.js +39 -0
  537. package/dist/custom/toasts/layout/types.d.ts +5 -0
  538. package/dist/custom/toasts/names/index.d.ts +1 -0
  539. package/dist/custom/toasts/names/names.plugin.d.ts +10 -0
  540. package/dist/custom/toasts/names/names.plugin.js +13 -0
  541. package/dist/custom/toasts/removal/index.d.ts +2 -0
  542. package/dist/custom/toasts/removal/removal.plugin.d.ts +35 -0
  543. package/dist/custom/toasts/removal/removal.plugin.js +69 -0
  544. package/dist/custom/toasts/removal/types.d.ts +6 -0
  545. package/dist/custom/toasts/timer/index.d.ts +2 -0
  546. package/dist/custom/toasts/timer/timer.plugin.d.ts +71 -0
  547. package/dist/custom/toasts/timer/timer.plugin.js +213 -0
  548. package/dist/custom/toasts/timer/types.d.ts +15 -0
  549. package/dist/custom/tooltip/ids/ids.plugin.d.ts +22 -0
  550. package/dist/custom/tooltip/ids/ids.plugin.js +42 -0
  551. package/dist/custom/tooltip/ids/index.d.ts +1 -0
  552. package/dist/custom/tooltip/index.d.ts +2 -0
  553. package/dist/custom/tooltip/trigger/document-state.d.ts +42 -0
  554. package/dist/custom/tooltip/trigger/document-state.js +50 -0
  555. package/dist/custom/tooltip/trigger/index.d.ts +2 -0
  556. package/dist/custom/tooltip/trigger/trigger.plugin.d.ts +133 -0
  557. package/dist/custom/tooltip/trigger/trigger.plugin.js +271 -0
  558. package/dist/custom/tooltip/trigger/types.d.ts +20 -0
  559. package/dist/custom/virtual/index.d.ts +2 -0
  560. package/dist/custom/virtual/types.d.ts +6 -0
  561. package/dist/custom/virtual/virtual.plugin.d.ts +126 -0
  562. package/dist/custom/virtual/virtual.plugin.js +311 -0
  563. package/dist/index.d.ts +7 -0
  564. package/dist/index.js +149 -0
  565. package/dist/locale/index.d.ts +6 -0
  566. package/dist/locale/locale.d.ts +38 -0
  567. package/dist/locale/locale.js +93 -0
  568. package/dist/locale/locale.plugin.d.ts +26 -0
  569. package/dist/locale/locale.plugin.js +35 -0
  570. package/dist/locale/locales/ar.d.ts +5 -0
  571. package/dist/locale/locales/ar.js +59 -0
  572. package/dist/locale/locales/en.d.ts +7 -0
  573. package/dist/locale/locales/en.js +61 -0
  574. package/dist/locale/locales/es.d.ts +2 -0
  575. package/dist/locale/locales/es.js +56 -0
  576. package/dist/locale/locales/fr.d.ts +2 -0
  577. package/dist/locale/locales/fr.js +56 -0
  578. package/dist/locale/locales/index.d.ts +6 -0
  579. package/dist/locale/locales/ru.d.ts +2 -0
  580. package/dist/locale/locales/ru.js +56 -0
  581. package/dist/locale/locales/zh.d.ts +2 -0
  582. package/dist/locale/locales/zh.js +56 -0
  583. package/dist/locale/names.plugin.d.ts +32 -0
  584. package/dist/locale/names.plugin.js +39 -0
  585. package/dist/locale/source.class.d.ts +22 -0
  586. package/dist/locale/source.class.js +32 -0
  587. package/dist/locale/types.d.ts +197 -0
  588. package/dist/motion/index.d.ts +2 -0
  589. package/dist/motion/motion.d.ts +28 -0
  590. package/dist/motion/motion.js +67 -0
  591. package/dist/motion/types.d.ts +14 -0
  592. package/dist/utils/afterTransitions.d.ts +49 -0
  593. package/dist/utils/afterTransitions.js +79 -0
  594. package/dist/utils/focusFirst.d.ts +13 -0
  595. package/dist/utils/focusFirst.js +24 -0
  596. package/dist/utils/graceArea.d.ts +21 -0
  597. package/dist/utils/graceArea.js +66 -0
  598. package/dist/utils/index.d.ts +18 -0
  599. package/dist/utils/isAboveLayer.d.ts +14 -0
  600. package/dist/utils/isAboveLayer.js +24 -0
  601. package/dist/utils/isAppleTouch.d.ts +10 -0
  602. package/dist/utils/isAppleTouch.js +17 -0
  603. package/dist/utils/isFocusableElement.d.ts +8 -0
  604. package/dist/utils/isFocusableElement.js +13 -0
  605. package/dist/utils/isMeasurableElement.d.ts +11 -0
  606. package/dist/utils/isMeasurableElement.js +16 -0
  607. package/dist/utils/isPrintableKey.d.ts +7 -0
  608. package/dist/utils/isPrintableKey.js +12 -0
  609. package/dist/utils/layerOf.d.ts +12 -0
  610. package/dist/utils/layerOf.js +21 -0
  611. package/dist/utils/nearestShift.d.ts +19 -0
  612. package/dist/utils/nearestShift.js +58 -0
  613. package/dist/utils/positionOrigin.d.ts +34 -0
  614. package/dist/utils/positionOrigin.js +71 -0
  615. package/dist/utils/scrollParent.d.ts +12 -0
  616. package/dist/utils/scrollParent.js +23 -0
  617. package/dist/utils/scrollWindow.d.ts +27 -0
  618. package/dist/utils/scrollWindow.js +50 -0
  619. package/dist/utils/tabStops.d.ts +44 -0
  620. package/dist/utils/tabStops.js +102 -0
  621. package/dist/utils/tabStopsAfter.d.ts +10 -0
  622. package/dist/utils/tabStopsAfter.js +16 -0
  623. package/dist/utils/tabStopsBefore.d.ts +11 -0
  624. package/dist/utils/tabStopsBefore.js +17 -0
  625. package/dist/utils/toCssValue.d.ts +8 -0
  626. package/dist/utils/toCssValue.js +17 -0
  627. package/dist/utils/trapTab.d.ts +16 -0
  628. package/dist/utils/trapTab.js +36 -0
  629. package/dist/utils/types.d.ts +64 -0
  630. package/package.json +43 -4
@@ -0,0 +1,150 @@
1
+ import { TBasePlugin } from '../../../base';
2
+ import type { IPluginContext } from '../../../base';
3
+ import type { IOverlayOpenOptions } from '../types';
4
+ import type { ISwipeOwner, TSwipePluginEvents } from './types';
5
+ /**
6
+ * TSwipePlugin — жест слоя: смахнуть панель, чтобы закрыть.
7
+ *
8
+ * Общий для слоёв, которые смахивают (`ISwipeable`): выезжающая панель уходит
9
+ * к своему краю, поповер — от триггера, а внутри контейнера — к своему краю,
10
+ * панели Select и DatePicker — от поля, тост — к стороне своего места в
11
+ * регионе. С владельцем плагин говорит только через контракт: класса ядра не
12
+ * требует, а владельца без контракта не трогает.
13
+ *
14
+ * **Панель** — узел, который тянут. Это узел с пометкой владельцем
15
+ * (`TDismissPlugin.findPanel()`): панель поповера телепортирована, и ссылки на
16
+ * неё у плагинов нет. Без пометки — корень: у выезжающей панели корень и есть
17
+ * панель. Так же панель находят `THideOutsidePlugin` и плагины фокуса.
18
+ *
19
+ * **Куда уходит слой**, знает ядро (`swipeSide`) — кроме панели у якоря: под
20
+ * триггером она или над ним, решает flip `TAnchorPlugin`, и знает это только
21
+ * её узел (`data-placement`). Тогда сторона берётся с узла в начале жеста, а
22
+ * ось у такой панели всегда вертикальная.
23
+ *
24
+ * За что тянуть, выбирает владелец (`swipe`): за полосу (`handle`) или за любое
25
+ * место панели (`panel`), кроме контролов (`closestControl`) и областей,
26
+ * которые прокручиваются вдоль оси, — те прокручиваются сами. За всю панель
27
+ * жест не начинается и тогда, когда в ней выделен текст: его тянут, а не
28
+ * панель.
29
+ *
30
+ * **Нажатие становится жестом**, когда указатель ушёл от точки нажатия вдоль
31
+ * оси дальше порога. Ушёл поперёк — это не жест панели: прокрутка, выделение,
32
+ * чужой жест, — и нажатие отпускается. Жест начинает владелец (`beginSwipe`):
33
+ * у него признак «тянут», по которому тема снимает переход, — иначе панель
34
+ * догоняла бы палец с опозданием.
35
+ *
36
+ * **Сдвиг во время жеста — операция над узлом**, а не значение: плагин пишет
37
+ * его в панель переменной `--so-swipe-offset`, и через обмен на каждом кадре он
38
+ * не ходит. К краю панель идёт за указателем, но не дальше своего размера; от
39
+ * края — с сопротивлением.
40
+ *
41
+ * **Отпустили** дальше четверти размера или быстро к краю — плагин закрывает
42
+ * слой с причиной `swipe` тем же путём, что нажатие мимо и Escape
43
+ * (`bindOverlayOpen`): запросом у владельца, который его принимает (подписчик
44
+ * `close:before` вправе его отменить), записью открытости у остальных. Иначе —
45
+ * и когда запрос отменили — панель возвращается: признак «тянут» снят, и сдвиг
46
+ * уходит кадром позже, когда переход у темы уже снова включён. Браузер отнял
47
+ * указатель (`pointercancel`) — это не решение пользователя, и панель
48
+ * возвращается тоже.
49
+ *
50
+ * **Закрытая панель сдвиг сохраняет** — и закрытая жестом, и закрытая посреди
51
+ * жеста: она исчезает переходом темы, и куда — решает тема. Выезжающая панель
52
+ * и поповер уезжают к своей стороне от места, где их отпустили, а карточка
53
+ * выбора месяца в календаре гаснет там же, где её отпустили. Снимай плагин
54
+ * сдвиг на закрытии, панель прыгнула бы на место посреди исчезания. Снимается
55
+ * он, когда панель показывают снова: показанная панель стоит на месте.
56
+ *
57
+ * **Касание.** Пока жест включён, плагин ставит панели `touch-action` по оси:
58
+ * без него браузер забрал бы касание под прокрутку страницы, и жест не работал
59
+ * бы пальцем, а поведение не должно зависеть от CSS темы. Но `touch-action`
60
+ * действует только до ближайшей прокручиваемой области: касание в ней — в
61
+ * теле панели, даже когда прокручивать нечего, — браузер забирает под
62
+ * прокрутку в любую сторону и отнимает указатель (`pointercancel`). Поэтому,
63
+ * пока идёт жест, плагин гасит `touchmove` панели. До порога он не гасит
64
+ * ничего: касание поперёк оси остаётся прокрутке, а из области, которая
65
+ * прокручивается вдоль оси, жест и не начинается — у пальца то же правило,
66
+ * что у мыши.
67
+ *
68
+ * Касание, в отличие от мыши, браузер сам захватывает за узлом под пальцем —
69
+ * полосой или абзацем тела. Начало жеста переносит захват на панель, и узел
70
+ * под пальцем его теряет: его `lostpointercapture` всплывает до панели. Жест
71
+ * кончает только потеря захвата самой панелью.
72
+ *
73
+ * Своих действий у нажатия на полосу нет (`preventDefault`): ни выделения, ни
74
+ * фокуса на саму панель. Нажатие по содержимому своих действий не теряет, а
75
+ * выделение, начатое им, жест снимает и гасит до конца. `click`, которым
76
+ * кончается жест, гасится: отпускание — не нажатие.
77
+ *
78
+ * Слушатели висят, только пока жест включён и слой открыт: это подписка на
79
+ * `change:swipe`, сторону ухода и открытость (`property`, по умолчанию `open`,
80
+ * как у других плагинов слоя), а не проверка в обработчике.
81
+ */
82
+ export declare class TSwipePlugin extends TBasePlugin<ISwipeOwner, TSwipePluginEvents> {
83
+ private _owner;
84
+ /** Открытость владельца: по ней жест включается, ею же слой закрывается. */
85
+ private _open;
86
+ private _dismiss;
87
+ private _root;
88
+ /** Панель, на которой жест включён; `null` — выключен. */
89
+ private _target;
90
+ /** Инлайновый `touch-action` панели до включения жеста. */
91
+ private _touchAction;
92
+ private _press;
93
+ private _gesture;
94
+ /** Жест кончился отпусканием: следующий `click` панели — его, а не пользователя. */
95
+ private _swallowClick;
96
+ /** Кадр, в котором уйдёт сдвиг отпущенной панели; `null` — ничего не ждёт. */
97
+ private _resetFrame;
98
+ private readonly _sync;
99
+ install(ctx: IPluginContext, options?: IOverlayOpenOptions): void;
100
+ destroy(): void;
101
+ /**
102
+ * Жест включён ровно тогда, когда он выбран, слой открыт, а корень объявлен.
103
+ * Панель — узел с пометкой владельцем, без неё — корень.
104
+ */
105
+ private _resync;
106
+ private _attach;
107
+ private _detach;
108
+ private readonly _onPointerDown;
109
+ /**
110
+ * Можно ли начать жест с узла. Узел — в слое своей панели: у панели,
111
+ * открытой внутри этой (`contained`), жест свой. Слой панели — она сама или
112
+ * ближайший слой над ней: тост своего слоя не держит, он лежит в регионе
113
+ * тостов, и слой у тоста — регион. Дальше — по выбору владельца: полоса или
114
+ * вся панель, кроме контролов, прокрутки вдоль оси и выделенного текста.
115
+ */
116
+ private _grabbable;
117
+ private readonly _onPointerMove;
118
+ private _begin;
119
+ /** Панель за указателем: к краю — не дальше своего размера, от края — с сопротивлением. */
120
+ private _drag;
121
+ /**
122
+ * Захват потеряла панель — указатель у неё отняли, и жест кончен. Узел под
123
+ * пальцем теряет захват и посреди жеста: касание браузер сам захватывает за
124
+ * ним, а начало жеста переносит захват на панель. Это событие всплывает до
125
+ * панели, но жест не кончает — указатель по-прежнему у неё.
126
+ */
127
+ private readonly _onLostCapture;
128
+ private readonly _onPointerEnd;
129
+ /** Закрыть ли отпущенную панель: путь к краю или скорость к краю. */
130
+ private _closes;
131
+ /**
132
+ * Жест кончился. Признак «тянут» снимается сразу, а сдвиг отпущенной
133
+ * панели — кадром позже: к этому кадру тема уже снова включила переход, и
134
+ * панель поедет на место. Сними сдвиг сразу — пересчёт стилей пришёлся бы
135
+ * раньше, и панель прыгнула бы на место. Закрылась панель — ожидание
136
+ * снимает отвязка жеста (`_detach`), а сдвиг остаётся до следующего показа.
137
+ */
138
+ private _finish;
139
+ private readonly _onClick;
140
+ /**
141
+ * Касание, которое ведёт жест, — жесту, а не прокрутке (см. «Касание» в
142
+ * шапке). До порога жеста касание остаётся браузеру, а событие, которое
143
+ * отменить уже нельзя (`cancelable: false`), не гасится: прокрутку, начатую
144
+ * раньше жеста, браузер не отдаёт.
145
+ */
146
+ private readonly _onTouchMove;
147
+ private _restoreSelect;
148
+ private _scheduleReset;
149
+ private _cancelReset;
150
+ }
@@ -0,0 +1,432 @@
1
+ import { TBasePlugin } from "../../../base/base.class.js";
2
+ import { TElementPlugin } from "../../element/element.plugin.js";
3
+ import { isMeasurableElement } from "../../../utils/isMeasurableElement.js";
4
+ import { closestControl } from "../../../utils/tabStops.js";
5
+ import { isScrollable } from "../../../utils/scrollParent.js";
6
+ import { bindOverlayOpen } from "../open-state.js";
7
+ import { TDismissPlugin } from "../../dismiss/dismiss.plugin.js";
8
+ import { ANCHOR_PLACEMENT_ATTRIBUTE } from "../../frame/anchor/anchor.plugin.js";
9
+ import { FRAME_LAYER_ATTRIBUTE, isSwipeable } from "@soxa-ui/core";
10
+ //#region src/custom/overlay/swipe/swipe.plugin.ts
11
+ /**
12
+ * Переменная сдвига панели во время жеста — контракт с темой. Значение — px
13
+ * по оси жеста, со знаком оси окна: у панели, которая уходит вправо или вниз,
14
+ * сдвиг к краю положительный, влево или вверх — отрицательный. Тема кладёт её
15
+ * в `translate` панели; без жеста переменной нет.
16
+ */
17
+ var SWIPE_VARIABLE = "--so-swipe-offset";
18
+ /** Сколько пройти от точки нажатия, чтобы нажатие стало жестом, px. */
19
+ var START_DISTANCE = 6;
20
+ /** Отпустили дальше этой доли размера панели — закрыть. */
21
+ var CLOSE_FRACTION = .25;
22
+ /** Отпустили быстрее этого к краю — закрыть, как ни мал путь, px/мс. */
23
+ var CLOSE_VELOCITY = .4;
24
+ /** Окно скорости: по точкам за столько последних мс перед отпусканием. */
25
+ var VELOCITY_WINDOW = 100;
26
+ /**
27
+ * Предел сопротивления за открытым положением, px: сколько ни тяни от края,
28
+ * панель отойдёт от него не дальше.
29
+ */
30
+ var OVERSHOOT = 24;
31
+ /** Инлайновые свойства, которыми жест гасит выделение текста. */
32
+ var USER_SELECT = ["user-select", "-webkit-user-select"];
33
+ /**
34
+ * Ось жеста: к началу или концу строки — по горизонтали, вверх или вниз — по
35
+ * вертикали. Сторона у якоря (`null`) — тоже вертикаль: якорь ставит панель
36
+ * под триггером или над ним.
37
+ */
38
+ function axisOf(side) {
39
+ return side === "start" || side === "end" ? "x" : "y";
40
+ }
41
+ /**
42
+ * Куда по оси окна слой уходит. `start` и `end` — логические: в RTL начало
43
+ * строки справа, и жест зеркалится вместе со слоем. Направление — вычисленное,
44
+ * как у `TAnchorPlugin`: у панели бывает `direction: inherit`, и сторону задаёт
45
+ * предок.
46
+ */
47
+ function closingSign(side, rtl) {
48
+ if (side === "bottom") return 1;
49
+ if (side === "top") return -1;
50
+ return side === "end" !== rtl ? 1 : -1;
51
+ }
52
+ /**
53
+ * Сторона панели у якоря после flip — её пишет `TAnchorPlugin` в самой панели
54
+ * (`data-placement`): `top…` — над триггером, `bottom…` — под ним. Панель
55
+ * уходит от триггера, то есть к этой же стороне. Атрибута нет — панель не у
56
+ * якоря, и уходить ей некуда. Сбоку от якоря (`start…`, `end…`) — тоже `null`:
57
+ * смахиваемых боковых панелей у якоря нет.
58
+ */
59
+ function anchoredSide(panel) {
60
+ const placement = panel.getAttribute(ANCHOR_PLACEMENT_ATTRIBUTE);
61
+ if (placement?.startsWith("top")) return "top";
62
+ if (placement?.startsWith("bottom")) return "bottom";
63
+ return null;
64
+ }
65
+ /** Сопротивление за открытым положением: чем дальше тянут, тем меньше отдаёт панель. */
66
+ function resist(distance) {
67
+ return OVERSHOOT * distance / (OVERSHOOT + distance);
68
+ }
69
+ /**
70
+ * Лежит ли узел в области, которая прокручивается вдоль оси, — между узлом и
71
+ * панелью. Такая область прокручивается сама, и жест из неё не начинается.
72
+ * Прокрутку поперёк оси жест не трогает: тянут вдоль.
73
+ */
74
+ function scrollsAlong(node, panel, axis) {
75
+ for (let current = node; current && current !== panel;) {
76
+ if (isScrollable(current, axis)) return true;
77
+ current = current.parentElement;
78
+ }
79
+ return false;
80
+ }
81
+ /**
82
+ * TSwipePlugin — жест слоя: смахнуть панель, чтобы закрыть.
83
+ *
84
+ * Общий для слоёв, которые смахивают (`ISwipeable`): выезжающая панель уходит
85
+ * к своему краю, поповер — от триггера, а внутри контейнера — к своему краю,
86
+ * панели Select и DatePicker — от поля, тост — к стороне своего места в
87
+ * регионе. С владельцем плагин говорит только через контракт: класса ядра не
88
+ * требует, а владельца без контракта не трогает.
89
+ *
90
+ * **Панель** — узел, который тянут. Это узел с пометкой владельцем
91
+ * (`TDismissPlugin.findPanel()`): панель поповера телепортирована, и ссылки на
92
+ * неё у плагинов нет. Без пометки — корень: у выезжающей панели корень и есть
93
+ * панель. Так же панель находят `THideOutsidePlugin` и плагины фокуса.
94
+ *
95
+ * **Куда уходит слой**, знает ядро (`swipeSide`) — кроме панели у якоря: под
96
+ * триггером она или над ним, решает flip `TAnchorPlugin`, и знает это только
97
+ * её узел (`data-placement`). Тогда сторона берётся с узла в начале жеста, а
98
+ * ось у такой панели всегда вертикальная.
99
+ *
100
+ * За что тянуть, выбирает владелец (`swipe`): за полосу (`handle`) или за любое
101
+ * место панели (`panel`), кроме контролов (`closestControl`) и областей,
102
+ * которые прокручиваются вдоль оси, — те прокручиваются сами. За всю панель
103
+ * жест не начинается и тогда, когда в ней выделен текст: его тянут, а не
104
+ * панель.
105
+ *
106
+ * **Нажатие становится жестом**, когда указатель ушёл от точки нажатия вдоль
107
+ * оси дальше порога. Ушёл поперёк — это не жест панели: прокрутка, выделение,
108
+ * чужой жест, — и нажатие отпускается. Жест начинает владелец (`beginSwipe`):
109
+ * у него признак «тянут», по которому тема снимает переход, — иначе панель
110
+ * догоняла бы палец с опозданием.
111
+ *
112
+ * **Сдвиг во время жеста — операция над узлом**, а не значение: плагин пишет
113
+ * его в панель переменной `--so-swipe-offset`, и через обмен на каждом кадре он
114
+ * не ходит. К краю панель идёт за указателем, но не дальше своего размера; от
115
+ * края — с сопротивлением.
116
+ *
117
+ * **Отпустили** дальше четверти размера или быстро к краю — плагин закрывает
118
+ * слой с причиной `swipe` тем же путём, что нажатие мимо и Escape
119
+ * (`bindOverlayOpen`): запросом у владельца, который его принимает (подписчик
120
+ * `close:before` вправе его отменить), записью открытости у остальных. Иначе —
121
+ * и когда запрос отменили — панель возвращается: признак «тянут» снят, и сдвиг
122
+ * уходит кадром позже, когда переход у темы уже снова включён. Браузер отнял
123
+ * указатель (`pointercancel`) — это не решение пользователя, и панель
124
+ * возвращается тоже.
125
+ *
126
+ * **Закрытая панель сдвиг сохраняет** — и закрытая жестом, и закрытая посреди
127
+ * жеста: она исчезает переходом темы, и куда — решает тема. Выезжающая панель
128
+ * и поповер уезжают к своей стороне от места, где их отпустили, а карточка
129
+ * выбора месяца в календаре гаснет там же, где её отпустили. Снимай плагин
130
+ * сдвиг на закрытии, панель прыгнула бы на место посреди исчезания. Снимается
131
+ * он, когда панель показывают снова: показанная панель стоит на месте.
132
+ *
133
+ * **Касание.** Пока жест включён, плагин ставит панели `touch-action` по оси:
134
+ * без него браузер забрал бы касание под прокрутку страницы, и жест не работал
135
+ * бы пальцем, а поведение не должно зависеть от CSS темы. Но `touch-action`
136
+ * действует только до ближайшей прокручиваемой области: касание в ней — в
137
+ * теле панели, даже когда прокручивать нечего, — браузер забирает под
138
+ * прокрутку в любую сторону и отнимает указатель (`pointercancel`). Поэтому,
139
+ * пока идёт жест, плагин гасит `touchmove` панели. До порога он не гасит
140
+ * ничего: касание поперёк оси остаётся прокрутке, а из области, которая
141
+ * прокручивается вдоль оси, жест и не начинается — у пальца то же правило,
142
+ * что у мыши.
143
+ *
144
+ * Касание, в отличие от мыши, браузер сам захватывает за узлом под пальцем —
145
+ * полосой или абзацем тела. Начало жеста переносит захват на панель, и узел
146
+ * под пальцем его теряет: его `lostpointercapture` всплывает до панели. Жест
147
+ * кончает только потеря захвата самой панелью.
148
+ *
149
+ * Своих действий у нажатия на полосу нет (`preventDefault`): ни выделения, ни
150
+ * фокуса на саму панель. Нажатие по содержимому своих действий не теряет, а
151
+ * выделение, начатое им, жест снимает и гасит до конца. `click`, которым
152
+ * кончается жест, гасится: отпускание — не нажатие.
153
+ *
154
+ * Слушатели висят, только пока жест включён и слой открыт: это подписка на
155
+ * `change:swipe`, сторону ухода и открытость (`property`, по умолчанию `open`,
156
+ * как у других плагинов слоя), а не проверка в обработчике.
157
+ */
158
+ var TSwipePlugin = class extends TBasePlugin {
159
+ _owner = null;
160
+ /** Открытость владельца: по ней жест включается, ею же слой закрывается. */
161
+ _open = null;
162
+ _dismiss = null;
163
+ _root = null;
164
+ /** Панель, на которой жест включён; `null` — выключен. */
165
+ _target = null;
166
+ /** Инлайновый `touch-action` панели до включения жеста. */
167
+ _touchAction = "";
168
+ _press = null;
169
+ _gesture = null;
170
+ /** Жест кончился отпусканием: следующий `click` панели — его, а не пользователя. */
171
+ _swallowClick = false;
172
+ /** Кадр, в котором уйдёт сдвиг отпущенной панели; `null` — ничего не ждёт. */
173
+ _resetFrame = null;
174
+ _sync = () => this._resync();
175
+ install(ctx, options) {
176
+ super.install(ctx, options);
177
+ const owner = ctx.getInstance();
178
+ this._owner = isSwipeable(owner) ? owner : null;
179
+ this._dismiss = ctx.get(TDismissPlugin) ?? null;
180
+ const element = ctx.get(TElementPlugin);
181
+ element?.events.on("ready", (node) => {
182
+ this._root = node;
183
+ this._resync();
184
+ });
185
+ element?.events.on("removed", () => {
186
+ this._root = null;
187
+ this._resync();
188
+ });
189
+ if (!this._owner) return;
190
+ this._listenTo(this._owner.events, "change:swipe", this._sync);
191
+ this._listenTo(this._owner.events, "change:swipeSide", this._sync);
192
+ this._open = bindOverlayOpen(ctx, options, this._sync);
193
+ }
194
+ destroy() {
195
+ this._detach();
196
+ this._open?.unbind();
197
+ this._open = null;
198
+ this._owner = null;
199
+ this._dismiss = null;
200
+ this._root = null;
201
+ super.destroy();
202
+ }
203
+ /**
204
+ * Жест включён ровно тогда, когда он выбран, слой открыт, а корень объявлен.
205
+ * Панель — узел с пометкой владельцем, без неё — корень.
206
+ */
207
+ _resync() {
208
+ const owner = this._owner;
209
+ const root = this._root;
210
+ this._detach();
211
+ if (!owner || owner.swipe === "none" || !this._open?.read() || !root) return;
212
+ const panel = this._dismiss?.findPanel() ?? root;
213
+ if (!isMeasurableElement(panel)) return;
214
+ this._attach(panel, owner);
215
+ }
216
+ _attach(panel, owner) {
217
+ const target = panel;
218
+ target.addEventListener("pointerdown", this._onPointerDown);
219
+ target.addEventListener("pointermove", this._onPointerMove);
220
+ target.addEventListener("pointerup", this._onPointerEnd);
221
+ target.addEventListener("pointercancel", this._onPointerEnd);
222
+ target.addEventListener("lostpointercapture", this._onLostCapture);
223
+ target.addEventListener("click", this._onClick);
224
+ target.addEventListener("touchmove", this._onTouchMove, { passive: false });
225
+ panel.style.removeProperty(SWIPE_VARIABLE);
226
+ this._touchAction = panel.style.getPropertyValue("touch-action");
227
+ panel.style.setProperty("touch-action", axisOf(owner.swipeSide) === "y" ? "pan-x pinch-zoom" : "pan-y pinch-zoom");
228
+ this._target = panel;
229
+ }
230
+ _detach() {
231
+ const panel = this._target;
232
+ this._press = null;
233
+ this._swallowClick = false;
234
+ if (!panel) return;
235
+ const target = panel;
236
+ target.removeEventListener("pointerdown", this._onPointerDown);
237
+ target.removeEventListener("pointermove", this._onPointerMove);
238
+ target.removeEventListener("pointerup", this._onPointerEnd);
239
+ target.removeEventListener("pointercancel", this._onPointerEnd);
240
+ target.removeEventListener("lostpointercapture", this._onLostCapture);
241
+ target.removeEventListener("click", this._onClick);
242
+ target.removeEventListener("touchmove", this._onTouchMove);
243
+ const gesture = this._gesture;
244
+ if (gesture) {
245
+ this._gesture = null;
246
+ this._restoreSelect(panel, gesture);
247
+ if ("hasPointerCapture" in panel && panel.hasPointerCapture(gesture.pointer)) panel.releasePointerCapture(gesture.pointer);
248
+ this._owner?.endSwipe();
249
+ }
250
+ restoreStyle(panel, "touch-action", this._touchAction);
251
+ this._cancelReset();
252
+ if (this._open?.read()) panel.style.removeProperty(SWIPE_VARIABLE);
253
+ this._target = null;
254
+ }
255
+ _onPointerDown = (event) => {
256
+ const owner = this._owner;
257
+ const panel = this._target;
258
+ this._swallowClick = false;
259
+ if (!owner || !panel || this._gesture || !event.isPrimary || event.button !== 0) return;
260
+ if (!(event.target instanceof Element) || !this._grabbable(owner, panel, event.target)) {
261
+ this._press = null;
262
+ return;
263
+ }
264
+ this._press = {
265
+ pointer: event.pointerId,
266
+ x: event.clientX,
267
+ y: event.clientY
268
+ };
269
+ if (owner.swipe === "handle") event.preventDefault();
270
+ };
271
+ /**
272
+ * Можно ли начать жест с узла. Узел — в слое своей панели: у панели,
273
+ * открытой внутри этой (`contained`), жест свой. Слой панели — она сама или
274
+ * ближайший слой над ней: тост своего слоя не держит, он лежит в регионе
275
+ * тостов, и слой у тоста — регион. Дальше — по выбору владельца: полоса или
276
+ * вся панель, кроме контролов, прокрутки вдоль оси и выделенного текста.
277
+ */
278
+ _grabbable(owner, panel, node) {
279
+ const layer = `[${FRAME_LAYER_ATTRIBUTE}]`;
280
+ if (node.closest(layer) !== panel.closest(layer)) return false;
281
+ if (owner.swipe === "handle") return node.closest(owner.classes.resolve("__handle", { point: true }))?.parentElement === panel;
282
+ if (closestControl(node, panel)) return false;
283
+ if (scrollsAlong(node, panel, axisOf(owner.swipeSide))) return false;
284
+ const selection = panel.ownerDocument.getSelection();
285
+ const anchor = selection?.anchorNode;
286
+ return !selection || selection.isCollapsed || !anchor || !panel.contains(anchor);
287
+ }
288
+ _onPointerMove = (event) => {
289
+ const gesture = this._gesture;
290
+ if (gesture) {
291
+ if (event.pointerId === gesture.pointer) this._drag(gesture, event);
292
+ return;
293
+ }
294
+ const press = this._press;
295
+ const owner = this._owner;
296
+ if (!press || !owner || event.pointerId !== press.pointer) return;
297
+ const dx = event.clientX - press.x;
298
+ const dy = event.clientY - press.y;
299
+ const [along, across] = axisOf(owner.swipeSide) === "y" ? [dy, dx] : [dx, dy];
300
+ if (Math.abs(along) < START_DISTANCE && Math.abs(across) < START_DISTANCE) return;
301
+ this._press = null;
302
+ if (Math.abs(across) >= Math.abs(along)) return;
303
+ this._begin(owner, press, event);
304
+ };
305
+ _begin(owner, press, event) {
306
+ const panel = this._target;
307
+ if (!panel) return;
308
+ const side = owner.swipeSide ?? anchoredSide(panel);
309
+ if (!side || !owner.beginSwipe()) return;
310
+ const axis = axisOf(side);
311
+ const box = panel.getBoundingClientRect();
312
+ const content = owner.swipe === "panel";
313
+ const gesture = {
314
+ pointer: press.pointer,
315
+ axis,
316
+ sign: closingSign(side, getComputedStyle(panel).direction === "rtl"),
317
+ origin: axis === "y" ? press.y : press.x,
318
+ size: axis === "y" ? box.height : box.width,
319
+ offset: 0,
320
+ samples: [],
321
+ userSelect: content ? USER_SELECT.map((property) => [property, panel.style.getPropertyValue(property)]) : []
322
+ };
323
+ this._gesture = gesture;
324
+ this._cancelReset();
325
+ if (content) {
326
+ panel.ownerDocument.getSelection()?.removeAllRanges();
327
+ for (const property of USER_SELECT) panel.style.setProperty(property, "none");
328
+ }
329
+ if ("setPointerCapture" in panel) panel.setPointerCapture(press.pointer);
330
+ this._drag(gesture, event);
331
+ }
332
+ /** Панель за указателем: к краю — не дальше своего размера, от края — с сопротивлением. */
333
+ _drag(gesture, event) {
334
+ const panel = this._target;
335
+ const distance = ((gesture.axis === "y" ? event.clientY : event.clientX) - gesture.origin) * gesture.sign;
336
+ const toEdge = gesture.size > 0 ? Math.min(distance, gesture.size) : distance;
337
+ gesture.offset = distance >= 0 ? toEdge : -resist(-distance);
338
+ gesture.samples = [...gesture.samples.filter(({ time }) => time >= event.timeStamp - VELOCITY_WINDOW), {
339
+ time: event.timeStamp,
340
+ distance
341
+ }];
342
+ panel?.style.setProperty(SWIPE_VARIABLE, `${gesture.offset * gesture.sign}px`);
343
+ }
344
+ /**
345
+ * Захват потеряла панель — указатель у неё отняли, и жест кончен. Узел под
346
+ * пальцем теряет захват и посреди жеста: касание браузер сам захватывает за
347
+ * ним, а начало жеста переносит захват на панель. Это событие всплывает до
348
+ * панели, но жест не кончает — указатель по-прежнему у неё.
349
+ */
350
+ _onLostCapture = (event) => {
351
+ if (event.target === this._target) this._onPointerEnd(event);
352
+ };
353
+ _onPointerEnd = (event) => {
354
+ if (this._press?.pointer === event.pointerId) this._press = null;
355
+ const gesture = this._gesture;
356
+ if (!gesture || event.pointerId !== gesture.pointer) return;
357
+ if (event.type !== "pointerup") {
358
+ this._finish(gesture, false);
359
+ return;
360
+ }
361
+ this._drag(gesture, event);
362
+ this._swallowClick = true;
363
+ this._finish(gesture, this._closes(gesture));
364
+ };
365
+ /** Закрыть ли отпущенную панель: путь к краю или скорость к краю. */
366
+ _closes(gesture) {
367
+ return (gesture.size > 0 ? gesture.offset / gesture.size : 0) >= CLOSE_FRACTION || gesture.offset > 0 && velocity(gesture) >= CLOSE_VELOCITY;
368
+ }
369
+ /**
370
+ * Жест кончился. Признак «тянут» снимается сразу, а сдвиг отпущенной
371
+ * панели — кадром позже: к этому кадру тема уже снова включила переход, и
372
+ * панель поедет на место. Сними сдвиг сразу — пересчёт стилей пришёлся бы
373
+ * раньше, и панель прыгнула бы на место. Закрылась панель — ожидание
374
+ * снимает отвязка жеста (`_detach`), а сдвиг остаётся до следующего показа.
375
+ */
376
+ _finish(gesture, close) {
377
+ const panel = this._target;
378
+ this._gesture = null;
379
+ if (panel) {
380
+ this._restoreSelect(panel, gesture);
381
+ this._scheduleReset(panel);
382
+ }
383
+ this._owner?.endSwipe();
384
+ if (close) this._open?.close("swipe");
385
+ }
386
+ _onClick = (event) => {
387
+ if (!this._swallowClick) return;
388
+ this._swallowClick = false;
389
+ event.preventDefault();
390
+ };
391
+ /**
392
+ * Касание, которое ведёт жест, — жесту, а не прокрутке (см. «Касание» в
393
+ * шапке). До порога жеста касание остаётся браузеру, а событие, которое
394
+ * отменить уже нельзя (`cancelable: false`), не гасится: прокрутку, начатую
395
+ * раньше жеста, браузер не отдаёт.
396
+ */
397
+ _onTouchMove = (event) => {
398
+ if (this._gesture && event.cancelable) event.preventDefault();
399
+ };
400
+ _restoreSelect(panel, gesture) {
401
+ for (const [property, value] of gesture.userSelect) restoreStyle(panel, property, value);
402
+ }
403
+ _scheduleReset(panel) {
404
+ this._cancelReset();
405
+ this._resetFrame = requestAnimationFrame(() => {
406
+ this._resetFrame = null;
407
+ panel.style.removeProperty(SWIPE_VARIABLE);
408
+ });
409
+ }
410
+ _cancelReset() {
411
+ if (this._resetFrame === null) return;
412
+ cancelAnimationFrame(this._resetFrame);
413
+ this._resetFrame = null;
414
+ }
415
+ };
416
+ /**
417
+ * Скорость к краю в конце жеста, px/мс: по точкам окна скорости. Одна точка
418
+ * — указатель стоял перед отпусканием, скорости нет.
419
+ */
420
+ function velocity(gesture) {
421
+ const first = gesture.samples[0];
422
+ const last = gesture.samples[gesture.samples.length - 1];
423
+ if (!first || !last || last.time <= first.time) return 0;
424
+ return (last.distance - first.distance) / (last.time - first.time);
425
+ }
426
+ /** Вернуть инлайновое значение, которое было до плагина: пустое — снять свойство. */
427
+ function restoreStyle(panel, property, value) {
428
+ if (value === "") panel.style.removeProperty(property);
429
+ else panel.style.setProperty(property, value);
430
+ }
431
+ //#endregion
432
+ export { TSwipePlugin };
@@ -0,0 +1,62 @@
1
+ import type { ISwipeable, TClasses, TSwipeableEvents } from '@soxa-ui/core';
2
+ import type { IListenable, TPluginEvents } from '../../../base';
3
+ /**
4
+ * Своих событий у плагина нет: результат жеста виден через владельца —
5
+ * `swiping` и закрытие (с причиной `swipe` у того, кто принимает запрос).
6
+ * Второй путь к тем же фактам через события плагина разошёлся бы с первым.
7
+ */
8
+ export type TSwipePluginEvents = TPluginEvents;
9
+ /**
10
+ * Владелец глазами плагина: смахиваемый слой (`ISwipeable`), его шина и
11
+ * классы — по базовому классу плагин узнаёт полосу (`__handle`).
12
+ *
13
+ * Контракт, а не класс: тот же плагин стоит на выезжающей панели, поповере,
14
+ * Select и DatePicker, общего предка у них нет — есть только общий контракт.
15
+ */
16
+ export interface ISwipeOwner extends ISwipeable {
17
+ readonly events: IListenable<TSwipeableEvents>;
18
+ readonly classes: TClasses;
19
+ }
20
+ /** Ось, вдоль которой слой уходит жестом. */
21
+ export type TSwipeAxis = 'x' | 'y';
22
+ /**
23
+ * Нажатие, которое ещё не стало жестом: жест начнётся, когда указатель уйдёт
24
+ * от точки нажатия вдоль оси дальше порога.
25
+ */
26
+ export type TSwipePress = {
27
+ /** `pointerId` нажатия: чужие указатели его не двигают */
28
+ pointer: number;
29
+ /** Точка нажатия в координатах окна */
30
+ x: number;
31
+ y: number;
32
+ };
33
+ /** Точка пути жеста — по ней считается скорость в конце. */
34
+ export type TSwipeSample = {
35
+ /** Время события, мс */
36
+ time: number;
37
+ /** Путь к краю от точки нажатия, px; назад от края — со знаком минус */
38
+ distance: number;
39
+ };
40
+ /** Жест, который ведёт плагин: от начала до отпускания. */
41
+ export type TSwipeGesture = {
42
+ /** `pointerId` указателя жеста */
43
+ pointer: number;
44
+ /** Ось жеста — на весь жест, вычислена в начале */
45
+ axis: TSwipeAxis;
46
+ /**
47
+ * Куда по оси окна слой уходит: `1` — к большим координатам (вправо,
48
+ * вниз), `-1` — к меньшим. `start` и `end` — с учётом вычисленного
49
+ * направления письма.
50
+ */
51
+ sign: 1 | -1;
52
+ /** Координата нажатия по оси */
53
+ origin: number;
54
+ /** Размер панели по оси: доля пути считается от него */
55
+ size: number;
56
+ /** Сдвиг панели к краю, px; за открытое положение — с сопротивлением, минус */
57
+ offset: number;
58
+ /** Недавние точки пути — окно скорости */
59
+ samples: TSwipeSample[];
60
+ /** Инлайновые `user-select` панели до жеста — вернуть в конце */
61
+ userSelect: readonly [property: string, value: string][];
62
+ };