ngwr 15.8.0 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) hide show
  1. package/animations/aurora/styles/_index.scss +1 -1
  2. package/animations/blur-reveal/styles/_index.scss +1 -1
  3. package/animations/decode/styles/_index.scss +1 -1
  4. package/animations/dot-grid/styles/_index.scss +1 -1
  5. package/animations/flow-lines/styles/_index.scss +1 -1
  6. package/animations/fluid-cursor/styles/_index.scss +1 -1
  7. package/animations/{core → internal}/styles/_mixins.scss +1 -1
  8. package/animations/reveal/styles/_index.scss +1 -1
  9. package/animations/ripple-grid/styles/_index.scss +1 -1
  10. package/animations/rotate-reveal/styles/_index.scss +1 -1
  11. package/animations/thread-lines/styles/_index.scss +1 -1
  12. package/animations/typewriter/styles/_index.scss +1 -1
  13. package/copy-value/styles/_index.scss +104 -0
  14. package/date-picker/styles/_index.scss +117 -0
  15. package/fesm2022/{ngwr-animations-core.mjs → internal-BaQU4t_0.mjs} +6 -49
  16. package/fesm2022/internal-BaQU4t_0.mjs.map +1 -0
  17. package/fesm2022/ngwr-alert.mjs +2 -2
  18. package/fesm2022/ngwr-alert.mjs.map +1 -1
  19. package/fesm2022/ngwr-animations-aurora.mjs +21 -21
  20. package/fesm2022/ngwr-animations-aurora.mjs.map +1 -1
  21. package/fesm2022/ngwr-animations-blur-reveal.mjs +3 -3
  22. package/fesm2022/ngwr-animations-blur-reveal.mjs.map +1 -1
  23. package/fesm2022/ngwr-animations-click-sparks.mjs +2 -2
  24. package/fesm2022/ngwr-animations-click-sparks.mjs.map +1 -1
  25. package/fesm2022/ngwr-animations-confetti.mjs +5 -5
  26. package/fesm2022/ngwr-animations-confetti.mjs.map +1 -1
  27. package/fesm2022/ngwr-animations-decode.mjs +4 -4
  28. package/fesm2022/ngwr-animations-decode.mjs.map +1 -1
  29. package/fesm2022/ngwr-animations-destruct.mjs +5 -5
  30. package/fesm2022/ngwr-animations-destruct.mjs.map +1 -1
  31. package/fesm2022/ngwr-animations-dot-grid.mjs +7 -7
  32. package/fesm2022/ngwr-animations-dot-grid.mjs.map +1 -1
  33. package/fesm2022/ngwr-animations-falling-letters.mjs +3 -3
  34. package/fesm2022/ngwr-animations-falling-letters.mjs.map +1 -1
  35. package/fesm2022/ngwr-animations-flow-lines.mjs +17 -17
  36. package/fesm2022/ngwr-animations-flow-lines.mjs.map +1 -1
  37. package/fesm2022/ngwr-animations-fluid-cursor.mjs +12 -12
  38. package/fesm2022/ngwr-animations-fluid-cursor.mjs.map +1 -1
  39. package/fesm2022/ngwr-animations-glitch.mjs +2 -2
  40. package/fesm2022/ngwr-animations-glitch.mjs.map +1 -1
  41. package/fesm2022/ngwr-animations-marquee.mjs +2 -2
  42. package/fesm2022/ngwr-animations-marquee.mjs.map +1 -1
  43. package/fesm2022/ngwr-animations-orbit.mjs +7 -7
  44. package/fesm2022/ngwr-animations-orbit.mjs.map +1 -1
  45. package/fesm2022/ngwr-animations-reveal.mjs +4 -4
  46. package/fesm2022/ngwr-animations-reveal.mjs.map +1 -1
  47. package/fesm2022/ngwr-animations-ripple-grid.mjs +5 -5
  48. package/fesm2022/ngwr-animations-ripple-grid.mjs.map +1 -1
  49. package/fesm2022/ngwr-animations-rotate-reveal.mjs +4 -4
  50. package/fesm2022/ngwr-animations-rotate-reveal.mjs.map +1 -1
  51. package/fesm2022/ngwr-animations-shimmer.mjs +2 -2
  52. package/fesm2022/ngwr-animations-shimmer.mjs.map +1 -1
  53. package/fesm2022/ngwr-animations-spotlight.mjs +1 -1
  54. package/fesm2022/ngwr-animations-spotlight.mjs.map +1 -1
  55. package/fesm2022/ngwr-animations-thread-lines.mjs +16 -16
  56. package/fesm2022/ngwr-animations-thread-lines.mjs.map +1 -1
  57. package/fesm2022/ngwr-animations-tilt.mjs +3 -3
  58. package/fesm2022/ngwr-animations-tilt.mjs.map +1 -1
  59. package/fesm2022/ngwr-animations-typewriter.mjs +4 -4
  60. package/fesm2022/ngwr-animations-typewriter.mjs.map +1 -1
  61. package/fesm2022/ngwr-avatar.mjs +3 -3
  62. package/fesm2022/ngwr-avatar.mjs.map +1 -1
  63. package/fesm2022/ngwr-badge.mjs.map +1 -1
  64. package/fesm2022/ngwr-cascader.mjs +43 -20
  65. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  66. package/fesm2022/ngwr-charts-bar-chart.mjs +13 -13
  67. package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
  68. package/fesm2022/ngwr-charts-boxplot-chart.mjs +9 -9
  69. package/fesm2022/ngwr-charts-boxplot-chart.mjs.map +1 -1
  70. package/fesm2022/ngwr-charts-bullet-chart.mjs +8 -8
  71. package/fesm2022/ngwr-charts-bullet-chart.mjs.map +1 -1
  72. package/fesm2022/ngwr-charts-candlestick-chart.mjs +11 -11
  73. package/fesm2022/ngwr-charts-candlestick-chart.mjs.map +1 -1
  74. package/fesm2022/ngwr-charts-chart-legend.mjs +2 -2
  75. package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
  76. package/fesm2022/ngwr-charts-core.mjs +20 -20
  77. package/fesm2022/ngwr-charts-core.mjs.map +1 -1
  78. package/fesm2022/ngwr-charts-donut-chart.mjs +2 -2
  79. package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
  80. package/fesm2022/ngwr-charts-funnel-chart.mjs +6 -6
  81. package/fesm2022/ngwr-charts-funnel-chart.mjs.map +1 -1
  82. package/fesm2022/ngwr-charts-gauge.mjs +3 -3
  83. package/fesm2022/ngwr-charts-gauge.mjs.map +1 -1
  84. package/fesm2022/ngwr-charts-heatmap-chart.mjs +3 -3
  85. package/fesm2022/ngwr-charts-heatmap-chart.mjs.map +1 -1
  86. package/fesm2022/ngwr-charts-line-chart.mjs +10 -10
  87. package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
  88. package/fesm2022/ngwr-charts-meter-group.mjs +2 -2
  89. package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
  90. package/fesm2022/ngwr-charts-radar-chart.mjs +11 -11
  91. package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
  92. package/fesm2022/ngwr-charts-scatter-chart.mjs +10 -10
  93. package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
  94. package/fesm2022/ngwr-charts-treemap-chart.mjs +4 -4
  95. package/fesm2022/ngwr-charts-treemap-chart.mjs.map +1 -1
  96. package/fesm2022/ngwr-charts-waterfall-chart.mjs +7 -7
  97. package/fesm2022/ngwr-charts-waterfall-chart.mjs.map +1 -1
  98. package/fesm2022/ngwr-checkbox.mjs +2 -2
  99. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  100. package/fesm2022/ngwr-collapse.mjs +2 -2
  101. package/fesm2022/ngwr-collapse.mjs.map +1 -1
  102. package/fesm2022/ngwr-color-picker.mjs +52 -52
  103. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  104. package/fesm2022/ngwr-command-palette.mjs +4 -4
  105. package/fesm2022/ngwr-command-palette.mjs.map +1 -1
  106. package/fesm2022/ngwr-comment.mjs +2 -2
  107. package/fesm2022/ngwr-comment.mjs.map +1 -1
  108. package/fesm2022/ngwr-compare.mjs +6 -6
  109. package/fesm2022/ngwr-compare.mjs.map +1 -1
  110. package/fesm2022/ngwr-context-menu.mjs +4 -4
  111. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  112. package/fesm2022/ngwr-copy-value-testing.mjs +58 -0
  113. package/fesm2022/ngwr-copy-value-testing.mjs.map +1 -0
  114. package/fesm2022/ngwr-copy-value.mjs +196 -0
  115. package/fesm2022/ngwr-copy-value.mjs.map +1 -0
  116. package/fesm2022/ngwr-counter.mjs +3 -3
  117. package/fesm2022/ngwr-counter.mjs.map +1 -1
  118. package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
  119. package/fesm2022/ngwr-date-picker.mjs +217 -40
  120. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  121. package/fesm2022/ngwr-date.mjs +27 -5
  122. package/fesm2022/ngwr-date.mjs.map +1 -1
  123. package/fesm2022/ngwr-dialog.mjs +32 -3
  124. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  125. package/fesm2022/ngwr-directives.mjs +116 -1
  126. package/fesm2022/ngwr-directives.mjs.map +1 -1
  127. package/fesm2022/ngwr-drawer.mjs +3 -3
  128. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  129. package/fesm2022/ngwr-dropdown.mjs +13 -12
  130. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  131. package/fesm2022/ngwr-editor.mjs +28 -28
  132. package/fesm2022/ngwr-editor.mjs.map +1 -1
  133. package/fesm2022/ngwr-event-calendar.mjs +5 -5
  134. package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
  135. package/fesm2022/ngwr-file-upload.mjs +8 -8
  136. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  137. package/fesm2022/ngwr-graph.mjs +3 -3
  138. package/fesm2022/ngwr-graph.mjs.map +1 -1
  139. package/fesm2022/ngwr-hotkey.mjs +22 -22
  140. package/fesm2022/ngwr-hotkey.mjs.map +1 -1
  141. package/fesm2022/ngwr-i18n-ar.mjs +5 -0
  142. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  143. package/fesm2022/ngwr-i18n-cs.mjs +5 -0
  144. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  145. package/fesm2022/ngwr-i18n-de.mjs +5 -0
  146. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  147. package/fesm2022/ngwr-i18n-en.mjs +5 -0
  148. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  149. package/fesm2022/ngwr-i18n-es.mjs +5 -0
  150. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  151. package/fesm2022/ngwr-i18n-fr.mjs +5 -0
  152. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  153. package/fesm2022/ngwr-i18n-he.mjs +5 -0
  154. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  155. package/fesm2022/ngwr-i18n-hi.mjs +5 -0
  156. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  157. package/fesm2022/ngwr-i18n-id.mjs +5 -0
  158. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  159. package/fesm2022/ngwr-i18n-it.mjs +5 -0
  160. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  161. package/fesm2022/ngwr-i18n-ja.mjs +5 -0
  162. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  163. package/fesm2022/ngwr-i18n-ko.mjs +5 -0
  164. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  165. package/fesm2022/ngwr-i18n-nl.mjs +5 -0
  166. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  167. package/fesm2022/ngwr-i18n-pl.mjs +5 -0
  168. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  169. package/fesm2022/ngwr-i18n-pt.mjs +5 -0
  170. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  171. package/fesm2022/ngwr-i18n-ru.mjs +5 -0
  172. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  173. package/fesm2022/ngwr-i18n-sv.mjs +5 -0
  174. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  175. package/fesm2022/ngwr-i18n-tr.mjs +5 -0
  176. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  177. package/fesm2022/ngwr-i18n-uk.mjs +5 -0
  178. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  179. package/fesm2022/ngwr-i18n-vi.mjs +5 -0
  180. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  181. package/fesm2022/ngwr-i18n-zh-tw.mjs +5 -0
  182. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  183. package/fesm2022/ngwr-i18n-zh.mjs +5 -0
  184. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  185. package/fesm2022/ngwr-i18n.mjs +2 -2
  186. package/fesm2022/ngwr-i18n.mjs.map +1 -1
  187. package/fesm2022/ngwr-icon.mjs +5 -5
  188. package/fesm2022/ngwr-icon.mjs.map +1 -1
  189. package/fesm2022/ngwr-image-cropper.mjs +11 -11
  190. package/fesm2022/ngwr-image-cropper.mjs.map +1 -1
  191. package/fesm2022/ngwr-input-number.mjs +4 -4
  192. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  193. package/fesm2022/ngwr-input-otp.mjs +2 -2
  194. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  195. package/fesm2022/ngwr-input.mjs +15 -15
  196. package/fesm2022/ngwr-input.mjs.map +1 -1
  197. package/fesm2022/ngwr-keyboard.mjs +28 -28
  198. package/fesm2022/ngwr-keyboard.mjs.map +1 -1
  199. package/fesm2022/ngwr-knob.mjs +4 -4
  200. package/fesm2022/ngwr-knob.mjs.map +1 -1
  201. package/fesm2022/ngwr-lightbox.mjs +2 -2
  202. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  203. package/fesm2022/ngwr-load-state.mjs +2 -2
  204. package/fesm2022/ngwr-load-state.mjs.map +1 -1
  205. package/fesm2022/ngwr-mention.mjs +6 -6
  206. package/fesm2022/ngwr-mention.mjs.map +1 -1
  207. package/fesm2022/ngwr-meta.mjs +19 -3
  208. package/fesm2022/ngwr-meta.mjs.map +1 -1
  209. package/fesm2022/ngwr-overlay.mjs +3 -3
  210. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  211. package/fesm2022/ngwr-pagination.mjs +7 -5
  212. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  213. package/fesm2022/ngwr-pipes.mjs +3 -5
  214. package/fesm2022/ngwr-pipes.mjs.map +1 -1
  215. package/fesm2022/ngwr-platform.mjs +4 -1
  216. package/fesm2022/ngwr-platform.mjs.map +1 -1
  217. package/fesm2022/ngwr-popconfirm.mjs +6 -5
  218. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  219. package/fesm2022/ngwr-popover.mjs +31 -30
  220. package/fesm2022/ngwr-popover.mjs.map +1 -1
  221. package/fesm2022/ngwr-pull-to-refresh.mjs +2 -2
  222. package/fesm2022/ngwr-pull-to-refresh.mjs.map +1 -1
  223. package/fesm2022/ngwr-qr.mjs +6 -6
  224. package/fesm2022/ngwr-qr.mjs.map +1 -1
  225. package/fesm2022/ngwr-radio.mjs +3 -3
  226. package/fesm2022/ngwr-radio.mjs.map +1 -1
  227. package/fesm2022/ngwr-rating.mjs +10 -10
  228. package/fesm2022/ngwr-rating.mjs.map +1 -1
  229. package/fesm2022/ngwr-schema-form.mjs +15 -5
  230. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  231. package/fesm2022/ngwr-select.mjs +57 -34
  232. package/fesm2022/ngwr-select.mjs.map +1 -1
  233. package/fesm2022/ngwr-sidebar.mjs +3 -3
  234. package/fesm2022/ngwr-sidebar.mjs.map +1 -1
  235. package/fesm2022/ngwr-skeleton.mjs +2 -2
  236. package/fesm2022/ngwr-skeleton.mjs.map +1 -1
  237. package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
  238. package/fesm2022/ngwr-slider.mjs +13 -13
  239. package/fesm2022/ngwr-slider.mjs.map +1 -1
  240. package/fesm2022/ngwr-sortable-list.mjs +3 -3
  241. package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
  242. package/fesm2022/ngwr-splitter.mjs +5 -5
  243. package/fesm2022/ngwr-splitter.mjs.map +1 -1
  244. package/fesm2022/ngwr-statistic.mjs +5 -3
  245. package/fesm2022/ngwr-statistic.mjs.map +1 -1
  246. package/fesm2022/ngwr-storage.mjs +6 -4
  247. package/fesm2022/ngwr-storage.mjs.map +1 -1
  248. package/fesm2022/ngwr-switch.mjs +2 -2
  249. package/fesm2022/ngwr-switch.mjs.map +1 -1
  250. package/fesm2022/ngwr-table-testing.mjs.map +1 -1
  251. package/fesm2022/ngwr-table.mjs +263 -32
  252. package/fesm2022/ngwr-table.mjs.map +1 -1
  253. package/fesm2022/ngwr-tabs.mjs +2 -2
  254. package/fesm2022/ngwr-tabs.mjs.map +1 -1
  255. package/fesm2022/ngwr-toast-testing.mjs +8 -1
  256. package/fesm2022/ngwr-toast-testing.mjs.map +1 -1
  257. package/fesm2022/ngwr-toast.mjs +63 -20
  258. package/fesm2022/ngwr-toast.mjs.map +1 -1
  259. package/fesm2022/ngwr-tour.mjs +7 -7
  260. package/fesm2022/ngwr-tour.mjs.map +1 -1
  261. package/fesm2022/ngwr-transfer.mjs +20 -9
  262. package/fesm2022/ngwr-transfer.mjs.map +1 -1
  263. package/fesm2022/ngwr-tree.mjs +64 -24
  264. package/fesm2022/ngwr-tree.mjs.map +1 -1
  265. package/fesm2022/ngwr-utils.mjs +98 -55
  266. package/fesm2022/ngwr-utils.mjs.map +1 -1
  267. package/fesm2022/ngwr-validators.mjs +2 -2
  268. package/fesm2022/ngwr-validators.mjs.map +1 -1
  269. package/fesm2022/ngwr-version.mjs +1 -1
  270. package/fesm2022/ngwr-version.mjs.map +1 -1
  271. package/fesm2022/ngwr-window.mjs +26 -26
  272. package/fesm2022/ngwr-window.mjs.map +1 -1
  273. package/fesm2022/ngwr.mjs.map +1 -1
  274. package/i18n/ar.json +5 -0
  275. package/i18n/cs.json +5 -0
  276. package/i18n/de.json +5 -0
  277. package/i18n/en.json +5 -0
  278. package/i18n/es.json +5 -0
  279. package/i18n/fr.json +5 -0
  280. package/i18n/he.json +5 -0
  281. package/i18n/hi.json +5 -0
  282. package/i18n/id.json +5 -0
  283. package/i18n/it.json +5 -0
  284. package/i18n/ja.json +5 -0
  285. package/i18n/ko.json +5 -0
  286. package/i18n/nl.json +5 -0
  287. package/i18n/pl.json +5 -0
  288. package/i18n/pt.json +5 -0
  289. package/i18n/ru.json +5 -0
  290. package/i18n/sv.json +5 -0
  291. package/i18n/tr.json +5 -0
  292. package/i18n/uk.json +5 -0
  293. package/i18n/vi.json +5 -0
  294. package/i18n/zh-TW.json +5 -0
  295. package/i18n/zh.json +5 -0
  296. package/input-number/styles/_index.scss +6 -0
  297. package/llms-full.txt +31 -19
  298. package/llms.txt +37 -19
  299. package/mcp/providers.js +1 -1
  300. package/package.json +15 -10
  301. package/pagination/styles/_index.scss +8 -0
  302. package/schematics/icon-set/index.js +3 -3
  303. package/schematics/migrations/v16/index.js +742 -0
  304. package/schematics/migrations.json +5 -0
  305. package/schematics/ng-add/index.js +4 -4
  306. package/schematics/provider/index.js +4 -4
  307. package/schematics/use/symbol-map.json +2 -0
  308. package/select/styles/_index.scss +1 -1
  309. package/skills/ngwr/SKILL.md +6 -4
  310. package/skills/ngwr/references/catalog.md +4 -2
  311. package/skills/ngwr/references/setup.md +10 -9
  312. package/table/styles/_index.scss +92 -30
  313. package/toast/styles/_index.scss +30 -0
  314. package/tree/styles/_index.scss +17 -0
  315. package/types/index-CXbgza47.d.ts +13 -0
  316. package/types/ngwr-animations-aurora.d.ts +1 -1
  317. package/types/ngwr-animations-blur-reveal.d.ts +2 -2
  318. package/types/ngwr-animations-dot-grid.d.ts +1 -2
  319. package/types/ngwr-animations-flow-lines.d.ts +1 -1
  320. package/types/ngwr-animations-fluid-cursor.d.ts +1 -1
  321. package/types/ngwr-animations-reveal.d.ts +4 -8
  322. package/types/ngwr-animations-ripple-grid.d.ts +1 -1
  323. package/types/ngwr-animations-spotlight.d.ts +1 -1
  324. package/types/ngwr-animations-thread-lines.d.ts +1 -1
  325. package/types/ngwr-animations-tilt.d.ts +1 -1
  326. package/types/ngwr-avatar.d.ts +2 -2
  327. package/types/ngwr-badge.d.ts +1 -1
  328. package/types/ngwr-cascader.d.ts +12 -1
  329. package/types/ngwr-charts-boxplot-chart.d.ts +1 -1
  330. package/types/ngwr-charts-bullet-chart.d.ts +2 -2
  331. package/types/ngwr-charts-candlestick-chart.d.ts +1 -1
  332. package/types/ngwr-charts-core.d.ts +12 -12
  333. package/types/ngwr-charts-line-chart.d.ts +2 -2
  334. package/types/ngwr-charts-radar-chart.d.ts +1 -1
  335. package/types/ngwr-charts-scatter-chart.d.ts +2 -2
  336. package/types/ngwr-charts-waterfall-chart.d.ts +1 -1
  337. package/types/ngwr-color-picker.d.ts +12 -12
  338. package/types/ngwr-copy-value-testing.d.ts +87 -0
  339. package/types/ngwr-copy-value.d.ts +95 -0
  340. package/types/ngwr-date-picker-testing.d.ts +3 -3
  341. package/types/ngwr-date-picker.d.ts +97 -1
  342. package/types/ngwr-date.d.ts +44 -3
  343. package/types/ngwr-dialog.d.ts +50 -3
  344. package/types/ngwr-directives.d.ts +40 -0
  345. package/types/ngwr-drawer.d.ts +1 -1
  346. package/types/ngwr-dropdown.d.ts +3 -2
  347. package/types/ngwr-hotkey.d.ts +5 -5
  348. package/types/ngwr-i18n.d.ts +3 -3
  349. package/types/ngwr-icon.d.ts +26 -26
  350. package/types/ngwr-input-number.d.ts +2 -2
  351. package/types/ngwr-input.d.ts +8 -8
  352. package/types/ngwr-load-state.d.ts +6 -6
  353. package/types/ngwr-meta.d.ts +18 -0
  354. package/types/ngwr-pipes.d.ts +6 -4
  355. package/types/ngwr-platform.d.ts +2 -1
  356. package/types/ngwr-popconfirm.d.ts +3 -2
  357. package/types/ngwr-popover.d.ts +4 -3
  358. package/types/ngwr-select.d.ts +33 -18
  359. package/types/ngwr-slider-testing.d.ts +2 -2
  360. package/types/ngwr-slider.d.ts +3 -3
  361. package/types/ngwr-statistic.d.ts +5 -1
  362. package/types/ngwr-storage.d.ts +1 -1
  363. package/types/ngwr-table-testing.d.ts +2 -1
  364. package/types/ngwr-table.d.ts +155 -18
  365. package/types/ngwr-tabs.d.ts +10 -2
  366. package/types/ngwr-toast-testing.d.ts +6 -2
  367. package/types/ngwr-toast.d.ts +33 -5
  368. package/types/ngwr-transfer.d.ts +5 -0
  369. package/types/ngwr-tree.d.ts +22 -2
  370. package/types/ngwr-utils.d.ts +157 -82
  371. package/types/ngwr-validators.d.ts +4 -2
  372. package/types/ngwr-version.d.ts +1 -1
  373. package/types/ngwr.d.ts +1 -0
  374. package/types/pointer-tracker-D7fXxLQL.d.ts +24 -0
  375. package/fesm2022/ngwr-animations-core.mjs.map +0 -1
  376. package/types/ngwr-animations-core.d.ts +0 -294
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-animations-falling-letters.mjs","names":[],"sources":["../../../projects/lib/animations/falling-letters/falling-letters.ts","../../../projects/lib/animations/falling-letters/public-api.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n PLATFORM_ID,\n afterNextRender,\n effect,\n inject,\n input,\n untracked,\n} from '@angular/core';\n\nimport { graphemes, optionalSelector, roundTo } from 'ngwr/animations/core';\nimport { WrPlatform } from 'ngwr/platform';\nimport { numAttr, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrFallingLettersState } from './types';\n\n/** How long the heap lies still before the letters spring back on their own, in ms. */\nconst FALLING_LETTERS_REST = 4000;\n\n/** Downward acceleration, in px/s²: a letter crosses half a screen in about two thirds of a second. */\nconst GRAVITY = 2400;\n\n/** The most a letter drifts sideways as it falls, each way, in px/s. */\nconst DRIFT = 80;\n\n/** The most a letter spins as it falls, each way, in degrees per second. */\nconst SPIN = 160;\n\n/** The letters let go over this long, not all at once, in ms. */\nconst RELEASE = 240;\n\n/** The width of one column of the height map, in px: narrower than a letter, so a heap has a shape. */\nconst COLUMN = 8;\n\n/** How much of the landing speed comes back as a hop. */\nconst RESTITUTION = 0.25;\n\n/** Landing slower than this, a letter settles instead of hopping, in px/s. */\nconst BOUNCE_MIN = 300;\n\n/** What a hop and a wall take off the sideways speed and the spin. */\nconst FRICTION = 0.5;\n\n/** How long one letter's flight back to its place takes, in ms. */\nconst RETURN = 700;\n\n/** The gap between two letters leaving the heap, in ms, and how far the last may start after the first. */\nconst RETURN_GAP = 24;\nconst RETURN_SPREAD = 300;\n\n/** The spring that brings a letter back: this much damping, this many turns of the overshoot per flight. */\nconst SPRING_DAMP = 7;\nconst SPRING_FREQ = 2.4 * Math.PI;\n\n/** The longest step one frame may integrate, in seconds: a stalled frame moves a little, never jumps. */\nconst MAX_STEP = 0.04;\n\n/**\n * How far under a letter's last bottom edge a surface may be, in px, and still\n * count as under it: the rounding of a frame, not a neighbour's top.\n */\nconst SLACK = 0.5;\n\n/** How fast a letter that lands against a neighbour slides clear of it, or climbs out from between two, in px/s. */\nconst SLIDE = 240;\n\n/** How far a letter slides and climbs at most, in px, before it gives up and lies where it is. */\nconst SLIDE_MAX = 48;\n\n/**\n * Multipliers of the low-discrepancy sequences, one per channel: `(n * m) mod 1`\n * spreads over (0, 1) with no two neighbours close, and three irrationals far\n * apart keep the release order, the drift and the spin from following one another.\n */\nconst SCATTER = [0.618_033_988_749_895, 0.414_213_562_373_095, 0.732_050_807_568_877] as const;\n\n/** Letter `i`'s place in (0, 1) on channel `k`: the same for the same letter every time. */\nfunction scatter(i: number, k: 0 | 1 | 2): number {\n const x = ((i + 1) * SCATTER[k]) % 1;\n return x < 0 ? x + 1 : x;\n}\n\n/**\n * A springy ease: overshoots its target by about seven percent, comes back a\n * little under, and is there at `t = 1`. `t` is clamped to [0, 1].\n */\nfunction spring(t: number): number {\n if (t <= 0) return 0;\n if (t >= 1) return 1;\n return 1 - Math.exp(-SPRING_DAMP * t) * Math.cos(SPRING_FREQ * t);\n}\n\n/**\n * The floor, as a row of narrow columns, each remembering the top of what has\n * landed in it. A letter lands on the highest top among the columns it covers\n * that lies under it, so later letters sit on earlier ones and the floor fills\n * into a heap, and a letter already level with a neighbour's top is beside\n * that neighbour, not on it.\n */\nclass Heap {\n private readonly tops: Float64Array;\n\n /** `floor` is the y of the empty floor; the columns span `from` to `to`. */\n constructor(\n private readonly from: number,\n to: number,\n private readonly floor: number\n ) {\n this.tops = new Float64Array(Math.max(1, Math.ceil((to - from) / COLUMN))).fill(floor);\n }\n\n /**\n * The y a body spanning `a` to `b` lands on: the smallest y (highest top)\n * among its columns at or under `below`, the body's own bottom edge a frame\n * ago. A column whose top is above that is a neighbour the body is passing\n * beside, so it does not count: a letter that lands next to one already on\n * the floor keeps falling to the floor instead of jumping up onto it. With\n * every column of the span above the body, it falls on to the floor itself.\n */\n top(a: number, b: number, below = -Infinity): number {\n let top = Infinity;\n for (let c = this.column(a); c <= this.column(b); c++) {\n const candidate = this.tops[c];\n if (candidate >= below) top = Math.min(top, candidate);\n }\n return top === Infinity ? this.floor : top;\n }\n\n /**\n * What stands beside a body spanning `a` to `b` that lies with its bottom\n * at `bottom`: how many of its columns, left and right of its middle, end\n * above that bottom, in a neighbour it landed against. `null` when none\n * does and it may lie where it is.\n */\n beside(a: number, b: number, bottom: number): { left: number; right: number } | null {\n const from = this.column(a);\n const to = this.column(b);\n const mid = (from + to) / 2;\n let left = 0;\n let right = 0;\n for (let c = from; c <= to; c++) {\n if (this.tops[c] >= bottom - SLACK) continue;\n if (c <= mid) left++;\n else right++;\n }\n return left === 0 && right === 0 ? null : { left, right };\n }\n\n /** A body spanning `a` to `b` has settled with its top at `y`: its columns now end there. */\n settle(a: number, b: number, y: number): void {\n for (let c = this.column(a); c <= this.column(b); c++) this.tops[c] = Math.min(this.tops[c], y);\n }\n\n private column(x: number): number {\n return Math.min(this.tops.length - 1, Math.max(0, Math.floor((x - this.from) / COLUMN)));\n }\n}\n\n/**\n * The part of a piece that falls and lands: the ink of the glyph, inside the\n * piece's box. `left` and `top` are from the box's top-left corner.\n */\ninterface Body {\n readonly left: number;\n readonly top: number;\n readonly width: number;\n readonly height: number;\n}\n\n/** One letter on its way: a piece over the page, its place in the line, and its motion. */\ninterface Piece {\n readonly el: HTMLElement;\n /** The body's size, for the walls and the heap. */\n readonly bw: number;\n readonly bh: number;\n /** The body's centre from the piece's top-left corner: where the piece turns, and what `cx`, `cy` are the position of. */\n readonly ox: number;\n readonly oy: number;\n /** The centre of the body in the line, from the target's padding box. */\n readonly x0: number;\n readonly y0: number;\n /** How long after the click this letter lets go, in seconds. */\n readonly release: number;\n cx: number;\n cy: number;\n angle: number;\n vx: number;\n vy: number;\n spin: number;\n /** How far the letter may still slide and climb to get clear of a neighbour, in px. */\n slide: number;\n /** The top the letter is climbing to, squeezed up from between two neighbours; `null` otherwise. */\n climb: number | null;\n settled: boolean;\n /** Where the flight back started from. */\n fromX: number;\n fromY: number;\n fromAngle: number;\n}\n\n/** The box the letters fall in, from the target's padding box. */\ninterface Bounds {\n readonly minX: number;\n readonly maxX: number;\n readonly floor: number;\n}\n\n/** Half the width and half the height of a body's axis-aligned box at `angle` degrees. */\nfunction extent(piece: Pick<Piece, 'bw' | 'bh'>, angle: number): { hw: number; hh: number } {\n const rad = (angle * Math.PI) / 180;\n const cos = Math.abs(Math.cos(rad));\n const sin = Math.abs(Math.sin(rad));\n return { hw: (piece.bw * cos + piece.bh * sin) / 2, hh: (piece.bh * cos + piece.bw * sin) / 2 };\n}\n\n/**\n * The ink of one grapheme inside its line box, from the canvas text metrics\n * of the same font: the line box is mostly air (the leading, the ascender\n * space over an `a`, the descender space under it), and a heap of air boxes\n * is a heap of letters hanging apart in mid-air. The baseline sits at the\n * box's half-leading plus the font's ascent, as in the line it came from; the\n * ink is the glyph's own bounds about that baseline and the start of its\n * advance. `null` when the browser gives no context or no metrics (jsdom, an\n * invisible glyph), and the piece's box is the body.\n */\nfunction ink(ctx: CanvasRenderingContext2D | null, text: string, box: Pick<DOMRect, 'height'>): Body | null {\n if (!ctx) return null;\n const m = ctx.measureText(text);\n const ascent = m.fontBoundingBoxAscent;\n const descent = m.fontBoundingBoxDescent;\n if (!(ascent >= 0 && descent >= 0)) return null;\n const baseline = (box.height - ascent - descent) / 2 + ascent;\n const left = -m.actualBoundingBoxLeft || 0;\n const top = baseline - m.actualBoundingBoxAscent;\n const width = m.actualBoundingBoxRight - left;\n const height = baseline + m.actualBoundingBoxDescent - top;\n return width > 0.5 && height > 0.5 ? { left, top, width, height } : null;\n}\n\n/** A canvas context set to the element's font, for `ink`; `null` where there is no canvas. */\nfunction measurer(el: HTMLElement): CanvasRenderingContext2D | null {\n const doc = el.ownerDocument;\n const style = doc.defaultView?.getComputedStyle(el);\n const ctx = doc.createElement('canvas').getContext('2d');\n if (!style || !ctx) return null;\n ctx.font = `${style.fontStyle} ${style.fontWeight} ${style.fontSize} ${style.fontFamily}`;\n return ctx;\n}\n\n/**\n * Click a line of text and its letters let go: each one drops with gravity,\n * drifts and tumbles a little on its own path, and lands on whatever already\n * lies under it, so the letters pile into a heap on the floor of a container.\n * Click again, or leave the heap for a few seconds, and every letter springs\n * back to its exact place in the line; the text is plain text again.\n *\n * No physics engine. A letter's path is gravity plus a sideways drift and a\n * spin drawn from a fixed low-discrepancy sequence by its index, so the same\n * text falls the same way every time and a spec can follow it. What falls is\n * the glyph's ink, measured from the canvas text metrics of the line's font\n * ({@link ink}), not its line box: the box is mostly air, and air boxes would\n * stack into a heap of letters hanging apart. Letters do not collide in the\n * air; they meet on the floor, which is a {@link Heap}: a row of narrow\n * columns, each remembering the top of what has landed in it, and a letter\n * lands on the highest top among the columns it covers that is under it. A\n * top above the letter's last bottom edge is a neighbour it is passing beside,\n * and is ignored: otherwise every letter landing beside one already down\n * would snap up on to it, and the heap would stack into towers in a frame. A\n * letter that lands fast hops once or twice ({@link RESTITUTION}); a slow one\n * that came down against such a neighbour slides along its surface until it\n * is clear ({@link SLIDE}), one down between two climbs out on to the taller,\n * and after {@link SLIDE_MAX} px of that a letter lies where it is. A wall of\n * the container turns the drift around. The floor and the walls are\n * the content box of `floor`'s element, measured when the fall starts.\n *\n * The line never moves. The authored nodes are moved into an invisible\n * wrapper that holds exactly their space, still the real text for a screen\n * reader and the clipboard, and the pieces, one `aria-hidden` span per\n * grapheme, are positioned from the target's own box and move by transform\n * alone, so nothing under them reflows and a button under a falling letter\n * stays clickable (`pointer-events: none`). They inherit the font and the\n * colour. When the last letter is back, the same authored node objects go\n * back where they were and the pieces are removed, so a binding inside the\n * text keeps working through the whole thing.\n *\n * One `requestAnimationFrame` loop runs only while a letter moves: it idles\n * once the heap is still and once the line is whole, and a hidden document\n * pauses it where it is. The return is a springy ease ({@link spring}) with a\n * short stagger in reading order. Nothing happens on the server, under\n * `prefers-reduced-motion: reduce`, or when the target has no box; a\n * preference that flips mid-fall puts the text back at once. Destroy puts the\n * text back, cancels the loop and drops the listener.\n *\n * The effect usually sits on its host, but a selector as the directive's value\n * points it at one descendant instead, for a paragraph a library component\n * draws (`<wr-result-404 wrFallingLetters=\".wr-result__description\">`). The\n * target is looked up once after the first render; if nothing matches, nothing\n * happens.\n */\n@Directive({\n selector: '[wrFallingLetters]',\n})\nexport class WrFallingLetters {\n /**\n * A selector for one descendant of the host whose letters fall instead of\n * the host's own, written as the directive's value:\n * `wrFallingLetters=\".wr-result__description\"`. Resolved once after the\n * first render with `querySelector`; a selector that matches nothing turns\n * the effect off. Unset or empty, the host.\n */\n readonly target = input<string | null, unknown>(null, { alias: 'wrFallingLetters', transform: optionalSelector });\n\n /**\n * A selector for the element whose content box is the floor and the walls,\n * found with `closest` from the host. Unset, the host's parent element: on\n * a `display: contents` host that is the box around it. On a `wr-*` host\n * write it as a binding (`[floor]=\"'main'\"`), since a static attribute that\n * is not one of the component's inputs fails `check:attrs`.\n */\n readonly floor = input<string | null, unknown>(null, { transform: optionalSelector });\n\n /** How long the heap lies still before the letters spring back on their own, in ms. @default 4000 */\n readonly rest = input(FALLING_LETTERS_REST, { transform: numAttr(FALLING_LETTERS_REST) });\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platform = inject(WrPlatform);\n private listeners: AbortController | null = null;\n /** The element whose letters fall, once resolved; `null` before and after. */\n private el: HTMLElement | null = null;\n private state: WrFallingLettersState = 'idle';\n /** The authored children while they sit in the wrapper, else `null`. */\n private original: ChildNode[] | null = null;\n private pieces: Piece[] = [];\n private heap: Heap | null = null;\n private bounds: Bounds | null = null;\n private frame: number | null = null;\n /** The timestamp of the last frame, or `null` when the next one is the first after a start. */\n private last: number | null = null;\n /** Seconds since the current phase began, summed from frame steps, so a pause adds nothing. */\n private clock = 0;\n private timer: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/falling-letters');\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n const host = this.host.nativeElement;\n const selector = this.target();\n const el = selector ? host.querySelector<HTMLElement>(selector) : host;\n if (!el) return;\n this.el = el;\n el.classList.add('wr-falling-letters');\n this.listeners = new AbortController();\n el.addEventListener('click', () => this.toggle(), { signal: this.listeners.signal });\n });\n\n // One place decides what the loop does: reduced motion puts the text\n // back, a hidden page pauses, otherwise a phase in motion gets a frame.\n effect(() => {\n const visible = this.platform.pageVisible();\n const reduced = this.platform.prefersReducedMotion();\n untracked(() => {\n if (reduced) this.restore();\n else if (!visible) this.pause();\n else if (this.state === 'fall' || this.state === 'return') this.start();\n });\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.listeners?.abort();\n this.listeners = null;\n this.restore();\n this.el?.classList.remove('wr-falling-letters');\n this.el = null;\n });\n }\n\n /** A click: plain text falls; a heap, still or in the making, springs back; a flight back is left alone. */\n private toggle(): void {\n if (this.platform.prefersReducedMotion()) return;\n if (this.state === 'idle') this.fall();\n else if (this.state === 'fall' || this.state === 'rest') this.spring();\n }\n\n /**\n * Measure every grapheme in place, then swap in the pieces and hide the\n * line, all in one task, so the first paint shows each piece exactly over\n * its letter. The measurement wraps each grapheme in an inline-block for one\n * synchronous layout and puts the authored nodes straight back, so no frame\n * ever shows the probe.\n */\n private fall(): void {\n const el = this.el;\n if (!el) return;\n const doc = el.ownerDocument;\n const box = el.getBoundingClientRect();\n if (box.width <= 0 || box.height <= 0) return;\n\n const original = Array.from(el.childNodes);\n const wrapper = doc.createElement('span');\n wrapper.className = 'wr-falling-letters__text';\n const glyphs: { el: HTMLElement; text: string; node: Node | null }[] = [];\n for (const node of original) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n // An inline element (`<code>`, `<a>`) is one piece, a copy of the whole thing.\n const probe = doc.createElement('span');\n probe.className = 'wr-falling-letters__glyph';\n probe.append(node);\n wrapper.append(probe);\n glyphs.push({ el: probe, text: '', node });\n } else if (node.nodeType === Node.TEXT_NODE) {\n for (const grapheme of graphemes(node.textContent ?? '')) {\n if (grapheme.trim() === '') {\n wrapper.append(grapheme);\n continue;\n }\n const probe = doc.createElement('span');\n probe.className = 'wr-falling-letters__glyph';\n probe.textContent = grapheme;\n wrapper.append(probe);\n glyphs.push({ el: probe, text: grapheme, node: null });\n }\n }\n }\n el.replaceChildren(wrapper);\n\n const origin = { x: box.left + el.clientLeft, y: box.top + el.clientTop };\n const rects = glyphs.map(glyph => glyph.el.getBoundingClientRect());\n const container = this.container();\n const bounds = this.measure(container ?? el, origin, box);\n // The text's font, read once: every grapheme of the line shares it. An\n // inline element is one piece with its own font and its own box, and its\n // box (a chip, a link) is its ink.\n const ctx = measurer(el);\n\n // The authored nodes back, the same objects, in their order: the wrapper now holds the line's space.\n wrapper.replaceChildren(...original);\n\n const layer = doc.createElement('span');\n layer.className = 'wr-falling-letters__pieces';\n layer.setAttribute('aria-hidden', 'true');\n const pieces: Piece[] = [];\n glyphs.forEach((glyph, i) => {\n const rect = rects[i];\n if (rect.width <= 0 || rect.height <= 0) return;\n const piece = doc.createElement('span');\n piece.className = 'wr-falling-letters__piece';\n if (glyph.node) piece.append(glyph.node.cloneNode(true));\n else piece.textContent = glyph.text;\n const n = pieces.length;\n const body: Body = (glyph.node ? null : ink(ctx, glyph.text, rect)) ?? {\n left: 0,\n top: 0,\n width: rect.width,\n height: rect.height,\n };\n const ox = body.left + body.width / 2;\n const oy = body.top + body.height / 2;\n piece.style.transformOrigin = `${roundTo(ox, 2)}px ${roundTo(oy, 2)}px`;\n const x0 = rect.left - origin.x + ox;\n const y0 = rect.top - origin.y + oy;\n pieces.push({\n el: piece,\n bw: body.width,\n bh: body.height,\n ox,\n oy,\n x0,\n y0,\n release: (scatter(n, 0) * RELEASE) / 1000,\n cx: x0,\n cy: y0,\n angle: 0,\n vx: (scatter(n, 1) - 0.5) * 2 * DRIFT,\n vy: 0,\n spin: (scatter(n, 2) - 0.5) * 2 * SPIN,\n slide: SLIDE_MAX,\n climb: null,\n settled: false,\n fromX: x0,\n fromY: y0,\n fromAngle: 0,\n });\n layer.append(piece);\n });\n if (pieces.length === 0) {\n el.replaceChildren(...original);\n return;\n }\n\n this.original = original;\n this.pieces = pieces;\n this.heap = new Heap(bounds.minX, bounds.maxX, bounds.floor);\n this.bounds = bounds;\n for (const piece of pieces) this.paint(piece);\n el.append(layer);\n el.classList.add('wr-falling-letters--out');\n this.state = 'fall';\n this.clock = 0;\n this.start();\n }\n\n /** The element whose content box is the floor: `floor`'s closest match from the host, else the host's parent. */\n private container(): HTMLElement | null {\n const host = this.host.nativeElement;\n const selector = this.floor();\n return selector ? host.closest<HTMLElement>(selector) : host.parentElement;\n }\n\n /**\n * The floor and the walls, from the target's padding box: the container's\n * content box, and never above the line itself, so a letter always has\n * somewhere to fall.\n */\n private measure(container: HTMLElement, origin: { x: number; y: number }, box: DOMRect): Bounds {\n const rect = container.getBoundingClientRect();\n const style = container.ownerDocument.defaultView?.getComputedStyle(container);\n const pad = (value: string | undefined): number => {\n const n = value === undefined ? NaN : parseFloat(value);\n return Number.isFinite(n) ? n : 0;\n };\n const minX = rect.left + pad(style?.paddingLeft) - origin.x;\n const maxX = rect.left + rect.width - pad(style?.paddingRight) - origin.x;\n const floor = rect.top + rect.height - pad(style?.paddingBottom) - origin.y;\n return { minX: Math.min(minX, 0), maxX: Math.max(maxX, box.width), floor: Math.max(floor, box.height) };\n }\n\n /** Every letter leaves where it is, heap or mid-air, for its place in the line. */\n private spring(): void {\n this.clearTimer();\n for (const piece of this.pieces) {\n piece.fromX = piece.cx;\n piece.fromY = piece.cy;\n piece.fromAngle = piece.angle;\n }\n this.state = 'return';\n this.clock = 0;\n this.start();\n }\n\n /** Ask for a frame, unless one is pending, nothing moves or the page is hidden. */\n private start(): void {\n if (this.frame !== null || this.state === 'idle' || this.state === 'rest') return;\n if (!untracked(() => this.platform.pageVisible())) return;\n this.last = null;\n this.frame = requestAnimationFrame(t => this.tick(t));\n }\n\n /** Drop the pending frame. The pieces stay where they are, so a restart continues from them. */\n private pause(): void {\n if (this.frame === null) return;\n cancelAnimationFrame(this.frame);\n this.frame = null;\n this.last = null;\n }\n\n /**\n * Put the authored children back, the same node objects, and drop the\n * wrapper and the pieces. Idempotent: the end of the flight back, reduced\n * motion and destroy all call it.\n */\n private restore(): void {\n this.pause();\n this.clearTimer();\n this.state = 'idle';\n if (!this.original) return;\n this.el?.replaceChildren(...this.original);\n this.el?.classList.remove('wr-falling-letters--out');\n this.original = null;\n this.pieces = [];\n this.heap = null;\n this.bounds = null;\n }\n\n /**\n * One frame. The first after a start has no length, so a pause of any length\n * moves nothing when the loop resumes. The fall ends when the last letter\n * settles, and the heap lies still until a click or the rest timer; the\n * flight back ends when the last letter is home, and the text is whole again.\n */\n private tick(now: number): void {\n const dt = this.last === null ? 0 : Math.min(Math.max(0, now - this.last) / 1000, MAX_STEP);\n this.last = now;\n this.clock += dt;\n const done = this.state === 'fall' ? this.stepFall(dt) : this.stepReturn();\n if (!done) {\n this.frame = requestAnimationFrame(t => this.tick(t));\n return;\n }\n this.frame = null;\n this.last = null;\n if (this.state === 'return') {\n this.restore();\n return;\n }\n this.state = 'rest';\n this.timer = setTimeout(\n () => {\n this.timer = null;\n this.spring();\n },\n Math.max(0, this.rest())\n );\n }\n\n /** Gravity, drift, spin, the walls and the heap for every letter still in the air. True once all have settled. */\n private stepFall(dt: number): boolean {\n const heap = this.heap;\n const bounds = this.bounds;\n if (!heap || !bounds) return true;\n let settled = true;\n for (const piece of this.pieces) {\n if (piece.settled) continue;\n settled = false;\n if (this.clock < piece.release) continue;\n if (piece.climb !== null) {\n // Squeezed up from between two neighbours at the slide's pace, until\n // the body is level with the top of the taller one; then it drops on.\n const rest = piece.climb - extent(piece, piece.angle).hh;\n piece.cy = Math.max(rest, piece.cy - SLIDE * dt);\n piece.slide -= SLIDE * dt;\n if (piece.cy <= rest) piece.climb = null;\n this.paint(piece);\n continue;\n }\n const below = piece.cy + extent(piece, piece.angle).hh;\n piece.vy += GRAVITY * dt;\n piece.cx += piece.vx * dt;\n piece.cy += piece.vy * dt;\n piece.angle += piece.spin * dt;\n const { hw, hh } = extent(piece, piece.angle);\n\n if (piece.cx - hw < bounds.minX) {\n piece.cx = bounds.minX + hw;\n piece.vx = Math.abs(piece.vx) * FRICTION;\n } else if (piece.cx + hw > bounds.maxX) {\n piece.cx = bounds.maxX - hw;\n piece.vx = -Math.abs(piece.vx) * FRICTION;\n }\n\n const top = heap.top(piece.cx - hw, piece.cx + hw, below - SLACK);\n if (piece.cy + hh >= top) {\n piece.cy = top - hh;\n if (piece.vy > BOUNCE_MIN) {\n piece.vy = -piece.vy * RESTITUTION;\n piece.vx *= FRICTION;\n piece.spin *= FRICTION;\n } else {\n piece.vy = 0;\n piece.spin = 0;\n const beside = piece.slide > 0 ? heap.beside(piece.cx - hw, piece.cx + hw, piece.cy + hh) : null;\n if (beside && beside.left > 0 && beside.right > 0) {\n // Down between two neighbours: climb out, to the top of the taller.\n piece.vx = 0;\n piece.climb = heap.top(piece.cx - hw, piece.cx + hw);\n } else if (beside) {\n // Down against a neighbour that is already there: slide along the\n // surface until clear of it, as letters landing on one another do,\n // instead of lying inside it or jumping up on to it.\n piece.vx = (beside.left > 0 ? 1 : -1) * SLIDE;\n piece.slide -= SLIDE * dt;\n } else {\n piece.vx = 0;\n piece.settled = true;\n // The heap learns of the letter once it lies still, not at first\n // touch: a letter that touched down, hopped and came to rest a step\n // away would leave a top in the air for the next one to hang on.\n heap.settle(piece.cx - hw, piece.cx + hw, piece.cy - hh);\n }\n }\n }\n this.paint(piece);\n }\n return settled;\n }\n\n /** Each letter springs from where it left toward its place, in reading order. True once all are home. */\n private stepReturn(): boolean {\n const count = this.pieces.length;\n const gap = Math.min(RETURN_GAP, RETURN_SPREAD / Math.max(1, count - 1)) / 1000;\n let home = true;\n this.pieces.forEach((piece, i) => {\n const t = (this.clock - i * gap) / (RETURN / 1000);\n if (t < 0) {\n home = false;\n return;\n }\n const s = spring(t);\n piece.cx = piece.fromX + (piece.x0 - piece.fromX) * s;\n piece.cy = piece.fromY + (piece.y0 - piece.fromY) * s;\n piece.angle = piece.fromAngle * (1 - s);\n if (t < 1) home = false;\n this.paint(piece);\n });\n return home;\n }\n\n /** Written to the DOM by hand: a binding would wait for change detection, and this is every frame. */\n private paint(piece: Piece): void {\n const x = roundTo(piece.cx - piece.ox, 2);\n const y = roundTo(piece.cy - piece.oy, 2);\n const angle = roundTo(piece.angle, 2);\n piece.el.style.transform = `translate(${x}px, ${y}px) rotate(${angle}deg)`;\n }\n\n private clearTimer(): void {\n if (this.timer !== null) clearTimeout(this.timer);\n this.timer = null;\n }\n}\n\nexport {\n BOUNCE_MIN,\n COLUMN,\n DRIFT,\n FALLING_LETTERS_REST,\n GRAVITY,\n Heap,\n RELEASE,\n RESTITUTION,\n RETURN,\n RETURN_GAP,\n RETURN_SPREAD,\n SLACK,\n SLIDE,\n SLIDE_MAX,\n SPIN,\n ink,\n scatter,\n spring,\n};\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nexport { WrFallingLetters } from './falling-letters';\nexport type { WrFallingLettersState } from './types';\n"],"mappings":";;;;;;;;;;;;AA2BA,MAAM,uBAAuB;AAG7B,MAAM,UAAU;AAehB,MAAM,cAAc;AAMpB,MAAM,WAAW;AAWjB,MAAM,cAAc,MAAM,KAAK;AAG/B,MAAM,WAAW;AAMjB,MAAM,QAAQ;AAad,MAAM,UAAU;CAAC;CAAuB;CAAuB;AAAqB;AAGpF,SAAS,QAAQ,GAAW,GAAY;CACtC,MAAM,KAAM,IAAI,KAAK,QAAQ,KAAM;CACnC,OAAO,IAAI,IAAI,IAAI,IAAI;AACzB;AAMA,SAAS,OAAO,GAAS;CACvB,IAAI,KAAK,GAAG,OAAO;CACnB,IAAI,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Q,MAAM,OAAY;EACxB,MAAM,IAAI,QAAQ,MAAM,KAAK,MAAM,IAAI,CAAC;EACxC,MAAM,IAAI,QAAQ,MAAM,KAAK,MAAM,IAAI,CAAC;EACxC,MAAM,QAAQ,QAAQ,MAAM,OAAO,CAAC;EACpC,MAAM,GAAG,MAAM,YAAY,aAAa,EAAC,MAAO,EAAC,aAAc,MAAK;CACtE;CAEQ,aAAU;EAChB,IAAI,KAAK,UAAU,MAAM,aAAa,KAAK,KAAK;EAChD,KAAK,QAAQ;CACf;CAvZW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAgB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAhB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAgB,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,QAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,OAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,MAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,UAAA;CAAA,CAAA;;AAAhB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAgB,YAAA,CAAA;EAH5B,MAAA;EAAU,MAAA,CAAA,EACT,UAAU,qBACX,CAAA"}
1
+ {"version":3,"file":"ngwr-animations-falling-letters.mjs","names":[],"sources":["../../../projects/lib/animations/falling-letters/falling-letters.ts","../../../projects/lib/animations/falling-letters/public-api.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { isPlatformBrowser } from '@angular/common';\nimport {\n DestroyRef,\n Directive,\n ElementRef,\n PLATFORM_ID,\n afterNextRender,\n effect,\n inject,\n input,\n untracked,\n} from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrNumAttr, wrCheckStyles } from 'ngwr/utils';\n\nimport { graphemes, optionalSelector, roundTo } from '../internal';\n\nimport type { WrFallingLettersState } from './types';\n\n/** How long the heap lies still before the letters spring back on their own, in ms. */\nconst FALLING_LETTERS_REST = 4000;\n\n/** Downward acceleration, in px/s²: a letter crosses half a screen in about two thirds of a second. */\nconst GRAVITY = 2400;\n\n/** The most a letter drifts sideways as it falls, each way, in px/s. */\nconst DRIFT = 80;\n\n/** The most a letter spins as it falls, each way, in degrees per second. */\nconst SPIN = 160;\n\n/** The letters let go over this long, not all at once, in ms. */\nconst RELEASE = 240;\n\n/** The width of one column of the height map, in px: narrower than a letter, so a heap has a shape. */\nconst COLUMN = 8;\n\n/** How much of the landing speed comes back as a hop. */\nconst RESTITUTION = 0.25;\n\n/** Landing slower than this, a letter settles instead of hopping, in px/s. */\nconst BOUNCE_MIN = 300;\n\n/** What a hop and a wall take off the sideways speed and the spin. */\nconst FRICTION = 0.5;\n\n/** How long one letter's flight back to its place takes, in ms. */\nconst RETURN = 700;\n\n/** The gap between two letters leaving the heap, in ms, and how far the last may start after the first. */\nconst RETURN_GAP = 24;\nconst RETURN_SPREAD = 300;\n\n/** The spring that brings a letter back: this much damping, this many turns of the overshoot per flight. */\nconst SPRING_DAMP = 7;\nconst SPRING_FREQ = 2.4 * Math.PI;\n\n/** The longest step one frame may integrate, in seconds: a stalled frame moves a little, never jumps. */\nconst MAX_STEP = 0.04;\n\n/**\n * How far under a letter's last bottom edge a surface may be, in px, and still\n * count as under it: the rounding of a frame, not a neighbour's top.\n */\nconst SLACK = 0.5;\n\n/** How fast a letter that lands against a neighbour slides clear of it, or climbs out from between two, in px/s. */\nconst SLIDE = 240;\n\n/** How far a letter slides and climbs at most, in px, before it gives up and lies where it is. */\nconst SLIDE_MAX = 48;\n\n/**\n * Multipliers of the low-discrepancy sequences, one per channel: `(n * m) mod 1`\n * spreads over (0, 1) with no two neighbours close, and three irrationals far\n * apart keep the release order, the drift and the spin from following one another.\n */\nconst SCATTER = [0.618_033_988_749_895, 0.414_213_562_373_095, 0.732_050_807_568_877] as const;\n\n/** Letter `i`'s place in (0, 1) on channel `k`: the same for the same letter every time. */\nfunction scatter(i: number, k: 0 | 1 | 2): number {\n const x = ((i + 1) * SCATTER[k]) % 1;\n return x < 0 ? x + 1 : x;\n}\n\n/**\n * A springy ease: overshoots its target by about seven percent, comes back a\n * little under, and is there at `t = 1`. `t` is clamped to [0, 1].\n */\nfunction spring(t: number): number {\n if (t <= 0) return 0;\n if (t >= 1) return 1;\n return 1 - Math.exp(-SPRING_DAMP * t) * Math.cos(SPRING_FREQ * t);\n}\n\n/**\n * The floor, as a row of narrow columns, each remembering the top of what has\n * landed in it. A letter lands on the highest top among the columns it covers\n * that lies under it, so later letters sit on earlier ones and the floor fills\n * into a heap, and a letter already level with a neighbour's top is beside\n * that neighbour, not on it.\n */\nclass Heap {\n private readonly tops: Float64Array;\n\n /** `floor` is the y of the empty floor; the columns span `from` to `to`. */\n constructor(\n private readonly from: number,\n to: number,\n private readonly floor: number\n ) {\n this.tops = new Float64Array(Math.max(1, Math.ceil((to - from) / COLUMN))).fill(floor);\n }\n\n /**\n * The y a body spanning `a` to `b` lands on: the smallest y (highest top)\n * among its columns at or under `below`, the body's own bottom edge a frame\n * ago. A column whose top is above that is a neighbour the body is passing\n * beside, so it does not count: a letter that lands next to one already on\n * the floor keeps falling to the floor instead of jumping up onto it. With\n * every column of the span above the body, it falls on to the floor itself.\n */\n top(a: number, b: number, below = -Infinity): number {\n let top = Infinity;\n for (let c = this.column(a); c <= this.column(b); c++) {\n const candidate = this.tops[c];\n if (candidate >= below) top = Math.min(top, candidate);\n }\n return top === Infinity ? this.floor : top;\n }\n\n /**\n * What stands beside a body spanning `a` to `b` that lies with its bottom\n * at `bottom`: how many of its columns, left and right of its middle, end\n * above that bottom, in a neighbour it landed against. `null` when none\n * does and it may lie where it is.\n */\n beside(a: number, b: number, bottom: number): { left: number; right: number } | null {\n const from = this.column(a);\n const to = this.column(b);\n const mid = (from + to) / 2;\n let left = 0;\n let right = 0;\n for (let c = from; c <= to; c++) {\n if (this.tops[c] >= bottom - SLACK) continue;\n if (c <= mid) left++;\n else right++;\n }\n return left === 0 && right === 0 ? null : { left, right };\n }\n\n /** A body spanning `a` to `b` has settled with its top at `y`: its columns now end there. */\n settle(a: number, b: number, y: number): void {\n for (let c = this.column(a); c <= this.column(b); c++) this.tops[c] = Math.min(this.tops[c], y);\n }\n\n private column(x: number): number {\n return Math.min(this.tops.length - 1, Math.max(0, Math.floor((x - this.from) / COLUMN)));\n }\n}\n\n/**\n * The part of a piece that falls and lands: the ink of the glyph, inside the\n * piece's box. `left` and `top` are from the box's top-left corner.\n */\ninterface Body {\n readonly left: number;\n readonly top: number;\n readonly width: number;\n readonly height: number;\n}\n\n/** One letter on its way: a piece over the page, its place in the line, and its motion. */\ninterface Piece {\n readonly el: HTMLElement;\n /** The body's size, for the walls and the heap. */\n readonly bw: number;\n readonly bh: number;\n /** The body's centre from the piece's top-left corner: where the piece turns, and what `cx`, `cy` are the position of. */\n readonly ox: number;\n readonly oy: number;\n /** The centre of the body in the line, from the target's padding box. */\n readonly x0: number;\n readonly y0: number;\n /** How long after the click this letter lets go, in seconds. */\n readonly release: number;\n cx: number;\n cy: number;\n angle: number;\n vx: number;\n vy: number;\n spin: number;\n /** How far the letter may still slide and climb to get clear of a neighbour, in px. */\n slide: number;\n /** The top the letter is climbing to, squeezed up from between two neighbours; `null` otherwise. */\n climb: number | null;\n settled: boolean;\n /** Where the flight back started from. */\n fromX: number;\n fromY: number;\n fromAngle: number;\n}\n\n/** The box the letters fall in, from the target's padding box. */\ninterface Bounds {\n readonly minX: number;\n readonly maxX: number;\n readonly floor: number;\n}\n\n/** Half the width and half the height of a body's axis-aligned box at `angle` degrees. */\nfunction extent(piece: Pick<Piece, 'bw' | 'bh'>, angle: number): { hw: number; hh: number } {\n const rad = (angle * Math.PI) / 180;\n const cos = Math.abs(Math.cos(rad));\n const sin = Math.abs(Math.sin(rad));\n return { hw: (piece.bw * cos + piece.bh * sin) / 2, hh: (piece.bh * cos + piece.bw * sin) / 2 };\n}\n\n/**\n * The ink of one grapheme inside its line box, from the canvas text metrics\n * of the same font: the line box is mostly air (the leading, the ascender\n * space over an `a`, the descender space under it), and a heap of air boxes\n * is a heap of letters hanging apart in mid-air. The baseline sits at the\n * box's half-leading plus the font's ascent, as in the line it came from; the\n * ink is the glyph's own bounds about that baseline and the start of its\n * advance. `null` when the browser gives no context or no metrics (jsdom, an\n * invisible glyph), and the piece's box is the body.\n */\nfunction ink(ctx: CanvasRenderingContext2D | null, text: string, box: Pick<DOMRect, 'height'>): Body | null {\n if (!ctx) return null;\n const m = ctx.measureText(text);\n const ascent = m.fontBoundingBoxAscent;\n const descent = m.fontBoundingBoxDescent;\n if (!(ascent >= 0 && descent >= 0)) return null;\n const baseline = (box.height - ascent - descent) / 2 + ascent;\n const left = -m.actualBoundingBoxLeft || 0;\n const top = baseline - m.actualBoundingBoxAscent;\n const width = m.actualBoundingBoxRight - left;\n const height = baseline + m.actualBoundingBoxDescent - top;\n return width > 0.5 && height > 0.5 ? { left, top, width, height } : null;\n}\n\n/** A canvas context set to the element's font, for `ink`; `null` where there is no canvas. */\nfunction measurer(el: HTMLElement): CanvasRenderingContext2D | null {\n const doc = el.ownerDocument;\n const style = doc.defaultView?.getComputedStyle(el);\n const ctx = doc.createElement('canvas').getContext('2d');\n if (!style || !ctx) return null;\n ctx.font = `${style.fontStyle} ${style.fontWeight} ${style.fontSize} ${style.fontFamily}`;\n return ctx;\n}\n\n/**\n * Click a line of text and its letters let go: each one drops with gravity,\n * drifts and tumbles a little on its own path, and lands on whatever already\n * lies under it, so the letters pile into a heap on the floor of a container.\n * Click again, or leave the heap for a few seconds, and every letter springs\n * back to its exact place in the line; the text is plain text again.\n *\n * No physics engine. A letter's path is gravity plus a sideways drift and a\n * spin drawn from a fixed low-discrepancy sequence by its index, so the same\n * text falls the same way every time and a spec can follow it. What falls is\n * the glyph's ink, measured from the canvas text metrics of the line's font\n * ({@link ink}), not its line box: the box is mostly air, and air boxes would\n * stack into a heap of letters hanging apart. Letters do not collide in the\n * air; they meet on the floor, which is a {@link Heap}: a row of narrow\n * columns, each remembering the top of what has landed in it, and a letter\n * lands on the highest top among the columns it covers that is under it. A\n * top above the letter's last bottom edge is a neighbour it is passing beside,\n * and is ignored: otherwise every letter landing beside one already down\n * would snap up on to it, and the heap would stack into towers in a frame. A\n * letter that lands fast hops once or twice ({@link RESTITUTION}); a slow one\n * that came down against such a neighbour slides along its surface until it\n * is clear ({@link SLIDE}), one down between two climbs out on to the taller,\n * and after {@link SLIDE_MAX} px of that a letter lies where it is. A wall of\n * the container turns the drift around. The floor and the walls are\n * the content box of `floor`'s element, measured when the fall starts.\n *\n * The line never moves. The authored nodes are moved into an invisible\n * wrapper that holds exactly their space, still the real text for a screen\n * reader and the clipboard, and the pieces, one `aria-hidden` span per\n * grapheme, are positioned from the target's own box and move by transform\n * alone, so nothing under them reflows and a button under a falling letter\n * stays clickable (`pointer-events: none`). They inherit the font and the\n * colour. When the last letter is back, the same authored node objects go\n * back where they were and the pieces are removed, so a binding inside the\n * text keeps working through the whole thing.\n *\n * One `requestAnimationFrame` loop runs only while a letter moves: it idles\n * once the heap is still and once the line is whole, and a hidden document\n * pauses it where it is. The return is a springy ease ({@link spring}) with a\n * short stagger in reading order. Nothing happens on the server, under\n * `prefers-reduced-motion: reduce`, or when the target has no box; a\n * preference that flips mid-fall puts the text back at once. Destroy puts the\n * text back, cancels the loop and drops the listener.\n *\n * The effect usually sits on its host, but a selector as the directive's value\n * points it at one descendant instead, for a paragraph a library component\n * draws (`<wr-result-404 wrFallingLetters=\".wr-result__description\">`). The\n * target is looked up once after the first render; if nothing matches, nothing\n * happens.\n */\n@Directive({\n selector: '[wrFallingLetters]',\n})\nexport class WrFallingLetters {\n /**\n * A selector for one descendant of the host whose letters fall instead of\n * the host's own, written as the directive's value:\n * `wrFallingLetters=\".wr-result__description\"`. Resolved once after the\n * first render with `querySelector`; a selector that matches nothing turns\n * the effect off. Unset or empty, the host.\n */\n readonly target = input<string | null, unknown>(null, { alias: 'wrFallingLetters', transform: optionalSelector });\n\n /**\n * A selector for the element whose content box is the floor and the walls,\n * found with `closest` from the host. Unset, the host's parent element: on\n * a `display: contents` host that is the box around it. On a `wr-*` host\n * write it as a binding (`[floor]=\"'main'\"`), since a static attribute that\n * is not one of the component's inputs fails `check:attrs`.\n */\n readonly floor = input<string | null, unknown>(null, { transform: optionalSelector });\n\n /** How long the heap lies still before the letters spring back on their own, in ms. @default 4000 */\n readonly rest = input(FALLING_LETTERS_REST, { transform: wrNumAttr(FALLING_LETTERS_REST) });\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platform = inject(WrPlatform);\n private listeners: AbortController | null = null;\n /** The element whose letters fall, once resolved; `null` before and after. */\n private el: HTMLElement | null = null;\n private state: WrFallingLettersState = 'idle';\n /** The authored children while they sit in the wrapper, else `null`. */\n private original: ChildNode[] | null = null;\n private pieces: Piece[] = [];\n private heap: Heap | null = null;\n private bounds: Bounds | null = null;\n private frame: number | null = null;\n /** The timestamp of the last frame, or `null` when the next one is the first after a start. */\n private last: number | null = null;\n /** Seconds since the current phase began, summed from frame steps, so a pause adds nothing. */\n private clock = 0;\n private timer: ReturnType<typeof setTimeout> | null = null;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/falling-letters');\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n const host = this.host.nativeElement;\n const selector = this.target();\n const el = selector ? host.querySelector<HTMLElement>(selector) : host;\n if (!el) return;\n this.el = el;\n el.classList.add('wr-falling-letters');\n this.listeners = new AbortController();\n el.addEventListener('click', () => this.toggle(), { signal: this.listeners.signal });\n });\n\n // One place decides what the loop does: reduced motion puts the text\n // back, a hidden page pauses, otherwise a phase in motion gets a frame.\n effect(() => {\n const visible = this.platform.pageVisible();\n const reduced = this.platform.prefersReducedMotion();\n untracked(() => {\n if (reduced) this.restore();\n else if (!visible) this.pause();\n else if (this.state === 'fall' || this.state === 'return') this.start();\n });\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.listeners?.abort();\n this.listeners = null;\n this.restore();\n this.el?.classList.remove('wr-falling-letters');\n this.el = null;\n });\n }\n\n /** A click: plain text falls; a heap, still or in the making, springs back; a flight back is left alone. */\n private toggle(): void {\n if (this.platform.prefersReducedMotion()) return;\n if (this.state === 'idle') this.fall();\n else if (this.state === 'fall' || this.state === 'rest') this.spring();\n }\n\n /**\n * Measure every grapheme in place, then swap in the pieces and hide the\n * line, all in one task, so the first paint shows each piece exactly over\n * its letter. The measurement wraps each grapheme in an inline-block for one\n * synchronous layout and puts the authored nodes straight back, so no frame\n * ever shows the probe.\n */\n private fall(): void {\n const el = this.el;\n if (!el) return;\n const doc = el.ownerDocument;\n const box = el.getBoundingClientRect();\n if (box.width <= 0 || box.height <= 0) return;\n\n const original = Array.from(el.childNodes);\n const wrapper = doc.createElement('span');\n wrapper.className = 'wr-falling-letters__text';\n const glyphs: { el: HTMLElement; text: string; node: Node | null }[] = [];\n for (const node of original) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n // An inline element (`<code>`, `<a>`) is one piece, a copy of the whole thing.\n const probe = doc.createElement('span');\n probe.className = 'wr-falling-letters__glyph';\n probe.append(node);\n wrapper.append(probe);\n glyphs.push({ el: probe, text: '', node });\n } else if (node.nodeType === Node.TEXT_NODE) {\n for (const grapheme of graphemes(node.textContent ?? '')) {\n if (grapheme.trim() === '') {\n wrapper.append(grapheme);\n continue;\n }\n const probe = doc.createElement('span');\n probe.className = 'wr-falling-letters__glyph';\n probe.textContent = grapheme;\n wrapper.append(probe);\n glyphs.push({ el: probe, text: grapheme, node: null });\n }\n }\n }\n el.replaceChildren(wrapper);\n\n const origin = { x: box.left + el.clientLeft, y: box.top + el.clientTop };\n const rects = glyphs.map(glyph => glyph.el.getBoundingClientRect());\n const container = this.container();\n const bounds = this.measure(container ?? el, origin, box);\n // The text's font, read once: every grapheme of the line shares it. An\n // inline element is one piece with its own font and its own box, and its\n // box (a chip, a link) is its ink.\n const ctx = measurer(el);\n\n // The authored nodes back, the same objects, in their order: the wrapper now holds the line's space.\n wrapper.replaceChildren(...original);\n\n const layer = doc.createElement('span');\n layer.className = 'wr-falling-letters__pieces';\n layer.setAttribute('aria-hidden', 'true');\n const pieces: Piece[] = [];\n glyphs.forEach((glyph, i) => {\n const rect = rects[i];\n if (rect.width <= 0 || rect.height <= 0) return;\n const piece = doc.createElement('span');\n piece.className = 'wr-falling-letters__piece';\n if (glyph.node) piece.append(glyph.node.cloneNode(true));\n else piece.textContent = glyph.text;\n const n = pieces.length;\n const body: Body = (glyph.node ? null : ink(ctx, glyph.text, rect)) ?? {\n left: 0,\n top: 0,\n width: rect.width,\n height: rect.height,\n };\n const ox = body.left + body.width / 2;\n const oy = body.top + body.height / 2;\n piece.style.transformOrigin = `${roundTo(ox, 2)}px ${roundTo(oy, 2)}px`;\n const x0 = rect.left - origin.x + ox;\n const y0 = rect.top - origin.y + oy;\n pieces.push({\n el: piece,\n bw: body.width,\n bh: body.height,\n ox,\n oy,\n x0,\n y0,\n release: (scatter(n, 0) * RELEASE) / 1000,\n cx: x0,\n cy: y0,\n angle: 0,\n vx: (scatter(n, 1) - 0.5) * 2 * DRIFT,\n vy: 0,\n spin: (scatter(n, 2) - 0.5) * 2 * SPIN,\n slide: SLIDE_MAX,\n climb: null,\n settled: false,\n fromX: x0,\n fromY: y0,\n fromAngle: 0,\n });\n layer.append(piece);\n });\n if (pieces.length === 0) {\n el.replaceChildren(...original);\n return;\n }\n\n this.original = original;\n this.pieces = pieces;\n this.heap = new Heap(bounds.minX, bounds.maxX, bounds.floor);\n this.bounds = bounds;\n for (const piece of pieces) this.paint(piece);\n el.append(layer);\n el.classList.add('wr-falling-letters--out');\n this.state = 'fall';\n this.clock = 0;\n this.start();\n }\n\n /** The element whose content box is the floor: `floor`'s closest match from the host, else the host's parent. */\n private container(): HTMLElement | null {\n const host = this.host.nativeElement;\n const selector = this.floor();\n return selector ? host.closest<HTMLElement>(selector) : host.parentElement;\n }\n\n /**\n * The floor and the walls, from the target's padding box: the container's\n * content box, and never above the line itself, so a letter always has\n * somewhere to fall.\n */\n private measure(container: HTMLElement, origin: { x: number; y: number }, box: DOMRect): Bounds {\n const rect = container.getBoundingClientRect();\n const style = container.ownerDocument.defaultView?.getComputedStyle(container);\n const pad = (value: string | undefined): number => {\n const n = value === undefined ? NaN : parseFloat(value);\n return Number.isFinite(n) ? n : 0;\n };\n const minX = rect.left + pad(style?.paddingLeft) - origin.x;\n const maxX = rect.left + rect.width - pad(style?.paddingRight) - origin.x;\n const floor = rect.top + rect.height - pad(style?.paddingBottom) - origin.y;\n return { minX: Math.min(minX, 0), maxX: Math.max(maxX, box.width), floor: Math.max(floor, box.height) };\n }\n\n /** Every letter leaves where it is, heap or mid-air, for its place in the line. */\n private spring(): void {\n this.clearTimer();\n for (const piece of this.pieces) {\n piece.fromX = piece.cx;\n piece.fromY = piece.cy;\n piece.fromAngle = piece.angle;\n }\n this.state = 'return';\n this.clock = 0;\n this.start();\n }\n\n /** Ask for a frame, unless one is pending, nothing moves or the page is hidden. */\n private start(): void {\n if (this.frame !== null || this.state === 'idle' || this.state === 'rest') return;\n if (!untracked(() => this.platform.pageVisible())) return;\n this.last = null;\n this.frame = requestAnimationFrame(t => this.tick(t));\n }\n\n /** Drop the pending frame. The pieces stay where they are, so a restart continues from them. */\n private pause(): void {\n if (this.frame === null) return;\n cancelAnimationFrame(this.frame);\n this.frame = null;\n this.last = null;\n }\n\n /**\n * Put the authored children back, the same node objects, and drop the\n * wrapper and the pieces. Idempotent: the end of the flight back, reduced\n * motion and destroy all call it.\n */\n private restore(): void {\n this.pause();\n this.clearTimer();\n this.state = 'idle';\n if (!this.original) return;\n this.el?.replaceChildren(...this.original);\n this.el?.classList.remove('wr-falling-letters--out');\n this.original = null;\n this.pieces = [];\n this.heap = null;\n this.bounds = null;\n }\n\n /**\n * One frame. The first after a start has no length, so a pause of any length\n * moves nothing when the loop resumes. The fall ends when the last letter\n * settles, and the heap lies still until a click or the rest timer; the\n * flight back ends when the last letter is home, and the text is whole again.\n */\n private tick(now: number): void {\n const dt = this.last === null ? 0 : Math.min(Math.max(0, now - this.last) / 1000, MAX_STEP);\n this.last = now;\n this.clock += dt;\n const done = this.state === 'fall' ? this.stepFall(dt) : this.stepReturn();\n if (!done) {\n this.frame = requestAnimationFrame(t => this.tick(t));\n return;\n }\n this.frame = null;\n this.last = null;\n if (this.state === 'return') {\n this.restore();\n return;\n }\n this.state = 'rest';\n this.timer = setTimeout(\n () => {\n this.timer = null;\n this.spring();\n },\n Math.max(0, this.rest())\n );\n }\n\n /** Gravity, drift, spin, the walls and the heap for every letter still in the air. True once all have settled. */\n private stepFall(dt: number): boolean {\n const heap = this.heap;\n const bounds = this.bounds;\n if (!heap || !bounds) return true;\n let settled = true;\n for (const piece of this.pieces) {\n if (piece.settled) continue;\n settled = false;\n if (this.clock < piece.release) continue;\n if (piece.climb !== null) {\n // Squeezed up from between two neighbours at the slide's pace, until\n // the body is level with the top of the taller one; then it drops on.\n const rest = piece.climb - extent(piece, piece.angle).hh;\n piece.cy = Math.max(rest, piece.cy - SLIDE * dt);\n piece.slide -= SLIDE * dt;\n if (piece.cy <= rest) piece.climb = null;\n this.paint(piece);\n continue;\n }\n const below = piece.cy + extent(piece, piece.angle).hh;\n piece.vy += GRAVITY * dt;\n piece.cx += piece.vx * dt;\n piece.cy += piece.vy * dt;\n piece.angle += piece.spin * dt;\n const { hw, hh } = extent(piece, piece.angle);\n\n if (piece.cx - hw < bounds.minX) {\n piece.cx = bounds.minX + hw;\n piece.vx = Math.abs(piece.vx) * FRICTION;\n } else if (piece.cx + hw > bounds.maxX) {\n piece.cx = bounds.maxX - hw;\n piece.vx = -Math.abs(piece.vx) * FRICTION;\n }\n\n const top = heap.top(piece.cx - hw, piece.cx + hw, below - SLACK);\n if (piece.cy + hh >= top) {\n piece.cy = top - hh;\n if (piece.vy > BOUNCE_MIN) {\n piece.vy = -piece.vy * RESTITUTION;\n piece.vx *= FRICTION;\n piece.spin *= FRICTION;\n } else {\n piece.vy = 0;\n piece.spin = 0;\n const beside = piece.slide > 0 ? heap.beside(piece.cx - hw, piece.cx + hw, piece.cy + hh) : null;\n if (beside && beside.left > 0 && beside.right > 0) {\n // Down between two neighbours: climb out, to the top of the taller.\n piece.vx = 0;\n piece.climb = heap.top(piece.cx - hw, piece.cx + hw);\n } else if (beside) {\n // Down against a neighbour that is already there: slide along the\n // surface until clear of it, as letters landing on one another do,\n // instead of lying inside it or jumping up on to it.\n piece.vx = (beside.left > 0 ? 1 : -1) * SLIDE;\n piece.slide -= SLIDE * dt;\n } else {\n piece.vx = 0;\n piece.settled = true;\n // The heap learns of the letter once it lies still, not at first\n // touch: a letter that touched down, hopped and came to rest a step\n // away would leave a top in the air for the next one to hang on.\n heap.settle(piece.cx - hw, piece.cx + hw, piece.cy - hh);\n }\n }\n }\n this.paint(piece);\n }\n return settled;\n }\n\n /** Each letter springs from where it left toward its place, in reading order. True once all are home. */\n private stepReturn(): boolean {\n const count = this.pieces.length;\n const gap = Math.min(RETURN_GAP, RETURN_SPREAD / Math.max(1, count - 1)) / 1000;\n let home = true;\n this.pieces.forEach((piece, i) => {\n const t = (this.clock - i * gap) / (RETURN / 1000);\n if (t < 0) {\n home = false;\n return;\n }\n const s = spring(t);\n piece.cx = piece.fromX + (piece.x0 - piece.fromX) * s;\n piece.cy = piece.fromY + (piece.y0 - piece.fromY) * s;\n piece.angle = piece.fromAngle * (1 - s);\n if (t < 1) home = false;\n this.paint(piece);\n });\n return home;\n }\n\n /** Written to the DOM by hand: a binding would wait for change detection, and this is every frame. */\n private paint(piece: Piece): void {\n const x = roundTo(piece.cx - piece.ox, 2);\n const y = roundTo(piece.cy - piece.oy, 2);\n const angle = roundTo(piece.angle, 2);\n piece.el.style.transform = `translate(${x}px, ${y}px) rotate(${angle}deg)`;\n }\n\n private clearTimer(): void {\n if (this.timer !== null) clearTimeout(this.timer);\n this.timer = null;\n }\n}\n\nexport {\n BOUNCE_MIN,\n COLUMN,\n DRIFT,\n FALLING_LETTERS_REST,\n GRAVITY,\n Heap,\n RELEASE,\n RESTITUTION,\n RETURN,\n RETURN_GAP,\n RETURN_SPREAD,\n SLACK,\n SLIDE,\n SLIDE_MAX,\n SPIN,\n ink,\n scatter,\n spring,\n};\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nexport { WrFallingLetters } from './falling-letters';\nexport type { WrFallingLettersState } from './types';\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAM,uBAAuB;AAG7B,MAAM,UAAU;AAehB,MAAM,cAAc;AAMpB,MAAM,WAAW;AAWjB,MAAM,cAAc,MAAM,KAAK;AAG/B,MAAM,WAAW;AAMjB,MAAM,QAAQ;AAad,MAAM,UAAU;CAAC;CAAuB;CAAuB;AAAqB;AAGpF,SAAS,QAAQ,GAAW,GAAY;CACtC,MAAM,KAAM,IAAI,KAAK,QAAQ,KAAM;CACnC,OAAO,IAAI,IAAI,IAAI,IAAI;AACzB;AAMA,SAAS,OAAO,GAAS;CACvB,IAAI,KAAK,GAAG,OAAO;CACnB,IAAI,KAAK,GAAG,OAAO;CACnB,OAAO,IAAI,KAAK,IAAI,KAAe,CAAC,IAAI,KAAK,IAAI,cAAc,CAAC;AAClE;AASA,IAAM,OAAN,MAAU;CAKW;CAEA;CANF;CAGjB,YACmB,MACjB,IACiB,OAAa;EAFb,KAAA,OAAA;EAEA,KAAA,QAAA;EAEjB,KAAK,OAAO,IAAI,aAAa,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,QAAA,CAAc,C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M,aAAa,KAAK,KAAK;EAChD,KAAK,QAAQ;CACf;CAvZW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAgB,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAhB,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAgB,cAAA;EAAA,UAAA;EAAA,QAAA;GAAA,QAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,OAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,MAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,UAAA;CAAA,CAAA;;AAAhB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAgB,YAAA,CAAA;EAH5B,MAAA;EAAU,MAAA,CAAA,EACT,UAAU,qBACX,CAAA"}
@@ -1,10 +1,10 @@
1
+ import "./internal-BaQU4t_0.mjs";
1
2
  import * as i0 from "@angular/core";
2
3
  import { Component, DestroyRef, ElementRef, PLATFORM_ID, ViewEncapsulation, afterNextRender, booleanAttribute, computed, effect, inject, input, untracked, viewChild } from "@angular/core";
3
4
  import { DOCUMENT as DOCUMENT$1, isPlatformBrowser } from "@angular/common";
4
- import { numAttr, resolveCssColorChannels, watchColorScheme, wrCheckStyles } from "ngwr/utils";
5
+ import { wrCheckStyles, wrNumAttr, wrResolveCssColorChannels, wrWatchColorScheme } from "ngwr/utils";
5
6
  import { WrPlatform } from "ngwr/platform";
6
7
  import { Directionality } from "@angular/cdk/bidi";
7
- import { FRAME_FLOOR_SLACK, MAX_DPR, MAX_FRAME_MS } from "ngwr/animations/core";
8
8
  /**
9
9
  * @license
10
10
  *
@@ -158,7 +158,7 @@ function flowIntroHead(elapsed, length) {
158
158
  }
159
159
  function flowRatio(width, height, devicePixelRatio) {
160
160
  const area = Math.max(1, width * height);
161
- return Math.max(1, Math.min(MAX_DPR, devicePixelRatio, Math.sqrt(PIXELS / area)));
161
+ return Math.max(1, Math.min(2, devicePixelRatio, Math.sqrt(PIXELS / area)));
162
162
  }
163
163
  function flowFrameMs(live) {
164
164
  return live ? 0 : REST_FRAME_MS;
@@ -484,36 +484,36 @@ const INK_DARK = .26;
484
484
  var WrFlowLines = class WrFlowLines {
485
485
  spacing = input(10, {
486
486
  ...ngDevMode ? { debugName: "spacing" } : /* istanbul ignore next */ {},
487
- transform: numAttr(10)
487
+ transform: wrNumAttr(10)
488
488
  });
