ngwr 15.9.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 (375) 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 +231 -27
  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/schematics/icon-set/index.js +3 -3
  302. package/schematics/migrations/v16/index.js +742 -0
  303. package/schematics/migrations.json +5 -0
  304. package/schematics/ng-add/index.js +4 -4
  305. package/schematics/provider/index.js +4 -4
  306. package/schematics/use/symbol-map.json +2 -0
  307. package/select/styles/_index.scss +1 -1
  308. package/skills/ngwr/SKILL.md +6 -4
  309. package/skills/ngwr/references/catalog.md +4 -2
  310. package/skills/ngwr/references/setup.md +10 -9
  311. package/table/styles/_index.scss +85 -29
  312. package/toast/styles/_index.scss +30 -0
  313. package/tree/styles/_index.scss +17 -0
  314. package/types/index-CXbgza47.d.ts +13 -0
  315. package/types/ngwr-animations-aurora.d.ts +1 -1
  316. package/types/ngwr-animations-blur-reveal.d.ts +2 -2
  317. package/types/ngwr-animations-dot-grid.d.ts +1 -2
  318. package/types/ngwr-animations-flow-lines.d.ts +1 -1
  319. package/types/ngwr-animations-fluid-cursor.d.ts +1 -1
  320. package/types/ngwr-animations-reveal.d.ts +4 -8
  321. package/types/ngwr-animations-ripple-grid.d.ts +1 -1
  322. package/types/ngwr-animations-spotlight.d.ts +1 -1
  323. package/types/ngwr-animations-thread-lines.d.ts +1 -1
  324. package/types/ngwr-animations-tilt.d.ts +1 -1
  325. package/types/ngwr-avatar.d.ts +2 -2
  326. package/types/ngwr-badge.d.ts +1 -1
  327. package/types/ngwr-cascader.d.ts +12 -1
  328. package/types/ngwr-charts-boxplot-chart.d.ts +1 -1
  329. package/types/ngwr-charts-bullet-chart.d.ts +2 -2
  330. package/types/ngwr-charts-candlestick-chart.d.ts +1 -1
  331. package/types/ngwr-charts-core.d.ts +12 -12
  332. package/types/ngwr-charts-line-chart.d.ts +2 -2
  333. package/types/ngwr-charts-radar-chart.d.ts +1 -1
  334. package/types/ngwr-charts-scatter-chart.d.ts +2 -2
  335. package/types/ngwr-charts-waterfall-chart.d.ts +1 -1
  336. package/types/ngwr-color-picker.d.ts +12 -12
  337. package/types/ngwr-copy-value-testing.d.ts +87 -0
  338. package/types/ngwr-copy-value.d.ts +95 -0
  339. package/types/ngwr-date-picker-testing.d.ts +3 -3
  340. package/types/ngwr-date-picker.d.ts +97 -1
  341. package/types/ngwr-date.d.ts +44 -3
  342. package/types/ngwr-dialog.d.ts +50 -3
  343. package/types/ngwr-directives.d.ts +40 -0
  344. package/types/ngwr-drawer.d.ts +1 -1
  345. package/types/ngwr-dropdown.d.ts +3 -2
  346. package/types/ngwr-hotkey.d.ts +5 -5
  347. package/types/ngwr-i18n.d.ts +3 -3
  348. package/types/ngwr-icon.d.ts +26 -26
  349. package/types/ngwr-input-number.d.ts +2 -2
  350. package/types/ngwr-input.d.ts +8 -8
  351. package/types/ngwr-load-state.d.ts +6 -6
  352. package/types/ngwr-meta.d.ts +18 -0
  353. package/types/ngwr-pipes.d.ts +6 -4
  354. package/types/ngwr-platform.d.ts +2 -1
  355. package/types/ngwr-popconfirm.d.ts +3 -2
  356. package/types/ngwr-popover.d.ts +4 -3
  357. package/types/ngwr-select.d.ts +33 -18
  358. package/types/ngwr-slider-testing.d.ts +2 -2
  359. package/types/ngwr-slider.d.ts +3 -3
  360. package/types/ngwr-statistic.d.ts +5 -1
  361. package/types/ngwr-storage.d.ts +1 -1
  362. package/types/ngwr-table-testing.d.ts +2 -1
  363. package/types/ngwr-table.d.ts +136 -11
  364. package/types/ngwr-tabs.d.ts +10 -2
  365. package/types/ngwr-toast-testing.d.ts +6 -2
  366. package/types/ngwr-toast.d.ts +33 -5
  367. package/types/ngwr-transfer.d.ts +5 -0
  368. package/types/ngwr-tree.d.ts +22 -2
  369. package/types/ngwr-utils.d.ts +157 -82
  370. package/types/ngwr-validators.d.ts +4 -2
  371. package/types/ngwr-version.d.ts +1 -1
  372. package/types/ngwr.d.ts +1 -0
  373. package/types/pointer-tracker-D7fXxLQL.d.ts +24 -0
  374. package/fesm2022/ngwr-animations-core.mjs.map +0 -1
  375. package/types/ngwr-animations-core.d.ts +0 -294
@@ -1,10 +1,10 @@
1
+ import { s as seededRandom } from "./internal-BaQU4t_0.mjs";
1
2
  import * as i0 from "@angular/core";
2
3
  import { Component, DestroyRef, ElementRef, PLATFORM_ID, ViewEncapsulation, afterNextRender, 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, seededRandom } from "ngwr/animations/core";
8
8
  /**
9
9
  * @license
10
10
  *
@@ -96,7 +96,7 @@ function threadSpringStill(spring) {
96
96
  }
97
97
  function threadRatio(width, height, devicePixelRatio) {
98
98
  const area = Math.max(1, width * height);
99
- return Math.max(1, Math.min(MAX_DPR, devicePixelRatio, Math.sqrt(PIXELS / area)));
99
+ return Math.max(1, Math.min(2, devicePixelRatio, Math.sqrt(PIXELS / area)));
100
100
  }
101
101
  function threadFrameMs(parting) {
102
102
  return parting ? 0 : REST_FRAME_MS;
@@ -397,31 +397,31 @@ const INK_DARK = [.75, .07];
397
397
  var WrThreadLines = class WrThreadLines {
398
398
  count = input(72, {
399
399
  ...ngDevMode ? { debugName: "count" } : /* istanbul ignore next */ {},
400
- transform: numAttr(72)
400
+ transform: wrNumAttr(72)
401
401
  });
402
402
  thickness = input(1, {
403
403
  ...ngDevMode ? { debugName: "thickness" } : /* istanbul ignore next */ {},
404
- transform: numAttr(1)
404
+ transform: wrNumAttr(1)
405
405
  });
406
406
  amplitude = input(16, {
407
407
  ...ngDevMode ? { debugName: "amplitude" } : /* istanbul ignore next */ {},
408
- transform: numAttr(16)
408
+ transform: wrNumAttr(16)
409
409
  });
410
410
  speed = input(1, {
411
411
  ...ngDevMode ? { debugName: "speed" } : /* istanbul ignore next */ {},
412
- transform: numAttr(1)
412
+ transform: wrNumAttr(1)
413
413
  });
414
414
  fray = input(1, {
415
415
  ...ngDevMode ? { debugName: "fray" } : /* istanbul ignore next */ {},
416
- transform: numAttr(1)
416
+ transform: wrNumAttr(1)
417
417
  });
418
418
  angle = input(-6, {
419
419
  ...ngDevMode ? { debugName: "angle" } : /* istanbul ignore next */ {},
420
- transform: numAttr(-6)
420
+ transform: wrNumAttr(-6)
421
421
  });
422
422
  parting = input(1, {
423
423
  ...ngDevMode ? { debugName: "parting" } : /* istanbul ignore next */ {},
424
- transform: numAttr(1)
424
+ transform: wrNumAttr(1)
425
425
  });
426
426
  host = inject(ElementRef);
427
427
  platform = inject(WrPlatform);
@@ -516,7 +516,7 @@ var WrThreadLines = class WrThreadLines {
516
516
  this.angle();
517
517
  untracked(() => this.still());
518
518
  });
