@taiga-ui/cdk 2.45.0 → 2.48.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 (427) hide show
  1. package/abstract/controller.d.ts +6 -0
  2. package/abstract/taiga-ui-cdk-abstract.metadata.json +1 -1
  3. package/bundles/taiga-ui-cdk-abstract.umd.js +63 -21
  4. package/bundles/taiga-ui-cdk-abstract.umd.js.map +1 -1
  5. package/bundles/taiga-ui-cdk-abstract.umd.min.js +1 -15
  6. package/bundles/taiga-ui-cdk-abstract.umd.min.js.map +1 -1
  7. package/bundles/taiga-ui-cdk-components-alert-host.umd.js +50 -20
  8. package/bundles/taiga-ui-cdk-components-alert-host.umd.js.map +1 -1
  9. package/bundles/taiga-ui-cdk-components-alert-host.umd.min.js +1 -15
  10. package/bundles/taiga-ui-cdk-components-alert-host.umd.min.js.map +1 -1
  11. package/bundles/taiga-ui-cdk-components-dialog-host.umd.js +54 -24
  12. package/bundles/taiga-ui-cdk-components-dialog-host.umd.js.map +1 -1
  13. package/bundles/taiga-ui-cdk-components-dialog-host.umd.min.js +1 -15
  14. package/bundles/taiga-ui-cdk-components-dialog-host.umd.min.js.map +1 -1
  15. package/bundles/taiga-ui-cdk-components-dropdown-host.umd.js +50 -20
  16. package/bundles/taiga-ui-cdk-components-dropdown-host.umd.js.map +1 -1
  17. package/bundles/taiga-ui-cdk-components-dropdown-host.umd.min.js +1 -15
  18. package/bundles/taiga-ui-cdk-components-dropdown-host.umd.min.js.map +1 -1
  19. package/bundles/taiga-ui-cdk-components-portal-host.umd.js +51 -21
  20. package/bundles/taiga-ui-cdk-components-portal-host.umd.js.map +1 -1
  21. package/bundles/taiga-ui-cdk-components-portal-host.umd.min.js +1 -15
  22. package/bundles/taiga-ui-cdk-components-portal-host.umd.min.js.map +1 -1
  23. package/bundles/taiga-ui-cdk-date-time.umd.js +54 -29
  24. package/bundles/taiga-ui-cdk-date-time.umd.js.map +1 -1
  25. package/bundles/taiga-ui-cdk-date-time.umd.min.js +1 -15
  26. package/bundles/taiga-ui-cdk-date-time.umd.min.js.map +1 -1
  27. package/bundles/taiga-ui-cdk-decorators.umd.js +50 -20
  28. package/bundles/taiga-ui-cdk-decorators.umd.js.map +1 -1
  29. package/bundles/taiga-ui-cdk-decorators.umd.min.js +1 -15
  30. package/bundles/taiga-ui-cdk-decorators.umd.min.js.map +1 -1
  31. package/bundles/taiga-ui-cdk-directives-active-zone.umd.js +50 -20
  32. package/bundles/taiga-ui-cdk-directives-active-zone.umd.js.map +1 -1
  33. package/bundles/taiga-ui-cdk-directives-active-zone.umd.min.js +1 -15
  34. package/bundles/taiga-ui-cdk-directives-active-zone.umd.min.js.map +1 -1
  35. package/bundles/taiga-ui-cdk-directives-auto-focus.umd.js +265 -92
  36. package/bundles/taiga-ui-cdk-directives-auto-focus.umd.js.map +1 -1
  37. package/bundles/taiga-ui-cdk-directives-auto-focus.umd.min.js +1 -15
  38. package/bundles/taiga-ui-cdk-directives-auto-focus.umd.min.js.map +1 -1
  39. package/bundles/taiga-ui-cdk-directives-autofilled.umd.js +91 -42
  40. package/bundles/taiga-ui-cdk-directives-autofilled.umd.js.map +1 -1
  41. package/bundles/taiga-ui-cdk-directives-autofilled.umd.min.js +1 -15
  42. package/bundles/taiga-ui-cdk-directives-autofilled.umd.min.js.map +1 -1
  43. package/bundles/taiga-ui-cdk-directives-checked.umd.js +50 -20
  44. package/bundles/taiga-ui-cdk-directives-checked.umd.js.map +1 -1
  45. package/bundles/taiga-ui-cdk-directives-checked.umd.min.js +1 -15
  46. package/bundles/taiga-ui-cdk-directives-checked.umd.min.js.map +1 -1
  47. package/bundles/taiga-ui-cdk-directives-copy-processor.umd.js +50 -20
  48. package/bundles/taiga-ui-cdk-directives-copy-processor.umd.js.map +1 -1
  49. package/bundles/taiga-ui-cdk-directives-copy-processor.umd.min.js +1 -15
  50. package/bundles/taiga-ui-cdk-directives-copy-processor.umd.min.js.map +1 -1
  51. package/bundles/taiga-ui-cdk-directives-drag.umd.js +50 -20
  52. package/bundles/taiga-ui-cdk-directives-drag.umd.js.map +1 -1
  53. package/bundles/taiga-ui-cdk-directives-drag.umd.min.js +1 -15
  54. package/bundles/taiga-ui-cdk-directives-drag.umd.min.js.map +1 -1
  55. package/bundles/taiga-ui-cdk-directives-droppable.umd.js +50 -20
  56. package/bundles/taiga-ui-cdk-directives-droppable.umd.js.map +1 -1
  57. package/bundles/taiga-ui-cdk-directives-droppable.umd.min.js +1 -15
  58. package/bundles/taiga-ui-cdk-directives-droppable.umd.min.js.map +1 -1
  59. package/bundles/taiga-ui-cdk-directives-element.umd.js +50 -20
  60. package/bundles/taiga-ui-cdk-directives-element.umd.js.map +1 -1
  61. package/bundles/taiga-ui-cdk-directives-element.umd.min.js +1 -15
  62. package/bundles/taiga-ui-cdk-directives-element.umd.min.js.map +1 -1
  63. package/bundles/taiga-ui-cdk-directives-focus-trap.umd.js +50 -20
  64. package/bundles/taiga-ui-cdk-directives-focus-trap.umd.js.map +1 -1
  65. package/bundles/taiga-ui-cdk-directives-focus-trap.umd.min.js +1 -15
  66. package/bundles/taiga-ui-cdk-directives-focus-trap.umd.min.js.map +1 -1
  67. package/bundles/taiga-ui-cdk-directives-focus-visible.umd.js +50 -20
  68. package/bundles/taiga-ui-cdk-directives-focus-visible.umd.js.map +1 -1
  69. package/bundles/taiga-ui-cdk-directives-focus-visible.umd.min.js +1 -15
  70. package/bundles/taiga-ui-cdk-directives-focus-visible.umd.min.js.map +1 -1
  71. package/bundles/taiga-ui-cdk-directives-focusable.umd.js +50 -20
  72. package/bundles/taiga-ui-cdk-directives-focusable.umd.js.map +1 -1
  73. package/bundles/taiga-ui-cdk-directives-focusable.umd.min.js +1 -15
  74. package/bundles/taiga-ui-cdk-directives-focusable.umd.min.js.map +1 -1
  75. package/bundles/taiga-ui-cdk-directives-focused.umd.js +50 -20
  76. package/bundles/taiga-ui-cdk-directives-focused.umd.js.map +1 -1
  77. package/bundles/taiga-ui-cdk-directives-focused.umd.min.js +1 -15
  78. package/bundles/taiga-ui-cdk-directives-focused.umd.min.js.map +1 -1
  79. package/bundles/taiga-ui-cdk-directives-for-async.umd.js +324 -0
  80. package/bundles/taiga-ui-cdk-directives-for-async.umd.js.map +1 -0
  81. package/bundles/taiga-ui-cdk-directives-for-async.umd.min.js +2 -0
  82. package/bundles/taiga-ui-cdk-directives-for-async.umd.min.js.map +1 -0
  83. package/bundles/taiga-ui-cdk-directives-for.umd.js +50 -20
  84. package/bundles/taiga-ui-cdk-directives-for.umd.js.map +1 -1
  85. package/bundles/taiga-ui-cdk-directives-for.umd.min.js +1 -15
  86. package/bundles/taiga-ui-cdk-directives-for.umd.min.js.map +1 -1
  87. package/bundles/taiga-ui-cdk-directives-high-dpi.umd.js +50 -20
  88. package/bundles/taiga-ui-cdk-directives-high-dpi.umd.js.map +1 -1
  89. package/bundles/taiga-ui-cdk-directives-high-dpi.umd.min.js +1 -15
  90. package/bundles/taiga-ui-cdk-directives-high-dpi.umd.min.js.map +1 -1
  91. package/bundles/taiga-ui-cdk-directives-hovered.umd.js +50 -20
  92. package/bundles/taiga-ui-cdk-directives-hovered.umd.js.map +1 -1
  93. package/bundles/taiga-ui-cdk-directives-hovered.umd.min.js +1 -15
  94. package/bundles/taiga-ui-cdk-directives-hovered.umd.min.js.map +1 -1
  95. package/bundles/taiga-ui-cdk-directives-input-mode.umd.js +50 -20
  96. package/bundles/taiga-ui-cdk-directives-input-mode.umd.js.map +1 -1
  97. package/bundles/taiga-ui-cdk-directives-input-mode.umd.min.js +1 -15
  98. package/bundles/taiga-ui-cdk-directives-input-mode.umd.min.js.map +1 -1
  99. package/bundles/taiga-ui-cdk-directives-item.umd.js +51 -21
  100. package/bundles/taiga-ui-cdk-directives-item.umd.js.map +1 -1
  101. package/bundles/taiga-ui-cdk-directives-item.umd.min.js +1 -15
  102. package/bundles/taiga-ui-cdk-directives-item.umd.min.js.map +1 -1
  103. package/bundles/taiga-ui-cdk-directives-let.umd.js +50 -20
  104. package/bundles/taiga-ui-cdk-directives-let.umd.js.map +1 -1
  105. package/bundles/taiga-ui-cdk-directives-let.umd.min.js +1 -15
  106. package/bundles/taiga-ui-cdk-directives-let.umd.min.js.map +1 -1
  107. package/bundles/taiga-ui-cdk-directives-media.umd.js +50 -20
  108. package/bundles/taiga-ui-cdk-directives-media.umd.js.map +1 -1
  109. package/bundles/taiga-ui-cdk-directives-media.umd.min.js +1 -15
  110. package/bundles/taiga-ui-cdk-directives-media.umd.min.js.map +1 -1
  111. package/bundles/taiga-ui-cdk-directives-obscured.umd.js +50 -20
  112. package/bundles/taiga-ui-cdk-directives-obscured.umd.js.map +1 -1
  113. package/bundles/taiga-ui-cdk-directives-obscured.umd.min.js +1 -15
  114. package/bundles/taiga-ui-cdk-directives-obscured.umd.min.js.map +1 -1
  115. package/bundles/taiga-ui-cdk-directives-overscroll.umd.js +50 -20
  116. package/bundles/taiga-ui-cdk-directives-overscroll.umd.js.map +1 -1
  117. package/bundles/taiga-ui-cdk-directives-overscroll.umd.min.js +1 -15
  118. package/bundles/taiga-ui-cdk-directives-overscroll.umd.min.js.map +1 -1
  119. package/bundles/taiga-ui-cdk-directives-pan.umd.js +50 -20
  120. package/bundles/taiga-ui-cdk-directives-pan.umd.js.map +1 -1
  121. package/bundles/taiga-ui-cdk-directives-pan.umd.min.js +1 -15
  122. package/bundles/taiga-ui-cdk-directives-pan.umd.min.js.map +1 -1
  123. package/bundles/taiga-ui-cdk-directives-portal.umd.js +50 -20
  124. package/bundles/taiga-ui-cdk-directives-portal.umd.js.map +1 -1
  125. package/bundles/taiga-ui-cdk-directives-portal.umd.min.js +1 -15
  126. package/bundles/taiga-ui-cdk-directives-portal.umd.min.js.map +1 -1
  127. package/bundles/taiga-ui-cdk-directives-pressed.umd.js +50 -20
  128. package/bundles/taiga-ui-cdk-directives-pressed.umd.js.map +1 -1
  129. package/bundles/taiga-ui-cdk-directives-pressed.umd.min.js +1 -15
  130. package/bundles/taiga-ui-cdk-directives-pressed.umd.min.js.map +1 -1
  131. package/bundles/taiga-ui-cdk-directives-prevent-default.umd.js +50 -20
  132. package/bundles/taiga-ui-cdk-directives-prevent-default.umd.js.map +1 -1
  133. package/bundles/taiga-ui-cdk-directives-prevent-default.umd.min.js +1 -15
  134. package/bundles/taiga-ui-cdk-directives-prevent-default.umd.min.js.map +1 -1
  135. package/bundles/taiga-ui-cdk-directives-repeat-times.umd.js +50 -20
  136. package/bundles/taiga-ui-cdk-directives-repeat-times.umd.js.map +1 -1
  137. package/bundles/taiga-ui-cdk-directives-repeat-times.umd.min.js +1 -15
  138. package/bundles/taiga-ui-cdk-directives-repeat-times.umd.min.js.map +1 -1
  139. package/bundles/taiga-ui-cdk-directives-resize.umd.js +50 -20
  140. package/bundles/taiga-ui-cdk-directives-resize.umd.js.map +1 -1
  141. package/bundles/taiga-ui-cdk-directives-resize.umd.min.js +1 -15
  142. package/bundles/taiga-ui-cdk-directives-resize.umd.min.js.map +1 -1
  143. package/bundles/taiga-ui-cdk-directives-swipe.umd.js +50 -20
  144. package/bundles/taiga-ui-cdk-directives-swipe.umd.js.map +1 -1
  145. package/bundles/taiga-ui-cdk-directives-swipe.umd.min.js +1 -15
  146. package/bundles/taiga-ui-cdk-directives-swipe.umd.min.js.map +1 -1
  147. package/bundles/taiga-ui-cdk-directives-validator.umd.js +50 -20
  148. package/bundles/taiga-ui-cdk-directives-validator.umd.js.map +1 -1
  149. package/bundles/taiga-ui-cdk-directives-validator.umd.min.js +1 -15
  150. package/bundles/taiga-ui-cdk-directives-validator.umd.min.js.map +1 -1
  151. package/bundles/taiga-ui-cdk-directives-zoom.umd.js +50 -20
  152. package/bundles/taiga-ui-cdk-directives-zoom.umd.js.map +1 -1
  153. package/bundles/taiga-ui-cdk-directives-zoom.umd.min.js +1 -15
  154. package/bundles/taiga-ui-cdk-directives-zoom.umd.min.js.map +1 -1
  155. package/bundles/taiga-ui-cdk-directives.umd.js +12 -4
  156. package/bundles/taiga-ui-cdk-directives.umd.js.map +1 -1
  157. package/bundles/taiga-ui-cdk-directives.umd.min.js +1 -1
  158. package/bundles/taiga-ui-cdk-enums.umd.js +12 -0
  159. package/bundles/taiga-ui-cdk-enums.umd.js.map +1 -1
  160. package/bundles/taiga-ui-cdk-enums.umd.min.js +1 -1
  161. package/bundles/taiga-ui-cdk-enums.umd.min.js.map +1 -1
  162. package/bundles/taiga-ui-cdk-exceptions.umd.js +50 -20
  163. package/bundles/taiga-ui-cdk-exceptions.umd.js.map +1 -1
  164. package/bundles/taiga-ui-cdk-exceptions.umd.min.js +1 -15
  165. package/bundles/taiga-ui-cdk-exceptions.umd.min.js.map +1 -1
  166. package/bundles/taiga-ui-cdk-observables.umd.js +1 -1
  167. package/bundles/taiga-ui-cdk-observables.umd.js.map +1 -1
  168. package/bundles/taiga-ui-cdk-observables.umd.min.js.map +1 -1
  169. package/bundles/taiga-ui-cdk-pipes-filter.umd.js +50 -20
  170. package/bundles/taiga-ui-cdk-pipes-filter.umd.js.map +1 -1
  171. package/bundles/taiga-ui-cdk-pipes-filter.umd.min.js +1 -15
  172. package/bundles/taiga-ui-cdk-pipes-filter.umd.min.js.map +1 -1
  173. package/bundles/taiga-ui-cdk-pipes-mapper.umd.js +50 -20
  174. package/bundles/taiga-ui-cdk-pipes-mapper.umd.js.map +1 -1
  175. package/bundles/taiga-ui-cdk-pipes-mapper.umd.min.js +1 -15
  176. package/bundles/taiga-ui-cdk-pipes-mapper.umd.min.js.map +1 -1
  177. package/bundles/taiga-ui-cdk-services.umd.js +50 -20
  178. package/bundles/taiga-ui-cdk-services.umd.js.map +1 -1
  179. package/bundles/taiga-ui-cdk-services.umd.min.js +1 -15
  180. package/bundles/taiga-ui-cdk-services.umd.min.js.map +1 -1
  181. package/bundles/taiga-ui-cdk-tokens.umd.js +54 -26
  182. package/bundles/taiga-ui-cdk-tokens.umd.js.map +1 -1
  183. package/bundles/taiga-ui-cdk-tokens.umd.min.js +1 -15
  184. package/bundles/taiga-ui-cdk-tokens.umd.min.js.map +1 -1
  185. package/bundles/taiga-ui-cdk-utils-browser.umd.js +2 -2
  186. package/bundles/taiga-ui-cdk-utils-browser.umd.js.map +1 -1
  187. package/bundles/taiga-ui-cdk-utils-browser.umd.min.js +1 -1
  188. package/bundles/taiga-ui-cdk-utils-browser.umd.min.js.map +1 -1
  189. package/bundles/taiga-ui-cdk-utils-focus.umd.js +3 -1
  190. package/bundles/taiga-ui-cdk-utils-focus.umd.js.map +1 -1
  191. package/bundles/taiga-ui-cdk-utils-focus.umd.min.js +1 -1
  192. package/bundles/taiga-ui-cdk-utils-focus.umd.min.js.map +1 -1
  193. package/bundles/taiga-ui-cdk-utils-os.umd.js +39 -0
  194. package/bundles/taiga-ui-cdk-utils-os.umd.js.map +1 -0
  195. package/bundles/taiga-ui-cdk-utils-os.umd.min.js +2 -0
  196. package/bundles/taiga-ui-cdk-utils-os.umd.min.js.map +1 -0
  197. package/bundles/taiga-ui-cdk-utils-svg.umd.js +50 -20
  198. package/bundles/taiga-ui-cdk-utils-svg.umd.js.map +1 -1
  199. package/bundles/taiga-ui-cdk-utils-svg.umd.min.js +1 -15
  200. package/bundles/taiga-ui-cdk-utils-svg.umd.min.js.map +1 -1
  201. package/bundles/taiga-ui-cdk-utils.umd.js +12 -4
  202. package/bundles/taiga-ui-cdk-utils.umd.js.map +1 -1
  203. package/bundles/taiga-ui-cdk-utils.umd.min.js +1 -1
  204. package/components/dialog-host/taiga-ui-cdk-components-dialog-host.metadata.json +1 -1
  205. package/components/portal-host/portal.service.d.ts +1 -1
  206. package/date-time/date-fillers.d.ts +0 -2
  207. package/date-time/day-range.d.ts +1 -2
  208. package/date-time/day.d.ts +0 -1
  209. package/date-time/month-range.d.ts +0 -1
  210. package/date-time/month.d.ts +0 -1
  211. package/date-time/taiga-ui-cdk-date-time.metadata.json +1 -1
  212. package/directives/auto-focus/autofocus.directive.d.ts +4 -13
  213. package/directives/auto-focus/autofocus.options.d.ts +13 -0
  214. package/directives/auto-focus/handlers/abstract.handler.d.ts +11 -0
  215. package/directives/auto-focus/handlers/default.handler.d.ts +9 -0
  216. package/directives/auto-focus/handlers/ios.handler.d.ts +35 -0
  217. package/directives/auto-focus/index.d.ts +4 -0
  218. package/directives/auto-focus/taiga-ui-cdk-directives-auto-focus.metadata.json +1 -1
  219. package/directives/autofilled/autofilled-style.component.d.ts +2 -0
  220. package/directives/autofilled/autofilled.directive.d.ts +5 -4
  221. package/directives/autofilled/index.d.ts +1 -0
  222. package/directives/autofilled/taiga-ui-cdk-directives-autofilled.metadata.json +1 -1
  223. package/directives/for-async/for-async.directive.d.ts +13 -0
  224. package/directives/for-async/for-async.module.d.ts +5 -0
  225. package/directives/for-async/index.d.ts +2 -0
  226. package/directives/for-async/package.json +13 -0
  227. package/directives/for-async/taiga-ui-cdk-directives-for-async.d.ts +4 -0
  228. package/directives/for-async/taiga-ui-cdk-directives-for-async.metadata.json +1 -0
  229. package/directives/index.d.ts +1 -0
  230. package/directives/item/item.directive.d.ts +1 -1
  231. package/directives/taiga-ui-cdk-directives.metadata.json +1 -1
  232. package/enums/autocomplete.d.ts +10 -0
  233. package/enums/taiga-ui-cdk-enums.metadata.json +1 -1
  234. package/esm2015/abstract/controller.js +7 -1
  235. package/esm2015/abstract/interactive.js +2 -2
  236. package/esm2015/components/dialog-host/dialog-host.component.js +5 -5
  237. package/esm2015/components/portal-host/portal.service.js +2 -2
  238. package/esm2015/date-time/date-fillers.js +1 -3
  239. package/esm2015/date-time/day-range.js +2 -2
  240. package/esm2015/date-time/day.js +2 -3
  241. package/esm2015/date-time/month-range.js +1 -2
  242. package/esm2015/date-time/month.js +2 -3
  243. package/esm2015/date-time/year.js +2 -2
  244. package/esm2015/directives/auto-focus/autofocus.directive.js +11 -87
  245. package/esm2015/directives/auto-focus/autofocus.options.js +28 -0
  246. package/esm2015/directives/auto-focus/handlers/abstract.handler.js +25 -0
  247. package/esm2015/directives/auto-focus/handlers/default.handler.js +39 -0
  248. package/esm2015/directives/auto-focus/handlers/ios.handler.js +121 -0
  249. package/esm2015/directives/auto-focus/index.js +5 -1
  250. package/esm2015/directives/autofilled/autofilled-style.component.js +13 -0
  251. package/esm2015/directives/autofilled/autofilled.directive.js +23 -37
  252. package/esm2015/directives/autofilled/autofilled.module.js +4 -2
  253. package/esm2015/directives/autofilled/index.js +2 -1
  254. package/esm2015/directives/for-async/for-async.directive.js +48 -0
  255. package/esm2015/directives/for-async/for-async.module.js +16 -0
  256. package/esm2015/directives/for-async/index.js +3 -0
  257. package/esm2015/directives/for-async/taiga-ui-cdk-directives-for-async.js +5 -0
  258. package/esm2015/directives/index.js +2 -1
  259. package/esm2015/directives/item/item.directive.js +2 -2
  260. package/esm2015/enums/autocomplete.js +12 -1
  261. package/esm2015/observables/replay-control-value-changes.js +2 -2
  262. package/esm2015/tokens/index.js +2 -1
  263. package/esm2015/tokens/is-apple.js +5 -0
  264. package/esm2015/tokens/is-ios.js +4 -6
  265. package/esm2015/utils/browser/index.js +2 -2
  266. package/esm2015/utils/browser/is-edge-older-than.js +2 -2
  267. package/esm2015/utils/browser/{is-IE.js → is-ie.js} +1 -1
  268. package/esm2015/utils/browser/is-safari.js +2 -2
  269. package/esm2015/utils/focus/get-native-focused.js +2 -2
  270. package/esm2015/utils/focus/set-native-focused.js +3 -1
  271. package/esm2015/utils/index.js +2 -1
  272. package/esm2015/utils/os/index.js +4 -0
  273. package/esm2015/utils/os/is-apple-platform.js +14 -0
  274. package/esm2015/utils/os/is-apple.js +6 -0
  275. package/esm2015/utils/os/is-ios.js +7 -0
  276. package/esm2015/utils/os/taiga-ui-cdk-utils-os.js +5 -0
  277. package/esm5/abstract/controller.js +14 -1
  278. package/esm5/abstract/interactive.js +2 -2
  279. package/esm5/components/dialog-host/dialog-host.component.js +5 -5
  280. package/esm5/components/portal-host/portal.service.js +2 -2
  281. package/esm5/date-time/date-fillers.js +1 -3
  282. package/esm5/date-time/day-range.js +2 -2
  283. package/esm5/date-time/day.js +2 -3
  284. package/esm5/date-time/month-range.js +1 -2
  285. package/esm5/date-time/month.js +2 -3
  286. package/esm5/date-time/year.js +2 -2
  287. package/esm5/directives/auto-focus/autofocus.directive.js +11 -97
  288. package/esm5/directives/auto-focus/autofocus.options.js +28 -0
  289. package/esm5/directives/auto-focus/handlers/abstract.handler.js +34 -0
  290. package/esm5/directives/auto-focus/handlers/default.handler.js +43 -0
  291. package/esm5/directives/auto-focus/handlers/ios.handler.js +137 -0
  292. package/esm5/directives/auto-focus/index.js +5 -1
  293. package/esm5/directives/autofilled/autofilled-style.component.js +16 -0
  294. package/esm5/directives/autofilled/autofilled.directive.js +24 -21
  295. package/esm5/directives/autofilled/autofilled.module.js +4 -2
  296. package/esm5/directives/autofilled/index.js +2 -1
  297. package/esm5/directives/for-async/for-async.directive.js +52 -0
  298. package/esm5/directives/for-async/for-async.module.js +19 -0
  299. package/esm5/directives/for-async/index.js +3 -0
  300. package/esm5/directives/for-async/taiga-ui-cdk-directives-for-async.js +5 -0
  301. package/esm5/directives/index.js +2 -1
  302. package/esm5/directives/item/item.directive.js +2 -2
  303. package/esm5/enums/autocomplete.js +12 -1
  304. package/esm5/observables/replay-control-value-changes.js +2 -2
  305. package/esm5/tokens/index.js +2 -1
  306. package/esm5/tokens/is-apple.js +5 -0
  307. package/esm5/tokens/is-ios.js +4 -8
  308. package/esm5/utils/browser/index.js +2 -2
  309. package/esm5/utils/browser/is-edge-older-than.js +2 -2
  310. package/esm5/utils/browser/{is-IE.js → is-ie.js} +1 -1
  311. package/esm5/utils/browser/is-safari.js +2 -2
  312. package/esm5/utils/focus/get-native-focused.js +2 -2
  313. package/esm5/utils/focus/set-native-focused.js +3 -1
  314. package/esm5/utils/index.js +2 -1
  315. package/esm5/utils/os/index.js +4 -0
  316. package/esm5/utils/os/is-apple-platform.js +14 -0
  317. package/esm5/utils/os/is-apple.js +6 -0
  318. package/esm5/utils/os/is-ios.js +7 -0
  319. package/esm5/utils/os/taiga-ui-cdk-utils-os.js +5 -0
  320. package/fesm2015/taiga-ui-cdk-abstract.js +8 -2
  321. package/fesm2015/taiga-ui-cdk-abstract.js.map +1 -1
  322. package/fesm2015/taiga-ui-cdk-components-dialog-host.js +4 -4
  323. package/fesm2015/taiga-ui-cdk-components-dialog-host.js.map +1 -1
  324. package/fesm2015/taiga-ui-cdk-components-portal-host.js +1 -1
  325. package/fesm2015/taiga-ui-cdk-components-portal-host.js.map +1 -1
  326. package/fesm2015/taiga-ui-cdk-date-time.js +4 -9
  327. package/fesm2015/taiga-ui-cdk-date-time.js.map +1 -1
  328. package/fesm2015/taiga-ui-cdk-directives-auto-focus.js +187 -69
  329. package/fesm2015/taiga-ui-cdk-directives-auto-focus.js.map +1 -1
  330. package/fesm2015/taiga-ui-cdk-directives-autofilled.js +33 -37
  331. package/fesm2015/taiga-ui-cdk-directives-autofilled.js.map +1 -1
  332. package/fesm2015/taiga-ui-cdk-directives-for-async.js +66 -0
  333. package/fesm2015/taiga-ui-cdk-directives-for-async.js.map +1 -0
  334. package/fesm2015/taiga-ui-cdk-directives-item.js +1 -1
  335. package/fesm2015/taiga-ui-cdk-directives-item.js.map +1 -1
  336. package/fesm2015/taiga-ui-cdk-directives.js +1 -0
  337. package/fesm2015/taiga-ui-cdk-directives.js.map +1 -1
  338. package/fesm2015/taiga-ui-cdk-enums.js +11 -0
  339. package/fesm2015/taiga-ui-cdk-enums.js.map +1 -1
  340. package/fesm2015/taiga-ui-cdk-observables.js +1 -1
  341. package/fesm2015/taiga-ui-cdk-observables.js.map +1 -1
  342. package/fesm2015/taiga-ui-cdk-tokens.js +6 -7
  343. package/fesm2015/taiga-ui-cdk-tokens.js.map +1 -1
  344. package/fesm2015/taiga-ui-cdk-utils-browser.js +2 -2
  345. package/fesm2015/taiga-ui-cdk-utils-browser.js.map +1 -1
  346. package/fesm2015/taiga-ui-cdk-utils-focus.js +3 -1
  347. package/fesm2015/taiga-ui-cdk-utils-focus.js.map +1 -1
  348. package/fesm2015/taiga-ui-cdk-utils-os.js +31 -0
  349. package/fesm2015/taiga-ui-cdk-utils-os.js.map +1 -0
  350. package/fesm2015/taiga-ui-cdk-utils.js +1 -0
  351. package/fesm2015/taiga-ui-cdk-utils.js.map +1 -1
  352. package/fesm5/taiga-ui-cdk-abstract.js +13 -2
  353. package/fesm5/taiga-ui-cdk-abstract.js.map +1 -1
  354. package/fesm5/taiga-ui-cdk-components-dialog-host.js +4 -4
  355. package/fesm5/taiga-ui-cdk-components-dialog-host.js.map +1 -1
  356. package/fesm5/taiga-ui-cdk-components-portal-host.js +1 -1
  357. package/fesm5/taiga-ui-cdk-components-portal-host.js.map +1 -1
  358. package/fesm5/taiga-ui-cdk-date-time.js +4 -9
  359. package/fesm5/taiga-ui-cdk-date-time.js.map +1 -1
  360. package/fesm5/taiga-ui-cdk-directives-auto-focus.js +211 -74
  361. package/fesm5/taiga-ui-cdk-directives-auto-focus.js.map +1 -1
  362. package/fesm5/taiga-ui-cdk-directives-autofilled.js +38 -22
  363. package/fesm5/taiga-ui-cdk-directives-autofilled.js.map +1 -1
  364. package/fesm5/taiga-ui-cdk-directives-for-async.js +73 -0
  365. package/fesm5/taiga-ui-cdk-directives-for-async.js.map +1 -0
  366. package/fesm5/taiga-ui-cdk-directives-item.js +1 -1
  367. package/fesm5/taiga-ui-cdk-directives-item.js.map +1 -1
  368. package/fesm5/taiga-ui-cdk-directives.js +1 -0
  369. package/fesm5/taiga-ui-cdk-directives.js.map +1 -1
  370. package/fesm5/taiga-ui-cdk-enums.js +11 -0
  371. package/fesm5/taiga-ui-cdk-enums.js.map +1 -1
  372. package/fesm5/taiga-ui-cdk-observables.js +1 -1
  373. package/fesm5/taiga-ui-cdk-observables.js.map +1 -1
  374. package/fesm5/taiga-ui-cdk-tokens.js +6 -9
  375. package/fesm5/taiga-ui-cdk-tokens.js.map +1 -1
  376. package/fesm5/taiga-ui-cdk-utils-browser.js +2 -2
  377. package/fesm5/taiga-ui-cdk-utils-browser.js.map +1 -1
  378. package/fesm5/taiga-ui-cdk-utils-focus.js +3 -1
  379. package/fesm5/taiga-ui-cdk-utils-focus.js.map +1 -1
  380. package/fesm5/taiga-ui-cdk-utils-os.js +31 -0
  381. package/fesm5/taiga-ui-cdk-utils-os.js.map +1 -0
  382. package/fesm5/taiga-ui-cdk-utils.js +1 -0
  383. package/fesm5/taiga-ui-cdk-utils.js.map +1 -1
  384. package/observables/replay-control-value-changes.d.ts +1 -1
  385. package/package.json +1 -1
  386. package/schematics/ng-add/constants/modules.d.ts +1 -1
  387. package/schematics/ng-add/constants/modules.js +2 -2
  388. package/schematics/ng-add/schema.d.ts +1 -1
  389. package/schematics/ng-add/schema.json +3 -3
  390. package/schematics/ng-add/steps/add-taiga-modules.js +1 -1
  391. package/schematics/ng-update/constants/consts.d.ts +7 -7
  392. package/schematics/ng-update/constants/consts.js +28 -0
  393. package/schematics/ng-update/constants/enums.d.ts +3 -3
  394. package/schematics/ng-update/constants/enums.js +22 -0
  395. package/schematics/ng-update/constants/services.d.ts +8 -0
  396. package/schematics/ng-update/constants/services.js +43 -0
  397. package/schematics/ng-update/constants/types.d.ts +4 -3
  398. package/schematics/ng-update/constants/types.js +55 -0
  399. package/schematics/ng-update/constants/warnings.d.ts +6 -0
  400. package/schematics/ng-update/constants/warnings.js +30 -0
  401. package/schematics/ng-update/index.js +4 -0
  402. package/schematics/ng-update/steps/rename-types.js +27 -11
  403. package/schematics/ng-update/steps/replace-const.js +2 -2
  404. package/schematics/ng-update/steps/replace-enums.js +2 -2
  405. package/schematics/ng-update/steps/replace-services.d.ts +1 -0
  406. package/schematics/ng-update/steps/replace-services.js +51 -0
  407. package/schematics/ng-update/steps/show-warnings.d.ts +2 -0
  408. package/schematics/ng-update/steps/show-warnings.js +35 -0
  409. package/schematics/utils/{remove-import.d.ts → import-manipulations.d.ts} +1 -0
  410. package/schematics/utils/import-manipulations.js +19 -0
  411. package/tokens/index.d.ts +1 -0
  412. package/tokens/is-apple.d.ts +2 -0
  413. package/tokens/taiga-ui-cdk-tokens.metadata.json +1 -1
  414. package/utils/browser/index.d.ts +1 -1
  415. package/utils/browser/{is-IE.d.ts → is-ie.d.ts} +0 -0
  416. package/utils/browser/taiga-ui-cdk-utils-browser.metadata.json +1 -1
  417. package/utils/focus/set-native-focused.d.ts +2 -0
  418. package/utils/index.d.ts +1 -0
  419. package/utils/os/index.d.ts +3 -0
  420. package/utils/os/is-apple-platform.d.ts +11 -0
  421. package/utils/os/is-apple.d.ts +1 -0
  422. package/utils/os/is-ios.d.ts +1 -0
  423. package/utils/os/package.json +13 -0
  424. package/utils/os/taiga-ui-cdk-utils-os.d.ts +4 -0
  425. package/utils/os/taiga-ui-cdk-utils-os.metadata.json +1 -0
  426. package/utils/taiga-ui-cdk-utils.metadata.json +1 -1
  427. package/schematics/utils/remove-import.js +0 -11