489
489
  lineWidth = input(1, {
490
490
  ...ngDevMode ? { debugName: "lineWidth" } : /* istanbul ignore next */ {},
491
- transform: numAttr(1)
491
+ transform: wrNumAttr(1)
492
492
  });
493
493
  amplitude = input(28, {
494
494
  ...ngDevMode ? { debugName: "amplitude" } : /* istanbul ignore next */ {},
495
- transform: numAttr(28)
495
+ transform: wrNumAttr(28)
496
496
  });
497
497
  orientation = input("horizontal", ...ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []);
498
498
  twist = input(0, {
499
499
  ...ngDevMode ? { debugName: "twist" } : /* istanbul ignore next */ {},
500
- transform: numAttr(0)
500
+ transform: wrNumAttr(0)
501
501
  });
502
502
  speed = input(1, {
503
503
  ...ngDevMode ? { debugName: "speed" } : /* istanbul ignore next */ {},
504
- transform: numAttr(1)
504
+ transform: wrNumAttr(1)
505
505
  });
506
506
  reach = input(160, {
507
507
  ...ngDevMode ? { debugName: "reach" } : /* istanbul ignore next */ {},
508
- transform: numAttr(160)
508
+ transform: wrNumAttr(160)
509
509
  });
510
510
  push = input(1, {
511
511
  ...ngDevMode ? { debugName: "push" } : /* istanbul ignore next */ {},
512
- transform: numAttr(1)
512
+ transform: wrNumAttr(1)
513
513
  });