519
- watchColorScheme(() => {
519
+ wrWatchColorScheme(() => {
520
520
  this.resolveColors();
521
521
  this.still();
522
522
  });
@@ -632,9 +632,9 @@ var WrThreadLines = class WrThreadLines {
632
632
  resolveColors() {
633
633
  if (!this.renderer) return;
634
634
  const canvas = this.canvasRef().nativeElement;
635
- this.frame.color.set(resolveCssColorChannels(canvas, "var(--wr-thread-lines-color)", "#6b7280"));
636
- this.frame.accent.set(resolveCssColorChannels(canvas, "var(--wr-thread-lines-accent)", "#3969e2"));
637
- const ink = threadInk(resolveCssColorChannels(canvas, "var(--wr-color-surface)", "#ffffff")) ? INK_LIGHT : INK_DARK;
635
+ this.frame.color.set(wrResolveCssColorChannels(canvas, "var(--wr-thread-lines-color)", "#6b7280"));
636
+ this.frame.accent.set(wrResolveCssColorChannels(canvas, "var(--wr-thread-lines-accent)", "#3969e2"));
637
+ const ink = threadInk(wrResolveCssColorChannels(canvas, "var(--wr-color-surface)", "#ffffff")) ? INK_LIGHT : INK_DARK;
638
638
  this.frame.core = ink[0];
639
639
  this.frame.glow = ink[1];
640
640
  }
@@ -686,11 +686,11 @@ var WrThreadLines = class WrThreadLines {
686
686
  this.rafId = null;
687
687
  if (!this.running) return;
688
688
  const floor = threadFrameMs(this.parted());
689
- if (floor > 0 && now - this.lastFrame + FRAME_FLOOR_SLACK < floor) {
689
+ if (floor > 0 && now - this.lastFrame + 2 < floor) {
690
690
  this.rafId = requestAnimationFrame(this.frameLoop);
691
691
  return;
692
692
  }
693
- const dt = Math.min(Math.max(now - this.lastFrame, 0), MAX_FRAME_MS) / 1e3;
693
+ const dt = Math.min(Math.max(now - this.lastFrame, 0), 50) / 1e3;
694
694
  this.lastFrame = now;
695
695
  this.advance(dt);
696
696
  this.draw();
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-animations-thread-lines.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/animations/thread-lines/thread-model.ts","../../../projects/lib/animations/thread-lines/thread-gl.ts","../../../projects/lib/animations/thread-lines/thread-lines.ts","../../../projects/lib/animations/thread-lines/thread-lines.html","../../../projects/lib/animations/thread-lines/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 { MAX_DPR, seededRandom } from 'ngwr/animations/core';\n\n/**\n * The pure side of `<wr-thread-lines>`: how the strands are laid across the\n * bundle, how the bundle opens along its length, how the pointer parts it and\n * how that parting eases, how big the canvas is and how often it is drawn.\n * The shader in `thread-gl.ts` reads the numbers from here as uniforms and as\n * a per-strand texture; it owns only what has to be per pixel.\n */\n\n/** The strands are laid from this seed, so two mounts and every spec see one ribbon. */\nconst SEED = 0x51c4e7;\n/** The shader's loop bound: `count` is capped here. */\nconst COUNT_MAX = 128;\n/** The gathered end's half width: this much of the height, never under the floor, in CSS px. */\nconst GATHER = 0.012;\nconst GATHER_MIN = 3;\n/** How far a unit `fray` opens the far end's half width, as a share of the height. */\nconst SPREAD = 0.42;\n/** How the bundle opens along its length: above one it stays a cord for a while, then lets go. */\nconst FRAY_POWER = 1.7;\n/** A strand's slot is nudged by up to this much of the gap to its neighbour. */\nconst JITTER = 0.4;\n/** The travelling wave's phase lags this far, in radians, from the bundle's middle to its edge. */\nconst WAVE_LAG = 1.1;\n/** On top of the lag each strand is off by up to this, in radians, so neighbours are almost in step. */\nconst WAVE_SCATTER = 0.18;\n/** A strand's own path bends through this many to this many radians along the length. */\nconst PATH_TURNS_MIN = 1.6;\nconst PATH_TURNS_MAX = 3.4;\n/** A strand shows between this much and all of its brightness, from its seed. */\nconst GAIN_MIN = 0.55;\n/** The parting's reach stretches this far along the ribbon for every px across it. */\nconst PART_STRETCH = 1.7;\n/** How many frames a second at rest, and the gap between them, in ms: the waves need no more. */\nconst REST_FPS = 30;\nconst REST_FRAME_MS = 1000 / REST_FPS;\n/**\n * The parting's spring: how fast it closes on its target, per second, and how\n * damped it is. Under one it overshoots a little on the way back, the slight\n * elastic return of silk let go.\n */\nconst SPRING_RATE = 9;\nconst SPRING_DAMPING = 0.72;\n/** The parting's centre follows the pointer at this rate, critically damped. */\nconst FOLLOW_RATE = 18;\n/** Under this a spring's value and speed count as at rest. */\nconst SPRING_EPS = 0.002;\n/**\n * The most device px the canvas holds: the shader walks every strand per\n * pixel, so this is what bounds its cost. Under the backdrops' shared budget:\n * a hairline at two device px per CSS px is sharper, but not at this price.\n */\nconst PIXELS = 2_000_000;\n\n/** Floats per strand in {@link threadStrands}' output. */\nconst STRAND_STRIDE = 6;\n/** Rows in the strand texture: the slot and gains, then the wave's phase. */\nconst TEXTURE_ROWS = 2;\n\n/**\n * The strands of a bundle of `count`, {@link STRAND_STRIDE} floats each:\n *\n * - `slot`, where the strand sits across the bundle, -1 at one edge to 1 at\n * the other, evenly spaced with a little seeded jitter;\n * - `gain`, how bright it is, {@link GAIN_MIN} to 1;\n * - `turns`, how many radians its own path bends through along the length;\n * - `phase`, where that path starts, 0 to 2pi;\n * - `cos` and `sin` of its travelling-wave lag, {@link WAVE_LAG} times its\n * slot plus up to {@link WAVE_SCATTER} of scatter, so the shader adds the\n * lag to the wave with no trigonometry of its own.\n *\n * Pure: the same `count` and `seed` give the same strands.\n */\nfunction threadStrands(count: number, seed = SEED): Float32Array<ArrayBuffer> {\n const n = threadCount(count);\n const random = seededRandom(seed);\n const out = new Float32Array(n * STRAND_STRIDE);\n for (let i = 0; i < n; i++) {\n const slot = ((i + 0.5 + (random() * 2 - 1) * JITTER) / n) * 2 - 1;\n const gain = GAIN_MIN + (1 - GAIN_MIN) * random();\n const turns = PATH_TURNS_MIN + (PATH_TURNS_MAX - PATH_TURNS_MIN) * random();\n const phase = random() * Math.PI * 2;\n const lag = WAVE_LAG * slot + (random() * 2 - 1) * WAVE_SCATTER;\n const base = i * STRAND_STRIDE;\n out[base] = slot;\n out[base + 1] = gain;\n out[base + 2] = turns;\n out[base + 3] = phase;\n out[base + 4] = Math.cos(lag);\n out[base + 5] = Math.sin(lag);\n }\n return out;\n}\n\n/** `count` as the shader takes it: a whole number, one at least, {@link COUNT_MAX} at most. */\nfunction threadCount(count: number): number {\n return Math.min(COUNT_MAX, Math.max(1, Math.round(count) || 1));\n}\n\n/**\n * The strands as the texture the shader reads them from: `count` texels wide,\n * {@link TEXTURE_ROWS} high, RGBA bytes. Row 0 holds the slot in sixteen bits\n * (red high, green low), the gain and the turns as a share of\n * {@link PATH_TURNS_MAX}; row 1 the phase as a share of 2pi and the lag's\n * cos and sin lifted into 0..1. Bytes, since a float texture is an extension\n * WebGL1 may not have, and a slot a quarter of a per-mille across is finer\n * than a pixel.\n */\nfunction threadStrandTexture(strands: Float32Array): Uint8Array<ArrayBuffer> {\n const n = strands.length / STRAND_STRIDE;\n const out = new Uint8Array(n * TEXTURE_ROWS * 4);\n const byte = (value: number): number => Math.round(Math.min(1, Math.max(0, value)) * 255);\n for (let i = 0; i < n; i++) {\n const base = i * STRAND_STRIDE;\n const slot = Math.round(((strands[base] + 1) / 2) * 65535);\n const row0 = i * 4;\n out[row0] = Math.floor(slot / 256);\n out[row0 + 1] = slot % 256;\n out[row0 + 2] = byte(strands[base + 1]);\n out[row0 + 3] = byte(strands[base + 2] / PATH_TURNS_MAX);\n const row1 = (n + i) * 4;\n out[row1] = byte(strands[base + 3] / (Math.PI * 2));\n out[row1 + 1] = byte((strands[base + 4] + 1) / 2);\n out[row1 + 2] = byte((strands[base + 5] + 1) / 2);\n out[row1 + 3] = 255;\n }\n return out;\n}\n\n/** The bundle's half width at the gathered end and how far it opens by the far end, in CSS px, for a region `height` tall. */\ninterface ThreadWidths {\n readonly gather: number;\n readonly spread: number;\n}\n\n/** How wide the bundle is for a region `height` tall under `fray`: a cord at the start, `fray` times {@link SPREAD} of the height wider at the end. */\nfunction threadWidths(height: number, fray: number): ThreadWidths {\n const gather = Math.max(GATHER_MIN, GATHER * height);\n return { gather, spread: Math.max(0, fray) * SPREAD * height };\n}\n\n/**\n * The bundle's half width `u` (0..1) of the way along, in CSS px: the\n * {@link threadWidths} opened along the fray curve, `u` to the\n * {@link FRAY_POWER}, so the strands hold together for a while and then part.\n * The shader has the same curve.\n */\nfunction threadHalfWidth(u: number, widths: ThreadWidths): number {\n const t = Math.min(1, Math.max(0, u));\n return widths.gather + widths.spread * t ** FRAY_POWER;\n}\n\n/**\n * How long the ribbon is: the region's extent along its own axis, turned by\n * `angle` radians, so the gathered end and the frayed one both reach the\n * region's edge whatever the tilt.\n */\nfunction threadLength(width: number, height: number, angle: number): number {\n return Math.abs(width * Math.cos(angle)) + Math.abs(height * Math.sin(angle));\n}\n\n/**\n * How far a strand `across` px from the pointer across the ribbon and `along`\n * px from it along the ribbon is pushed, as a share of the parting's full\n * push: whole at the pointer, falling smoothly, as a squared bell, to nothing\n * at `radius` across or {@link PART_STRETCH} times that along, so the gap is\n * a lens drawn out along the threads. The shader has the same bell.\n */\nfunction threadParting(across: number, along: number, radius: number): number {\n if (radius <= 0) return 0;\n const q = Math.hypot(across / radius, along / (radius * PART_STRETCH));\n if (q >= 1) return 0;\n const bell = 1 - q * q;\n return bell * bell;\n}\n\n/** A damped spring's value and speed. */\ninterface ThreadSpring {\n value: number;\n speed: number;\n}\n\n/** A spring step never covers more than this much of a period at once: semi-implicit Euler is stable well under it. */\nconst SPRING_SUBSTEP = 0.25;\n\n/**\n * `spring` moved `dt` seconds toward `target` at `rate` per second under\n * `damping`: critically damped at one, so it never overshoots; under one it\n * swings a little past and back. Semi-implicit Euler in substeps no longer\n * than {@link SPRING_SUBSTEP} of the rate, so a long frame (a throttled tab,\n * a slow screen) moves the spring the same way as many short ones instead of\n * flinging it; it reaches the target to {@link SPRING_EPS}.\n */\nfunction threadSpringStep(spring: ThreadSpring, target: number, dt: number, rate: number, damping: number): void {\n const steps = Math.max(1, Math.ceil((rate * dt) / SPRING_SUBSTEP));\n const h = dt / steps;\n for (let i = 0; i < steps; i++) {\n const gap = target - spring.value;\n spring.speed += (gap * rate * rate - 2 * damping * rate * spring.speed) * h;\n spring.value += spring.speed * h;\n }\n if (Math.abs(target - spring.value) < SPRING_EPS && Math.abs(spring.speed) < SPRING_EPS * rate) {\n spring.value = target;\n spring.speed = 0;\n }\n}\n\n/** Whether the parting is at rest at nothing: no gap and nothing moving. */\nfunction threadSpringStill(spring: ThreadSpring): boolean {\n return spring.value === 0 && spring.speed === 0;\n}\n\n/**\n * How many device px per CSS px the canvas renders at: the device's ratio,\n * capped at {@link MAX_DPR} and by {@link PIXELS}, never under one.\n */\nfunction threadRatio(width: number, height: number, devicePixelRatio: number): number {\n const area = Math.max(1, width * height);\n return Math.max(1, Math.min(MAX_DPR, devicePixelRatio, Math.sqrt(PIXELS / area)));\n}\n\n/**\n * The least time between two frames, in ms: {@link REST_FRAME_MS} while only\n * the waves move, since they are slow; none while the parting is live, since\n * a gap that follows the pointer at thirty frames a second stutters.\n */\nfunction threadFrameMs(parting: boolean): number {\n return parting ? 0 : REST_FRAME_MS;\n}\n\n/** Whether `surface` is light, so the strands are laid as ink on it rather than lit over it. */\nfunction threadInk(surface: ArrayLike<number>): boolean {\n return 0.2126 * surface[0] + 0.7152 * surface[1] + 0.0722 * surface[2] > 0.5;\n}\n\nexport {\n COUNT_MAX,\n FOLLOW_RATE,\n FRAY_POWER,\n GAIN_MIN,\n GATHER,\n GATHER_MIN,\n JITTER,\n PART_STRETCH,\n PATH_TURNS_MAX,\n PATH_TURNS_MIN,\n PIXELS,\n REST_FRAME_MS,\n SEED,\n SPREAD,\n SPRING_DAMPING,\n SPRING_EPS,\n SPRING_RATE,\n SPRING_SUBSTEP,\n STRAND_STRIDE,\n TEXTURE_ROWS,\n WAVE_LAG,\n WAVE_SCATTER,\n threadCount,\n threadFrameMs,\n threadHalfWidth,\n threadInk,\n threadLength,\n threadParting,\n threadRatio,\n threadSpringStep,\n threadSpringStill,\n threadStrandTexture,\n threadStrands,\n threadWidths,\n};\nexport type { ThreadSpring, ThreadWidths };\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\nimport { COUNT_MAX, PART_STRETCH, PATH_TURNS_MAX, TEXTURE_ROWS } from './thread-model';\n\n/**\n * The one pass `<wr-thread-lines>` draws: a full-screen quad whose fragment\n * shader walks every strand of the bundle and adds up how much of each lies\n * under the pixel. A strand is a curve across the region, defined where it is\n * sampled rather than as geometry: its place across the bundle (its slot)\n * times the bundle's half width at that point along, plus a path of its own\n * that opens with the fray, plus the travelling wave the whole bundle rides,\n * lagged a little by slot so neighbours move almost together, plus the push\n * of the pointer. The pixel's distance to the curve, in device px, is turned\n * into a crisp anti-aliased core and a faint wider glow; the colour is the\n * main one in the middle of the bundle and the accent toward its edges; the\n * sum is laid as straight coverage, so it reads as ink on a light surface\n * and as light on a dark one.\n *\n * The per-strand constants come in as a byte texture written by the model\n * (`threadStrandTexture`), so a frame uploads a handful of uniforms and\n * nothing else. GLSL ES 1.00, which WebGL1 and WebGL2 both accept; the loop\n * bound is the model's `COUNT_MAX`, with a break at the live count.\n */\n\ntype ThreadGLContext = WebGLRenderingContext | WebGL2RenderingContext;\n\n/** What one frame needs, every length in CSS px unless said otherwise. */\ninterface ThreadFrame {\n /** The canvas, in device px. */\n width: number;\n height: number;\n /** CSS px per device px: the inverse of the render ratio. */\n scale: number;\n /** The region's CSS size. */\n regionWidth: number;\n regionHeight: number;\n /** The ribbon's tilt, as its axis's cos and sin, and the ribbon's length along that axis. */\n cos: number;\n sin: number;\n length: number;\n /** -1 under RTL, so the gathered end sits at the inline start; 1 otherwise. */\n mirror: number;\n /** The bundle's half width at the gathered end and how far it opens by the far end, and the fray curve's power. */\n gather: number;\n spread: number;\n power: number;\n /** Where the bundle's centre line sits across the region at the gathered end and at the far one, from the region's middle. */\n centreStart: number;\n centreEnd: number;\n /** How far a strand's own path bends at the far end. */\n path: number;\n /** The travelling wave: its height, the two harmonics' wavenumbers (radians per unit length) and their phases now. */\n amplitude: number;\n wave1: number;\n wave2: number;\n phase1: number;\n phase2: number;\n /** A strand's half thickness in device px, and how many strands are live. */\n thickness: number;\n count: number;\n /** The main and the accent colour, 0..1 sRGB. */\n color: Float32Array;\n accent: Float32Array;\n /** How much of the core's colour a strand lays, and how much glow it has at its edge. */\n core: number;\n glow: number;\n /** Where the parting is centred along and across the ribbon, how far it pushes at its heart and how far it reaches. */\n pointerAlong: number;\n pointerAcross: number;\n push: number;\n radius: number;\n}\n\ninterface ThreadRenderer {\n /** The strands' constants, `count` texels wide, as `threadStrandTexture` lays them. */\n strands(data: Uint8Array, count: number): void;\n /** Draws the frame onto the canvas. */\n render(frame: ThreadFrame): void;\n /** Frees the program, the quad and the texture. */\n destroy(): void;\n}\n\nconst VERTEX = `\nattribute vec2 aPosition;\nvoid main () {\n gl_Position = vec4(aPosition, 0.0, 1.0);\n}`;\n\n/**\n * The one fragment pass. `u` runs 0 at the gathered end to 1 at the far\n * edge; `across` is the pixel's offset from the ribbon's axis. Every strand\n * is evaluated at the pixel's `u`, the distance to it taken across the\n * ribbon, and the coverage summed; the output is premultiplied.\n */\nconst FRAGMENT = `\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nconst int COUNT_MAX = ${COUNT_MAX};\nconst float TWO_PI = 6.283185307;\nconst float TURNS_MAX = ${PATH_TURNS_MAX.toFixed(3)};\nconst float STRETCH = ${PART_STRETCH.toFixed(3)};\nuniform vec2 uSize;\nuniform float uScale;\nuniform vec3 uAxis;\nuniform float uMirror;\nuniform vec3 uWidths;\nuniform vec2 uCentre;\nuniform float uPath;\nuniform vec3 uWave;\nuniform vec2 uPhase;\nuniform float uThickness;\nuniform float uCount;\nuniform sampler2D uStrands;\nuniform vec3 uColor;\nuniform vec3 uAccent;\nuniform vec2 uInk;\nuniform vec4 uPointer;\n\nvoid main () {\n // The pixel in CSS px from the region's middle, y down, then in the ribbon's frame.\n vec2 p = vec2(gl_FragCoord.x * uScale, uSize.y - gl_FragCoord.y * uScale) - uSize * 0.5;\n float along = (p.x * uAxis.x + p.y * uAxis.y) * uMirror;\n float across = -p.x * uAxis.y + p.y * uAxis.x;\n float u = along / uAxis.z + 0.5;\n float t = clamp(u, 0.0, 1.0);\n // Faded in slowly from the gathered end, where the strands pile into one, and out at the far edge.\n float taper = smoothstep(0.0, 0.3, u) * (1.0 - smoothstep(0.78, 1.0, u));\n if (taper <= 0.0) {\n gl_FragColor = vec4(0.0);\n return;\n }\n\n // The bundle's shape here, and how fast it changes along the ribbon (the d* terms, per CSS px).\n float inside = (u > 0.0 && u < 1.0) ? 1.0 / uAxis.z : 0.0;\n float fray = pow(t, uWidths.z);\n float dfray = uWidths.z * pow(t, uWidths.z - 1.0) * inside;\n float width = uWidths.x + uWidths.y * fray;\n float dwidth = uWidths.y * dfray;\n float ease = t * t * (3.0 - 2.0 * t);\n float dease = 6.0 * t * (1.0 - t) * inside;\n float centre = mix(uCentre.x, uCentre.y, ease);\n float dcentre = (uCentre.y - uCentre.x) * dease;\n // The cord barely moves; the frayed end rides the whole wave.\n float swing = uWave.x * mix(0.3, 1.0, ease);\n float dswing = uWave.x * 0.7 * dease;\n float s1 = sin(uWave.y * u - uPhase.x);\n float c1 = cos(uWave.y * u - uPhase.x);\n float s2 = sin(uWave.z * u - uPhase.y);\n float c2 = cos(uWave.z * u - uPhase.y);\n float k1 = uWave.y / uAxis.z;\n float k2 = uWave.z / uAxis.z;\n\n // Nothing of the bundle can reach this pixel: the strands' furthest reach, the glow's and the push's.\n float reach = width + abs(uPath) * fray + swing * 1.45 + abs(uPointer.z) + 25.0 * uScale;\n if (abs(across - centre) > reach) {\n gl_FragColor = vec4(0.0);\n return;\n }\n\n // Where the strands lie closer than two lines' width they are thinned, so the cord is a cord and not a bar.\n float crowd = clamp(width / (uCount * uThickness * uScale * 2.0), 0.05, 1.0);\n float weight = taper * crowd;\n float radius2 = uPointer.w * uPointer.w;\n float soft2 = radius2 * 0.02;\n float du = along - uPointer.x;\n float dq = 2.0 * du / (STRETCH * STRETCH * radius2);\n\n float texel = 1.0 / uCount;\n float sumA = 0.0;\n vec3 sumC = vec3(0.0);\n for (int i = 0; i < COUNT_MAX; i++) {\n if (float(i) >= uCount) break;\n float x = (float(i) + 0.5) * texel;\n vec4 a = texture2D(uStrands, vec2(x, 0.25));\n vec4 b = texture2D(uStrands, vec2(x, 0.75));\n float slot = (a.r * 65280.0 + a.g * 255.0) / 65535.0 * 2.0 - 1.0;\n float turns = a.a * TURNS_MAX;\n float lc = b.g * 2.0 - 1.0;\n float ls = b.b * 2.0 - 1.0;\n // The wave at this strand's lag, and the second harmonic at twice it, by the angle sums; and its slope.\n float lc2 = 2.0 * lc * lc - 1.0;\n float ls2 = 2.0 * lc * ls;\n float wave = (s1 * lc + c1 * ls) + 0.45 * (s2 * lc2 + c2 * ls2);\n float dwave = k1 * (c1 * lc - s1 * ls) + 0.45 * k2 * (c2 * lc2 - s2 * ls2);\n float own = sin(turns * u + b.r * TWO_PI);\n float y = centre + slot * width + own * fray * uPath + wave * swing;\n float slope = dcentre + slot * dwidth + own * dfray * uPath + dwave * swing + wave * dswing;\n\n // The pointer: a squared bell, drawn out along the ribbon, pushing the strand away across it.\n float dv = y - uPointer.y;\n float q = (dv * dv + du * du / (STRETCH * STRETCH)) / radius2;\n float bell = max(0.0, 1.0 - q);\n float inv = inversesqrt(dv * dv + soft2);\n float push = bell * bell * uPointer.z * dv * inv;\n y += push;\n // The push steepens a strand where it rises along the ribbon, and stretches its slope across it.\n float dpush = -2.0 * bell * dq * uPointer.z * dv * inv;\n float gain = bell * uPointer.z * inv * (bell * soft2 * inv * inv - 4.0 * dv * dv / radius2);\n slope = slope * (1.0 + gain) + dpush;\n\n // The distance to the strand, in device px, measured square to it rather than straight across.\n float dist = abs(across - y) * inversesqrt(1.0 + slope * slope) / uScale;\n float core = clamp(uThickness + 0.5 - dist, 0.0, 1.0);\n float glow = exp(-dist * 0.22);\n float w = weight * a.b * (1.0 - 0.55 * slot * slot);\n float cover = w * (core * uInk.x + glow * uInk.y);\n sumA += cover;\n sumC += cover * mix(uColor, uAccent, 0.9 * smoothstep(0.3, 1.0, abs(slot)));\n }\n float alpha = 1.0 - exp(-sumA);\n vec3 rgb = sumC / max(sumA, 0.0001);\n gl_FragColor = vec4(rgb * alpha, alpha);\n}`;\n\nconst UNIFORMS = [\n 'uSize',\n 'uScale',\n 'uAxis',\n 'uMirror',\n 'uWidths',\n 'uCentre',\n 'uPath',\n 'uWave',\n 'uPhase',\n 'uThickness',\n 'uCount',\n 'uStrands',\n 'uColor',\n 'uAccent',\n 'uInk',\n 'uPointer',\n] as const;\n\ntype ThreadUniform = (typeof UNIFORMS)[number];\n\nclass Renderer implements ThreadRenderer {\n private readonly program: WebGLProgram;\n private readonly quad: WebGLBuffer;\n private readonly texture: WebGLTexture;\n private readonly uniforms: Record<ThreadUniform, WebGLUniformLocation | null>;\n\n constructor(private readonly gl: ThreadGLContext) {\n const quad = gl.createBuffer();\n const texture = gl.createTexture();\n if (!quad || !texture) throw new Error('thread-lines: no buffer');\n this.quad = quad;\n this.texture = texture;\n gl.bindBuffer(gl.ARRAY_BUFFER, quad);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]), gl.STATIC_DRAW);\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.disable(gl.BLEND);\n gl.disable(gl.DEPTH_TEST);\n\n const vertex = this.shader(gl.VERTEX_SHADER, VERTEX);\n const fragment = this.shader(gl.FRAGMENT_SHADER, FRAGMENT);\n const program = gl.createProgram();\n if (!program) throw new Error('thread-lines: no program');\n gl.attachShader(program, vertex);\n gl.attachShader(program, fragment);\n gl.bindAttribLocation(program, 0, 'aPosition');\n gl.linkProgram(program);\n gl.deleteShader(vertex);\n gl.deleteShader(fragment);\n if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n const log = gl.getProgramInfoLog(program);\n gl.deleteProgram(program);\n throw new Error(`thread-lines: program failed: ${log ?? ''}`);\n }\n this.program = program;\n const uniforms = {} as Record<ThreadUniform, WebGLUniformLocation | null>;\n for (const name of UNIFORMS) uniforms[name] = gl.getUniformLocation(program, name);\n this.uniforms = uniforms;\n }\n\n strands(data: Uint8Array, count: number): void {\n const { gl } = this;\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, this.texture);\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, count, TEXTURE_ROWS, 0, gl.RGBA, gl.UNSIGNED_BYTE, data);\n }\n\n render(frame: ThreadFrame): void {\n const { gl, uniforms } = this;\n gl.useProgram(this.program);\n gl.uniform2f(uniforms.uSize, frame.regionWidth, frame.regionHeight);\n gl.uniform1f(uniforms.uScale, frame.scale);\n gl.uniform3f(uniforms.uAxis, frame.cos, frame.sin, frame.length);\n gl.uniform1f(uniforms.uMirror, frame.mirror);\n gl.uniform3f(uniforms.uWidths, frame.gather, frame.spread, frame.power);\n gl.uniform2f(uniforms.uCentre, frame.centreStart, frame.centreEnd);\n gl.uniform1f(uniforms.uPath, frame.path);\n gl.uniform3f(uniforms.uWave, frame.amplitude, frame.wave1, frame.wave2);\n gl.uniform2f(uniforms.uPhase, frame.phase1, frame.phase2);\n gl.uniform1f(uniforms.uThickness, frame.thickness);\n gl.uniform1f(uniforms.uCount, frame.count);\n gl.uniform3f(uniforms.uColor, frame.color[0], frame.color[1], frame.color[2]);\n gl.uniform3f(uniforms.uAccent, frame.accent[0], frame.accent[1], frame.accent[2]);\n gl.uniform2f(uniforms.uInk, frame.core, frame.glow);\n gl.uniform4f(uniforms.uPointer, frame.pointerAlong, frame.pointerAcross, frame.push, frame.radius);\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, this.texture);\n gl.uniform1i(uniforms.uStrands, 0);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.viewport(0, 0, frame.width, frame.height);\n gl.clearColor(0, 0, 0, 0);\n gl.clear(gl.COLOR_BUFFER_BIT);\n gl.bindBuffer(gl.ARRAY_BUFFER, this.quad);\n gl.enableVertexAttribArray(0);\n gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);\n }\n\n destroy(): void {\n const { gl } = this;\n gl.deleteTexture(this.texture);\n gl.deleteBuffer(this.quad);\n gl.deleteProgram(this.program);\n }\n\n private shader(kind: number, source: string): WebGLShader {\n const { gl } = this;\n const shader = gl.createShader(kind);\n if (!shader) throw new Error('thread-lines: no shader');\n gl.shaderSource(shader, source);\n gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n const log = gl.getShaderInfoLog(shader);\n gl.deleteShader(shader);\n throw new Error(`thread-lines: shader failed: ${log ?? ''}`);\n }\n return shader;\n }\n}\n\n/**\n * The attributes the canvas's context is asked for: premultiplied alpha,\n * which is what the pass writes, no antialiasing (the shader does its own)\n * and no buffer the pass does not use.\n */\nconst THREAD_CONTEXT_ATTRIBUTES: WebGLContextAttributes = {\n alpha: true,\n premultipliedAlpha: true,\n antialias: false,\n depth: false,\n stencil: false,\n preserveDrawingBuffer: false,\n powerPreference: 'low-power',\n};\n\n/** A renderer on `gl`, or `null` where the shader will not compile or link. */\nfunction createThreadRenderer(gl: ThreadGLContext): ThreadRenderer | null {\n try {\n return new Renderer(gl);\n } catch {\n return null;\n }\n}\n\nexport { THREAD_CONTEXT_ATTRIBUTES, UNIFORMS as THREAD_UNIFORMS, createThreadRenderer };\nexport type { ThreadFrame, ThreadGLContext, ThreadRenderer, ThreadUniform };\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\nimport { Directionality } from '@angular/cdk/bidi';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n untracked,\n viewChild,\n} from '@angular/core';\n\nimport { FRAME_FLOOR_SLACK, MAX_FRAME_MS } from 'ngwr/animations/core';\nimport { WrPlatform } from 'ngwr/platform';\nimport { numAttr, resolveCssColorChannels, watchColorScheme, wrCheckStyles } from 'ngwr/utils';\n\nimport {\n THREAD_CONTEXT_ATTRIBUTES,\n type ThreadFrame,\n type ThreadGLContext,\n type ThreadRenderer,\n createThreadRenderer,\n} from './thread-gl';\nimport {\n FOLLOW_RATE,\n FRAY_POWER,\n SPRING_DAMPING,\n SPRING_RATE,\n type ThreadSpring,\n threadCount,\n threadFrameMs,\n threadInk,\n threadLength,\n threadRatio,\n threadSpringStep,\n threadSpringStill,\n threadStrandTexture,\n threadStrands,\n threadWidths,\n} from './thread-model';\n\n/** Where the bundle's centre line sits at the gathered end and at the far one, as a share of the height from the middle. */\nconst CENTRE_START = -0.1;\nconst CENTRE_END = 0.02;\n/** How far a strand's own path bends at the far end under a unit `fray`, as a share of the height. */\nconst PATH = 0.075;\n/** The travelling wave: the main harmonic's wavelengths per ribbon length and its period in seconds under a unit `speed`; the second is shorter and faster. */\nconst WAVE_CYCLES = 1.4;\nconst WAVE_PERIOD = 9;\nconst WAVE_CYCLES_2 = 3.1;\nconst WAVE_PERIOD_2 = 5.6;\n/** The parting's reach, in CSS px, and how far it pushes at its heart under a unit `parting`, as a share of the reach. */\nconst PART_RADIUS = 110;\nconst PART_PUSH = 0.45;\n/** How much of its colour a strand's core lays and how much glow rings it, on a light surface and on a dark one. */\nconst INK_LIGHT: readonly [number, number] = [0.6, 0.03];\nconst INK_DARK: readonly [number, number] = [0.75, 0.07];\n\n/**\n * A wide ribbon of fine threads behind a section's content, like silk: dozens\n * of hair-thin strands flowing across the region at a slight angle, close\n * together near one end, almost a single cord, and parting as they go toward\n * the other, each taking a path of its own. The whole bundle rides slow waves\n * that travel along it, neighbours moving almost together but not quite, so\n * the ribbon shimmers; the strands are brightest in the middle of the bundle\n * and fade toward its edges and at both ends, and the outer ones blend toward\n * an accent. The pointer parts the threads around itself, like fingers drawn\n * through silk, and they close again behind it with a slightly elastic\n * return. The drawing is one WebGL pass in `thread-gl.ts`; the pure pieces\n * (the strands, the fray, the parting and its spring, the canvas size and the\n * frame cap) are `thread-model.ts`.\n *\n * Fills its positioned parent, which isolates itself, so the host's negative\n * z-index lands under the content and over the page background. The parent\n * takes the pointer, passively: the host and its canvas never do, and a\n * finger is ignored, so a scroll over the section is never fought. The\n * context is made when the host is first on screen and sized, not at mount,\n * so a region nobody scrolls to costs nothing; the loop runs while the host\n * is on screen and the document is visible, at thirty frames a second while\n * only the waves move and at the screen's rate while the parting is live.\n * The canvas renders at the device ratio under the model's pixel budget.\n *\n * Colours come from the `--wr-thread-lines-color` and `-accent` hooks through\n * `resolveCssColorChannels`, re-read when the scheme changes; the surface is\n * read too, so on a light one the strands are laid as ink with next to no\n * glow and on a dark one they are lit, with a soft glow. Under\n * `prefers-reduced-motion: reduce` one still frame is drawn; under\n * `forced-colors: active` nothing is; without WebGL nothing is; on the\n * server the empty canvas is rendered, absolutely positioned, so the\n * browser's first draw shifts no layout. A lost context is let go and\n * rebuilt when it comes back. Under RTL the ribbon is mirrored, so it\n * gathers at the inline start. Decorative: `aria-hidden`, no pointer events.\n * Styles: `@use 'ngwr/animations/thread-lines'`.\n */\n@Component({\n selector: 'wr-thread-lines',\n templateUrl: './thread-lines.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-thread-lines', 'aria-hidden': 'true' },\n})\nexport class WrThreadLines {\n /** How many strands the bundle has, 128 at most. @default 72 */\n readonly count = input(72, { transform: numAttr(72) });\n /** How thick a strand is, in device px. @default 1 */\n readonly thickness = input(1, { transform: numAttr(1) });\n /** How high the travelling wave lifts the bundle, in CSS px. @default 16 */\n readonly amplitude = input(16, { transform: numAttr(16) });\n /** How fast the wave travels, a multiplier: one is a wave every nine seconds. @default 1 */\n readonly speed = input(1, { transform: numAttr(1) });\n /** How far the strands part by the far end, a multiplier: none keeps them a cord the whole way. @default 1 */\n readonly fray = input(1, { transform: numAttr(1) });\n /** The ribbon's tilt, in degrees: positive falls toward the far end, negative rises. @default -6 */\n readonly angle = input(-6, { transform: numAttr(-6) });\n /** How strongly the pointer parts the strands, a multiplier: none turns the parting off. @default 1 */\n readonly parting = input(1, { transform: numAttr(1) });\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platform = inject(WrPlatform);\n private readonly doc = inject(DOCUMENT);\n private readonly dir = inject(Directionality, { optional: true });\n private readonly canvasRef = viewChild.required<ElementRef<HTMLCanvasElement>>('canvas');\n /** The ribbon gathers at the inline start: under RTL its axis is mirrored. */\n private readonly mirrored = computed(() => this.dir?.valueSignal() === 'rtl');\n\n private gl: ThreadGLContext | null = null;\n private renderer: ThreadRenderer | null = null;\n /** Set once the browser was asked for a context, so a refusal is not asked again. */\n private contextTried = false;\n /** How many strands the renderer holds; -1 before the first upload. */\n private uploaded = -1;\n\n /** The host's CSS size, zero until the first layout. */\n private width = 0;\n private height = 0;\n private readonly frame: ThreadFrame = {\n width: 0,\n height: 0,\n scale: 1,\n regionWidth: 0,\n regionHeight: 0,\n cos: 1,\n sin: 0,\n length: 1,\n mirror: 1,\n gather: 0,\n spread: 0,\n power: FRAY_POWER,\n centreStart: 0,\n centreEnd: 0,\n path: 0,\n amplitude: 0,\n wave1: 0,\n wave2: 0,\n phase1: 0,\n phase2: 0,\n thickness: 0.5,\n count: 1,\n color: new Float32Array([0.42, 0.45, 0.5]),\n accent: new Float32Array([0.22, 0.41, 0.89]),\n core: INK_LIGHT[0],\n glow: INK_LIGHT[1],\n pointerAlong: 0,\n pointerAcross: 0,\n push: 0,\n radius: PART_RADIUS,\n };\n\n /** The scene's clock, in seconds: moves only while a frame runs, so a hidden tab holds the pose. */\n private time = 0;\n /** Where the pointer is over the parent, in CSS px from the host's top left; NaN when it is not. */\n private pointerX = NaN;\n private pointerY = NaN;\n /** The parting: how open it is, and where its centre is, each eased after the pointer. */\n private readonly open: ThreadSpring = { value: 0, speed: 0 };\n private readonly centreX: ThreadSpring = { value: 0, speed: 0 };\n private readonly centreY: ThreadSpring = { value: 0, speed: 0 };\n\n private running = false;\n private rafId: number | null = null;\n private lastFrame = 0;\n private resizeRafId: number | null = null;\n private pendingWidth = 0;\n private pendingHeight = 0;\n private inView = false;\n private mounted = false;\n\n private resizeObserver: ResizeObserver | null = null;\n private viewObserver: IntersectionObserver | null = null;\n private pointerTarget: HTMLElement | null = null;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/thread-lines');\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n effect(() => {\n this.platform.pageVisible();\n this.platform.prefersReducedMotion();\n this.mirrored();\n untracked(() => this.sync());\n });\n effect(() => {\n this.count();\n this.fray();\n this.angle();\n untracked(() => this.still());\n });\n watchColorScheme(() => {\n this.resolveColors();\n this.still();\n });\n\n afterNextRender(() => this.mount());\n inject(DestroyRef).onDestroy(() => this.unmount());\n }\n\n // Lifecycle\n\n private mount(): void {\n // Nothing drawn under forced colours: the stylesheet hides the host too.\n if (this.doc.defaultView?.matchMedia?.('(forced-colors: active)').matches) return;\n const host = this.host.nativeElement;\n this.mounted = true;\n\n if (typeof ResizeObserver !== 'undefined') {\n this.resizeObserver = new ResizeObserver(entries => {\n const rect = entries[entries.length - 1]?.contentRect;\n this.scheduleResize(rect?.width ?? host.clientWidth, rect?.height ?? host.clientHeight);\n });\n this.resizeObserver.observe(host);\n } else {\n this.layout(host.clientWidth, host.clientHeight);\n }\n\n if (typeof IntersectionObserver !== 'undefined') {\n this.viewObserver = new IntersectionObserver(entries => {\n this.inView = entries[entries.length - 1]?.isIntersecting ?? false;\n this.sync();\n });\n this.viewObserver.observe(host);\n } else {\n this.inView = true;\n this.sync();\n }\n\n const canvas = this.canvasRef().nativeElement;\n canvas.addEventListener('webglcontextlost', this.onContextLost);\n canvas.addEventListener('webglcontextrestored', this.onContextRestored);\n\n const target = host.parentElement;\n this.pointerTarget = target;\n target?.addEventListener('pointermove', this.onPointerMove, { passive: true });\n target?.addEventListener('pointerleave', this.onPointerLeave, { passive: true });\n }\n\n private unmount(): void {\n this.running = false;\n this.stopLoop();\n if (this.resizeRafId !== null) cancelAnimationFrame(this.resizeRafId);\n this.resizeRafId = null;\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n this.viewObserver?.disconnect();\n this.viewObserver = null;\n this.pointerTarget?.removeEventListener('pointermove', this.onPointerMove);\n this.pointerTarget?.removeEventListener('pointerleave', this.onPointerLeave);\n this.pointerTarget = null;\n if (this.mounted) {\n const canvas = this.canvasRef().nativeElement;\n canvas.removeEventListener('webglcontextlost', this.onContextLost);\n canvas.removeEventListener('webglcontextrestored', this.onContextRestored);\n }\n this.renderer?.destroy();\n this.renderer = null;\n // The context itself is let go now rather than when the canvas is collected.\n this.gl?.getExtension('WEBGL_lose_context')?.loseContext();\n this.gl = null;\n this.mounted = false;\n }\n\n // Context\n\n /** The context and the renderer, made at the first chance to draw; `null` where the browser has no WebGL. */\n private ensure(): ThreadRenderer | null {\n if (this.renderer) return this.renderer;\n if (this.contextTried || !this.mounted) return null;\n this.contextTried = true;\n const canvas = this.canvasRef().nativeElement;\n const gl =\n canvas.getContext('webgl2', THREAD_CONTEXT_ATTRIBUTES) ?? canvas.getContext('webgl', THREAD_CONTEXT_ATTRIBUTES);\n if (!gl) return null;\n this.gl = gl;\n this.renderer = createThreadRenderer(gl);\n if (!this.renderer) return null;\n this.uploaded = -1;\n this.resolveColors();\n return this.renderer;\n }\n\n private readonly onContextLost = (event: Event): void => {\n // Not prevented, the browser never restores it.\n event.preventDefault();\n this.renderer = null;\n this.running = false;\n this.stopLoop();\n };\n\n private readonly onContextRestored = (): void => {\n if (!this.gl) return;\n this.renderer = createThreadRenderer(this.gl);\n this.uploaded = -1;\n this.still();\n this.sync();\n };\n\n // Layout\n\n private scheduleResize(width: number, height: number): void {\n this.pendingWidth = width;\n this.pendingHeight = height;\n if (this.resizeRafId !== null) return;\n this.resizeRafId = requestAnimationFrame(() => {\n this.resizeRafId = null;\n this.layout(this.pendingWidth, this.pendingHeight);\n });\n }\n\n private layout(width: number, height: number): void {\n if (width <= 0 || height <= 0) return;\n this.width = width;\n this.height = height;\n this.still();\n this.sync();\n }\n\n /** Sizes the canvas to the host under the pixel budget. */\n private size(): void {\n const canvas = this.canvasRef().nativeElement;\n const ratio = threadRatio(this.width, this.height, this.doc.defaultView?.devicePixelRatio ?? 1);\n const width = Math.round(this.width * ratio);\n const height = Math.round(this.height * ratio);\n if (canvas.width !== width) canvas.width = width;\n if (canvas.height !== height) canvas.height = height;\n this.frame.width = width;\n this.frame.height = height;\n this.frame.scale = 1 / ratio;\n }\n\n // Colours\n\n private resolveColors(): void {\n if (!this.renderer) return;\n const canvas = this.canvasRef().nativeElement;\n this.frame.color.set(resolveCssColorChannels(canvas, 'var(--wr-thread-lines-color)', '#6b7280'));\n this.frame.accent.set(resolveCssColorChannels(canvas, 'var(--wr-thread-lines-accent)', '#3969e2'));\n const light = threadInk(resolveCssColorChannels(canvas, 'var(--wr-color-surface)', '#ffffff'));\n const ink = light ? INK_LIGHT : INK_DARK;\n this.frame.core = ink[0];\n this.frame.glow = ink[1];\n }\n\n // Pointer\n\n private readonly onPointerMove = (event: PointerEvent): void => {\n // A finger that moves is scrolling: the ribbon must never fight it.\n if (event.pointerType === 'touch' || this.width === 0) return;\n const rect = this.canvasRef().nativeElement.getBoundingClientRect();\n this.pointerX = event.clientX - rect.left;\n this.pointerY = event.clientY - rect.top;\n };\n\n private readonly onPointerLeave = (): void => {\n this.pointerX = NaN;\n this.pointerY = NaN;\n };\n\n // Loop\n\n /** Whether the strands are parted, still closing or about to part: the frame cap is lifted while they are. */\n private parted(): boolean {\n if (!threadSpringStill(this.open)) return true;\n return !Number.isNaN(this.pointerX) && untracked(this.parting) > 0;\n }\n\n private sync(): void {\n const reduced = this.platform.prefersReducedMotion();\n const allowed = this.mounted && this.width > 0 && this.inView && this.platform.pageVisible();\n const run = allowed && !reduced;\n if (run !== this.running) {\n this.running = run;\n if (run) {\n this.lastFrame = performance.now();\n this.rafId = requestAnimationFrame(this.frameLoop);\n return;\n }\n this.stopLoop();\n }\n // Reduced motion: one still frame, with the strands closed, however the pointer sits.\n if (allowed && reduced) {\n this.rest();\n this.still();\n }\n }\n\n /** The parting closed at once: the still frame has no gap in it. */\n private rest(): void {\n this.open.value = 0;\n this.open.speed = 0;\n }\n\n private stopLoop(): void {\n if (this.rafId !== null) cancelAnimationFrame(this.rafId);\n this.rafId = null;\n }\n\n /** One frame drawn outside the loop: the reduced-motion still, and a resize or a retheme while the loop is off. */\n private still(): void {\n if (this.running || !this.mounted || this.width === 0 || !this.inView) return;\n this.draw();\n }\n\n private readonly frameLoop = (now: number): void => {\n this.rafId = null;\n if (!this.running) return;\n const floor = threadFrameMs(this.parted());\n if (floor > 0 && now - this.lastFrame + FRAME_FLOOR_SLACK < floor) {\n this.rafId = requestAnimationFrame(this.frameLoop);\n return;\n }\n const dt = Math.min(Math.max(now - this.lastFrame, 0), MAX_FRAME_MS) / 1000;\n this.lastFrame = now;\n this.advance(dt);\n this.draw();\n if (this.running) this.rafId = requestAnimationFrame(this.frameLoop);\n };\n\n /** The clock moves on and the parting eases after the pointer. */\n private advance(dt: number): void {\n this.time += dt * untracked(this.speed);\n const pointing = !Number.isNaN(this.pointerX) && untracked(this.parting) > 0;\n if (pointing) {\n if (threadSpringStill(this.open)) {\n // The first touch sets the centre; after that it follows.\n this.centreX.value = this.pointerX;\n this.centreY.value = this.pointerY;\n this.centreX.speed = this.centreY.speed = 0;\n } else {\n threadSpringStep(this.centreX, this.pointerX, dt, FOLLOW_RATE, 1);\n threadSpringStep(this.centreY, this.pointerY, dt, FOLLOW_RATE, 1);\n }\n }\n threadSpringStep(this.open, pointing ? 1 : 0, dt, SPRING_RATE, SPRING_DAMPING);\n }\n\n /** The frame's numbers from the inputs and the state, and the pass. */\n private draw(): void {\n const renderer = this.ensure();\n if (!renderer || this.width === 0) return;\n const frame = this.frame;\n this.size();\n\n const count = threadCount(untracked(this.count));\n if (count !== this.uploaded) {\n renderer.strands(threadStrandTexture(threadStrands(count)), count);\n this.uploaded = count;\n }\n const width = this.width;\n const height = this.height;\n const angle = (untracked(this.angle) * Math.PI) / 180;\n const fray = Math.max(0, untracked(this.fray));\n const widths = threadWidths(height, fray);\n const mirror = this.mirrored() ? -1 : 1;\n\n frame.regionWidth = width;\n frame.regionHeight = height;\n frame.cos = Math.cos(angle);\n frame.sin = Math.sin(angle);\n frame.length = threadLength(width, height, angle);\n frame.mirror = mirror;\n frame.gather = widths.gather;\n frame.spread = widths.spread;\n frame.centreStart = CENTRE_START * height;\n frame.centreEnd = CENTRE_END * height;\n frame.path = PATH * fray * height;\n frame.amplitude = untracked(this.amplitude);\n frame.wave1 = WAVE_CYCLES * Math.PI * 2;\n frame.wave2 = WAVE_CYCLES_2 * Math.PI * 2;\n frame.phase1 = ((this.time / WAVE_PERIOD) % 1) * Math.PI * 2;\n frame.phase2 = ((this.time / WAVE_PERIOD_2) % 1) * Math.PI * 2;\n frame.thickness = Math.max(0.1, untracked(this.thickness)) / 2;\n frame.count = count;\n\n // The parting's centre, from the host's top left into the ribbon's frame.\n const dx = this.centreX.value - width / 2;\n const dy = this.centreY.value - height / 2;\n frame.pointerAlong = (dx * frame.cos + dy * frame.sin) * mirror;\n frame.pointerAcross = -dx * frame.sin + dy * frame.cos;\n frame.push = this.open.value * untracked(this.parting) * PART_PUSH * PART_RADIUS;\n frame.radius = PART_RADIUS;\n\n renderer.render(frame);\n }\n}\n\nexport { CENTRE_END, CENTRE_START, INK_DARK, INK_LIGHT, PART_PUSH, PART_RADIUS, PATH, WAVE_PERIOD };\n","<canvas #canvas class=\"wr-thread-lines__canvas\"></canvas>\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 { WrThreadLines } from './thread-lines';\n"],"mappings":";;;;;;;;;;;;;AAkBA,MAAM,OAAO;AAIb,MAAM,SAAS;AAGf,MAAM,SAAS;AAEf,MAAM,aAAa;AAEnB,MAAM,SAAS;AAEf,MAAM,WAAW;AAEjB,MAAM,eAAe;AAErB,MAAM,iBAAiB;AACvB,MAAM,iBAAiB;AAEvB,MAAM,WAAW;AAEjB,MAAM,eAAe;AAGrB,MAAM,gBAAgB,MAAO;AAO7B,MAAM,iBAAiB;AAUvB,MAAM,SAAS;AAqBf,SAAS,cAAc,OAAe,OAAO,MAAI;CAC/C,MAAM,IAAI,YAAY,KAAK;CAC3B,MAAM,SAAS,aAAa,IAAI;CAChC,MAAM,MAAM,I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AA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,UAAQ,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-animations-thread-lines.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/animations/thread-lines/thread-model.ts","../../../projects/lib/animations/thread-lines/thread-gl.ts","../../../projects/lib/animations/thread-lines/thread-lines.ts","../../../projects/lib/animations/thread-lines/thread-lines.html","../../../projects/lib/animations/thread-lines/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 { MAX_DPR, seededRandom } from '../internal';\n\n/**\n * The pure side of `<wr-thread-lines>`: how the strands are laid across the\n * bundle, how the bundle opens along its length, how the pointer parts it and\n * how that parting eases, how big the canvas is and how often it is drawn.\n * The shader in `thread-gl.ts` reads the numbers from here as uniforms and as\n * a per-strand texture; it owns only what has to be per pixel.\n */\n\n/** The strands are laid from this seed, so two mounts and every spec see one ribbon. */\nconst SEED = 0x51c4e7;\n/** The shader's loop bound: `count` is capped here. */\nconst COUNT_MAX = 128;\n/** The gathered end's half width: this much of the height, never under the floor, in CSS px. */\nconst GATHER = 0.012;\nconst GATHER_MIN = 3;\n/** How far a unit `fray` opens the far end's half width, as a share of the height. */\nconst SPREAD = 0.42;\n/** How the bundle opens along its length: above one it stays a cord for a while, then lets go. */\nconst FRAY_POWER = 1.7;\n/** A strand's slot is nudged by up to this much of the gap to its neighbour. */\nconst JITTER = 0.4;\n/** The travelling wave's phase lags this far, in radians, from the bundle's middle to its edge. */\nconst WAVE_LAG = 1.1;\n/** On top of the lag each strand is off by up to this, in radians, so neighbours are almost in step. */\nconst WAVE_SCATTER = 0.18;\n/** A strand's own path bends through this many to this many radians along the length. */\nconst PATH_TURNS_MIN = 1.6;\nconst PATH_TURNS_MAX = 3.4;\n/** A strand shows between this much and all of its brightness, from its seed. */\nconst GAIN_MIN = 0.55;\n/** The parting's reach stretches this far along the ribbon for every px across it. */\nconst PART_STRETCH = 1.7;\n/** How many frames a second at rest, and the gap between them, in ms: the waves need no more. */\nconst REST_FPS = 30;\nconst REST_FRAME_MS = 1000 / REST_FPS;\n/**\n * The parting's spring: how fast it closes on its target, per second, and how\n * damped it is. Under one it overshoots a little on the way back, the slight\n * elastic return of silk let go.\n */\nconst SPRING_RATE = 9;\nconst SPRING_DAMPING = 0.72;\n/** The parting's centre follows the pointer at this rate, critically damped. */\nconst FOLLOW_RATE = 18;\n/** Under this a spring's value and speed count as at rest. */\nconst SPRING_EPS = 0.002;\n/**\n * The most device px the canvas holds: the shader walks every strand per\n * pixel, so this is what bounds its cost. Under the backdrops' shared budget:\n * a hairline at two device px per CSS px is sharper, but not at this price.\n */\nconst PIXELS = 2_000_000;\n\n/** Floats per strand in {@link threadStrands}' output. */\nconst STRAND_STRIDE = 6;\n/** Rows in the strand texture: the slot and gains, then the wave's phase. */\nconst TEXTURE_ROWS = 2;\n\n/**\n * The strands of a bundle of `count`, {@link STRAND_STRIDE} floats each:\n *\n * - `slot`, where the strand sits across the bundle, -1 at one edge to 1 at\n * the other, evenly spaced with a little seeded jitter;\n * - `gain`, how bright it is, {@link GAIN_MIN} to 1;\n * - `turns`, how many radians its own path bends through along the length;\n * - `phase`, where that path starts, 0 to 2pi;\n * - `cos` and `sin` of its travelling-wave lag, {@link WAVE_LAG} times its\n * slot plus up to {@link WAVE_SCATTER} of scatter, so the shader adds the\n * lag to the wave with no trigonometry of its own.\n *\n * Pure: the same `count` and `seed` give the same strands.\n */\nfunction threadStrands(count: number, seed = SEED): Float32Array<ArrayBuffer> {\n const n = threadCount(count);\n const random = seededRandom(seed);\n const out = new Float32Array(n * STRAND_STRIDE);\n for (let i = 0; i < n; i++) {\n const slot = ((i + 0.5 + (random() * 2 - 1) * JITTER) / n) * 2 - 1;\n const gain = GAIN_MIN + (1 - GAIN_MIN) * random();\n const turns = PATH_TURNS_MIN + (PATH_TURNS_MAX - PATH_TURNS_MIN) * random();\n const phase = random() * Math.PI * 2;\n const lag = WAVE_LAG * slot + (random() * 2 - 1) * WAVE_SCATTER;\n const base = i * STRAND_STRIDE;\n out[base] = slot;\n out[base + 1] = gain;\n out[base + 2] = turns;\n out[base + 3] = phase;\n out[base + 4] = Math.cos(lag);\n out[base + 5] = Math.sin(lag);\n }\n return out;\n}\n\n/** `count` as the shader takes it: a whole number, one at least, {@link COUNT_MAX} at most. */\nfunction threadCount(count: number): number {\n return Math.min(COUNT_MAX, Math.max(1, Math.round(count) || 1));\n}\n\n/**\n * The strands as the texture the shader reads them from: `count` texels wide,\n * {@link TEXTURE_ROWS} high, RGBA bytes. Row 0 holds the slot in sixteen bits\n * (red high, green low), the gain and the turns as a share of\n * {@link PATH_TURNS_MAX}; row 1 the phase as a share of 2pi and the lag's\n * cos and sin lifted into 0..1. Bytes, since a float texture is an extension\n * WebGL1 may not have, and a slot a quarter of a per-mille across is finer\n * than a pixel.\n */\nfunction threadStrandTexture(strands: Float32Array): Uint8Array<ArrayBuffer> {\n const n = strands.length / STRAND_STRIDE;\n const out = new Uint8Array(n * TEXTURE_ROWS * 4);\n const byte = (value: number): number => Math.round(Math.min(1, Math.max(0, value)) * 255);\n for (let i = 0; i < n; i++) {\n const base = i * STRAND_STRIDE;\n const slot = Math.round(((strands[base] + 1) / 2) * 65535);\n const row0 = i * 4;\n out[row0] = Math.floor(slot / 256);\n out[row0 + 1] = slot % 256;\n out[row0 + 2] = byte(strands[base + 1]);\n out[row0 + 3] = byte(strands[base + 2] / PATH_TURNS_MAX);\n const row1 = (n + i) * 4;\n out[row1] = byte(strands[base + 3] / (Math.PI * 2));\n out[row1 + 1] = byte((strands[base + 4] + 1) / 2);\n out[row1 + 2] = byte((strands[base + 5] + 1) / 2);\n out[row1 + 3] = 255;\n }\n return out;\n}\n\n/** The bundle's half width at the gathered end and how far it opens by the far end, in CSS px, for a region `height` tall. */\ninterface ThreadWidths {\n readonly gather: number;\n readonly spread: number;\n}\n\n/** How wide the bundle is for a region `height` tall under `fray`: a cord at the start, `fray` times {@link SPREAD} of the height wider at the end. */\nfunction threadWidths(height: number, fray: number): ThreadWidths {\n const gather = Math.max(GATHER_MIN, GATHER * height);\n return { gather, spread: Math.max(0, fray) * SPREAD * height };\n}\n\n/**\n * The bundle's half width `u` (0..1) of the way along, in CSS px: the\n * {@link threadWidths} opened along the fray curve, `u` to the\n * {@link FRAY_POWER}, so the strands hold together for a while and then part.\n * The shader has the same curve.\n */\nfunction threadHalfWidth(u: number, widths: ThreadWidths): number {\n const t = Math.min(1, Math.max(0, u));\n return widths.gather + widths.spread * t ** FRAY_POWER;\n}\n\n/**\n * How long the ribbon is: the region's extent along its own axis, turned by\n * `angle` radians, so the gathered end and the frayed one both reach the\n * region's edge whatever the tilt.\n */\nfunction threadLength(width: number, height: number, angle: number): number {\n return Math.abs(width * Math.cos(angle)) + Math.abs(height * Math.sin(angle));\n}\n\n/**\n * How far a strand `across` px from the pointer across the ribbon and `along`\n * px from it along the ribbon is pushed, as a share of the parting's full\n * push: whole at the pointer, falling smoothly, as a squared bell, to nothing\n * at `radius` across or {@link PART_STRETCH} times that along, so the gap is\n * a lens drawn out along the threads. The shader has the same bell.\n */\nfunction threadParting(across: number, along: number, radius: number): number {\n if (radius <= 0) return 0;\n const q = Math.hypot(across / radius, along / (radius * PART_STRETCH));\n if (q >= 1) return 0;\n const bell = 1 - q * q;\n return bell * bell;\n}\n\n/** A damped spring's value and speed. */\ninterface ThreadSpring {\n value: number;\n speed: number;\n}\n\n/** A spring step never covers more than this much of a period at once: semi-implicit Euler is stable well under it. */\nconst SPRING_SUBSTEP = 0.25;\n\n/**\n * `spring` moved `dt` seconds toward `target` at `rate` per second under\n * `damping`: critically damped at one, so it never overshoots; under one it\n * swings a little past and back. Semi-implicit Euler in substeps no longer\n * than {@link SPRING_SUBSTEP} of the rate, so a long frame (a throttled tab,\n * a slow screen) moves the spring the same way as many short ones instead of\n * flinging it; it reaches the target to {@link SPRING_EPS}.\n */\nfunction threadSpringStep(spring: ThreadSpring, target: number, dt: number, rate: number, damping: number): void {\n const steps = Math.max(1, Math.ceil((rate * dt) / SPRING_SUBSTEP));\n const h = dt / steps;\n for (let i = 0; i < steps; i++) {\n const gap = target - spring.value;\n spring.speed += (gap * rate * rate - 2 * damping * rate * spring.speed) * h;\n spring.value += spring.speed * h;\n }\n if (Math.abs(target - spring.value) < SPRING_EPS && Math.abs(spring.speed) < SPRING_EPS * rate) {\n spring.value = target;\n spring.speed = 0;\n }\n}\n\n/** Whether the parting is at rest at nothing: no gap and nothing moving. */\nfunction threadSpringStill(spring: ThreadSpring): boolean {\n return spring.value === 0 && spring.speed === 0;\n}\n\n/**\n * How many device px per CSS px the canvas renders at: the device's ratio,\n * capped at {@link MAX_DPR} and by {@link PIXELS}, never under one.\n */\nfunction threadRatio(width: number, height: number, devicePixelRatio: number): number {\n const area = Math.max(1, width * height);\n return Math.max(1, Math.min(MAX_DPR, devicePixelRatio, Math.sqrt(PIXELS / area)));\n}\n\n/**\n * The least time between two frames, in ms: {@link REST_FRAME_MS} while only\n * the waves move, since they are slow; none while the parting is live, since\n * a gap that follows the pointer at thirty frames a second stutters.\n */\nfunction threadFrameMs(parting: boolean): number {\n return parting ? 0 : REST_FRAME_MS;\n}\n\n/** Whether `surface` is light, so the strands are laid as ink on it rather than lit over it. */\nfunction threadInk(surface: ArrayLike<number>): boolean {\n return 0.2126 * surface[0] + 0.7152 * surface[1] + 0.0722 * surface[2] > 0.5;\n}\n\nexport {\n COUNT_MAX,\n FOLLOW_RATE,\n FRAY_POWER,\n GAIN_MIN,\n GATHER,\n GATHER_MIN,\n JITTER,\n PART_STRETCH,\n PATH_TURNS_MAX,\n PATH_TURNS_MIN,\n PIXELS,\n REST_FRAME_MS,\n SEED,\n SPREAD,\n SPRING_DAMPING,\n SPRING_EPS,\n SPRING_RATE,\n SPRING_SUBSTEP,\n STRAND_STRIDE,\n TEXTURE_ROWS,\n WAVE_LAG,\n WAVE_SCATTER,\n threadCount,\n threadFrameMs,\n threadHalfWidth,\n threadInk,\n threadLength,\n threadParting,\n threadRatio,\n threadSpringStep,\n threadSpringStill,\n threadStrandTexture,\n threadStrands,\n threadWidths,\n};\nexport type { ThreadSpring, ThreadWidths };\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\nimport { COUNT_MAX, PART_STRETCH, PATH_TURNS_MAX, TEXTURE_ROWS } from './thread-model';\n\n/**\n * The one pass `<wr-thread-lines>` draws: a full-screen quad whose fragment\n * shader walks every strand of the bundle and adds up how much of each lies\n * under the pixel. A strand is a curve across the region, defined where it is\n * sampled rather than as geometry: its place across the bundle (its slot)\n * times the bundle's half width at that point along, plus a path of its own\n * that opens with the fray, plus the travelling wave the whole bundle rides,\n * lagged a little by slot so neighbours move almost together, plus the push\n * of the pointer. The pixel's distance to the curve, in device px, is turned\n * into a crisp anti-aliased core and a faint wider glow; the colour is the\n * main one in the middle of the bundle and the accent toward its edges; the\n * sum is laid as straight coverage, so it reads as ink on a light surface\n * and as light on a dark one.\n *\n * The per-strand constants come in as a byte texture written by the model\n * (`threadStrandTexture`), so a frame uploads a handful of uniforms and\n * nothing else. GLSL ES 1.00, which WebGL1 and WebGL2 both accept; the loop\n * bound is the model's `COUNT_MAX`, with a break at the live count.\n */\n\ntype ThreadGLContext = WebGLRenderingContext | WebGL2RenderingContext;\n\n/** What one frame needs, every length in CSS px unless said otherwise. */\ninterface ThreadFrame {\n /** The canvas, in device px. */\n width: number;\n height: number;\n /** CSS px per device px: the inverse of the render ratio. */\n scale: number;\n /** The region's CSS size. */\n regionWidth: number;\n regionHeight: number;\n /** The ribbon's tilt, as its axis's cos and sin, and the ribbon's length along that axis. */\n cos: number;\n sin: number;\n length: number;\n /** -1 under RTL, so the gathered end sits at the inline start; 1 otherwise. */\n mirror: number;\n /** The bundle's half width at the gathered end and how far it opens by the far end, and the fray curve's power. */\n gather: number;\n spread: number;\n power: number;\n /** Where the bundle's centre line sits across the region at the gathered end and at the far one, from the region's middle. */\n centreStart: number;\n centreEnd: number;\n /** How far a strand's own path bends at the far end. */\n path: number;\n /** The travelling wave: its height, the two harmonics' wavenumbers (radians per unit length) and their phases now. */\n amplitude: number;\n wave1: number;\n wave2: number;\n phase1: number;\n phase2: number;\n /** A strand's half thickness in device px, and how many strands are live. */\n thickness: number;\n count: number;\n /** The main and the accent colour, 0..1 sRGB. */\n color: Float32Array;\n accent: Float32Array;\n /** How much of the core's colour a strand lays, and how much glow it has at its edge. */\n core: number;\n glow: number;\n /** Where the parting is centred along and across the ribbon, how far it pushes at its heart and how far it reaches. */\n pointerAlong: number;\n pointerAcross: number;\n push: number;\n radius: number;\n}\n\ninterface ThreadRenderer {\n /** The strands' constants, `count` texels wide, as `threadStrandTexture` lays them. */\n strands(data: Uint8Array, count: number): void;\n /** Draws the frame onto the canvas. */\n render(frame: ThreadFrame): void;\n /** Frees the program, the quad and the texture. */\n destroy(): void;\n}\n\nconst VERTEX = `\nattribute vec2 aPosition;\nvoid main () {\n gl_Position = vec4(aPosition, 0.0, 1.0);\n}`;\n\n/**\n * The one fragment pass. `u` runs 0 at the gathered end to 1 at the far\n * edge; `across` is the pixel's offset from the ribbon's axis. Every strand\n * is evaluated at the pixel's `u`, the distance to it taken across the\n * ribbon, and the coverage summed; the output is premultiplied.\n */\nconst FRAGMENT = `\n#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nconst int COUNT_MAX = ${COUNT_MAX};\nconst float TWO_PI = 6.283185307;\nconst float TURNS_MAX = ${PATH_TURNS_MAX.toFixed(3)};\nconst float STRETCH = ${PART_STRETCH.toFixed(3)};\nuniform vec2 uSize;\nuniform float uScale;\nuniform vec3 uAxis;\nuniform float uMirror;\nuniform vec3 uWidths;\nuniform vec2 uCentre;\nuniform float uPath;\nuniform vec3 uWave;\nuniform vec2 uPhase;\nuniform float uThickness;\nuniform float uCount;\nuniform sampler2D uStrands;\nuniform vec3 uColor;\nuniform vec3 uAccent;\nuniform vec2 uInk;\nuniform vec4 uPointer;\n\nvoid main () {\n // The pixel in CSS px from the region's middle, y down, then in the ribbon's frame.\n vec2 p = vec2(gl_FragCoord.x * uScale, uSize.y - gl_FragCoord.y * uScale) - uSize * 0.5;\n float along = (p.x * uAxis.x + p.y * uAxis.y) * uMirror;\n float across = -p.x * uAxis.y + p.y * uAxis.x;\n float u = along / uAxis.z + 0.5;\n float t = clamp(u, 0.0, 1.0);\n // Faded in slowly from the gathered end, where the strands pile into one, and out at the far edge.\n float taper = smoothstep(0.0, 0.3, u) * (1.0 - smoothstep(0.78, 1.0, u));\n if (taper <= 0.0) {\n gl_FragColor = vec4(0.0);\n return;\n }\n\n // The bundle's shape here, and how fast it changes along the ribbon (the d* terms, per CSS px).\n float inside = (u > 0.0 && u < 1.0) ? 1.0 / uAxis.z : 0.0;\n float fray = pow(t, uWidths.z);\n float dfray = uWidths.z * pow(t, uWidths.z - 1.0) * inside;\n float width = uWidths.x + uWidths.y * fray;\n float dwidth = uWidths.y * dfray;\n float ease = t * t * (3.0 - 2.0 * t);\n float dease = 6.0 * t * (1.0 - t) * inside;\n float centre = mix(uCentre.x, uCentre.y, ease);\n float dcentre = (uCentre.y - uCentre.x) * dease;\n // The cord barely moves; the frayed end rides the whole wave.\n float swing = uWave.x * mix(0.3, 1.0, ease);\n float dswing = uWave.x * 0.7 * dease;\n float s1 = sin(uWave.y * u - uPhase.x);\n float c1 = cos(uWave.y * u - uPhase.x);\n float s2 = sin(uWave.z * u - uPhase.y);\n float c2 = cos(uWave.z * u - uPhase.y);\n float k1 = uWave.y / uAxis.z;\n float k2 = uWave.z / uAxis.z;\n\n // Nothing of the bundle can reach this pixel: the strands' furthest reach, the glow's and the push's.\n float reach = width + abs(uPath) * fray + swing * 1.45 + abs(uPointer.z) + 25.0 * uScale;\n if (abs(across - centre) > reach) {\n gl_FragColor = vec4(0.0);\n return;\n }\n\n // Where the strands lie closer than two lines' width they are thinned, so the cord is a cord and not a bar.\n float crowd = clamp(width / (uCount * uThickness * uScale * 2.0), 0.05, 1.0);\n float weight = taper * crowd;\n float radius2 = uPointer.w * uPointer.w;\n float soft2 = radius2 * 0.02;\n float du = along - uPointer.x;\n float dq = 2.0 * du / (STRETCH * STRETCH * radius2);\n\n float texel = 1.0 / uCount;\n float sumA = 0.0;\n vec3 sumC = vec3(0.0);\n for (int i = 0; i < COUNT_MAX; i++) {\n if (float(i) >= uCount) break;\n float x = (float(i) + 0.5) * texel;\n vec4 a = texture2D(uStrands, vec2(x, 0.25));\n vec4 b = texture2D(uStrands, vec2(x, 0.75));\n float slot = (a.r * 65280.0 + a.g * 255.0) / 65535.0 * 2.0 - 1.0;\n float turns = a.a * TURNS_MAX;\n float lc = b.g * 2.0 - 1.0;\n float ls = b.b * 2.0 - 1.0;\n // The wave at this strand's lag, and the second harmonic at twice it, by the angle sums; and its slope.\n float lc2 = 2.0 * lc * lc - 1.0;\n float ls2 = 2.0 * lc * ls;\n float wave = (s1 * lc + c1 * ls) + 0.45 * (s2 * lc2 + c2 * ls2);\n float dwave = k1 * (c1 * lc - s1 * ls) + 0.45 * k2 * (c2 * lc2 - s2 * ls2);\n float own = sin(turns * u + b.r * TWO_PI);\n float y = centre + slot * width + own * fray * uPath + wave * swing;\n float slope = dcentre + slot * dwidth + own * dfray * uPath + dwave * swing + wave * dswing;\n\n // The pointer: a squared bell, drawn out along the ribbon, pushing the strand away across it.\n float dv = y - uPointer.y;\n float q = (dv * dv + du * du / (STRETCH * STRETCH)) / radius2;\n float bell = max(0.0, 1.0 - q);\n float inv = inversesqrt(dv * dv + soft2);\n float push = bell * bell * uPointer.z * dv * inv;\n y += push;\n // The push steepens a strand where it rises along the ribbon, and stretches its slope across it.\n float dpush = -2.0 * bell * dq * uPointer.z * dv * inv;\n float gain = bell * uPointer.z * inv * (bell * soft2 * inv * inv - 4.0 * dv * dv / radius2);\n slope = slope * (1.0 + gain) + dpush;\n\n // The distance to the strand, in device px, measured square to it rather than straight across.\n float dist = abs(across - y) * inversesqrt(1.0 + slope * slope) / uScale;\n float core = clamp(uThickness + 0.5 - dist, 0.0, 1.0);\n float glow = exp(-dist * 0.22);\n float w = weight * a.b * (1.0 - 0.55 * slot * slot);\n float cover = w * (core * uInk.x + glow * uInk.y);\n sumA += cover;\n sumC += cover * mix(uColor, uAccent, 0.9 * smoothstep(0.3, 1.0, abs(slot)));\n }\n float alpha = 1.0 - exp(-sumA);\n vec3 rgb = sumC / max(sumA, 0.0001);\n gl_FragColor = vec4(rgb * alpha, alpha);\n}`;\n\nconst UNIFORMS = [\n 'uSize',\n 'uScale',\n 'uAxis',\n 'uMirror',\n 'uWidths',\n 'uCentre',\n 'uPath',\n 'uWave',\n 'uPhase',\n 'uThickness',\n 'uCount',\n 'uStrands',\n 'uColor',\n 'uAccent',\n 'uInk',\n 'uPointer',\n] as const;\n\ntype ThreadUniform = (typeof UNIFORMS)[number];\n\nclass Renderer implements ThreadRenderer {\n private readonly program: WebGLProgram;\n private readonly quad: WebGLBuffer;\n private readonly texture: WebGLTexture;\n private readonly uniforms: Record<ThreadUniform, WebGLUniformLocation | null>;\n\n constructor(private readonly gl: ThreadGLContext) {\n const quad = gl.createBuffer();\n const texture = gl.createTexture();\n if (!quad || !texture) throw new Error('thread-lines: no buffer');\n this.quad = quad;\n this.texture = texture;\n gl.bindBuffer(gl.ARRAY_BUFFER, quad);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]), gl.STATIC_DRAW);\n gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\n gl.disable(gl.BLEND);\n gl.disable(gl.DEPTH_TEST);\n\n const vertex = this.shader(gl.VERTEX_SHADER, VERTEX);\n const fragment = this.shader(gl.FRAGMENT_SHADER, FRAGMENT);\n const program = gl.createProgram();\n if (!program) throw new Error('thread-lines: no program');\n gl.attachShader(program, vertex);\n gl.attachShader(program, fragment);\n gl.bindAttribLocation(program, 0, 'aPosition');\n gl.linkProgram(program);\n gl.deleteShader(vertex);\n gl.deleteShader(fragment);\n if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n const log = gl.getProgramInfoLog(program);\n gl.deleteProgram(program);\n throw new Error(`thread-lines: program failed: ${log ?? ''}`);\n }\n this.program = program;\n const uniforms = {} as Record<ThreadUniform, WebGLUniformLocation | null>;\n for (const name of UNIFORMS) uniforms[name] = gl.getUniformLocation(program, name);\n this.uniforms = uniforms;\n }\n\n strands(data: Uint8Array, count: number): void {\n const { gl } = this;\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, this.texture);\n gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1);\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, count, TEXTURE_ROWS, 0, gl.RGBA, gl.UNSIGNED_BYTE, data);\n }\n\n render(frame: ThreadFrame): void {\n const { gl, uniforms } = this;\n gl.useProgram(this.program);\n gl.uniform2f(uniforms.uSize, frame.regionWidth, frame.regionHeight);\n gl.uniform1f(uniforms.uScale, frame.scale);\n gl.uniform3f(uniforms.uAxis, frame.cos, frame.sin, frame.length);\n gl.uniform1f(uniforms.uMirror, frame.mirror);\n gl.uniform3f(uniforms.uWidths, frame.gather, frame.spread, frame.power);\n gl.uniform2f(uniforms.uCentre, frame.centreStart, frame.centreEnd);\n gl.uniform1f(uniforms.uPath, frame.path);\n gl.uniform3f(uniforms.uWave, frame.amplitude, frame.wave1, frame.wave2);\n gl.uniform2f(uniforms.uPhase, frame.phase1, frame.phase2);\n gl.uniform1f(uniforms.uThickness, frame.thickness);\n gl.uniform1f(uniforms.uCount, frame.count);\n gl.uniform3f(uniforms.uColor, frame.color[0], frame.color[1], frame.color[2]);\n gl.uniform3f(uniforms.uAccent, frame.accent[0], frame.accent[1], frame.accent[2]);\n gl.uniform2f(uniforms.uInk, frame.core, frame.glow);\n gl.uniform4f(uniforms.uPointer, frame.pointerAlong, frame.pointerAcross, frame.push, frame.radius);\n gl.activeTexture(gl.TEXTURE0);\n gl.bindTexture(gl.TEXTURE_2D, this.texture);\n gl.uniform1i(uniforms.uStrands, 0);\n\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.viewport(0, 0, frame.width, frame.height);\n gl.clearColor(0, 0, 0, 0);\n gl.clear(gl.COLOR_BUFFER_BIT);\n gl.bindBuffer(gl.ARRAY_BUFFER, this.quad);\n gl.enableVertexAttribArray(0);\n gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);\n gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);\n }\n\n destroy(): void {\n const { gl } = this;\n gl.deleteTexture(this.texture);\n gl.deleteBuffer(this.quad);\n gl.deleteProgram(this.program);\n }\n\n private shader(kind: number, source: string): WebGLShader {\n const { gl } = this;\n const shader = gl.createShader(kind);\n if (!shader) throw new Error('thread-lines: no shader');\n gl.shaderSource(shader, source);\n gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n const log = gl.getShaderInfoLog(shader);\n gl.deleteShader(shader);\n throw new Error(`thread-lines: shader failed: ${log ?? ''}`);\n }\n return shader;\n }\n}\n\n/**\n * The attributes the canvas's context is asked for: premultiplied alpha,\n * which is what the pass writes, no antialiasing (the shader does its own)\n * and no buffer the pass does not use.\n */\nconst THREAD_CONTEXT_ATTRIBUTES: WebGLContextAttributes = {\n alpha: true,\n premultipliedAlpha: true,\n antialias: false,\n depth: false,\n stencil: false,\n preserveDrawingBuffer: false,\n powerPreference: 'low-power',\n};\n\n/** A renderer on `gl`, or `null` where the shader will not compile or link. */\nfunction createThreadRenderer(gl: ThreadGLContext): ThreadRenderer | null {\n try {\n return new Renderer(gl);\n } catch {\n return null;\n }\n}\n\nexport { THREAD_CONTEXT_ATTRIBUTES, UNIFORMS as THREAD_UNIFORMS, createThreadRenderer };\nexport type { ThreadFrame, ThreadGLContext, ThreadRenderer, ThreadUniform };\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\nimport { Directionality } from '@angular/cdk/bidi';\nimport { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n ElementRef,\n PLATFORM_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n untracked,\n viewChild,\n} from '@angular/core';\n\nimport { WrPlatform } from 'ngwr/platform';\nimport { wrNumAttr, wrResolveCssColorChannels, wrWatchColorScheme, wrCheckStyles } from 'ngwr/utils';\n\nimport { FRAME_FLOOR_SLACK, MAX_FRAME_MS } from '../internal';\n\nimport {\n THREAD_CONTEXT_ATTRIBUTES,\n type ThreadFrame,\n type ThreadGLContext,\n type ThreadRenderer,\n createThreadRenderer,\n} from './thread-gl';\nimport {\n FOLLOW_RATE,\n FRAY_POWER,\n SPRING_DAMPING,\n SPRING_RATE,\n type ThreadSpring,\n threadCount,\n threadFrameMs,\n threadInk,\n threadLength,\n threadRatio,\n threadSpringStep,\n threadSpringStill,\n threadStrandTexture,\n threadStrands,\n threadWidths,\n} from './thread-model';\n\n/** Where the bundle's centre line sits at the gathered end and at the far one, as a share of the height from the middle. */\nconst CENTRE_START = -0.1;\nconst CENTRE_END = 0.02;\n/** How far a strand's own path bends at the far end under a unit `fray`, as a share of the height. */\nconst PATH = 0.075;\n/** The travelling wave: the main harmonic's wavelengths per ribbon length and its period in seconds under a unit `speed`; the second is shorter and faster. */\nconst WAVE_CYCLES = 1.4;\nconst WAVE_PERIOD = 9;\nconst WAVE_CYCLES_2 = 3.1;\nconst WAVE_PERIOD_2 = 5.6;\n/** The parting's reach, in CSS px, and how far it pushes at its heart under a unit `parting`, as a share of the reach. */\nconst PART_RADIUS = 110;\nconst PART_PUSH = 0.45;\n/** How much of its colour a strand's core lays and how much glow rings it, on a light surface and on a dark one. */\nconst INK_LIGHT: readonly [number, number] = [0.6, 0.03];\nconst INK_DARK: readonly [number, number] = [0.75, 0.07];\n\n/**\n * A wide ribbon of fine threads behind a section's content, like silk: dozens\n * of hair-thin strands flowing across the region at a slight angle, close\n * together near one end, almost a single cord, and parting as they go toward\n * the other, each taking a path of its own. The whole bundle rides slow waves\n * that travel along it, neighbours moving almost together but not quite, so\n * the ribbon shimmers; the strands are brightest in the middle of the bundle\n * and fade toward its edges and at both ends, and the outer ones blend toward\n * an accent. The pointer parts the threads around itself, like fingers drawn\n * through silk, and they close again behind it with a slightly elastic\n * return. The drawing is one WebGL pass in `thread-gl.ts`; the pure pieces\n * (the strands, the fray, the parting and its spring, the canvas size and the\n * frame cap) are `thread-model.ts`.\n *\n * Fills its positioned parent, which isolates itself, so the host's negative\n * z-index lands under the content and over the page background. The parent\n * takes the pointer, passively: the host and its canvas never do, and a\n * finger is ignored, so a scroll over the section is never fought. The\n * context is made when the host is first on screen and sized, not at mount,\n * so a region nobody scrolls to costs nothing; the loop runs while the host\n * is on screen and the document is visible, at thirty frames a second while\n * only the waves move and at the screen's rate while the parting is live.\n * The canvas renders at the device ratio under the model's pixel budget.\n *\n * Colours come from the `--wr-thread-lines-color` and `-accent` hooks through\n * `wrResolveCssColorChannels`, re-read when the scheme changes; the surface is\n * read too, so on a light one the strands are laid as ink with next to no\n * glow and on a dark one they are lit, with a soft glow. Under\n * `prefers-reduced-motion: reduce` one still frame is drawn; under\n * `forced-colors: active` nothing is; without WebGL nothing is; on the\n * server the empty canvas is rendered, absolutely positioned, so the\n * browser's first draw shifts no layout. A lost context is let go and\n * rebuilt when it comes back. Under RTL the ribbon is mirrored, so it\n * gathers at the inline start. Decorative: `aria-hidden`, no pointer events.\n * Styles: `@use 'ngwr/animations/thread-lines'`.\n */\n@Component({\n selector: 'wr-thread-lines',\n templateUrl: './thread-lines.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-thread-lines', 'aria-hidden': 'true' },\n})\nexport class WrThreadLines {\n /** How many strands the bundle has, 128 at most. @default 72 */\n readonly count = input(72, { transform: wrNumAttr(72) });\n /** How thick a strand is, in device px. @default 1 */\n readonly thickness = input(1, { transform: wrNumAttr(1) });\n /** How high the travelling wave lifts the bundle, in CSS px. @default 16 */\n readonly amplitude = input(16, { transform: wrNumAttr(16) });\n /** How fast the wave travels, a multiplier: one is a wave every nine seconds. @default 1 */\n readonly speed = input(1, { transform: wrNumAttr(1) });\n /** How far the strands part by the far end, a multiplier: none keeps them a cord the whole way. @default 1 */\n readonly fray = input(1, { transform: wrNumAttr(1) });\n /** The ribbon's tilt, in degrees: positive falls toward the far end, negative rises. @default -6 */\n readonly angle = input(-6, { transform: wrNumAttr(-6) });\n /** How strongly the pointer parts the strands, a multiplier: none turns the parting off. @default 1 */\n readonly parting = input(1, { transform: wrNumAttr(1) });\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly platform = inject(WrPlatform);\n private readonly doc = inject(DOCUMENT);\n private readonly dir = inject(Directionality, { optional: true });\n private readonly canvasRef = viewChild.required<ElementRef<HTMLCanvasElement>>('canvas');\n /** The ribbon gathers at the inline start: under RTL its axis is mirrored. */\n private readonly mirrored = computed(() => this.dir?.valueSignal() === 'rtl');\n\n private gl: ThreadGLContext | null = null;\n private renderer: ThreadRenderer | null = null;\n /** Set once the browser was asked for a context, so a refusal is not asked again. */\n private contextTried = false;\n /** How many strands the renderer holds; -1 before the first upload. */\n private uploaded = -1;\n\n /** The host's CSS size, zero until the first layout. */\n private width = 0;\n private height = 0;\n private readonly frame: ThreadFrame = {\n width: 0,\n height: 0,\n scale: 1,\n regionWidth: 0,\n regionHeight: 0,\n cos: 1,\n sin: 0,\n length: 1,\n mirror: 1,\n gather: 0,\n spread: 0,\n power: FRAY_POWER,\n centreStart: 0,\n centreEnd: 0,\n path: 0,\n amplitude: 0,\n wave1: 0,\n wave2: 0,\n phase1: 0,\n phase2: 0,\n thickness: 0.5,\n count: 1,\n color: new Float32Array([0.42, 0.45, 0.5]),\n accent: new Float32Array([0.22, 0.41, 0.89]),\n core: INK_LIGHT[0],\n glow: INK_LIGHT[1],\n pointerAlong: 0,\n pointerAcross: 0,\n push: 0,\n radius: PART_RADIUS,\n };\n\n /** The scene's clock, in seconds: moves only while a frame runs, so a hidden tab holds the pose. */\n private time = 0;\n /** Where the pointer is over the parent, in CSS px from the host's top left; NaN when it is not. */\n private pointerX = NaN;\n private pointerY = NaN;\n /** The parting: how open it is, and where its centre is, each eased after the pointer. */\n private readonly open: ThreadSpring = { value: 0, speed: 0 };\n private readonly centreX: ThreadSpring = { value: 0, speed: 0 };\n private readonly centreY: ThreadSpring = { value: 0, speed: 0 };\n\n private running = false;\n private rafId: number | null = null;\n private lastFrame = 0;\n private resizeRafId: number | null = null;\n private pendingWidth = 0;\n private pendingHeight = 0;\n private inView = false;\n private mounted = false;\n\n private resizeObserver: ResizeObserver | null = null;\n private viewObserver: IntersectionObserver | null = null;\n private pointerTarget: HTMLElement | null = null;\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('animations/thread-lines');\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n effect(() => {\n this.platform.pageVisible();\n this.platform.prefersReducedMotion();\n this.mirrored();\n untracked(() => this.sync());\n });\n effect(() => {\n this.count();\n this.fray();\n this.angle();\n untracked(() => this.still());\n });\n wrWatchColorScheme(() => {\n this.resolveColors();\n this.still();\n });\n\n afterNextRender(() => this.mount());\n inject(DestroyRef).onDestroy(() => this.unmount());\n }\n\n // Lifecycle\n\n private mount(): void {\n // Nothing drawn under forced colours: the stylesheet hides the host too.\n if (this.doc.defaultView?.matchMedia?.('(forced-colors: active)').matches) return;\n const host = this.host.nativeElement;\n this.mounted = true;\n\n if (typeof ResizeObserver !== 'undefined') {\n this.resizeObserver = new ResizeObserver(entries => {\n const rect = entries[entries.length - 1]?.contentRect;\n this.scheduleResize(rect?.width ?? host.clientWidth, rect?.height ?? host.clientHeight);\n });\n this.resizeObserver.observe(host);\n } else {\n this.layout(host.clientWidth, host.clientHeight);\n }\n\n if (typeof IntersectionObserver !== 'undefined') {\n this.viewObserver = new IntersectionObserver(entries => {\n this.inView = entries[entries.length - 1]?.isIntersecting ?? false;\n this.sync();\n });\n this.viewObserver.observe(host);\n } else {\n this.inView = true;\n this.sync();\n }\n\n const canvas = this.canvasRef().nativeElement;\n canvas.addEventListener('webglcontextlost', this.onContextLost);\n canvas.addEventListener('webglcontextrestored', this.onContextRestored);\n\n const target = host.parentElement;\n this.pointerTarget = target;\n target?.addEventListener('pointermove', this.onPointerMove, { passive: true });\n target?.addEventListener('pointerleave', this.onPointerLeave, { passive: true });\n }\n\n private unmount(): void {\n this.running = false;\n this.stopLoop();\n if (this.resizeRafId !== null) cancelAnimationFrame(this.resizeRafId);\n this.resizeRafId = null;\n this.resizeObserver?.disconnect();\n this.resizeObserver = null;\n this.viewObserver?.disconnect();\n this.viewObserver = null;\n this.pointerTarget?.removeEventListener('pointermove', this.onPointerMove);\n this.pointerTarget?.removeEventListener('pointerleave', this.onPointerLeave);\n this.pointerTarget = null;\n if (this.mounted) {\n const canvas = this.canvasRef().nativeElement;\n canvas.removeEventListener('webglcontextlost', this.onContextLost);\n canvas.removeEventListener('webglcontextrestored', this.onContextRestored);\n }\n this.renderer?.destroy();\n this.renderer = null;\n // The context itself is let go now rather than when the canvas is collected.\n this.gl?.getExtension('WEBGL_lose_context')?.loseContext();\n this.gl = null;\n this.mounted = false;\n }\n\n // Context\n\n /** The context and the renderer, made at the first chance to draw; `null` where the browser has no WebGL. */\n private ensure(): ThreadRenderer | null {\n if (this.renderer) return this.renderer;\n if (this.contextTried || !this.mounted) return null;\n this.contextTried = true;\n const canvas = this.canvasRef().nativeElement;\n const gl =\n canvas.getContext('webgl2', THREAD_CONTEXT_ATTRIBUTES) ?? canvas.getContext('webgl', THREAD_CONTEXT_ATTRIBUTES);\n if (!gl) return null;\n this.gl = gl;\n this.renderer = createThreadRenderer(gl);\n if (!this.renderer) return null;\n this.uploaded = -1;\n this.resolveColors();\n return this.renderer;\n }\n\n private readonly onContextLost = (event: Event): void => {\n // Not prevented, the browser never restores it.\n event.preventDefault();\n this.renderer = null;\n this.running = false;\n this.stopLoop();\n };\n\n private readonly onContextRestored = (): void => {\n if (!this.gl) return;\n this.renderer = createThreadRenderer(this.gl);\n this.uploaded = -1;\n this.still();\n this.sync();\n };\n\n // Layout\n\n private scheduleResize(width: number, height: number): void {\n this.pendingWidth = width;\n this.pendingHeight = height;\n if (this.resizeRafId !== null) return;\n this.resizeRafId = requestAnimationFrame(() => {\n this.resizeRafId = null;\n this.layout(this.pendingWidth, this.pendingHeight);\n });\n }\n\n private layout(width: number, height: number): void {\n if (width <= 0 || height <= 0) return;\n this.width = width;\n this.height = height;\n this.still();\n this.sync();\n }\n\n /** Sizes the canvas to the host under the pixel budget. */\n private size(): void {\n const canvas = this.canvasRef().nativeElement;\n const ratio = threadRatio(this.width, this.height, this.doc.defaultView?.devicePixelRatio ?? 1);\n const width = Math.round(this.width * ratio);\n const height = Math.round(this.height * ratio);\n if (canvas.width !== width) canvas.width = width;\n if (canvas.height !== height) canvas.height = height;\n this.frame.width = width;\n this.frame.height = height;\n this.frame.scale = 1 / ratio;\n }\n\n // Colours\n\n private resolveColors(): void {\n if (!this.renderer) return;\n const canvas = this.canvasRef().nativeElement;\n this.frame.color.set(wrResolveCssColorChannels(canvas, 'var(--wr-thread-lines-color)', '#6b7280'));\n this.frame.accent.set(wrResolveCssColorChannels(canvas, 'var(--wr-thread-lines-accent)', '#3969e2'));\n const light = threadInk(wrResolveCssColorChannels(canvas, 'var(--wr-color-surface)', '#ffffff'));\n const ink = light ? INK_LIGHT : INK_DARK;\n this.frame.core = ink[0];\n this.frame.glow = ink[1];\n }\n\n // Pointer\n\n private readonly onPointerMove = (event: PointerEvent): void => {\n // A finger that moves is scrolling: the ribbon must never fight it.\n if (event.pointerType === 'touch' || this.width === 0) return;\n const rect = this.canvasRef().nativeElement.getBoundingClientRect();\n this.pointerX = event.clientX - rect.left;\n this.pointerY = event.clientY - rect.top;\n };\n\n private readonly onPointerLeave = (): void => {\n this.pointerX = NaN;\n this.pointerY = NaN;\n };\n\n // Loop\n\n /** Whether the strands are parted, still closing or about to part: the frame cap is lifted while they are. */\n private parted(): boolean {\n if (!threadSpringStill(this.open)) return true;\n return !Number.isNaN(this.pointerX) && untracked(this.parting) > 0;\n }\n\n private sync(): void {\n const reduced = this.platform.prefersReducedMotion();\n const allowed = this.mounted && this.width > 0 && this.inView && this.platform.pageVisible();\n const run = allowed && !reduced;\n if (run !== this.running) {\n this.running = run;\n if (run) {\n this.lastFrame = performance.now();\n this.rafId = requestAnimationFrame(this.frameLoop);\n return;\n }\n this.stopLoop();\n }\n // Reduced motion: one still frame, with the strands closed, however the pointer sits.\n if (allowed && reduced) {\n this.rest();\n this.still();\n }\n }\n\n /** The parting closed at once: the still frame has no gap in it. */\n private rest(): void {\n this.open.value = 0;\n this.open.speed = 0;\n }\n\n private stopLoop(): void {\n if (this.rafId !== null) cancelAnimationFrame(this.rafId);\n this.rafId = null;\n }\n\n /** One frame drawn outside the loop: the reduced-motion still, and a resize or a retheme while the loop is off. */\n private still(): void {\n if (this.running || !this.mounted || this.width === 0 || !this.inView) return;\n this.draw();\n }\n\n private readonly frameLoop = (now: number): void => {\n this.rafId = null;\n if (!this.running) return;\n const floor = threadFrameMs(this.parted());\n if (floor > 0 && now - this.lastFrame + FRAME_FLOOR_SLACK < floor) {\n this.rafId = requestAnimationFrame(this.frameLoop);\n return;\n }\n const dt = Math.min(Math.max(now - this.lastFrame, 0), MAX_FRAME_MS) / 1000;\n this.lastFrame = now;\n this.advance(dt);\n this.draw();\n if (this.running) this.rafId = requestAnimationFrame(this.frameLoop);\n };\n\n /** The clock moves on and the parting eases after the pointer. */\n private advance(dt: number): void {\n this.time += dt * untracked(this.speed);\n const pointing = !Number.isNaN(this.pointerX) && untracked(this.parting) > 0;\n if (pointing) {\n if (threadSpringStill(this.open)) {\n // The first touch sets the centre; after that it follows.\n this.centreX.value = this.pointerX;\n this.centreY.value = this.pointerY;\n this.centreX.speed = this.centreY.speed = 0;\n } else {\n threadSpringStep(this.centreX, this.pointerX, dt, FOLLOW_RATE, 1);\n threadSpringStep(this.centreY, this.pointerY, dt, FOLLOW_RATE, 1);\n }\n }\n threadSpringStep(this.open, pointing ? 1 : 0, dt, SPRING_RATE, SPRING_DAMPING);\n }\n\n /** The frame's numbers from the inputs and the state, and the pass. */\n private draw(): void {\n const renderer = this.ensure();\n if (!renderer || this.width === 0) return;\n const frame = this.frame;\n this.size();\n\n const count = threadCount(untracked(this.count));\n if (count !== this.uploaded) {\n renderer.strands(threadStrandTexture(threadStrands(count)), count);\n this.uploaded = count;\n }\n const width = this.width;\n const height = this.height;\n const angle = (untracked(this.angle) * Math.PI) / 180;\n const fray = Math.max(0, untracked(this.fray));\n const widths = threadWidths(height, fray);\n const mirror = this.mirrored() ? -1 : 1;\n\n frame.regionWidth = width;\n frame.regionHeight = height;\n frame.cos = Math.cos(angle);\n frame.sin = Math.sin(angle);\n frame.length = threadLength(width, height, angle);\n frame.mirror = mirror;\n frame.gather = widths.gather;\n frame.spread = widths.spread;\n frame.centreStart = CENTRE_START * height;\n frame.centreEnd = CENTRE_END * height;\n frame.path = PATH * fray * height;\n frame.amplitude = untracked(this.amplitude);\n frame.wave1 = WAVE_CYCLES * Math.PI * 2;\n frame.wave2 = WAVE_CYCLES_2 * Math.PI * 2;\n frame.phase1 = ((this.time / WAVE_PERIOD) % 1) * Math.PI * 2;\n frame.phase2 = ((this.time / WAVE_PERIOD_2) % 1) * Math.PI * 2;\n frame.thickness = Math.max(0.1, untracked(this.thickness)) / 2;\n frame.count = count;\n\n // The parting's centre, from the host's top left into the ribbon's frame.\n const dx = this.centreX.value - width / 2;\n const dy = this.centreY.value - height / 2;\n frame.pointerAlong = (dx * frame.cos + dy * frame.sin) * mirror;\n frame.pointerAcross = -dx * frame.sin + dy * frame.cos;\n frame.push = this.open.value * untracked(this.parting) * PART_PUSH * PART_RADIUS;\n frame.radius = PART_RADIUS;\n\n renderer.render(frame);\n }\n}\n\nexport { CENTRE_END, CENTRE_START, INK_DARK, INK_LIGHT, PART_PUSH, PART_RADIUS, PATH, WAVE_PERIOD };\n","<canvas #canvas class=\"wr-thread-lines__canvas\"></canvas>\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 { WrThreadLines } from './thread-lines';\n"],"mappings":";;;;;;;;;;;;;AAkBA,MAAM,OAAO;AAIb,MAAM,SAAS;AAGf,MAAM,SAAS;AAEf,MAAM,aAAa;AAEnB,MAAM,SAAS;AAEf,MAAM,WAAW;AAEjB,MAAM,eAAe;AAErB,MAAM,iBAAiB;AACvB,MAAM,iBAAiB;AAEvB,MAAM,WAAW;AAEjB,MAAM,eAAe;AAGrB,MAAM,gBAAgB,MAAO;AAO7B,MAAM,iBAAiB;AAUvB,MAAM,SAAS;AAqBf,SAAS,cAAc,OAAe,OAAO,MAAI;CAC/C,MAAM,IAAI,YAAY,KAAK;CAC3B,MAAM,SAAS,aAAa,IAAI;CAChC,MAAM,MAAM,IAAI,aAAa,IAAA,CAAiB;CAC9C,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK;EAC1B,MAAM,QAAS,IAAI,MAAO,OAAM,IAAK,IAAI,KAAK,UAAU,IAAK,IAAI;EACjE,MAAM,OAAO,WAAY,qBAAgB,OAAM;EAC/C,MA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+1,7 @@
1
+ import { o as WrPointerTracker } from "./internal-BaQU4t_0.mjs";
1
2
  import * as i0 from "@angular/core";
2
3
  import { DestroyRef, Directive, ElementRef, PLATFORM_ID, afterNextRender, inject } from "@angular/core";
3
4
  import { DOCUMENT as DOCUMENT$1, isPlatformBrowser } from "@angular/common";
4
- import { WrPointerTracker } from "ngwr/animations/core";
5
5
  /**
6
6
  * @license
7
7
  *
@@ -9,9 +9,9 @@ import { WrPointerTracker } from "ngwr/animations/core";
9
9
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
10
10
  */
11
11
  const TAU = 100;
12
- const MAX_FRAME_MS$1 = 100;
12
+ const MAX_FRAME_MS = 100;
13
13
  function tiltRate(dt) {
14
- return 1 - Math.exp(-Math.min(Math.max(dt, 0), MAX_FRAME_MS$1) / TAU);
14
+ return 1 - Math.exp(-Math.min(Math.max(dt, 0), MAX_FRAME_MS) / TAU);
15
15
  }
16
16
  function tiltAngles(clientX, clientY, rect, max = 10) {
17
17
  if (rect.width <= 0 || rect.height <= 0) return {
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-animations-tilt.mjs","names":["MAX_FRAME_MS","DOCUMENT"],"sources":["../../../projects/lib/animations/tilt/tilt.ts","../../../projects/lib/animations/tilt/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 { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { DestroyRef, Directive, ElementRef, PLATFORM_ID, afterNextRender, inject } from '@angular/core';\n\nimport { type WrPointerFollower, WrPointerTracker } from 'ngwr/animations/core';\n\n/**\n * The most the card leans, in degrees, reached with the pointer at an edge.\n * Small on purpose: a lean is a hint that the card is a thing with depth, and\n * at this angle the text's lines stay level enough to read through it. Not\n * smaller: at four degrees over a thousand pixels the near edge of a card grew\n * by a percent, a pixel on a card of a hundred, and nobody saw the card move.\n */\nconst MAX_ANGLE = 10;\n\n/**\n * The viewing distance, in px, for the lean's foreshortening. Close enough\n * that the near edge of a card grows by about four percent at the full angle\n * and the far edge shrinks by as much, eight or nine pixels across a card of\n * a hundred, so the lean reads as a lean; far enough that the card reads as\n * tilted, not as coming out of the page. `tiltDepth` is the number.\n */\nconst PERSPECTIVE = 800;\n\n/**\n * The ease's time constant, in ms: each frame the rendered angle closes the\n * gap to the target by `1 - exp(-dt / TAU)`. Over 100ms the gap drops by two\n * thirds, over 300ms it is gone to the eye. The same on the way back to flat.\n */\nconst TAU = 100;\n\n/** A frame after a throttled tab or a long task moves the angle at most this far, in ms of easing. */\nconst MAX_FRAME_MS = 100;\n\n/** Under this gap, in degrees, the angle is at its target: the loop stops. */\nconst SETTLE = 0.02;\n\n/** One step of the ease, for a frame `dt` ms after the last. */\nexport function tiltRate(dt: number): number {\n return 1 - Math.exp(-Math.min(Math.max(dt, 0), MAX_FRAME_MS) / TAU);\n}\n\n/**\n * The angles for a pointer at `(clientX, clientY)` over a card at `rect`: the\n * edge under the pointer dips away, as if pressed. Positive `rotateX` brings\n * the bottom edge forward, so the pointer below the centre makes it negative;\n * positive `rotateY` sends the right edge back, so the pointer right of the\n * centre makes it positive. The corners give `max` on both axes, the centre\n * gives zero, a point past an edge (a late `pointerleave`) is clamped to the\n * edge. A card with no size (a hidden pane) gives zero.\n */\nexport function tiltAngles(\n clientX: number,\n clientY: number,\n rect: Pick<DOMRect, 'left' | 'top' | 'width' | 'height'>,\n max = MAX_ANGLE\n): { x: number; y: number } {\n if (rect.width <= 0 || rect.height <= 0) return { x: 0, y: 0 };\n const nx = Math.min(Math.max(((clientX - rect.left) / rect.width) * 2 - 1, -1), 1);\n const ny = Math.min(Math.max(((clientY - rect.top) / rect.height) * 2 - 1, -1), 1);\n // `|| 0` turns the `-0` of a centred pointer into `0`.\n return { x: -max * ny || 0, y: max * nx || 0 };\n}\n\n/**\n * How far the lean shows, as the difference between the scale of the near\n * edge and of the far edge of a card `size` px across, turned by `angle`\n * degrees at the viewing distance: the foreshortening the eye reads as depth.\n * `0.08` is an edge grown by four percent against one shrunk by four; under\n * about `0.05` the card looks still.\n */\nexport function tiltDepth(size: number, angle = MAX_ANGLE, perspective = PERSPECTIVE): number {\n const z = (size / 2) * Math.sin((angle * Math.PI) / 180);\n return perspective / (perspective - z) - perspective / (perspective + z);\n}\n\n/** The inline `transform` for a pair of angles. */\nexport function tiltTransform(x: number, y: number): string {\n const deg = (value: number): string => (Math.round(value * 100) / 100).toFixed(2);\n return `perspective(${PERSPECTIVE}px) rotateX(${deg(x)}deg) rotateY(${deg(y)}deg)`;\n}\n\n/**\n * A card leans toward the pointer in 3D while the pointer is over it, and\n * settles back flat when it leaves. The lean is small (`MAX_ANGLE`) and the\n * card's box never changes: `transform` only, so nothing around it moves and\n * the card's own hover and focus styles stay as they are.\n *\n * The pointer plumbing is the shared {@link WrPointerTracker}: one frame per\n * burst of moves, the host's rect read at enter and on scroll or resize, a\n * touch pointer ignored. Each frame takes the target angles from the latest\n * point and eases the rendered angles toward them, an exponential step sized\n * by the frame's real duration (`tiltRate`), then writes one `transform`. The\n * loop runs only while the rendered angles are short of the target, so a still\n * pointer costs no frames. On leave the target is flat and the same ease\n * brings the card back; when it lands, the inline `transform` and\n * `will-change` come off, so at rest the card is exactly as its stylesheet\n * says and its text is rasterised the ordinary way.\n *\n * The ease is in the frame loop and not a CSS transition for two reasons: a\n * `transition` on the host would replace the card's own (`border-color` on\n * the link card), and a transition restarted on every write lags a fast\n * pointer with a visible catch-up. The loop eases every frame from wherever\n * the angle is, so a fast move and a slow one feel the same.\n *\n * Keyboard focus tilts nothing: the focus ring is the hint. Nothing runs\n * under `prefers-reduced-motion: reduce`, under `forced-colors: active` or on\n * the server. No stylesheet, so nothing to `@use`: the host class `wr-tilt` is a\n * hook for a consumer, the directive paints inline.\n */\n@Directive({\n selector: '[wrTilt]',\n host: { class: 'wr-tilt' },\n})\nexport class WrTilt implements WrPointerFollower {\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly doc = inject(DOCUMENT);\n private tracker: WrPointerTracker | null = null;\n /** The rendered angles, in degrees. */\n private x = 0;\n private y = 0;\n /** The last frame's timestamp; `0` while the loop is idle, so the first frame after a pause steps as a normal one. */\n private last = 0;\n\n constructor() {\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n const view = this.doc.defaultView;\n if (!view) return;\n if (view.matchMedia?.('(prefers-reduced-motion: reduce)').matches) return;\n if (view.matchMedia?.('(forced-colors: active)').matches) return;\n this.tracker = new WrPointerTracker(this.host.nativeElement, view, this);\n this.tracker.start();\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.tracker?.stop();\n this.tracker = null;\n this.rest();\n });\n }\n\n enter(): void {\n this.host.nativeElement.style.setProperty('will-change', 'transform');\n }\n\n frame(time: number): void {\n const tracker = this.tracker;\n if (!tracker) return;\n const target = tracker.rect ? tiltAngles(tracker.clientX, tracker.clientY, tracker.rect) : { x: 0, y: 0 };\n const rate = tiltRate(this.last === 0 ? 16 : time - this.last);\n this.x += (target.x - this.x) * rate;\n this.y += (target.y - this.y) * rate;\n\n const settled = Math.abs(target.x - this.x) < SETTLE && Math.abs(target.y - this.y) < SETTLE;\n if (settled) {\n this.x = target.x;\n this.y = target.y;\n this.last = 0;\n } else {\n this.last = time;\n tracker.schedule();\n }\n\n if (settled && !tracker.inside) {\n this.rest();\n return;\n }\n this.host.nativeElement.style.setProperty('transform', tiltTransform(this.x, this.y));\n }\n\n /** The pointer left: ease back to flat over the next frames. */\n leave(): void {\n this.tracker?.schedule();\n }\n\n /** Flat, with nothing inline: the card is its stylesheet's again. */\n private rest(): void {\n this.x = 0;\n this.y = 0;\n this.last = 0;\n const style = this.host.nativeElement.style;\n style.removeProperty('transform');\n style.removeProperty('will-change');\n }\n}\n\nexport { MAX_ANGLE as TILT_MAX_ANGLE, PERSPECTIVE as TILT_PERSPECTIVE, SETTLE as TILT_SETTLE };\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 { WrTilt } from './tilt';\n"],"mappings":";;;;;;;;;;AAmCA,MAAM,MAAM;AAGZ,MAAMA,iBAAe;AAMrB,SAAgB,SAAS,IAAU;CACjC,OAAO,IAAI,KAAK,IAAI,CAAC,KAAK,IAAI,KAAK,IAAI,IAAI,CAAC,GAAGA,cAAY,IAAI,GAAG;AACpE;AAWA,SAAgB,WACd,SACA,SACA,MACA,MAAA,IAAe;CAEf,IAAI,KAAK,SAAS,KAAK,KAAK,UAAU,GAAG,OAAO;EAAE,GAAG;EAAG,GAAG;CAAC;CAC5D,MAAM,KAAK,KAAK,IAAI,KAAK,KAAM,UAAU,KAAK,QAAQ,KAAK,QAAS,IAAI,GAAG,EAAE,GAAG,CAAC;CACjF,MAAM,KAAK,KAAK,IAAI,KAAK,KAAM,UAAU,KAAK,OAAO,KAAK,SAAU,IAAI,GAAG,EAAE,GAAG,CAAC;CAEjF,OAAO;EAAE,GAAG,CAAC,MAAM,MAAM;EAAG,GAAG,MAAM,MAAM;CAAC;AAC9C;AAeA,SAAgB,cAAc,GAAW,GAAS;CAChD,MAAM,OAAO,WAA2B,KAAK,MAAM,QAAQ,GAAG,IAAI,IAAA,CAAK,QAAQ,CAAC;CAChF,OAAO,8BAAyC,IAAI,CAAC,EAAC,eAAgB,IAAI,CAAC,EAAC;AAC9E;AAkCA,IAAa,SAAb,MAAa,OAAM;CACA,OAAO,OAAgC,UAAU;CACjD,MAAM,OAAOC,UAAQ;CAC9B,UAAmC;CAEnC,IAAI;CACJ,IAAI;CAEJ,OAAO;CAEf,cAAA;EACE,IAAI,CAAC,kBAAkB,OAAO,WAAW,CAAC,GAAG;EAE7C,sBAAqB;GACnB,MAAM,OAAO,KAAK,IAAI;GACtB,IAAI,CAAC,MAAM;GACX,IAAI,KAAK,aAAa,kCAAkC,CAAC,CAAC,SAAS;GACnE,IAAI,KAAK,aA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AvEW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAM,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAN,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAM,cAAA;EAAA,UAAA;EAAA,MAAA,EAAA,gBAAA,UAAA;EAAA,UAAA;CAAA,CAAA;;AAAN,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAM,YAAA,CAAA;EAJlB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,MAAM,EAAE,OAAO,UAAS;EACzB,CAAA"}
1
+ {"version":3,"file":"ngwr-animations-tilt.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/animations/tilt/tilt.ts","../../../projects/lib/animations/tilt/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 { DOCUMENT, isPlatformBrowser } from '@angular/common';\nimport { DestroyRef, Directive, ElementRef, PLATFORM_ID, afterNextRender, inject } from '@angular/core';\n\nimport { type WrPointerFollower, WrPointerTracker } from '../internal';\n\n/**\n * The most the card leans, in degrees, reached with the pointer at an edge.\n * Small on purpose: a lean is a hint that the card is a thing with depth, and\n * at this angle the text's lines stay level enough to read through it. Not\n * smaller: at four degrees over a thousand pixels the near edge of a card grew\n * by a percent, a pixel on a card of a hundred, and nobody saw the card move.\n */\nconst MAX_ANGLE = 10;\n\n/**\n * The viewing distance, in px, for the lean's foreshortening. Close enough\n * that the near edge of a card grows by about four percent at the full angle\n * and the far edge shrinks by as much, eight or nine pixels across a card of\n * a hundred, so the lean reads as a lean; far enough that the card reads as\n * tilted, not as coming out of the page. `tiltDepth` is the number.\n */\nconst PERSPECTIVE = 800;\n\n/**\n * The ease's time constant, in ms: each frame the rendered angle closes the\n * gap to the target by `1 - exp(-dt / TAU)`. Over 100ms the gap drops by two\n * thirds, over 300ms it is gone to the eye. The same on the way back to flat.\n */\nconst TAU = 100;\n\n/** A frame after a throttled tab or a long task moves the angle at most this far, in ms of easing. */\nconst MAX_FRAME_MS = 100;\n\n/** Under this gap, in degrees, the angle is at its target: the loop stops. */\nconst SETTLE = 0.02;\n\n/** One step of the ease, for a frame `dt` ms after the last. */\nexport function tiltRate(dt: number): number {\n return 1 - Math.exp(-Math.min(Math.max(dt, 0), MAX_FRAME_MS) / TAU);\n}\n\n/**\n * The angles for a pointer at `(clientX, clientY)` over a card at `rect`: the\n * edge under the pointer dips away, as if pressed. Positive `rotateX` brings\n * the bottom edge forward, so the pointer below the centre makes it negative;\n * positive `rotateY` sends the right edge back, so the pointer right of the\n * centre makes it positive. The corners give `max` on both axes, the centre\n * gives zero, a point past an edge (a late `pointerleave`) is clamped to the\n * edge. A card with no size (a hidden pane) gives zero.\n */\nexport function tiltAngles(\n clientX: number,\n clientY: number,\n rect: Pick<DOMRect, 'left' | 'top' | 'width' | 'height'>,\n max = MAX_ANGLE\n): { x: number; y: number } {\n if (rect.width <= 0 || rect.height <= 0) return { x: 0, y: 0 };\n const nx = Math.min(Math.max(((clientX - rect.left) / rect.width) * 2 - 1, -1), 1);\n const ny = Math.min(Math.max(((clientY - rect.top) / rect.height) * 2 - 1, -1), 1);\n // `|| 0` turns the `-0` of a centred pointer into `0`.\n return { x: -max * ny || 0, y: max * nx || 0 };\n}\n\n/**\n * How far the lean shows, as the difference between the scale of the near\n * edge and of the far edge of a card `size` px across, turned by `angle`\n * degrees at the viewing distance: the foreshortening the eye reads as depth.\n * `0.08` is an edge grown by four percent against one shrunk by four; under\n * about `0.05` the card looks still.\n */\nexport function tiltDepth(size: number, angle = MAX_ANGLE, perspective = PERSPECTIVE): number {\n const z = (size / 2) * Math.sin((angle * Math.PI) / 180);\n return perspective / (perspective - z) - perspective / (perspective + z);\n}\n\n/** The inline `transform` for a pair of angles. */\nexport function tiltTransform(x: number, y: number): string {\n const deg = (value: number): string => (Math.round(value * 100) / 100).toFixed(2);\n return `perspective(${PERSPECTIVE}px) rotateX(${deg(x)}deg) rotateY(${deg(y)}deg)`;\n}\n\n/**\n * A card leans toward the pointer in 3D while the pointer is over it, and\n * settles back flat when it leaves. The lean is small (`MAX_ANGLE`) and the\n * card's box never changes: `transform` only, so nothing around it moves and\n * the card's own hover and focus styles stay as they are.\n *\n * The pointer plumbing is the shared {@link WrPointerTracker}: one frame per\n * burst of moves, the host's rect read at enter and on scroll or resize, a\n * touch pointer ignored. Each frame takes the target angles from the latest\n * point and eases the rendered angles toward them, an exponential step sized\n * by the frame's real duration (`tiltRate`), then writes one `transform`. The\n * loop runs only while the rendered angles are short of the target, so a still\n * pointer costs no frames. On leave the target is flat and the same ease\n * brings the card back; when it lands, the inline `transform` and\n * `will-change` come off, so at rest the card is exactly as its stylesheet\n * says and its text is rasterised the ordinary way.\n *\n * The ease is in the frame loop and not a CSS transition for two reasons: a\n * `transition` on the host would replace the card's own (`border-color` on\n * the link card), and a transition restarted on every write lags a fast\n * pointer with a visible catch-up. The loop eases every frame from wherever\n * the angle is, so a fast move and a slow one feel the same.\n *\n * Keyboard focus tilts nothing: the focus ring is the hint. Nothing runs\n * under `prefers-reduced-motion: reduce`, under `forced-colors: active` or on\n * the server. No stylesheet, so nothing to `@use`: the host class `wr-tilt` is a\n * hook for a consumer, the directive paints inline.\n */\n@Directive({\n selector: '[wrTilt]',\n host: { class: 'wr-tilt' },\n})\nexport class WrTilt implements WrPointerFollower {\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly doc = inject(DOCUMENT);\n private tracker: WrPointerTracker | null = null;\n /** The rendered angles, in degrees. */\n private x = 0;\n private y = 0;\n /** The last frame's timestamp; `0` while the loop is idle, so the first frame after a pause steps as a normal one. */\n private last = 0;\n\n constructor() {\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n\n afterNextRender(() => {\n const view = this.doc.defaultView;\n if (!view) return;\n if (view.matchMedia?.('(prefers-reduced-motion: reduce)').matches) return;\n if (view.matchMedia?.('(forced-colors: active)').matches) return;\n this.tracker = new WrPointerTracker(this.host.nativeElement, view, this);\n this.tracker.start();\n });\n\n inject(DestroyRef).onDestroy(() => {\n this.tracker?.stop();\n this.tracker = null;\n this.rest();\n });\n }\n\n enter(): void {\n this.host.nativeElement.style.setProperty('will-change', 'transform');\n }\n\n frame(time: number): void {\n const tracker = this.tracker;\n if (!tracker) return;\n const target = tracker.rect ? tiltAngles(tracker.clientX, tracker.clientY, tracker.rect) : { x: 0, y: 0 };\n const rate = tiltRate(this.last === 0 ? 16 : time - this.last);\n this.x += (target.x - this.x) * rate;\n this.y += (target.y - this.y) * rate;\n\n const settled = Math.abs(target.x - this.x) < SETTLE && Math.abs(target.y - this.y) < SETTLE;\n if (settled) {\n this.x = target.x;\n this.y = target.y;\n this.last = 0;\n } else {\n this.last = time;\n tracker.schedule();\n }\n\n if (settled && !tracker.inside) {\n this.rest();\n return;\n }\n this.host.nativeElement.style.setProperty('transform', tiltTransform(this.x, this.y));\n }\n\n /** The pointer left: ease back to flat over the next frames. */\n leave(): void {\n this.tracker?.schedule();\n }\n\n /** Flat, with nothing inline: the card is its stylesheet's again. */\n private rest(): void {\n this.x = 0;\n this.y = 0;\n this.last = 0;\n const style = this.host.nativeElement.style;\n style.removeProperty('transform');\n style.removeProperty('will-change');\n }\n}\n\nexport { MAX_ANGLE as TILT_MAX_ANGLE, PERSPECTIVE as TILT_PERSPECTIVE, SETTLE as TILT_SETTLE };\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 { WrTilt } from './tilt';\n"],"mappings":";;;;;;;;;;AAmCA,MAAM,MAAM;AAGZ,MAAM,eAAe;AAMrB,SAAgB,SAAS,IAAU;CACjC,OAAO,IAAI,KAAK,IAAI,CAAC,KAAK,IAAI,KA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gBAAA,UAAA;EAAA,UAAA;CAAA,CAAA;;AAAN,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAM,YAAA,CAAA;EAJlB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,MAAM,EAAE,OAAO,UAAS;EACzB,CAAA"}
@@ -1,9 +1,9 @@
1
+ import { n as VIEW_THRESHOLD, r as graphemes } from "./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, signal, untracked } from "@angular/core";
3
4
  import { DOCUMENT as DOCUMENT$1, isPlatformBrowser } from "@angular/common";
4
- import { numAttr, wrCheckStyles } from "ngwr/utils";
5
+ import { wrCheckStyles, wrNumAttr } from "ngwr/utils";
5
6
  import { WrPlatform } from "ngwr/platform";
6
- import { VIEW_THRESHOLD, graphemes } from "ngwr/animations/core";
7
7
  /**
8
8
  * @license
9
9
  *
@@ -55,11 +55,11 @@ var WrTypewriter = class WrTypewriter {
55
55
  });
56
56
  hold = input(TYPEWRITER_HOLD, {
57
57
  ...ngDevMode ? { debugName: "hold" } : /* istanbul ignore next */ {},
58
- transform: numAttr(TYPEWRITER_HOLD)
58
+ transform: wrNumAttr(TYPEWRITER_HOLD)
59
59
  });
60
60
  delay = input(0, {
61
61
  ...ngDevMode ? { debugName: "delay" } : /* istanbul ignore next */ {},
62
- transform: numAttr(0)
62
+ transform: wrNumAttr(0)
63
63
  });
64
64
  trigger = input("view", ...ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []);
65
65
  phase = signal("idle", ...ngDevMode ? [{ debugName: "phase" }] : /* istanbul ignore next */ []);