@@ -1,43 +1,18 @@
1
- import { __decorate, __param } from 'tslib';
2
- import { Optional, Self, Inject, NgZone, ElementRef, Renderer2, Input, Directive, NgModule } from '@angular/core';
3
- import { ANIMATION_FRAME } from '@ng-web-apis/common';
4
- import { POLLING_TIME } from '@taiga-ui/cdk/constants';
1
+ import { __decorate, __extends, __param, __values } from 'tslib';
2
+ import { ElementRef, Directive, Optional, Self, Inject, Renderer2, NgZone, InjectionToken, inject, Input, NgModule } from '@angular/core';
3
+ import { ANIMATION_FRAME, WINDOW } from '@ng-web-apis/common';
5
4
  import { TUI_FOCUSABLE_ITEM_ACCESSOR, TUI_IS_IOS } from '@taiga-ui/cdk/tokens';
6
- import { setNativeFocused } from '@taiga-ui/cdk/utils/focus';
5
+ import { POLLING_TIME } from '@taiga-ui/cdk/constants';
7
6
  import { race, timer, Observable } from 'rxjs';
8
7
  import { throttleTime, map, skipWhile, take } from 'rxjs/operators';
8
+ import { px } from '@taiga-ui/cdk/utils';
9
9
 
10
- var TIMEOUT = 1000;
11
- var NG_ANIMATION_SELECTOR = '.ng-animating';
12
- // TODO: in 3.0 change input name to tuiAutoFocus and handle empty string
13
- // TODO: refactor on this whole thing in 3.0
14
- var TuiAutoFocusDirective = /** @class */ (function () {
15
- function TuiAutoFocusDirective(tuiFocusableComponent, isIos, animationFrame$, ngZone, elementRef, renderer) {
10
+ var AbstractTuiAutofocusHandler = /** @class */ (function () {
11
+ function AbstractTuiAutofocusHandler(tuiFocusableComponent, elementRef) {
16
12
  this.tuiFocusableComponent = tuiFocusableComponent;
17
- this.isIos = isIos;
18
- this.animationFrame$ = animationFrame$;
19
- this.ngZone = ngZone;
20
13
  this.elementRef = elementRef;
21
- this.renderer = renderer;
22
- this.autoFocus = true;
23
14
  }
24
- TuiAutoFocusDirective.prototype.ngAfterViewInit = function () {
25
- var _this = this;
26
- if (!this.autoFocus) {
27
- return;
28
- }
29
- if (this.isTextFieldElement) {
30
- if (this.isIos) {
31
- this.ngZone.runOutsideAngular(function () { return _this.iosWebkitAutofocus(); });
32
- }
33
- else {
34
- race(timer(TIMEOUT), this.animationFrame$.pipe(throttleTime(POLLING_TIME), map(function () { return _this.element.closest(NG_ANIMATION_SELECTOR); }), skipWhile(Boolean), take(1))).subscribe(function () { return setNativeFocused(_this.element); });
35
- }
36
- return;
37
- }
38
- setNativeFocused(this.element);
39
- };
40
- Object.defineProperty(TuiAutoFocusDirective.prototype, "element", {
15
+ Object.defineProperty(AbstractTuiAutofocusHandler.prototype, "element", {
41
16
  get: function () {
42
17
  var _a;
43
18
  return (((_a = this.tuiFocusableComponent) === null || _a === void 0 ? void 0 : _a.nativeFocusableElement) ||
@@ -46,55 +21,223 @@ var TuiAutoFocusDirective = /** @class */ (function () {
46
21
  enumerable: true,
47
22
  configurable: true
48
23
  });
49
- Object.defineProperty(TuiAutoFocusDirective.prototype, "isTextFieldElement", {
24
+ Object.defineProperty(AbstractTuiAutofocusHandler.prototype, "isTextFieldElement", {
50
25
  get: function () {
51
26
  return this.element.matches('input, textarea');
52
27
  },
53
28
  enumerable: true,
54
29
  configurable: true
55
30
  });
56
- TuiAutoFocusDirective.prototype.iosWebkitAutofocus = function () {
31
+ AbstractTuiAutofocusHandler.ctorParameters = function () { return [
32
+ { type: undefined },
33
+ { type: ElementRef }
34
+ ]; };
35
+ AbstractTuiAutofocusHandler = __decorate([
36
+ Directive()
37
+ ], AbstractTuiAutofocusHandler);
38
+ return AbstractTuiAutofocusHandler;
39
+ }());
40
+
41
+ var TIMEOUT = 1000;
42
+ var NG_ANIMATION_SELECTOR = '.ng-animating';
43
+ var TuiDefaultAutofocusHandler = /** @class */ (function (_super) {
44
+ __extends(TuiDefaultAutofocusHandler, _super);
45
+ function TuiDefaultAutofocusHandler(tuiFocusableComponent, elementRef, animationFrame$) {
46
+ var _this = _super.call(this, tuiFocusableComponent, elementRef) || this;
47
+ _this.animationFrame$ = animationFrame$;
48
+ return _this;
49
+ }
50
+ TuiDefaultAutofocusHandler.prototype.setFocus = function () {
51
+ var _this = this;
52
+ if (this.isTextFieldElement) {
53
+ race(timer(TIMEOUT), this.animationFrame$.pipe(throttleTime(POLLING_TIME), map(function () { return _this.element.closest(NG_ANIMATION_SELECTOR); }), skipWhile(Boolean), take(1))).subscribe(function () { return _this.element.focus(); });
54
+ }
55
+ else {
56
+ this.element.focus();
57
+ }
58
+ };
59
+ TuiDefaultAutofocusHandler.ctorParameters = function () { return [
60
+ { type: undefined, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [TUI_FOCUSABLE_ITEM_ACCESSOR,] }] },
61
+ { type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] },
62
+ { type: Observable, decorators: [{ type: Inject, args: [ANIMATION_FRAME,] }] }
63
+ ]; };
64
+ TuiDefaultAutofocusHandler = __decorate([
65
+ Directive(),
66
+ __param(0, Optional()),
67
+ __param(0, Self()),
68
+ __param(0, Inject(TUI_FOCUSABLE_ITEM_ACCESSOR)),
69
+ __param(1, Inject(ElementRef)),
70
+ __param(2, Inject(ANIMATION_FRAME))
71
+ ], TuiDefaultAutofocusHandler);
72
+ return TuiDefaultAutofocusHandler;
73
+ }(AbstractTuiAutofocusHandler));
74
+
75
+ // @dynamic
76
+ var TuiIosAutofocusHandler = /** @class */ (function (_super) {
77
+ __extends(TuiIosAutofocusHandler, _super);
78
+ function TuiIosAutofocusHandler(tuiFocusableComponent, elementRef, renderer, ngZone, windowRef) {
79
+ var _this = _super.call(this, tuiFocusableComponent, elementRef) || this;
80
+ _this.renderer = renderer;
81
+ _this.ngZone = ngZone;
82
+ _this.windowRef = windowRef;
83
+ _this.patchCssStyles();
84
+ return _this;
85
+ }
86
+ TuiIosAutofocusHandler.prototype.setFocus = function () {
87
+ var _this = this;
88
+ if (this.isTextFieldElement) {
89
+ this.ngZone.runOutsideAngular(function () { return _this.iosWebkitAutofocus(); });
90
+ }
91
+ else {
92
+ this.element.focus();
93
+ }
94
+ };
95
+ TuiIosAutofocusHandler.prototype.iosWebkitAutofocus = function () {
57
96
  var _this = this;
58
97
  var _a;
59
- var fakeInput = this.renderer.createElement('input');
60
- fakeInput.style.position = 'absolute';
61
- fakeInput.style.opacity = '0';
62
- fakeInput.style.height = '0';
63
- var blurHandler = function () { return setNativeFocused(fakeInput); };
98
+ var fakeInput = this.makeFakeInput();
99
+ var duration = this.getDurationTimeBeforeFocus();
100
+ var fakeFocusTimeoutId = 0;
101
+ var elementFocusTimeoutId = 0;
102
+ var blurHandler = function () { return fakeInput.focus({ preventScroll: true }); };
64
103
  var focusHandler = function () {
65
- setTimeout(function () {
66
- setNativeFocused(_this.element);
67
- /**
68
- * @note:
69
- * We can't remove the element immediately, because it breaks flow
70
- */
71
- setTimeout(function () {
72
- fakeInput.removeEventListener('blur', blurHandler);
73
- fakeInput.removeEventListener('focus', focusHandler);
104
+ clearTimeout(fakeFocusTimeoutId);
105
+ fakeFocusTimeoutId = _this.windowRef.setTimeout(function () {
106
+ clearTimeout(elementFocusTimeoutId);
107
+ fakeInput.removeEventListener('blur', blurHandler);
108
+ fakeInput.removeEventListener('focus', focusHandler);
109
+ elementFocusTimeoutId = _this.windowRef.setTimeout(function () {
110
+ _this.element.focus({ preventScroll: false });
74
111
  fakeInput.remove();
75
- });
112
+ }, duration);
76
113
  });
77
114
  };
78
- /**
79
- * @note: ping-pong eager strategy hack
80
- * After creating an element and bringing it into DOM,
81
- * the browser automatically focuses on the invisible element.
82
- * And then, after focus is triggered, we try to focus on target element, and if we managed to refocus,
83
- * then we try to focus again on an invisible element, so that the keyboard slowly appears.
84
- * This ping pong allows the keyboard to not overlap the modal window.
85
- */
86
115
  fakeInput.addEventListener('blur', blurHandler, { once: true });
87
116
  fakeInput.addEventListener('focus', focusHandler);
88
- (_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.appendChild(fakeInput);
89
- setNativeFocused(fakeInput);
117
+ if (this.insideDialog()) {
118
+ this.windowRef.document.body.appendChild(fakeInput);
119
+ }
120
+ else {
121
+ (_a = this.element.parentElement) === null || _a === void 0 ? void 0 : _a.appendChild(fakeInput);
122
+ }
123
+ fakeInput.focus({ preventScroll: true });
90
124
  };
91
- TuiAutoFocusDirective.ctorParameters = function () { return [
125
+ /**
126
+ * @note:
127
+ * emulate textfield position in layout with cursor
128
+ * before focus to real textfield element
129
+ */
130
+ TuiIosAutofocusHandler.prototype.makeFakeInput = function () {
131
+ var fakeInput = this.renderer.createElement('input');
132
+ var rect = this.element.getBoundingClientRect();
133
+ fakeInput.style.height = px(rect.height);
134
+ fakeInput.style.width = px(rect.width / 2);
135
+ fakeInput.style.position = 'fixed';
136
+ fakeInput.style.opacity = '0';
137
+ fakeInput.style.fontSize = px(16); // disable possible auto zoom
138
+ fakeInput.readOnly = true; // prevent keyboard for fake input
139
+ // @note: emulate position cursor before focus to real textfield element
140
+ fakeInput.style.top = px(rect.top);
141
+ fakeInput.style.left = px(rect.left);
142
+ return fakeInput;
143
+ };
144
+ TuiIosAutofocusHandler.prototype.getDurationTimeBeforeFocus = function () {
145
+ return (parseFloat(this.windowRef
146
+ .getComputedStyle(this.element)
147
+ .getPropertyValue('--tui-duration')) || 0);
148
+ };
149
+ /**
150
+ * @note:
151
+ * unfortunately, in older versions of iOS
152
+ * there is a bug that the fake input cursor
153
+ * will move along with the dialog animation
154
+ * and then that dialog will be shaking
155
+ */
156
+ TuiIosAutofocusHandler.prototype.insideDialog = function () {
157
+ return !!this.element.closest('tui-dialog');
158
+ };
159
+ /**
160
+ * @note:
161
+ * This is necessary so that the viewport isn't recalculated
162
+ * and then the dialogs don't shake.
163
+ *
164
+ * Also, we need to fixed height viewport,
165
+ * so that when focusing the dialogs don't shake
166
+ */
167
+ TuiIosAutofocusHandler.prototype.patchCssStyles = function () {
168
+ var e_1, _a;
169
+ var documentRef = this.windowRef.document;
170
+ try {
171
+ for (var _b = __values([documentRef.documentElement, documentRef.body]), _c = _b.next(); !_c.done; _c = _b.next()) {
172
+ var element = _c.value;
173
+ element.style.setProperty('overflow', 'auto');
174
+ element.style.setProperty('height', '100%');
175
+ }
176
+ }
177
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
178
+ finally {
179
+ try {
180
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
181
+ }
182
+ finally { if (e_1) throw e_1.error; }
183
+ }
184
+ };
185
+ TuiIosAutofocusHandler.ctorParameters = function () { return [
92
186
  { type: undefined, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [TUI_FOCUSABLE_ITEM_ACCESSOR,] }] },
93
- { type: Boolean, decorators: [{ type: Inject, args: [TUI_IS_IOS,] }] },
94
- { type: Observable, decorators: [{ type: Inject, args: [ANIMATION_FRAME,] }] },
95
- { type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] },
96
187
  { type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] },
97
- { type: Renderer2, decorators: [{ type: Inject, args: [Renderer2,] }] }
188
+ { type: Renderer2, decorators: [{ type: Inject, args: [Renderer2,] }] },
189
+ { type: NgZone, decorators: [{ type: Inject, args: [NgZone,] }] },
190
+ { type: Window, decorators: [{ type: Inject, args: [WINDOW,] }] }
191
+ ]; };
192
+ TuiIosAutofocusHandler = __decorate([
193
+ Directive(),
194
+ __param(0, Optional()),
195
+ __param(0, Self()),
196
+ __param(0, Inject(TUI_FOCUSABLE_ITEM_ACCESSOR)),
197
+ __param(1, Inject(ElementRef)),
198
+ __param(2, Inject(Renderer2)),
199
+ __param(3, Inject(NgZone)),
200
+ __param(4, Inject(WINDOW))
201
+ ], TuiIosAutofocusHandler);
202
+ return TuiIosAutofocusHandler;
203
+ }(AbstractTuiAutofocusHandler));
204
+
205
+ var TUI_AUTOFOCUS_HANDLER = new InjectionToken('Autofocusing handler');
206
+ // TODO: 3.0 remove in ivy compilation
207
+ function tuiAutofocusHandlerFactory(tuiFocusableComponent, elementRef, animationFrame$, renderer, ngZone, windowRef) {
208
+ return inject(TUI_IS_IOS)
209
+ ? new TuiIosAutofocusHandler(tuiFocusableComponent, elementRef, renderer, ngZone, windowRef)
210
+ : new TuiDefaultAutofocusHandler(tuiFocusableComponent, elementRef, animationFrame$);
211
+ }
212
+ var TUI_AUTOFOCUS_PROVIDERS = [
213
+ {
214
+ provide: TUI_AUTOFOCUS_HANDLER,
215
+ // TODO: replace to useClass in v3.0
216
+ useFactory: tuiAutofocusHandlerFactory,
217
+ deps: [
218
+ [new Optional(), new Self(), TUI_FOCUSABLE_ITEM_ACCESSOR],
219
+ ElementRef,
220
+ ANIMATION_FRAME,
221
+ Renderer2,
222
+ NgZone,
223
+ WINDOW,
224
+ ],
225
+ },
226
+ ];
227
+
228
+ // TODO: 3.0 change input name to tuiAutoFocus and handle empty string
229
+ var TuiAutoFocusDirective = /** @class */ (function () {
230
+ function TuiAutoFocusDirective(handler) {
231
+ this.handler = handler;
232
+ this.autoFocus = true;
233
+ }
234
+ TuiAutoFocusDirective.prototype.ngAfterViewInit = function () {
235
+ if (this.autoFocus) {
236
+ this.handler.setFocus();
237
+ }
238
+ };
239
+ TuiAutoFocusDirective.ctorParameters = function () { return [
240
+ { type: undefined, decorators: [{ type: Inject, args: [TUI_AUTOFOCUS_HANDLER,] }] }
98
241
  ]; };
99
242
  __decorate([
100
243
  Input()
@@ -102,15 +245,9 @@ var TuiAutoFocusDirective = /** @class */ (function () {
102
245
  TuiAutoFocusDirective = __decorate([
103
246
  Directive({
104
247
  selector: '[tuiAutoFocus]',
248
+ providers: TUI_AUTOFOCUS_PROVIDERS,
105
249
  }),
106
- __param(0, Optional()),
107
- __param(0, Self()),
108
- __param(0, Inject(TUI_FOCUSABLE_ITEM_ACCESSOR)),
109
- __param(1, Inject(TUI_IS_IOS)),
110
- __param(2, Inject(ANIMATION_FRAME)),
111
- __param(3, Inject(NgZone)),
112
- __param(4, Inject(ElementRef)),
113
- __param(5, Inject(Renderer2))
250
+ __param(0, Inject(TUI_AUTOFOCUS_HANDLER))
114
251
  ], TuiAutoFocusDirective);
115
252
  return TuiAutoFocusDirective;
116
253
  }());
@@ -131,5 +268,5 @@ var TuiAutoFocusModule = /** @class */ (function () {
131
268
  * Generated bundle index. Do not edit.
132
269
  */
133
270
 
134
- export { TuiAutoFocusDirective, TuiAutoFocusModule };
271
+ export { AbstractTuiAutofocusHandler, TUI_AUTOFOCUS_HANDLER, TUI_AUTOFOCUS_PROVIDERS, TuiAutoFocusDirective, TuiAutoFocusModule, TuiDefaultAutofocusHandler, TuiIosAutofocusHandler, tuiAutofocusHandlerFactory };
135
272
  //# sourceMappingURL=taiga-ui-cdk-directives-auto-focus.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-cdk-directives-auto-focus.js","sources":["ng://@taiga-ui/cdk/directives/auto-focus/autofocus.directive.ts","ng://@taiga-ui/cdk/directives/auto-focus/autofocus.module.ts","ng://@taiga-ui/cdk/directives/auto-focus/taiga-ui-cdk-directives-auto-focus.ts"],"sourcesContent":["import {\n AfterViewInit,\n Directive,\n ElementRef,\n Inject,\n Input,\n NgZone,\n Optional,\n Renderer2,\n Self,\n} from '@angular/core';\nimport {ANIMATION_FRAME} from '@ng-web-apis/common';\nimport {POLLING_TIME} from '@taiga-ui/cdk/constants';\nimport {\n TuiFocusableElementAccessor,\n TuiNativeFocusableElement,\n} from '@taiga-ui/cdk/interfaces';\nimport {TUI_FOCUSABLE_ITEM_ACCESSOR, TUI_IS_IOS} from '@taiga-ui/cdk/tokens';\nimport {setNativeFocused} from '@taiga-ui/cdk/utils/focus';\nimport {Observable, race, timer} from 'rxjs';\nimport {map, skipWhile, take, throttleTime} from 'rxjs/operators';\n\nconst TIMEOUT = 1000;\nconst NG_ANIMATION_SELECTOR = '.ng-animating';\n\n// TODO: in 3.0 change input name to tuiAutoFocus and handle empty string\n// TODO: refactor on this whole thing in 3.0\n@Directive({\n selector: '[tuiAutoFocus]',\n})\nexport class TuiAutoFocusDirective implements AfterViewInit {\n @Input()\n autoFocus = true;\n\n constructor(\n @Optional()\n @Self()\n @Inject(TUI_FOCUSABLE_ITEM_ACCESSOR)\n private readonly tuiFocusableComponent: TuiFocusableElementAccessor | null,\n @Inject(TUI_IS_IOS) private readonly isIos: boolean,\n @Inject(ANIMATION_FRAME) private readonly animationFrame$: Observable<number>,\n @Inject(NgZone)\n private readonly ngZone: NgZone,\n @Inject(ElementRef)\n private readonly elementRef: ElementRef<HTMLElement>,\n @Inject(Renderer2)\n private readonly renderer: Renderer2,\n ) {}\n\n ngAfterViewInit(): void {\n if (!this.autoFocus) {\n return;\n }\n\n if (this.isTextFieldElement) {\n if (this.isIos) {\n this.ngZone.runOutsideAngular(() => this.iosWebkitAutofocus());\n } else {\n race(\n timer(TIMEOUT),\n this.animationFrame$.pipe(\n throttleTime(POLLING_TIME),\n map(() => this.element.closest(NG_ANIMATION_SELECTOR)),\n skipWhile(Boolean),\n take(1),\n ),\n ).subscribe(() => setNativeFocused(this.element));\n }\n\n return;\n }\n\n setNativeFocused(this.element);\n }\n\n private get element(): TuiNativeFocusableElement {\n return (\n this.tuiFocusableComponent?.nativeFocusableElement ||\n this.elementRef.nativeElement\n );\n }\n\n private get isTextFieldElement(): boolean {\n return this.element.matches('input, textarea');\n }\n\n private iosWebkitAutofocus(): void {\n const fakeInput: HTMLElement = this.renderer.createElement('input');\n\n fakeInput.style.position = 'absolute';\n fakeInput.style.opacity = '0';\n fakeInput.style.height = '0';\n\n const blurHandler = (): void => setNativeFocused(fakeInput);\n const focusHandler = (): void => {\n setTimeout(() => {\n setNativeFocused(this.element);\n\n /**\n * @note:\n * We can't remove the element immediately, because it breaks flow\n */\n setTimeout(() => {\n fakeInput.removeEventListener('blur', blurHandler);\n fakeInput.removeEventListener('focus', focusHandler);\n fakeInput.remove();\n });\n });\n };\n\n /**\n * @note: ping-pong eager strategy hack\n * After creating an element and bringing it into DOM,\n * the browser automatically focuses on the invisible element.\n * And then, after focus is triggered, we try to focus on target element, and if we managed to refocus,\n * then we try to focus again on an invisible element, so that the keyboard slowly appears.\n * This ping pong allows the keyboard to not overlap the modal window.\n */\n fakeInput.addEventListener('blur', blurHandler, {once: true});\n fakeInput.addEventListener('focus', focusHandler);\n\n this.element.parentElement?.appendChild(fakeInput);\n\n setNativeFocused(fakeInput);\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiAutoFocusDirective} from './autofocus.directive';\n\n@NgModule({\n declarations: [TuiAutoFocusDirective],\n exports: [TuiAutoFocusDirective],\n})\nexport class TuiAutoFocusModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;AAsBA,IAAM,OAAO,GAAG,IAAI,CAAC;AACrB,IAAM,qBAAqB,GAAG,eAAe,CAAC;AAE9C;AACA;;IAQI,+BAIqB,qBAAyD,EACrC,KAAc,EACT,eAAmC,EAE5D,MAAc,EAEd,UAAmC,EAEnC,QAAmB;QARnB,0BAAqB,GAArB,qBAAqB,CAAoC;QACrC,UAAK,GAAL,KAAK,CAAS;QACT,oBAAe,GAAf,eAAe,CAAoB;QAE5D,WAAM,GAAN,MAAM,CAAQ;QAEd,eAAU,GAAV,UAAU,CAAyB;QAEnC,aAAQ,GAAR,QAAQ,CAAW;QAdxC,cAAS,GAAG,IAAI,CAAC;KAeb;IAEJ,+CAAe,GAAf;QAAA,iBAwBC;QAvBG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,OAAO;SACV;QAED,IAAI,IAAI,CA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AAC,SAAS,CAAC,CAAA;OAfb,qBAAqB,CA+FjC;IAAD,4BAAC;CA/FD;;;ICtBA;KAAkC;IAArB,kBAAkB;QAJ9B,QAAQ,CAAC;YACN,YAAY,EAAE,CAAC,qBAAqB,CAAC;YACrC,OAAO,EAAE,CAAC,qBAAqB,CAAC;SACnC,CAAC;OACW,kBAAkB,CAAG;IAAD,yBAAC;CAAlC;;ACRA;;;;;;"}
1
+ {"version":3,"file":"taiga-ui-cdk-directives-auto-focus.js","sources":["ng://@taiga-ui/cdk/directives/auto-focus/handlers/abstract.handler.ts","ng://@taiga-ui/cdk/directives/auto-focus/handlers/default.handler.ts","ng://@taiga-ui/cdk/directives/auto-focus/handlers/ios.handler.ts","ng://@taiga-ui/cdk/directives/auto-focus/autofocus.options.ts","ng://@taiga-ui/cdk/directives/auto-focus/autofocus.directive.ts","ng://@taiga-ui/cdk/directives/auto-focus/autofocus.module.ts","ng://@taiga-ui/cdk/directives/auto-focus/taiga-ui-cdk-directives-auto-focus.ts"],"sourcesContent":["import {Directive, ElementRef} from '@angular/core';\nimport {\n TuiFocusableElementAccessor,\n TuiNativeFocusableElement,\n} from '@taiga-ui/cdk/interfaces';\n\nimport {TuiAutofocusHandler} from '../autofocus.options';\n\n@Directive()\nexport abstract class AbstractTuiAutofocusHandler implements TuiAutofocusHandler {\n protected constructor(\n protected readonly tuiFocusableComponent: TuiFocusableElementAccessor | null,\n protected readonly elementRef: ElementRef<HTMLElement>,\n ) {}\n\n protected get element(): TuiNativeFocusableElement {\n return (\n this.tuiFocusableComponent?.nativeFocusableElement ||\n this.elementRef.nativeElement\n );\n }\n\n protected get isTextFieldElement(): boolean {\n return this.element.matches('input, textarea');\n }\n\n abstract setFocus(): void;\n}\n","import {Directive, ElementRef, Inject, Optional, Self} from '@angular/core';\nimport {ANIMATION_FRAME} from '@ng-web-apis/common';\nimport {POLLING_TIME} from '@taiga-ui/cdk/constants';\nimport {TuiFocusableElementAccessor} from '@taiga-ui/cdk/interfaces';\nimport {TUI_FOCUSABLE_ITEM_ACCESSOR} from '@taiga-ui/cdk/tokens';\nimport {Observable, race, timer} from 'rxjs';\nimport {map, skipWhile, take, throttleTime} from 'rxjs/operators';\n\nimport {AbstractTuiAutofocusHandler} from './abstract.handler';\n\nconst TIMEOUT = 1000;\nconst NG_ANIMATION_SELECTOR = '.ng-animating';\n\n@Directive()\nexport class TuiDefaultAutofocusHandler extends AbstractTuiAutofocusHandler {\n constructor(\n @Optional()\n @Self()\n @Inject(TUI_FOCUSABLE_ITEM_ACCESSOR)\n tuiFocusableComponent: TuiFocusableElementAccessor | null,\n @Inject(ElementRef) elementRef: ElementRef<HTMLElement>,\n @Inject(ANIMATION_FRAME) private readonly animationFrame$: Observable<number>,\n ) {\n super(tuiFocusableComponent, elementRef);\n }\n\n setFocus(): void {\n if (this.isTextFieldElement) {\n race(\n timer(TIMEOUT),\n this.animationFrame$.pipe(\n throttleTime(POLLING_TIME),\n map(() => this.element.closest(NG_ANIMATION_SELECTOR)),\n skipWhile(Boolean),\n take(1),\n ),\n ).subscribe(() => this.element.focus());\n } else {\n this.element.focus();\n }\n }\n}\n","import {\n Directive,\n ElementRef,\n Inject,\n NgZone,\n Optional,\n Renderer2,\n Self,\n} from '@angular/core';\nimport {WINDOW} from '@ng-web-apis/common';\nimport {TuiFocusableElementAccessor} from '@taiga-ui/cdk/interfaces';\nimport {TUI_FOCUSABLE_ITEM_ACCESSOR} from '@taiga-ui/cdk/tokens';\nimport {px} from '@taiga-ui/cdk/utils';\n\nimport {AbstractTuiAutofocusHandler} from './abstract.handler';\n\n// @dynamic\n@Directive()\nexport class TuiIosAutofocusHandler extends AbstractTuiAutofocusHandler {\n constructor(\n @Optional()\n @Self()\n @Inject(TUI_FOCUSABLE_ITEM_ACCESSOR)\n tuiFocusableComponent: TuiFocusableElementAccessor | null,\n @Inject(ElementRef) elementRef: ElementRef<HTMLElement>,\n @Inject(Renderer2) private readonly renderer: Renderer2,\n @Inject(NgZone) private readonly ngZone: NgZone,\n @Inject(WINDOW) private readonly windowRef: Window,\n ) {\n super(tuiFocusableComponent, elementRef);\n this.patchCssStyles();\n }\n\n setFocus(): void {\n if (this.isTextFieldElement) {\n this.ngZone.runOutsideAngular(() => this.iosWebkitAutofocus());\n } else {\n this.element.focus();\n }\n }\n\n private iosWebkitAutofocus(): void {\n const fakeInput: HTMLInputElement = this.makeFakeInput();\n const duration = this.getDurationTimeBeforeFocus();\n let fakeFocusTimeoutId = 0;\n let elementFocusTimeoutId = 0;\n\n const blurHandler = (): void => fakeInput.focus({preventScroll: true});\n const focusHandler = (): void => {\n clearTimeout(fakeFocusTimeoutId);\n\n fakeFocusTimeoutId = this.windowRef.setTimeout(() => {\n clearTimeout(elementFocusTimeoutId);\n\n fakeInput.removeEventListener('blur', blurHandler);\n fakeInput.removeEventListener('focus', focusHandler);\n\n elementFocusTimeoutId = this.windowRef.setTimeout(() => {\n this.element.focus({preventScroll: false});\n fakeInput.remove();\n }, duration);\n });\n };\n\n fakeInput.addEventListener('blur', blurHandler, {once: true});\n fakeInput.addEventListener('focus', focusHandler);\n\n if (this.insideDialog()) {\n this.windowRef.document.body.appendChild(fakeInput);\n } else {\n this.element.parentElement?.appendChild(fakeInput);\n }\n\n fakeInput.focus({preventScroll: true});\n }\n\n /**\n * @note:\n * emulate textfield position in layout with cursor\n * before focus to real textfield element\n */\n private makeFakeInput(): HTMLInputElement {\n const fakeInput: HTMLInputElement = this.renderer.createElement('input');\n const rect: DOMRect = this.element.getBoundingClientRect();\n\n fakeInput.style.height = px(rect.height);\n fakeInput.style.width = px(rect.width / 2);\n fakeInput.style.position = 'fixed';\n fakeInput.style.opacity = '0';\n fakeInput.style.fontSize = px(16); // disable possible auto zoom\n fakeInput.readOnly = true; // prevent keyboard for fake input\n\n // @note: emulate position cursor before focus to real textfield element\n fakeInput.style.top = px(rect.top);\n fakeInput.style.left = px(rect.left);\n\n return fakeInput;\n }\n\n private getDurationTimeBeforeFocus(): number {\n return (\n parseFloat(\n this.windowRef\n .getComputedStyle(this.element)\n .getPropertyValue('--tui-duration'),\n ) || 0\n );\n }\n\n /**\n * @note:\n * unfortunately, in older versions of iOS\n * there is a bug that the fake input cursor\n * will move along with the dialog animation\n * and then that dialog will be shaking\n */\n private insideDialog(): boolean {\n return !!this.element.closest('tui-dialog');\n }\n\n /**\n * @note:\n * This is necessary so that the viewport isn't recalculated\n * and then the dialogs don't shake.\n *\n * Also, we need to fixed height viewport,\n * so that when focusing the dialogs don't shake\n */\n private patchCssStyles(): void {\n const documentRef = this.windowRef.document;\n\n for (const element of [documentRef.documentElement, documentRef.body]) {\n element.style.setProperty('overflow', 'auto');\n element.style.setProperty('height', '100%');\n }\n }\n}\n","import {\n ElementRef,\n inject,\n InjectionToken,\n NgZone,\n Optional,\n Renderer2,\n Self,\n} from '@angular/core';\nimport {ANIMATION_FRAME, WINDOW} from '@ng-web-apis/common';\nimport {TuiFocusableElementAccessor} from '@taiga-ui/cdk/interfaces';\nimport {TUI_FOCUSABLE_ITEM_ACCESSOR, TUI_IS_IOS} from '@taiga-ui/cdk/tokens';\nimport {Observable} from 'rxjs';\n\nimport {TuiDefaultAutofocusHandler} from './handlers/default.handler';\nimport {TuiIosAutofocusHandler} from './handlers/ios.handler';\n\nexport interface TuiAutofocusHandler {\n setFocus(): void;\n}\n\nexport const TUI_AUTOFOCUS_HANDLER = new InjectionToken<TuiAutofocusHandler>(\n 'Autofocusing handler',\n);\n\n// TODO: 3.0 remove in ivy compilation\nexport function tuiAutofocusHandlerFactory(\n tuiFocusableComponent: TuiFocusableElementAccessor | null,\n elementRef: ElementRef<HTMLElement>,\n animationFrame$: Observable<number>,\n renderer: Renderer2,\n ngZone: NgZone,\n windowRef: Window,\n): TuiAutofocusHandler {\n return inject(TUI_IS_IOS)\n ? new TuiIosAutofocusHandler(\n tuiFocusableComponent,\n elementRef,\n renderer,\n ngZone,\n windowRef,\n )\n : new TuiDefaultAutofocusHandler(\n tuiFocusableComponent,\n elementRef,\n animationFrame$,\n );\n}\n\nexport const TUI_AUTOFOCUS_PROVIDERS = [\n {\n provide: TUI_AUTOFOCUS_HANDLER,\n // TODO: replace to useClass in v3.0\n useFactory: tuiAutofocusHandlerFactory,\n deps: [\n [new Optional(), new Self(), TUI_FOCUSABLE_ITEM_ACCESSOR],\n ElementRef,\n ANIMATION_FRAME,\n Renderer2,\n NgZone,\n WINDOW,\n ],\n },\n];\n","import {AfterViewInit, Directive, Inject, Input} from '@angular/core';\n\nimport {\n TUI_AUTOFOCUS_HANDLER,\n TUI_AUTOFOCUS_PROVIDERS,\n TuiAutofocusHandler,\n} from './autofocus.options';\n\n// TODO: 3.0 change input name to tuiAutoFocus and handle empty string\n@Directive({\n selector: '[tuiAutoFocus]',\n providers: TUI_AUTOFOCUS_PROVIDERS,\n})\nexport class TuiAutoFocusDirective implements AfterViewInit {\n @Input()\n autoFocus = true;\n\n constructor(\n @Inject(TUI_AUTOFOCUS_HANDLER) private readonly handler: TuiAutofocusHandler,\n ) {}\n\n ngAfterViewInit(): void {\n if (this.autoFocus) {\n this.handler.setFocus();\n }\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiAutoFocusDirective} from './autofocus.directive';\n\n@NgModule({\n declarations: [TuiAutoFocusDirective],\n exports: [TuiAutoFocusDirective],\n})\nexport class TuiAutoFocusModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;IAUI,qCACuB,qBAAyD,EACzD,UAAmC;QADnC,0BAAqB,GAArB,qBAAqB,CAAoC;QACzD,eAAU,GAAV,UAAU,CAAyB;KACtD;IAEJ,sBAAc,gDAAO;aAArB;;YACI,QACI,OAAA,IAAI,CAAC,qBAAqB,0CAAE,sBAAsB;gBAClD,IAAI,CAAC,UAAU,CAAC,aAAa,EAC/B;SACL;;;OAAA;IAED,sBAAc,2DAAkB;aAAhC;YACI,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;SAClD;;;OAAA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A;OALzB,qBAAqB,CAajC;IAAD,4BAAC;CAbD;;;ICLA;KAAkC;IAArB,kBAAkB;QAJ9B,QAAQ,CAAC;YACN,YAAY,EAAE,CAAC,qBAAqB,CAAC;YACrC,OAAO,EAAE,CAAC,qBAAqB,CAAC;SACnC,CAAC;OACW,kBAAkB,CAAG;IAAD,yBAAC;CAAlC;;ACRA;;;;;;"}
@@ -1,38 +1,53 @@
1
1
  import { __decorate, __param } from 'tslib';
2
- import { ElementRef, Inject, Output, Directive, NgModule } from '@angular/core';
3
- import { typedFromEvent } from '@taiga-ui/cdk/observables';
2
+ import { Component, ViewEncapsulation, EventEmitter, Inject, HostBinding, Output, HostListener, Directive, NgModule } from '@angular/core';
4
3
  import { TuiDirectiveStylesService } from '@taiga-ui/cdk/services';
5
- import { map, skip } from 'rxjs/operators';
6
4
 
7
- var ON = 'tuiAutofillOn';
8
- var OFF = 'tuiAutofillOff';
9
- var STYLE = "\n@keyframes " + ON + " {\n from {\n content: '1';\n }\n\n to {\n content: '2';\n }\n}\n\n@keyframes " + OFF + " {\n from {\n content: '2';\n }\n\n to {\n content: '1';\n }\n}";
10
- // @dynamic
5
+ var TuiAutofilledStyleComponent = /** @class */ (function () {
6
+ function TuiAutofilledStyleComponent() {
7
+ }
8
+ TuiAutofilledStyleComponent = __decorate([
9
+ Component({
10
+ template: '',
11
+ encapsulation: ViewEncapsulation.None,
12
+ styles: [".tui-autofill,.tui-autofill input{transition:box-shadow 10ms}.tui-autofill input::-webkit-credit-card-auto-fill-button,.tui-autofill::-webkit-credit-card-auto-fill-button{pointer-events:none;background-color:transparent!important;-webkit-mask-image:none!important}"]
13
+ })
14
+ ], TuiAutofilledStyleComponent);
15
+ return TuiAutofilledStyleComponent;
16
+ }());
17
+
11
18
  var TuiAutofilledDirective = /** @class */ (function () {
12
- function TuiAutofilledDirective(elementRef, directiveStyles) {
13
- this.elementRef = elementRef;
14
- this.tuiAutofilledChange = typedFromEvent(this.elementRef.nativeElement, 'animationstart').pipe(map(function (_a) {
15
- var animationName = _a.animationName;
16
- return animationName === ON;
17
- }), skip(1));
18
- directiveStyles.addStyle(STYLE, 'TuiAutofilledDirective');
19
+ function TuiAutofilledDirective(directiveStyles) {
20
+ this.autofilled = false;
21
+ this.tuiAutofilledChange = new EventEmitter();
22
+ directiveStyles.addComponent(TuiAutofilledStyleComponent);
19
23
  }
24
+ TuiAutofilledDirective.prototype.transitionStartHandler = function (_a) {
25
+ var propertyName = _a.propertyName, target = _a.target;
26
+ var _b;
27
+ var matchedAutofill = propertyName.includes('box-shadow') && ((_b = target) === null || _b === void 0 ? void 0 : _b.matches('input'));
28
+ if (matchedAutofill) {
29
+ this.autofilled = !this.autofilled;
30
+ this.tuiAutofilledChange.emit(this.autofilled);
31
+ }
32
+ };
20
33
  TuiAutofilledDirective.ctorParameters = function () { return [
21
- { type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] },
22
34
  { type: TuiDirectiveStylesService, decorators: [{ type: Inject, args: [TuiDirectiveStylesService,] }] }
23
35
  ]; };
36
+ __decorate([
37
+ HostBinding('class._autofilled')
38
+ ], TuiAutofilledDirective.prototype, "autofilled", void 0);
24
39
  __decorate([
25
40
  Output()
26
41
  ], TuiAutofilledDirective.prototype, "tuiAutofilledChange", void 0);
42
+ __decorate([
43
+ HostListener('transitionstart', ['$event'])
44
+ ], TuiAutofilledDirective.prototype, "transitionStartHandler", null);
27
45
  TuiAutofilledDirective = __decorate([
28
46
  Directive({
29
47
  selector: '[tuiAutofilledChange]',
30
- host: {
31
- class: 'tui-autofill',
32
- },
48
+ host: { class: 'tui-autofill' },
33
49
  }),
34
- __param(0, Inject(ElementRef)),
35
- __param(1, Inject(TuiDirectiveStylesService))
50
+ __param(0, Inject(TuiDirectiveStylesService))
36
51
  ], TuiAutofilledDirective);
37
52
  return TuiAutofilledDirective;
38
53
  }());
@@ -42,8 +57,9 @@ var TuiAutofilledModule = /** @class */ (function () {
42
57
  }
43
58
  TuiAutofilledModule = __decorate([
44
59
  NgModule({
45
- declarations: [TuiAutofilledDirective],
46
60
  exports: [TuiAutofilledDirective],
61
+ entryComponents: [TuiAutofilledStyleComponent],
62
+ declarations: [TuiAutofilledDirective, TuiAutofilledStyleComponent],
47
63
  })
48
64
  ], TuiAutofilledModule);
49
65
  return TuiAutofilledModule;
@@ -53,5 +69,5 @@ var TuiAutofilledModule = /** @class */ (function () {
53
69
  * Generated bundle index. Do not edit.
54
70
  */
55
71
 
56
- export { TuiAutofilledDirective, TuiAutofilledModule };
72
+ export { TuiAutofilledDirective, TuiAutofilledModule, TuiAutofilledStyleComponent };
57
73
  //# sourceMappingURL=taiga-ui-cdk-directives-autofilled.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-cdk-directives-autofilled.js","sources":["ng://@taiga-ui/cdk/directives/autofilled/autofilled.directive.ts","ng://@taiga-ui/cdk/directives/autofilled/autofilled.module.ts","ng://@taiga-ui/cdk/directives/autofilled/taiga-ui-cdk-directives-autofilled.ts"],"sourcesContent":["import {Directive, ElementRef, Inject, Output} from '@angular/core';\nimport {typedFromEvent} from '@taiga-ui/cdk/observables';\nimport {TuiDirectiveStylesService} from '@taiga-ui/cdk/services';\nimport {map, skip} from 'rxjs/operators';\n\nconst ON = 'tuiAutofillOn';\nconst OFF = 'tuiAutofillOff';\nconst STYLE = `\n@keyframes ${ON} {\n from {\n content: '1';\n }\n\n to {\n content: '2';\n }\n}\n\n@keyframes ${OFF} {\n from {\n content: '2';\n }\n\n to {\n content: '1';\n }\n}`;\n\n// @dynamic\n@Directive({\n selector: '[tuiAutofilledChange]',\n host: {\n class: 'tui-autofill',\n },\n})\nexport class TuiAutofilledDirective {\n @Output()\n readonly tuiAutofilledChange = typedFromEvent(\n this.elementRef.nativeElement,\n 'animationstart',\n ).pipe(\n map(({animationName}) => animationName === ON),\n skip(1),\n );\n\n constructor(\n @Inject(ElementRef) private readonly elementRef: ElementRef<HTMLInputElement>,\n @Inject(TuiDirectiveStylesService)\n directiveStyles: TuiDirectiveStylesService,\n ) {\n directiveStyles.addStyle(STYLE, 'TuiAutofilledDirective');\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiAutofilledDirective} from './autofilled.directive';\n\n@NgModule({\n declarations: [TuiAutofilledDirective],\n exports: [TuiAutofilledDirective],\n})\nexport class TuiAutofilledModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAKA,IAAM,EAAE,GAAG,eAAe,CAAC;AAC3B,IAAM,GAAG,GAAG,gBAAgB,CAAC;AAC7B,IAAM,KAAK,GAAG,kBACD,EAAE,gHAUF,GAAG,8FAQd,CAAC;AAEH;;IAiBI,gCACyC,UAAwC,EAE7E,eAA0C;QAFL,eAAU,GAAV,UAAU,CAA8B;QATxE,wBAAmB,GAAG,cAAc,CACzC,IAAI,CAAC,UAAU,CAAC,aAAa,EAC7B,gBAAgB,CACnB,CAAC,IAAI,CACF,GAAG,CAAC,UAAC,EAAe;gBAAd,gCAAa;YAAM,OAAA,aAAa,KAAK,EAAE;SAAA,CAAC,EAC9C,IAAI,CAAC,CAAC,CAAC,CACV,CAAC;QAOE,eAAe,CAAC,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAC,CAAC;KAC7D;;gBALoD,UAAU,uBAA1D,MAAM,SAAC,UAAU;gBAED,yBAAyB,uBADzC,MAAM,SAAC,yBAAyB;;IAVrC;QADC,MAAM,EAAE;uEAOP;IARO,sBAAsB;QANlC,SAAS,CAAC;YACP,QAAQ,EAAE,uBAAuB;YACjC,IAAI,EAAE;gBACF,KAAK,EAAE,cAAc;aACxB;SACJ,CAAC;QAYO,WAAA,MAAM,CAAC,UAAU,CAAC,CAAA;QAClB,WAAA,MAAM,CAAC,yBAAyB,CAAC,CAAA;OAZ7B,sBAAsB,CAiBlC;IAAD,6BAAC;CAjBD;;;IC3BA;KAAmC;IAAtB,mBAAmB;QAJ/B,QAAQ,CAAC;YACN,YAAY,EAAE,CAAC,sBAAsB,CAAC;YACtC,OAAO,EAAE,CAAC,sBAAsB,CAAC;SACpC,CAAC;OACW,mBAAmB,CAAG;IAAD,0BAAC;CAAnC;;ACRA;;;;;;"}
1
+ {"version":3,"file":"taiga-ui-cdk-directives-autofilled.js","sources":["ng://@taiga-ui/cdk/directives/autofilled/autofilled-style.component.ts","ng://@taiga-ui/cdk/directives/autofilled/autofilled.directive.ts","ng://@taiga-ui/cdk/directives/autofilled/autofilled.module.ts","ng://@taiga-ui/cdk/directives/autofilled/taiga-ui-cdk-directives-autofilled.ts"],"sourcesContent":["import {Component, ViewEncapsulation} from '@angular/core';\n\n@Component({\n template: '',\n styleUrls: ['./autofilled.style.less'],\n encapsulation: ViewEncapsulation.None,\n})\nexport class TuiAutofilledStyleComponent {}\n","import {\n Directive,\n EventEmitter,\n HostBinding,\n HostListener,\n Inject,\n Output,\n} from '@angular/core';\nimport {TuiDirectiveStylesService} from '@taiga-ui/cdk/services';\n\nimport {TuiAutofilledStyleComponent} from './autofilled-style.component';\n\n@Directive({\n selector: '[tuiAutofilledChange]',\n host: {class: 'tui-autofill'},\n})\nexport class TuiAutofilledDirective {\n @HostBinding('class._autofilled')\n autofilled = false;\n\n @Output()\n readonly tuiAutofilledChange = new EventEmitter<boolean>();\n\n constructor(\n @Inject(TuiDirectiveStylesService) directiveStyles: TuiDirectiveStylesService,\n ) {\n directiveStyles.addComponent(TuiAutofilledStyleComponent);\n }\n\n @HostListener('transitionstart', ['$event'])\n transitionStartHandler({propertyName, target}: TransitionEvent): void {\n const matchedAutofill =\n propertyName.includes('box-shadow') && (target as Element)?.matches('input');\n\n if (matchedAutofill) {\n this.autofilled = !this.autofilled;\n this.tuiAutofilledChange.emit(this.autofilled);\n }\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiAutofilledDirective} from './autofilled.directive';\nimport {TuiAutofilledStyleComponent} from './autofilled-style.component';\n\n@NgModule({\n exports: [TuiAutofilledDirective],\n entryComponents: [TuiAutofilledStyleComponent],\n declarations: [TuiAutofilledDirective, TuiAutofilledStyleComponent],\n})\nexport class TuiAutofilledModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;IAOA;KAA2C;IAA9B,2BAA2B;QALvC,SAAS,CAAC;YACP,QAAQ,EAAE,EAAE;YAEZ,aAAa,EAAE,iBAAiB,CAAC,IAAI;;SACxC,CAAC;OACW,2BAA2B,CAAG;IAAD,kCAAC;CAA3C;;;ICgBI,gCACuC,eAA0C;QANjF,eAAU,GAAG,KAAK,CAAC;QAGV,wBAAmB,GAAG,IAAI,YAAY,EAAW,CAAC;QAKvD,eAAe,CAAC,YAAY,CAAC,2BAA2B,CAAC,CAAC;KAC7D;IAGD,uDAAsB,GAAtB,UAAuB,EAAuC;YAAtC,8BAAY,EAAE,kBAAM;;QACxC,IAAM,eAAe,GACjB,YAAY,CAAC,QAAQ,CAAC,YAAY,CAAC,WAAK,MAAkB,0CAAE,OAAO,CAAC,OAAO,EAAC,CAAC;QAEjF,IAAI,eAAe,EAAE;YACjB,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC;YACnC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SAClD;KACJ;;gBAduD,yBAAyB,uBAA5E,MAAM,SAAC,yBAAyB;;IANrC;QADC,WAAW,CAAC,mBAAmB,CAAC;8DACd;IAGnB;QADC,MAAM,EAAE;uEACkD;IAS3D;QADC,YAAY,CAAC,iBAAiB,EAAE,CAAC,QAAQ,CAAC,CAAC;wEAS3C;IAtBQ,sBAAsB;QAJlC,SAAS,CAAC;YACP,QAAQ,EAAE,uBAAuB;YACjC,IAAI,EAAE,EAAC,KAAK,EAAE,cAAc,EAAC;SAChC,CAAC;QASO,WAAA,MAAM,CAAC,yBAAyB,CAAC,CAAA;OAR7B,sBAAsB,CAuBlC;IAAD,6BAAC;CAvBD;;;ICNA;KAAmC;IAAtB,mBAAmB;QAL/B,QAAQ,CAAC;YACN,OAAO,EAAE,CAAC,sBAAsB,CAAC;YACjC,eAAe,EAAE,CAAC,2BAA2B,CAAC;YAC9C,YAAY,EAAE,CAAC,sBAAsB,EAAE,2BAA2B,CAAC;SACtE,CAAC;OACW,mBAAmB,CAAG;IAAD,0BAAC;CAAnC;;ACVA;;;;;;"}
@@ -0,0 +1,73 @@
1
+ import { __decorate, __param } from 'tslib';
2
+ import { ViewContainerRef, Inject, TemplateRef, Input, Directive, NgModule } from '@angular/core';
3
+ import { Subject, from, of } from 'rxjs';
4
+ import { concatMap, delay, takeUntil } from 'rxjs/operators';
5
+
6
+ var TuiForAsyncDirective = /** @class */ (function () {
7
+ function TuiForAsyncDirective(view, template) {
8
+ this.view = view;
9
+ this.template = template;
10
+ this.destroy$ = new Subject();
11
+ this.tuiForAsyncTimeout = 10;
12
+ }
13
+ TuiForAsyncDirective.prototype.ngOnChanges = function () {
14
+ this.clearViewForOldNodes();
15
+ this.createAsyncViewForNewNodes();
16
+ };
17
+ TuiForAsyncDirective.prototype.ngOnDestroy = function () {
18
+ this.clearViewForOldNodes();
19
+ this.destroy$.complete();
20
+ };
21
+ TuiForAsyncDirective.prototype.createAsyncViewForNewNodes = function () {
22
+ var _this = this;
23
+ from(this.tuiForAsyncOf || [])
24
+ .pipe(concatMap(function (item) { return of(item).pipe(delay(_this.tuiForAsyncTimeout)); }), takeUntil(this.destroy$))
25
+ .subscribe(function (item) {
26
+ return _this.view
27
+ .createEmbeddedView(_this.template, { $implicit: item })
28
+ .detectChanges();
29
+ });
30
+ };
31
+ TuiForAsyncDirective.prototype.clearViewForOldNodes = function () {
32
+ this.destroy$.next();
33
+ this.view.clear();
34
+ };
35
+ TuiForAsyncDirective.ctorParameters = function () { return [
36
+ { type: ViewContainerRef, decorators: [{ type: Inject, args: [ViewContainerRef,] }] },
37
+ { type: TemplateRef, decorators: [{ type: Inject, args: [TemplateRef,] }] }
38
+ ]; };
39
+ __decorate([
40
+ Input()
41
+ ], TuiForAsyncDirective.prototype, "tuiForAsyncOf", void 0);
42
+ __decorate([
43
+ Input()
44
+ ], TuiForAsyncDirective.prototype, "tuiForAsyncTimeout", void 0);
45
+ TuiForAsyncDirective = __decorate([
46
+ Directive({ selector: '[tuiForAsync][tuiForAsyncOf]' }),
47
+ __param(0, Inject(ViewContainerRef)),
48
+ __param(1, Inject(TemplateRef))
49
+ ], TuiForAsyncDirective);
50
+ return TuiForAsyncDirective;
51
+ }());
52
+
53
+ /**
54
+ * @experimental
55
+ */
56
+ var TuiForAsyncModule = /** @class */ (function () {
57
+ function TuiForAsyncModule() {
58
+ }
59
+ TuiForAsyncModule = __decorate([
60
+ NgModule({
61
+ declarations: [TuiForAsyncDirective],
62
+ exports: [TuiForAsyncDirective],
63
+ })
64
+ ], TuiForAsyncModule);
65
+ return TuiForAsyncModule;
66
+ }());
67
+
68
+ /**
69
+ * Generated bundle index. Do not edit.
70
+ */
71
+
72
+ export { TuiForAsyncDirective, TuiForAsyncModule };
73
+ //# sourceMappingURL=taiga-ui-cdk-directives-for-async.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taiga-ui-cdk-directives-for-async.js","sources":["ng://@taiga-ui/cdk/directives/for-async/for-async.directive.ts","ng://@taiga-ui/cdk/directives/for-async/for-async.module.ts","ng://@taiga-ui/cdk/directives/for-async/taiga-ui-cdk-directives-for-async.ts"],"sourcesContent":["import {\n Directive,\n Inject,\n Input,\n OnChanges,\n OnDestroy,\n TemplateRef,\n ViewContainerRef,\n} from '@angular/core';\nimport {from, of, Subject} from 'rxjs';\nimport {concatMap, delay, takeUntil} from 'rxjs/operators';\n\n@Directive({selector: '[tuiForAsync][tuiForAsyncOf]'})\nexport class TuiForAsyncDirective<T> implements OnChanges, OnDestroy {\n private readonly destroy$ = new Subject<void>();\n\n @Input()\n tuiForAsyncOf: readonly T[] | undefined | null;\n\n @Input()\n tuiForAsyncTimeout = 10;\n\n constructor(\n @Inject(ViewContainerRef) private readonly view: ViewContainerRef,\n @Inject(TemplateRef) private readonly template: TemplateRef<unknown>,\n ) {}\n\n ngOnChanges(): void {\n this.clearViewForOldNodes();\n this.createAsyncViewForNewNodes();\n }\n\n ngOnDestroy(): void {\n this.clearViewForOldNodes();\n this.destroy$.complete();\n }\n\n private createAsyncViewForNewNodes(): void {\n from(this.tuiForAsyncOf || [])\n .pipe(\n concatMap(item => of(item).pipe(delay(this.tuiForAsyncTimeout))),\n takeUntil(this.destroy$),\n )\n .subscribe(item =>\n this.view\n .createEmbeddedView(this.template, {$implicit: item})\n .detectChanges(),\n );\n }\n\n private clearViewForOldNodes(): void {\n this.destroy$.next();\n this.view.clear();\n }\n}\n","import {NgModule} from '@angular/core';\n\nimport {TuiForAsyncDirective} from './for-async.directive';\n\n/**\n * @experimental\n */\n@NgModule({\n declarations: [TuiForAsyncDirective],\n exports: [TuiForAsyncDirective],\n})\nexport class TuiForAsyncModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;IAsBI,8BAC+C,IAAsB,EAC3B,QAA8B;QADzB,SAAI,GAAJ,IAAI,CAAkB;QAC3B,aAAQ,GAAR,QAAQ,CAAsB;QAVvD,aAAQ,GAAG,IAAI,OAAO,EAAQ,CAAC;QAMhD,uBAAkB,GAAG,EAAE,CAAC;KAKpB;IAEJ,0CAAW,GAAX;QACI,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,IAAI,CAAC,0BAA0B,EAAE,CAAC;KACrC;IAED,0CAAW,GAAX;QACI,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAC5B,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;KAC5B;IAEO,yDAA0B,GAAlC;QAAA,iBAWC;QAVG,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,EAAE,CAAC;aACzB,IAAI,CACD,SAAS,CAAC,UAAA,IAAI,IAAI,OAAA,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAI,CAAC,kBAAkB,CAAC,CAAC,GAAA,CAAC,EAChE,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAC3B;aACA,SAAS,CAAC,UAAA,IAAI;YACX,OAAA,KAAI,CAAC,IAAI;iBACJ,kBAAkB,CAAC,KAAI,CAAC,QAAQ,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC;iBACpD,aAAa,EAAE;SAAA,CACvB,CAAC;KACT;IAEO,mDAAoB,GAA5B;QACI,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;KACrB;;gBA9BoD,gBAAgB,uBAAhE,MAAM,SAAC,gBAAgB;gBACwB,WAAW,uBAA1D,MAAM,SAAC,WAAW;;IAPvB;QADC,KAAK,EAAE;+DACuC;IAG/C;QADC,KAAK,EAAE;oEACgB;IAPf,oBAAoB;QADhC,SAAS,CAAC,EAAC,QAAQ,EAAE,8BAA8B,EAAC,CAAC;QAW7C,WAAA,MAAM,CAAC,gBAAgB,CAAC,CAAA;QACxB,WAAA,MAAM,CAAC,WAAW,CAAC,CAAA;OAXf,oBAAoB,CAyChC;IAAD,2BAAC;CAzCD;;ACTA;;;;IAOA;KAAiC;IAApB,iBAAiB;QAJ7B,QAAQ,CAAC;YACN,YAAY,EAAE,CAAC,oBAAoB,CAAC;YACpC,OAAO,EAAE,CAAC,oBAAoB,CAAC;SAClC,CAAC;OACW,iBAAiB,CAAG;IAAD,wBAAC;CAAjC;;ACXA;;;;;;"}
@@ -3,7 +3,7 @@ import { Directive, NgModule } from '@angular/core';
3
3
 
4
4
  /**
5
5
  * Blank directive to query for {@link TemplateRef}
6
- * TODO: Migrate everything to this directive
6
+ * TODO: 3.0 Migrate everything to this directive
7
7
  */
8
8
  var TuiItemDirective = /** @class */ (function () {
9
9
  function TuiItemDirective() {
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-cdk-directives-item.js","sources":["ng://@taiga-ui/cdk/directives/item/item.directive.ts","ng://@taiga-ui/cdk/directives/item/item.module.ts","ng://@taiga-ui/cdk/directives/item/taiga-ui-cdk-directives-item.ts"],"sourcesContent":["import {Directive} from '@angular/core';\n\n/**\n * Blank directive to query for {@link TemplateRef}\n * TODO: Migrate everything to this directive\n */\n@Directive({\n selector: 'ng-template[tuiItem]',\n})\nexport class TuiItemDirective {}\n","import {NgModule} from '@angular/core';\n\nimport {TuiItemDirective} from './item.directive';\n\n@NgModule({\n declarations: [TuiItemDirective],\n exports: [TuiItemDirective],\n})\nexport class TuiItemModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;;;;;IAOA;KAAgC;IAAnB,gBAAgB;QAH5B,SAAS,CAAC;YACP,QAAQ,EAAE,sBAAsB;SACnC,CAAC;OACW,gBAAgB,CAAG;IAAD,uBAAC;CAAhC;;;ICDA;KAA6B;IAAhB,aAAa;QAJzB,QAAQ,CAAC;YACN,YAAY,EAAE,CAAC,gBAAgB,CAAC;YAChC,OAAO,EAAE,CAAC,gBAAgB,CAAC;SAC9B,CAAC;OACW,aAAa,CAAG;IAAD,oBAAC;CAA7B;;ACRA;;;;;;"}
1
+ {"version":3,"file":"taiga-ui-cdk-directives-item.js","sources":["ng://@taiga-ui/cdk/directives/item/item.directive.ts","ng://@taiga-ui/cdk/directives/item/item.module.ts","ng://@taiga-ui/cdk/directives/item/taiga-ui-cdk-directives-item.ts"],"sourcesContent":["import {Directive} from '@angular/core';\n\n/**\n * Blank directive to query for {@link TemplateRef}\n * TODO: 3.0 Migrate everything to this directive\n */\n@Directive({\n selector: 'ng-template[tuiItem]',\n})\nexport class TuiItemDirective {}\n","import {NgModule} from '@angular/core';\n\nimport {TuiItemDirective} from './item.directive';\n\n@NgModule({\n declarations: [TuiItemDirective],\n exports: [TuiItemDirective],\n})\nexport class TuiItemModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAEA;;;;;IAOA;KAAgC;IAAnB,gBAAgB;QAH5B,SAAS,CAAC;YACP,QAAQ,EAAE,sBAAsB;SACnC,CAAC;OACW,gBAAgB,CAAG;IAAD,uBAAC;CAAhC;;;ICDA;KAA6B;IAAhB,aAAa;QAJzB,QAAQ,CAAC;YACN,YAAY,EAAE,CAAC,gBAAgB,CAAC;YAChC,OAAO,EAAE,CAAC,gBAAgB,CAAC;SAC9B,CAAC;OACW,aAAa,CAAG;IAAD,oBAAC;CAA7B;;ACRA;;;;;;"}
@@ -10,6 +10,7 @@ export * from '@taiga-ui/cdk/directives/focus-visible';
10
10
  export * from '@taiga-ui/cdk/directives/focusable';
11
11
  export * from '@taiga-ui/cdk/directives/focused';
12
12
  export * from '@taiga-ui/cdk/directives/for';
13
+ export * from '@taiga-ui/cdk/directives/for-async';
13
14
  export * from '@taiga-ui/cdk/directives/high-dpi';
14
15
  export * from '@taiga-ui/cdk/directives/hovered';
15
16
  export * from '@taiga-ui/cdk/directives/input-mode';
@@ -1 +1 @@
1
- {"version":3,"file":"taiga-ui-cdk-directives.js","sources":["ng://@taiga-ui/cdk/directives/taiga-ui-cdk-directives.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;"}
1
+ {"version":3,"file":"taiga-ui-cdk-directives.js","sources":["ng://@taiga-ui/cdk/directives/taiga-ui-cdk-directives.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;"}