514
514
  bounce = input(1, {
515
515
  ...ngDevMode ? { debugName: "bounce" } : /* istanbul ignore next */ {},
516
- transform: numAttr(1)
516
+ transform: wrNumAttr(1)
517
517
  });
518
518
  ripple = input(true, {
519
519
  ...ngDevMode ? { debugName: "ripple" } : /* istanbul ignore next */ {},
@@ -620,7 +620,7 @@ var WrFlowLines = class WrFlowLines {
620
620
  this.mirrored();
621
621
  untracked(() => this.still());
622
622
  });
623
- watchColorScheme(() => {
623
+ wrWatchColorScheme(() => {
624
624
  this.resolveColors();
625
625
  this.still();
626
626
  });
@@ -734,9 +734,9 @@ var WrFlowLines = class WrFlowLines {
734
734
  resolveColors() {
735
735
  if (!this.renderer) return;
736
736
  const canvas = this.canvasRef().nativeElement;
737
- this.frame.color.set(resolveCssColorChannels(canvas, "var(--wr-flow-lines-color)", "#6b7280"));
738
- this.frame.accent.set(resolveCssColorChannels(canvas, "var(--wr-flow-lines-accent)", "#3969e2"));
739
- const light = flowInk(resolveCssColorChannels(canvas, "var(--wr-color-surface)", "#ffffff"));
737
+ this.frame.color.set(wrResolveCssColorChannels(canvas, "var(--wr-flow-lines-color)", "#6b7280"));
738
+ this.frame.accent.set(wrResolveCssColorChannels(canvas, "var(--wr-flow-lines-accent)", "#3969e2"));
739
+ const light = flowInk(wrResolveCssColorChannels(canvas, "var(--wr-color-surface)", "#ffffff"));
740
740
  this.frame.ink = light ? INK_LIGHT : INK_DARK;
741
741
  }
742
742
  at(event) {
@@ -801,11 +801,11 @@ var WrFlowLines = class WrFlowLines {
801
801
  this.rafId = null;
802
802
  if (!this.running) return;
803
803
  const floor = flowFrameMs(this.live());
804
- if (floor > 0 && now - this.lastFrame + FRAME_FLOOR_SLACK < floor) {
804
+ if (floor > 0 && now - this.lastFrame + 2 < floor) {
805
805
  this.rafId = requestAnimationFrame(this.frameLoop);
806
806
  return;
807
807
  }
808
- const dt = Math.min(Math.max(now - this.lastFrame, 0), MAX_FRAME_MS) / 1e3;
808
+ const dt = Math.min(Math.max(now - this.lastFrame, 0), 50) / 1e3;
809
809
  this.lastFrame = now;
810
810
  this.advance(performance.now() / 1e3, dt);
811
811
  this.draw();