@eui/core 22.0.0-alpha.9 → 22.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (349) hide show
  1. package/CHANGELOG.md +1282 -0
  2. package/assets/i18n-eui/bg.json +23 -1
  3. package/assets/i18n-eui/cs.json +23 -1
  4. package/assets/i18n-eui/da.json +23 -1
  5. package/assets/i18n-eui/de.json +23 -1
  6. package/assets/i18n-eui/el.json +23 -1
  7. package/assets/i18n-eui/en.json +23 -1
  8. package/assets/i18n-eui/es.json +23 -1
  9. package/assets/i18n-eui/et.json +31 -2
  10. package/assets/i18n-eui/fi.json +24 -2
  11. package/assets/i18n-eui/fr.json +23 -1
  12. package/assets/i18n-eui/ga.json +23 -1
  13. package/assets/i18n-eui/hr.json +23 -1
  14. package/assets/i18n-eui/hu.json +23 -1
  15. package/assets/i18n-eui/it.json +23 -1
  16. package/assets/i18n-eui/lt.json +23 -1
  17. package/assets/i18n-eui/lv.json +23 -1
  18. package/assets/i18n-eui/mt.json +23 -1
  19. package/assets/i18n-eui/nl.json +23 -1
  20. package/assets/i18n-eui/pl.json +23 -1
  21. package/assets/i18n-eui/pt.json +23 -1
  22. package/assets/i18n-eui/ro.json +23 -1
  23. package/assets/i18n-eui/sk.json +23 -1
  24. package/assets/i18n-eui/sl.json +23 -1
  25. package/assets/i18n-eui/sv.json +23 -1
  26. package/docs/changelog.html +1796 -0
  27. package/docs/classes/ActivatedRouteAction.html +1 -1
  28. package/docs/classes/AddApiQueueItemAction.html +1 -1
  29. package/docs/classes/AddAppLoadedConfigModulesAction.html +1 -1
  30. package/docs/classes/ApiQueueServiceMock.html +1 -1
  31. package/docs/classes/EmptyApiQueueAction.html +1 -1
  32. package/docs/classes/ErrorSubClass.html +1 -1
  33. package/docs/classes/EuiAppShellServiceMock.html +3 -3
  34. package/docs/classes/EuiCoreRootGuardClass.html +1 -1
  35. package/docs/classes/EuiError.html +1 -1
  36. package/docs/classes/I18nResourceImpl.html +1 -1
  37. package/docs/classes/InitStoreAction.html +1 -1
  38. package/docs/classes/RemoveApiQueueItemAction.html +1 -1
  39. package/docs/classes/ServiceResolver.html +722 -0
  40. package/docs/classes/TooltipImportCollector.html +524 -0
  41. package/docs/classes/TranslateServiceMock.html +8 -8
  42. package/docs/classes/UpdateAppConnectionAction.html +1 -1
  43. package/docs/classes/UpdateAppStatusAction.html +1 -1
  44. package/docs/classes/UpdateAppVersionAction.html +1 -1
  45. package/docs/classes/UpdateCurrentModuleAction.html +1 -1
  46. package/docs/classes/UpdateI18nStateAction.html +1 -1
  47. package/docs/classes/UpdateLocaleStateAction.html +1 -1
  48. package/docs/classes/UpdateNotificationsListAction.html +1 -1
  49. package/docs/classes/UpdateUserDashboardAction.html +1 -1
  50. package/docs/classes/UpdateUserDetailsAction.html +1 -1
  51. package/docs/classes/UpdateUserPreferencesAction.html +1 -1
  52. package/docs/classes/UpdateUserRightsAction.html +1 -1
  53. package/docs/classes/UpdateUserStateAction.html +1 -1
  54. package/docs/injectables/ApiQueueService.html +3 -3
  55. package/docs/injectables/EuiAppShellService.html +1 -1
  56. package/docs/injectables/EuiDynamicMenuService.html +5 -5
  57. package/docs/injectables/EuiPermissionService.html +1 -1
  58. package/docs/injectables/EuiThemeService.html +1 -1
  59. package/docs/injectables/EuiTimezoneService.html +1 -1
  60. package/docs/injectables/I18nLoader.html +2 -2
  61. package/docs/injectables/I18nService.html +1 -1
  62. package/docs/injectables/I18nServiceMock.html +21 -6
  63. package/docs/injectables/LocalForageService.html +1 -1
  64. package/docs/injectables/LocaleService.html +1 -1
  65. package/docs/injectables/LocaleServiceMock.html +1 -1
  66. package/docs/injectables/LogService.html +1 -1
  67. package/docs/injectables/StoreService.html +2 -2
  68. package/docs/injectables/StoreServiceMock.html +1 -1
  69. package/docs/injectables/UserService.html +1 -1
  70. package/docs/injectables/UserServiceMock.html +1 -1
  71. package/docs/interceptors/{UxRequestErrorModelInterceptor.html → RequestErrorInterceptor.html} +3 -3
  72. package/docs/interfaces/Annotation.html +402 -0
  73. package/docs/interfaces/AstLike.html +477 -0
  74. package/docs/interfaces/Edit-1.html +1 -1
  75. package/docs/interfaces/Edit-10.html +395 -0
  76. package/docs/interfaces/Edit-11.html +395 -0
  77. package/docs/interfaces/Edit-12.html +395 -0
  78. package/docs/interfaces/Edit-13.html +395 -0
  79. package/docs/interfaces/Edit-14.html +446 -0
  80. package/docs/interfaces/Edit-15.html +395 -0
  81. package/docs/interfaces/Edit-16.html +395 -0
  82. package/docs/interfaces/Edit-17.html +395 -0
  83. package/docs/interfaces/Edit-18.html +395 -0
  84. package/docs/interfaces/Edit-19.html +395 -0
  85. package/docs/interfaces/Edit-2.html +1 -1
  86. package/docs/interfaces/Edit-20.html +395 -0
  87. package/docs/interfaces/Edit-21.html +395 -0
  88. package/docs/interfaces/Edit-22.html +446 -0
  89. package/docs/interfaces/Edit-23.html +395 -0
  90. package/docs/interfaces/Edit-3.html +1 -1
  91. package/docs/interfaces/Edit-4.html +1 -1
  92. package/docs/interfaces/Edit-5.html +395 -0
  93. package/docs/interfaces/Edit-6.html +395 -0
  94. package/docs/interfaces/Edit-7.html +395 -0
  95. package/docs/interfaces/Edit-8.html +395 -0
  96. package/docs/interfaces/Edit-9.html +395 -0
  97. package/docs/interfaces/Edit.html +1 -1
  98. package/docs/interfaces/IEuiTheme.html +4 -4
  99. package/docs/interfaces/LoadedResources.html +2 -2
  100. package/docs/interfaces/MigrateAllSchema.html +45 -0
  101. package/docs/interfaces/MigrateEclSchema.html +368 -0
  102. package/docs/interfaces/MigrateResult.html +39 -0
  103. package/docs/interfaces/ModuleLoadEvent.html +2 -2
  104. package/docs/interfaces/OutputFormatUsage.html +446 -0
  105. package/docs/interfaces/ProvisionResult.html +407 -0
  106. package/docs/interfaces/{ActionReducer.html → RefInfo.html} +30 -24
  107. package/docs/interfaces/Refs-1.html +443 -0
  108. package/docs/interfaces/Refs.html +413 -0
  109. package/docs/interfaces/RemovedAttr.html +401 -0
  110. package/docs/interfaces/{TranslationKeys.html → RemovedIdentifier.html} +100 -16
  111. package/docs/interfaces/RemovedTag.html +356 -0
  112. package/docs/interfaces/RewriteResult.html +356 -0
  113. package/docs/interfaces/Schema-10.html +14 -1
  114. package/docs/interfaces/Schema-11.html +14 -1
  115. package/docs/interfaces/Schema-12.html +14 -1
  116. package/docs/interfaces/Schema-13.html +31 -1
  117. package/docs/interfaces/Schema-14.html +14 -1
  118. package/docs/interfaces/Schema-15.html +12 -1
  119. package/docs/interfaces/Schema-16.html +20 -1
  120. package/docs/interfaces/Schema-17.html +1 -1
  121. package/docs/interfaces/Schema-18.html +1 -1
  122. package/docs/interfaces/Schema-19.html +1 -1
  123. package/docs/interfaces/Schema-20.html +1 -1
  124. package/docs/interfaces/Schema-21.html +1 -1
  125. package/docs/interfaces/Schema-22.html +1 -1
  126. package/docs/interfaces/Schema-23.html +368 -0
  127. package/docs/interfaces/Schema-24.html +368 -0
  128. package/docs/interfaces/Schema-25.html +413 -0
  129. package/docs/interfaces/Schema-26.html +387 -0
  130. package/docs/interfaces/Schema-27.html +368 -0
  131. package/docs/interfaces/Schema-28.html +368 -0
  132. package/docs/interfaces/Schema-29.html +368 -0
  133. package/docs/interfaces/Schema-30.html +368 -0
  134. package/docs/interfaces/Schema-31.html +368 -0
  135. package/docs/interfaces/Schema-32.html +368 -0
  136. package/docs/interfaces/Schema-33.html +368 -0
  137. package/docs/interfaces/Schema-34.html +378 -0
  138. package/docs/interfaces/Schema-35.html +368 -0
  139. package/docs/interfaces/Schema-36.html +368 -0
  140. package/docs/interfaces/Schema-37.html +368 -0
  141. package/docs/interfaces/Schema-38.html +368 -0
  142. package/docs/interfaces/Schema-39.html +368 -0
  143. package/docs/interfaces/Schema-4.html +13 -1
  144. package/docs/interfaces/Schema-40.html +368 -0
  145. package/docs/interfaces/Schema-41.html +380 -0
  146. package/docs/interfaces/Schema-42.html +368 -0
  147. package/docs/interfaces/Schema-43.html +368 -0
  148. package/docs/interfaces/Schema-5.html +26 -1
  149. package/docs/interfaces/Schema-6.html +20 -1
  150. package/docs/interfaces/Schema-7.html +14 -1
  151. package/docs/interfaces/Schema-8.html +22 -1
  152. package/docs/interfaces/Schema-9.html +13 -1
  153. package/docs/interfaces/SelectorMapping.html +395 -0
  154. package/docs/interfaces/TemplateScan.html +373 -0
  155. package/docs/interfaces/TemplateSource.html +395 -0
  156. package/docs/interfaces/TextChange-1.html +395 -0
  157. package/docs/interfaces/TextChange.html +1 -1
  158. package/docs/interfaces/TextEdit.html +395 -0
  159. package/docs/interfaces/TodoEdit.html +395 -0
  160. package/docs/interfaces/TrackedComponent.html +652 -0
  161. package/docs/interfaces/TsEnv.html +395 -0
  162. package/docs/js/menu-wc.js +189 -9
  163. package/docs/js/search/search_index.js +2 -2
  164. package/docs/json/documentation.json +67465 -29375
  165. package/docs/llms.txt +1691 -105
  166. package/docs/miscellaneous/functions.html +29498 -3829
  167. package/docs/miscellaneous/typealiases.html +252 -0
  168. package/docs/miscellaneous/variables.html +7958 -2493
  169. package/docs/overview.html +2 -2
  170. package/docs/properties.html +1 -1
  171. package/fesm2022/eui-core.mjs +5783 -5463
  172. package/fesm2022/eui-core.mjs.map +1 -1
  173. package/migrations.json +233 -0
  174. package/package.json +2 -4
  175. package/schematics/add-eui-imports/index.js +3 -13
  176. package/schematics/add-eui-imports/index.js.map +1 -1
  177. package/schematics/collection.json +125 -6
  178. package/schematics/migrate/index.js +2 -2
  179. package/schematics/migrate/replacements/icons.d.ts +3 -1
  180. package/schematics/migrate/replacements/icons.js +15 -5
  181. package/schematics/migrate/replacements/icons.js.map +1 -1
  182. package/schematics/migrate/replacements/mwp.js +1 -0
  183. package/schematics/migrate/replacements/mwp.js.map +1 -1
  184. package/schematics/migrate-all/index.d.ts +1 -0
  185. package/schematics/migrate-all/index.js +21 -0
  186. package/schematics/migrate-all/index.js.map +1 -1
  187. package/schematics/migrate-all/schema.json +6 -0
  188. package/schematics/migrate-ecl/index.d.ts +21 -0
  189. package/schematics/migrate-ecl/index.js +40 -0
  190. package/schematics/migrate-ecl/index.js.map +1 -0
  191. package/schematics/migrate-ecl/schema.json +20 -0
  192. package/schematics/migrate-ecl-breadcrumb/index.d.ts +16 -0
  193. package/schematics/migrate-ecl-breadcrumb/index.js +177 -0
  194. package/schematics/migrate-ecl-breadcrumb/index.js.map +1 -0
  195. package/schematics/migrate-ecl-breadcrumb/schema.json +18 -0
  196. package/schematics/migrate-ecl-file/index.d.ts +28 -0
  197. package/schematics/migrate-ecl-file/index.js +271 -0
  198. package/schematics/migrate-ecl-file/index.js.map +1 -0
  199. package/schematics/migrate-ecl-file/schema.json +18 -0
  200. package/schematics/migrate-ecl-icon/index.d.ts +22 -0
  201. package/schematics/migrate-ecl-icon/index.js +257 -0
  202. package/schematics/migrate-ecl-icon/index.js.map +1 -0
  203. package/schematics/migrate-ecl-icon/schema.json +18 -0
  204. package/schematics/migrate-ecl-inpage-navigation/index.d.ts +17 -0
  205. package/schematics/migrate-ecl-inpage-navigation/index.js +177 -0
  206. package/schematics/migrate-ecl-inpage-navigation/index.js.map +1 -0
  207. package/schematics/migrate-ecl-inpage-navigation/schema.json +18 -0
  208. package/schematics/migrate-ecl-link/index.d.ts +25 -0
  209. package/schematics/migrate-ecl-link/index.js +298 -0
  210. package/schematics/migrate-ecl-link/index.js.map +1 -0
  211. package/schematics/migrate-ecl-link/schema.json +18 -0
  212. package/schematics/migrate-ecl-page-header/index.d.ts +16 -0
  213. package/schematics/migrate-ecl-page-header/index.js +177 -0
  214. package/schematics/migrate-ecl-page-header/index.js.map +1 -0
  215. package/schematics/migrate-ecl-page-header/schema.json +18 -0
  216. package/schematics/migrate-ecl-page-summary/index.d.ts +17 -0
  217. package/schematics/migrate-ecl-page-summary/index.js +177 -0
  218. package/schematics/migrate-ecl-page-summary/index.js.map +1 -0
  219. package/schematics/migrate-ecl-page-summary/schema.json +18 -0
  220. package/schematics/migrate-ecl-pagination/index.d.ts +17 -0
  221. package/schematics/migrate-ecl-pagination/index.js +177 -0
  222. package/schematics/migrate-ecl-pagination/index.js.map +1 -0
  223. package/schematics/migrate-ecl-pagination/schema.json +18 -0
  224. package/schematics/migrate-ecl-quiz/index.d.ts +17 -0
  225. package/schematics/migrate-ecl-quiz/index.js +190 -0
  226. package/schematics/migrate-ecl-quiz/index.js.map +1 -0
  227. package/schematics/migrate-ecl-quiz/schema.json +18 -0
  228. package/schematics/migrate-ecl-removed-components/index.d.ts +32 -0
  229. package/schematics/migrate-ecl-removed-components/index.js +284 -0
  230. package/schematics/migrate-ecl-removed-components/index.js.map +1 -0
  231. package/schematics/migrate-ecl-removed-components/schema.json +18 -0
  232. package/schematics/migrate-ecl-site-footer/index.d.ts +17 -0
  233. package/schematics/migrate-ecl-site-footer/index.js +177 -0
  234. package/schematics/migrate-ecl-site-footer/index.js.map +1 -0
  235. package/schematics/migrate-ecl-site-footer/schema.json +18 -0
  236. package/schematics/migrate-ecl-tabs/index.d.ts +15 -0
  237. package/schematics/migrate-ecl-tabs/index.js +178 -0
  238. package/schematics/migrate-ecl-tabs/index.js.map +1 -0
  239. package/schematics/migrate-ecl-tabs/schema.json +18 -0
  240. package/schematics/migrate-ecl-timeline/index.d.ts +22 -0
  241. package/schematics/migrate-ecl-timeline/index.js +182 -0
  242. package/schematics/migrate-ecl-timeline/index.js.map +1 -0
  243. package/schematics/migrate-ecl-timeline/schema.json +18 -0
  244. package/schematics/migrate-eui-accent/index.js +5 -7
  245. package/schematics/migrate-eui-accent/index.js.map +1 -1
  246. package/schematics/migrate-eui-alert/index.js +7 -10
  247. package/schematics/migrate-eui-alert/index.js.map +1 -1
  248. package/schematics/migrate-eui-autocomplete/index.d.ts +7 -0
  249. package/schematics/migrate-eui-autocomplete/index.js +552 -0
  250. package/schematics/migrate-eui-autocomplete/index.js.map +1 -0
  251. package/schematics/migrate-eui-autocomplete/schema.json +19 -0
  252. package/schematics/migrate-eui-avatar/index.js +5 -7
  253. package/schematics/migrate-eui-avatar/index.js.map +1 -1
  254. package/schematics/migrate-eui-button/index.js +5 -7
  255. package/schematics/migrate-eui-button/index.js.map +1 -1
  256. package/schematics/migrate-eui-chip/index.js +20 -11
  257. package/schematics/migrate-eui-chip/index.js.map +1 -1
  258. package/schematics/migrate-eui-chip/schema.json +1 -1
  259. package/schematics/migrate-eui-chip-list/index.js +16 -23
  260. package/schematics/migrate-eui-chip-list/index.js.map +1 -1
  261. package/schematics/migrate-eui-date-range-selector/index.d.ts +24 -0
  262. package/schematics/migrate-eui-date-range-selector/index.js +115 -0
  263. package/schematics/migrate-eui-date-range-selector/index.js.map +1 -0
  264. package/schematics/migrate-eui-date-range-selector/schema.json +19 -0
  265. package/schematics/migrate-eui-datepicker/adapter-provision.d.ts +16 -0
  266. package/schematics/migrate-eui-datepicker/adapter-provision.js +278 -0
  267. package/schematics/migrate-eui-datepicker/adapter-provision.js.map +1 -0
  268. package/schematics/migrate-eui-datepicker/component-refs.d.ts +51 -0
  269. package/schematics/migrate-eui-datepicker/component-refs.js +552 -0
  270. package/schematics/migrate-eui-datepicker/component-refs.js.map +1 -0
  271. package/schematics/migrate-eui-datepicker/formats.d.ts +8 -0
  272. package/schematics/migrate-eui-datepicker/formats.js +73 -0
  273. package/schematics/migrate-eui-datepicker/formats.js.map +1 -0
  274. package/schematics/migrate-eui-datepicker/index.d.ts +23 -0
  275. package/schematics/migrate-eui-datepicker/index.js +226 -0
  276. package/schematics/migrate-eui-datepicker/index.js.map +1 -0
  277. package/schematics/migrate-eui-datepicker/schema.json +25 -0
  278. package/schematics/migrate-eui-dialog/index.d.ts +23 -0
  279. package/schematics/migrate-eui-dialog/index.js +401 -0
  280. package/schematics/migrate-eui-dialog/index.js.map +1 -0
  281. package/schematics/migrate-eui-dialog/schema.json +19 -0
  282. package/schematics/migrate-eui-discussion-thread/index.js +5 -7
  283. package/schematics/migrate-eui-discussion-thread/index.js.map +1 -1
  284. package/schematics/migrate-eui-editor/index.js +5 -7
  285. package/schematics/migrate-eui-editor/index.js.map +1 -1
  286. package/schematics/migrate-eui-fieldset/index.js +5 -7
  287. package/schematics/migrate-eui-fieldset/index.js.map +1 -1
  288. package/schematics/migrate-eui-icon-svg/index.js +5 -8
  289. package/schematics/migrate-eui-icon-svg/index.js.map +1 -1
  290. package/schematics/migrate-eui-icon-toggle/index.js +5 -8
  291. package/schematics/migrate-eui-icon-toggle/index.js.map +1 -1
  292. package/schematics/migrate-eui-popover/index.js +40 -16
  293. package/schematics/migrate-eui-popover/index.js.map +1 -1
  294. package/schematics/migrate-eui-popover/signals.d.ts +13 -0
  295. package/schematics/migrate-eui-popover/signals.js +430 -0
  296. package/schematics/migrate-eui-popover/signals.js.map +1 -0
  297. package/schematics/migrate-eui-progress-circle/index.js +5 -8
  298. package/schematics/migrate-eui-progress-circle/index.js.map +1 -1
  299. package/schematics/migrate-eui-slider/index.d.ts +13 -0
  300. package/schematics/migrate-eui-slider/index.js +405 -0
  301. package/schematics/migrate-eui-slider/index.js.map +1 -0
  302. package/schematics/migrate-eui-slider/schema.json +19 -0
  303. package/schematics/migrate-eui-tab-signals/index.d.ts +7 -0
  304. package/schematics/migrate-eui-tab-signals/index.js +382 -0
  305. package/schematics/migrate-eui-tab-signals/index.js.map +1 -0
  306. package/schematics/migrate-eui-tab-signals/schema.json +19 -0
  307. package/schematics/migrate-eui-table/index.js +29 -14
  308. package/schematics/migrate-eui-table/index.js.map +1 -1
  309. package/schematics/migrate-eui-tabs/index.js +8 -11
  310. package/schematics/migrate-eui-tabs/index.js.map +1 -1
  311. package/schematics/migrate-eui-timepicker/index.d.ts +19 -0
  312. package/schematics/migrate-eui-timepicker/index.js +38 -0
  313. package/schematics/migrate-eui-timepicker/index.js.map +1 -0
  314. package/schematics/migrate-eui-timepicker/schema.json +19 -0
  315. package/schematics/migrate-eui-toolbar-menu/index.js +6 -8
  316. package/schematics/migrate-eui-toolbar-menu/index.js.map +1 -1
  317. package/schematics/migrate-eui-tooltip/index.js +256 -10
  318. package/schematics/migrate-eui-tooltip/index.js.map +1 -1
  319. package/schematics/migrate-eui-tooltip/schema.json +19 -0
  320. package/schematics/migrate-ngx-translate-18/index.d.ts +16 -0
  321. package/schematics/migrate-ngx-translate-18/index.js +970 -0
  322. package/schematics/migrate-ngx-translate-18/index.js.map +1 -0
  323. package/schematics/migrate-ngx-translate-18/schema.json +19 -0
  324. package/schematics/migrate-to-signals/ecl-signal-map.d.ts +17 -0
  325. package/schematics/migrate-to-signals/ecl-signal-map.js +342 -0
  326. package/schematics/migrate-to-signals/ecl-signal-map.js.map +1 -0
  327. package/schematics/migrate-to-signals/index.d.ts +3 -2
  328. package/schematics/migrate-to-signals/index.js +543 -73
  329. package/schematics/migrate-to-signals/index.js.map +1 -1
  330. package/schematics/migrate-to-signals/schema.json +19 -0
  331. package/schematics/migrate-to-signals/signal-map.d.ts +20 -0
  332. package/schematics/migrate-to-signals/signal-map.js +182 -3
  333. package/schematics/migrate-to-signals/signal-map.js.map +1 -1
  334. package/schematics/migrate-to-standalone/index.js +8 -13
  335. package/schematics/migrate-to-standalone/index.js.map +1 -1
  336. package/schematics/utils/date-adapter.d.ts +30 -0
  337. package/schematics/utils/date-adapter.js +113 -0
  338. package/schematics/utils/date-adapter.js.map +1 -0
  339. package/schematics/utils/template-walk.d.ts +11 -0
  340. package/schematics/utils/template-walk.js +43 -0
  341. package/schematics/utils/template-walk.js.map +1 -0
  342. package/schematics/utils/todo-comment.d.ts +25 -0
  343. package/schematics/utils/todo-comment.js +47 -0
  344. package/schematics/utils/todo-comment.js.map +1 -0
  345. package/schematics/utils/tooltip-message.d.ts +32 -0
  346. package/schematics/utils/tooltip-message.js +251 -0
  347. package/schematics/utils/tooltip-message.js.map +1 -0
  348. package/types/eui-core.d.ts +2105 -2174
  349. package/types/eui-core.d.ts.map +1 -1
@@ -35,13 +35,39 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.migrateToSignals = migrateToSignals;
37
37
  const compiler_1 = require("@angular/compiler");
38
+ const template_walk_1 = require("../utils/template-walk");
38
39
  const ts = __importStar(require("typescript"));
39
40
  const dry_run_1 = require("../utils/dry-run");
40
41
  const signal_map_1 = require("./signal-map");
42
+ const ecl_signal_map_1 = require("./ecl-signal-map");
41
43
  /**
42
- * Migrates consumer code that accesses EUI component instances programmatically.
44
+ * Combined EUI + ECL signal maps. The migration logic is identical for both
45
+ * libraries (plain field → signal getter), so the maps are merged and the rest
46
+ * of the engine treats them uniformly. EUI and ECL class names don't collide
47
+ * (Eui* vs Ecl* prefixes), and the selector namespaces are disjoint.
48
+ */
49
+ const EUI_SIGNAL_MAP = { ...signal_map_1.EUI_SIGNAL_MAP, ...ecl_signal_map_1.ECL_SIGNAL_MAP };
50
+ const EUI_SELECTOR_TO_CLASS = { ...signal_map_1.EUI_SELECTOR_TO_CLASS, ...ecl_signal_map_1.ECL_SELECTOR_TO_CLASS };
51
+ /** Every class the schematic knows about (signals, outputs or removed host bindings). */
52
+ const KNOWN_CLASSES = new Set([
53
+ ...Object.keys(EUI_SIGNAL_MAP),
54
+ ...Object.keys(signal_map_1.EUI_OUTPUT_MAP),
55
+ ...Object.keys(signal_map_1.EUI_HOST_BINDING_REMOVED_MAP),
56
+ ]);
57
+ const isKnownClass = (name) => !!name && KNOWN_CLASSES.has(name);
58
+ /** rxjs functions that take Observables as (possibly array-wrapped) arguments. */
59
+ const OBSERVABLE_COMBINATORS = new Set([
60
+ 'merge', 'race', 'combineLatest', 'forkJoin', 'concat', 'zip', 'firstValueFrom', 'lastValueFrom', 'raceWith', 'mergeWith', 'concatWith', 'zipWith', 'combineLatestWith',
61
+ ]);
62
+ /** Observable methods that need a real Observable instead of an OutputEmitterRef. */
63
+ const OBSERVABLE_METHODS = new Set(['subscribe', 'pipe', 'asObservable', 'forEach', 'toPromise']);
64
+ /** QueryList iteration methods whose callback parameter is an element of the list. */
65
+ const LIST_ITERATION_METHODS = new Set(['forEach', 'map', 'filter', 'some', 'every', 'find', 'findIndex', 'reduce']);
66
+ /**
67
+ * Migrates consumer code that accesses EUI or ECL component instances
68
+ * programmatically.
43
69
  *
44
- * When EUI migrated @Input() → input(), @ViewChild() → viewChild(), and
70
+ * When EUI/ECL migrated @Input() → input(), @ViewChild() → viewChild(), and
45
71
  * @ContentChild() → contentChild(), properties that were plain class fields
46
72
  * became signal getters. Consumers who access them via @ViewChild need to
47
73
  * change `comp.prop` to `comp.prop()`.
@@ -60,6 +86,7 @@ function migrateToSignals(options = {}) {
60
86
  const scanPath = options.path ? '/' + options.path.replace(/^\.?\//, '').replace(/\/$/, '') : '';
61
87
  let fileCount = 0;
62
88
  let propCount = 0;
89
+ let todoCount = 0;
63
90
  visitDir(tree.getDir(scanPath || '/'), (path) => {
64
91
  if (!path.endsWith('.ts'))
65
92
  return;
@@ -77,16 +104,25 @@ function migrateToSignals(options = {}) {
77
104
  const result = migrateTypeScript(original, path, tree, context);
78
105
  if (result.source !== original) {
79
106
  if (options.dryRun) {
80
- (0, dry_run_1.logDryRun)(context, `Would migrate ${result.editCount} signal property access(es) in ${path}`);
107
+ if (result.editCount > 0) {
108
+ (0, dry_run_1.logDryRun)(context, `Would migrate ${result.editCount} signal property access(es) in ${path}`);
109
+ }
110
+ if (result.todoCount > 0) {
111
+ (0, dry_run_1.logDryRun)(context, `Would comment out ${result.todoCount} programmatic signal-input write(s) with a TODO in ${path}`);
112
+ }
81
113
  }
82
114
  else {
83
115
  tree.overwrite(path, result.source);
84
116
  }
85
117
  fileCount++;
86
118
  propCount += result.editCount;
119
+ todoCount += result.todoCount;
87
120
  }
88
121
  });
89
122
  context.logger.info(`Migrated ${propCount} property access(es) to signal getters in ${fileCount} file(s).`);
123
+ if (todoCount > 0) {
124
+ context.logger.info(`Commented out ${todoCount} programmatic signal-input write(s) and left a TODO — these cannot be migrated automatically and need a manual fix.`);
125
+ }
90
126
  if (options.dryRun) {
91
127
  (0, dry_run_1.logDryRunNote)(context);
92
128
  }
@@ -95,7 +131,7 @@ function migrateToSignals(options = {}) {
95
131
  }
96
132
  /** Quick check: does the file reference any EUI class name from the signal map? */
97
133
  function hasEuiReference(source) {
98
- for (const className of Object.keys(signal_map_1.EUI_SIGNAL_MAP)) {
134
+ for (const className of KNOWN_CLASSES) {
99
135
  if (source.includes(className))
100
136
  return true;
101
137
  }
@@ -108,13 +144,16 @@ function hasStringRefQuery(source) {
108
144
  function migrateTypeScript(source, filePath, tree, context) {
109
145
  const sourceFile = ts.createSourceFile(filePath, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
110
146
  const edits = [];
147
+ const todoEdits = [];
111
148
  // Phase 0: Build template ref map (#refName → EUI class name) from the component's template
112
149
  const templateRefMap = buildTemplateRefMap(sourceFile, source, filePath, tree);
113
150
  // Phase 1: Collect all variables/properties typed as EUI classes
114
151
  const euiRefs = collectEuiReferences(sourceFile, source, templateRefMap);
115
- if (euiRefs.size === 0) {
116
- return { source, editCount: 0 };
152
+ if (euiRefs.props.size === 0 && euiRefs.propLists.size === 0 && euiRefs.decls.size === 0 && euiRefs.listDecls.size === 0) {
153
+ return { source, editCount: 0, todoCount: 0 };
117
154
  }
155
+ const hostTodoEdits = [];
156
+ let needsOutputImport = false;
118
157
  // Phase 2: Find property accesses on those references and rewrite signal props
119
158
  const visitNode = (node) => {
120
159
  // Match: ref.prop (PropertyAccessExpression)
@@ -123,16 +162,59 @@ function migrateTypeScript(source, filePath, tree, context) {
123
162
  if (rewrite) {
124
163
  edits.push(rewrite);
125
164
  }
165
+ // Writable signal (model()): `ref.prop = value` -> `ref.prop.set(value)`
166
+ edits.push(...trySetRewrite(node, euiRefs, sourceFile));
167
+ // Output: `ref.out.subscribe()` -> `outputToObservable(ref.out).subscribe()`
168
+ const wrap = tryWrapOutput(node, euiRefs, sourceFile);
169
+ if (wrap) {
170
+ edits.push(...wrap);
171
+ needsOutputImport = true;
172
+ }
173
+ // Output handed to rxjs combinators / used as a value: wrap or flag
174
+ const outputUse = tryOutputUsage(node, euiRefs, sourceFile, source);
175
+ if (outputUse) {
176
+ edits.push(...outputUse.edits);
177
+ if (outputUse.todo)
178
+ hostTodoEdits.push(outputUse.todo);
179
+ if (outputUse.edits.length > 0)
180
+ needsOutputImport = true;
181
+ }
182
+ // Removed @HostBinding property: flag with a TODO
183
+ const hostTodo = tryHostBindingTodo(node, euiRefs, sourceFile, source);
184
+ if (hostTodo) {
185
+ hostTodoEdits.push(hostTodo);
186
+ }
187
+ // Separately: a programmatic WRITE to a now-signal input cannot be
188
+ // migrated automatically. Flag it with a TODO instead of silently
189
+ // leaving a line that will fail to compile against the signal API.
190
+ const todo = tryInsertWriteTodo(node, euiRefs, sourceFile, source);
191
+ if (todo) {
192
+ todoEdits.push(todo);
193
+ }
126
194
  }
195
+ // Destructuring / aliasing of a tracked reference cannot be followed: flag it.
196
+ const alias = tryAliasTodo(node, euiRefs, sourceFile, source);
197
+ if (alias)
198
+ hostTodoEdits.push(alias);
127
199
  ts.forEachChild(node, visitNode);
128
200
  };
129
201
  ts.forEachChild(sourceFile, visitNode);
130
- if (edits.length === 0) {
131
- return { source, editCount: 0 };
202
+ if (edits.length === 0 && todoEdits.length === 0 && hostTodoEdits.length === 0) {
203
+ return { source, editCount: 0, todoCount: 0 };
132
204
  }
205
+ const dedupedTodos = deduplicateEdits(todoEdits);
206
+ const dedupedHostTodos = deduplicateEdits(hostTodoEdits);
207
+ // A TODO edit comments out the whole write statement. Any read-rewrite `()`
208
+ // edit whose position falls inside that commented-out range must be dropped,
209
+ // otherwise we'd both edit and comment the same text (and produce overlapping
210
+ // edits that corrupt the output).
211
+ const keptEdits = edits.filter((edit) => !isInsideAnyRange(edit, dedupedTodos));
212
+ const keptHostTodos = dedupedHostTodos.filter((edit) => !isInsideAnyRange(edit, dedupedTodos));
213
+ const importEdit = needsOutputImport ? buildOutputImportEdit(sourceFile) : null;
133
214
  return {
134
- source: applyEdits(source, edits),
135
- editCount: edits.length,
215
+ source: applyEdits(source, [...keptEdits, ...dedupedTodos, ...keptHostTodos, ...(importEdit ? [importEdit] : [])]),
216
+ editCount: keptEdits.length,
217
+ todoCount: dedupedTodos.length + keptHostTodos.length,
136
218
  };
137
219
  }
138
220
  /**
@@ -149,51 +231,151 @@ function migrateTypeScript(source, filePath, tree, context) {
149
231
  * const alias = this.viewChildRef; (alias tracking)
150
232
  */
151
233
  function collectEuiReferences(sourceFile, source, templateRefMap) {
152
- const refs = new Map();
234
+ const tracked = { props: new Map(), propLists: new Map(), decls: new Map(), listDecls: new Map() };
235
+ const { props, propLists, decls, listDecls } = tracked;
153
236
  // Pass 1: collect directly-typed references
154
237
  const visitDirect = (node) => {
155
238
  // Class property declarations
156
239
  if (ts.isPropertyDeclaration(node) && node.name && ts.isIdentifier(node.name)) {
157
240
  const euiClass = resolveEuiClassName(node, sourceFile, templateRefMap);
158
- if (euiClass && signal_map_1.EUI_SIGNAL_MAP[euiClass]) {
159
- refs.set(node.name.text, signal_map_1.EUI_SIGNAL_MAP[euiClass]);
241
+ if (isKnownClass(euiClass)) {
242
+ (isListProperty(node) ? propLists : props).set(node.name.text, euiClass);
160
243
  }
161
244
  }
162
- // Variable declarations (const x: EuiXxxComponent = ...)
163
- if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name)) {
245
+ // Variable (const x: EuiXxxComponent = ...) and parameter (method(ref: EuiXxxComponent)) declarations
246
+ if ((ts.isVariableDeclaration(node) || ts.isParameter(node)) && ts.isIdentifier(node.name)) {
164
247
  const typeName = getTypeAnnotationName(node.type);
165
- if (typeName && signal_map_1.EUI_SIGNAL_MAP[typeName]) {
166
- refs.set(node.name.text, signal_map_1.EUI_SIGNAL_MAP[typeName]);
248
+ if (isKnownClass(typeName)) {
249
+ decls.set(node, typeName);
250
+ // constructor parameter property: also reachable as `this.name`
251
+ if (ts.isParameter(node) && (ts.getModifiers?.(node) ?? []).length > 0)
252
+ props.set(node.name.text, typeName);
167
253
  }
168
- }
169
- // Parameter declarations (method(ref: EuiXxxComponent))
170
- if (ts.isParameter(node) && ts.isIdentifier(node.name)) {
171
- const typeName = getTypeAnnotationName(node.type);
172
- if (typeName && signal_map_1.EUI_SIGNAL_MAP[typeName]) {
173
- refs.set(node.name.text, signal_map_1.EUI_SIGNAL_MAP[typeName]);
254
+ else {
255
+ const listClass = listElementClass(node.type);
256
+ if (listClass)
257
+ listDecls.set(node, listClass);
174
258
  }
175
259
  }
176
260
  ts.forEachChild(node, visitDirect);
177
261
  };
178
262
  ts.forEachChild(sourceFile, visitDirect);
179
- // Pass 2: track aliases — variables assigned from already-tracked references
180
- // e.g. const alias = this.viewChildRef; or const alias = someParam;
263
+ // Pass 2: aliases, QueryList/array iteration (source order)
181
264
  const visitAlias = (node) => {
182
- if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.initializer) {
183
- // Skip if already tracked (has explicit type annotation)
184
- if (refs.has(node.name.text)) {
185
- ts.forEachChild(node, visitAlias);
186
- return;
187
- }
188
- const aliasedRef = resolveRefName(node.initializer);
189
- if (aliasedRef && refs.has(aliasedRef)) {
190
- refs.set(node.name.text, refs.get(aliasedRef));
265
+ if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.initializer && !decls.has(node)) {
266
+ const aliased = trackedClass(node.initializer, tracked);
267
+ if (aliased)
268
+ decls.set(node, aliased);
269
+ const aliasedList = listClassOf(node.initializer, tracked);
270
+ if (aliasedList)
271
+ listDecls.set(node, aliasedList);
272
+ }
273
+ // list.forEach((el) => ...) / list.map(function (el) {...}) -> `el` is an element of the list
274
+ if (ts.isCallExpression(node) &&
275
+ ts.isPropertyAccessExpression(node.expression) &&
276
+ LIST_ITERATION_METHODS.has(node.expression.name.text)) {
277
+ const listClass = listClassOf(node.expression.expression, tracked);
278
+ const callback = node.arguments[0];
279
+ if (listClass &&
280
+ callback &&
281
+ (ts.isArrowFunction(callback) || ts.isFunctionExpression(callback)) &&
282
+ callback.parameters[0] &&
283
+ ts.isIdentifier(callback.parameters[0].name) &&
284
+ !callback.parameters[0].type) {
285
+ decls.set(callback.parameters[0], listClass);
191
286
  }
192
287
  }
288
+ // for (const el of list) -> `el` is an element of the list
289
+ if (ts.isForOfStatement(node) && ts.isVariableDeclarationList(node.initializer)) {
290
+ const listClass = listClassOf(node.expression, tracked);
291
+ const decl = node.initializer.declarations[0];
292
+ if (listClass && decl && ts.isIdentifier(decl.name) && !decls.has(decl))
293
+ decls.set(decl, listClass);
294
+ }
193
295
  ts.forEachChild(node, visitAlias);
194
296
  };
195
297
  ts.forEachChild(sourceFile, visitAlias);
196
- return refs;
298
+ return tracked;
299
+ }
300
+ /** `EuiXxx[]`, `Array<EuiXxx>`, `QueryList<EuiXxx>` -> the known element class. */
301
+ function listElementClass(type) {
302
+ if (!type)
303
+ return null;
304
+ if (ts.isArrayTypeNode(type)) {
305
+ const n = getTypeAnnotationName(type.elementType);
306
+ return isKnownClass(n) ? n : null;
307
+ }
308
+ if (ts.isTypeReferenceNode(type) && ts.isIdentifier(type.typeName) && ['Array', 'ReadonlyArray', 'QueryList'].includes(type.typeName.text)) {
309
+ const n = getTypeAnnotationName(type.typeArguments?.[0]);
310
+ return isKnownClass(n) ? n : null;
311
+ }
312
+ return null;
313
+ }
314
+ /** Strips parentheses, `!`, `as T`, `<T>x` and `satisfies`. */
315
+ function unwrap(expr) {
316
+ let cur = expr;
317
+ while (ts.isParenthesizedExpression(cur) ||
318
+ ts.isNonNullExpression(cur) ||
319
+ ts.isAsExpression(cur) ||
320
+ ts.isTypeAssertionExpression(cur) ||
321
+ ts.isSatisfiesExpression(cur)) {
322
+ cur = cur.expression;
323
+ }
324
+ return cur;
325
+ }
326
+ /** Nearest declaration (parameter / variable / binding element) of a bare identifier, or null. */
327
+ function findDeclaration(id) {
328
+ const name = id.text;
329
+ const boundIn = (bn) => ts.isIdentifier(bn) ? bn.text === name : bn.elements.some((e) => !ts.isOmittedExpression(e) && boundIn(e.name));
330
+ const matchDecl = (d) => (boundIn(d.name) ? d : null);
331
+ for (let cur = id.parent; cur; cur = cur.parent) {
332
+ if (ts.isFunctionLike(cur)) {
333
+ for (const p of cur.parameters) {
334
+ const m = matchDecl(p);
335
+ if (m)
336
+ return m;
337
+ }
338
+ }
339
+ if (ts.isBlock(cur) || ts.isSourceFile(cur) || ts.isModuleBlock(cur) || ts.isCaseClause(cur) || ts.isDefaultClause(cur)) {
340
+ const stmts = ts.isCaseClause(cur) || ts.isDefaultClause(cur) ? cur.statements : cur.statements;
341
+ for (const st of stmts) {
342
+ if (ts.isVariableStatement(st)) {
343
+ for (const d of st.declarationList.declarations) {
344
+ const m = matchDecl(d);
345
+ if (m)
346
+ return m;
347
+ }
348
+ }
349
+ }
350
+ }
351
+ if ((ts.isForStatement(cur) || ts.isForOfStatement(cur) || ts.isForInStatement(cur)) && cur.initializer && ts.isVariableDeclarationList(cur.initializer)) {
352
+ for (const d of cur.initializer.declarations) {
353
+ const m = matchDecl(d);
354
+ if (m)
355
+ return m;
356
+ }
357
+ }
358
+ if (ts.isCatchClause(cur) && cur.variableDeclaration) {
359
+ const m = matchDecl(cur.variableDeclaration);
360
+ if (m)
361
+ return m;
362
+ }
363
+ }
364
+ return null;
365
+ }
366
+ /** `this.name` -> name; anything else null. */
367
+ function thisMemberName(expr) {
368
+ return ts.isPropertyAccessExpression(expr) && expr.expression.kind === ts.SyntaxKind.ThisKeyword ? expr.name.text : null;
369
+ }
370
+ /** Element class of a tracked QueryList / array expression, or null. */
371
+ function listClassOf(expr, tracked) {
372
+ const e = unwrap(expr);
373
+ if (ts.isIdentifier(e)) {
374
+ const d = findDeclaration(e);
375
+ return d ? (tracked.listDecls.get(d) ?? null) : null;
376
+ }
377
+ const member = thisMemberName(e);
378
+ return member ? (tracked.propLists.get(member) ?? null) : null;
197
379
  }
198
380
  /**
199
381
  * Resolves the EUI class name from a property declaration.
@@ -202,13 +384,16 @@ function collectEuiReferences(sourceFile, source, templateRefMap) {
202
384
  function resolveEuiClassName(node, sourceFile, templateRefMap) {
203
385
  // Check type annotation first
204
386
  const typeName = getTypeAnnotationName(node.type);
205
- if (typeName && signal_map_1.EUI_SIGNAL_MAP[typeName]) {
387
+ if (isKnownClass(typeName)) {
206
388
  return typeName;
207
389
  }
208
- // Check generic type argument: ElementRef<EuiXxxComponent>
390
+ const arrayClass = listElementClass(node.type);
391
+ if (arrayClass)
392
+ return arrayClass;
393
+ // Check generic type argument: ElementRef<EuiXxxComponent> / QueryList<EuiXxxComponent>
209
394
  if (node.type && ts.isTypeReferenceNode(node.type) && node.type.typeArguments?.length) {
210
395
  const genericArg = getTypeAnnotationName(node.type.typeArguments[0]);
211
- if (genericArg && signal_map_1.EUI_SIGNAL_MAP[genericArg]) {
396
+ if (isKnownClass(genericArg)) {
212
397
  return genericArg;
213
398
  }
214
399
  }
@@ -228,14 +413,14 @@ function resolveEuiClassName(node, sourceFile, templateRefMap) {
228
413
  if (args.length > 0) {
229
414
  const firstArg = args[0];
230
415
  // @ViewChild(EuiXxxComponent) — class reference
231
- if (ts.isIdentifier(firstArg) && signal_map_1.EUI_SIGNAL_MAP[firstArg.text]) {
416
+ if (ts.isIdentifier(firstArg) && isKnownClass(firstArg.text)) {
232
417
  return firstArg.text;
233
418
  }
234
419
  // @ViewChild('refName') — string template ref, resolve via template
235
420
  if (ts.isStringLiteralLike(firstArg)) {
236
421
  const refName = firstArg.text;
237
422
  const euiClass = templateRefMap.get(refName);
238
- if (euiClass && signal_map_1.EUI_SIGNAL_MAP[euiClass]) {
423
+ if (isKnownClass(euiClass)) {
239
424
  return euiClass;
240
425
  }
241
426
  }
@@ -244,6 +429,35 @@ function resolveEuiClassName(node, sourceFile, templateRefMap) {
244
429
  }
245
430
  return null;
246
431
  }
432
+ /** True for `@ViewChildren/@ContentChildren` fields and `QueryList<...>`-typed fields. */
433
+ function isListProperty(node) {
434
+ if (listElementClass(node.type))
435
+ return true;
436
+ if (node.type && ts.isTypeReferenceNode(node.type) && ts.isIdentifier(node.type.typeName) && node.type.typeName.text === 'QueryList') {
437
+ return true;
438
+ }
439
+ return (ts.getDecorators?.(node) ?? []).some((d) => ts.isCallExpression(d.expression) && ['ViewChildren', 'ContentChildren'].includes(getDecoratorName(d.expression) ?? ''));
440
+ }
441
+ /**
442
+ * Resolves an expression to the tracked EUI class: `ref`, `this.ref`, `this.ref!`, `(this.ref as any)`,
443
+ * the `.first` / `.last` element of a tracked QueryList, or `list[i]` of a tracked list/array.
444
+ */
445
+ function trackedClass(expr, tracked) {
446
+ const e = unwrap(expr);
447
+ if (ts.isIdentifier(e)) {
448
+ const d = findDeclaration(e);
449
+ return d ? (tracked.decls.get(d) ?? null) : null;
450
+ }
451
+ const member = thisMemberName(e);
452
+ if (member)
453
+ return tracked.props.get(member) ?? null;
454
+ if (ts.isPropertyAccessExpression(e) && (e.name.text === 'first' || e.name.text === 'last')) {
455
+ return listClassOf(e.expression, tracked);
456
+ }
457
+ if (ts.isElementAccessExpression(e))
458
+ return listClassOf(e.expression, tracked);
459
+ return null;
460
+ }
247
461
  function getDecoratorName(callExpr) {
248
462
  if (ts.isIdentifier(callExpr.expression)) {
249
463
  return callExpr.expression.text;
@@ -270,17 +484,27 @@ function getTypeAnnotationName(typeNode) {
270
484
  */
271
485
  function tryRewritePropertyAccess(node, euiRefs, sourceFile, source) {
272
486
  const propName = node.name.text;
273
- // Resolve the reference name — handle `this.ref.prop` and `ref.prop`
274
- const refName = resolveRefName(node.expression);
275
- if (!refName)
487
+ // Resolve the reference class — handle `this.ref.prop`, `ref.prop`, `list.first.prop`
488
+ const cls = trackedClass(node.expression, euiRefs);
489
+ if (!cls)
276
490
  return null;
277
- const signalProps = euiRefs.get(refName);
491
+ const signalProps = EUI_SIGNAL_MAP[cls];
278
492
  if (!signalProps || !signalProps.has(propName))
279
493
  return null;
280
494
  // Skip if parent is already a call expression on this property: ref.prop(...)
281
495
  if (ts.isCallExpression(node.parent) && node.parent.expression === node) {
282
496
  return null;
283
497
  }
498
+ // Skip a signal handed to toObservable(ref.prop): it needs the signal itself (e.g. written by migrate-eui-tab-signals)
499
+ if (ts.isCallExpression(node.parent) && node.parent.arguments[0] === node &&
500
+ ts.isIdentifier(node.parent.expression) && node.parent.expression.text === 'toObservable') {
501
+ return null;
502
+ }
503
+ // Skip signal API access already in place: ref.prop.set(..) / .update(..) / .asReadonly()
504
+ if (ts.isPropertyAccessExpression(node.parent) && node.parent.expression === node &&
505
+ ['set', 'update', 'asReadonly'].includes(node.parent.name.text)) {
506
+ return null;
507
+ }
284
508
  // Skip if this is the left side of an assignment: ref.prop = value
285
509
  if (ts.isBinaryExpression(node.parent) &&
286
510
  node.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken &&
@@ -312,21 +536,269 @@ function tryRewritePropertyAccess(node, euiRefs, sourceFile, source) {
312
536
  function isAssignmentOperator(kind) {
313
537
  return kind >= ts.SyntaxKind.FirstAssignment && kind <= ts.SyntaxKind.LastAssignment;
314
538
  }
539
+ /** Marker used to detect an already-inserted TODO so the schematic stays idempotent. */
540
+ const WRITE_TODO_MARKER = 'TODO(eui-signals):';
315
541
  /**
316
- * Resolves a reference name from an expression.
317
- * Handles: `ref`, `this.ref`, `this._ref`
542
+ * Detects a programmatic WRITE to a now-signal input and returns an edit that
543
+ * comments out the offending statement and prepends an explanatory TODO.
544
+ *
545
+ * A signal input (`input()`) exposes a read-only getter — it cannot be assigned
546
+ * from outside the component (`comp.prop = value` no longer compiles, and
547
+ * `comp.prop()` is a getter, not a setter). There is no safe, mechanical
548
+ * rewrite: the correct fix is to drive the value declaratively through a
549
+ * template binding (`[prop]="..."`) or, when a ComponentRef is genuinely
550
+ * available, `componentRef.setInput('prop', value)`. Both require human
551
+ * judgement, so instead of rewriting we comment the statement out (keeping the
552
+ * build green) and leave a TODO pointing at the manual fix.
553
+ *
554
+ * Only acts when the assignment is the ENTIRE statement
555
+ * (`ExpressionStatement` whose expression is exactly this assignment):
556
+ * ref.prop = value (simple assignment)
557
+ * ref.prop += value, etc. (compound assignment)
558
+ * where `ref` is a tracked EUI/ECL reference and `prop` is in its signal set.
559
+ *
560
+ * When the write is only part of a larger statement (e.g. inside an `if`
561
+ * without a block, or nested in another expression), commenting it out would
562
+ * also remove unrelated logic, so we leave it untouched (it will surface as a
563
+ * compile error the developer must resolve by hand).
318
564
  */
319
- function resolveRefName(expr) {
320
- // Direct identifier: ref.prop
321
- if (ts.isIdentifier(expr)) {
322
- return expr.text;
565
+ function tryInsertWriteTodo(node, euiRefs, sourceFile, source) {
566
+ const propName = node.name.text;
567
+ const cls = trackedClass(node.expression, euiRefs);
568
+ if (!cls)
569
+ return null;
570
+ const signalProps = EUI_SIGNAL_MAP[cls];
571
+ if (!signalProps || !signalProps.has(propName))
572
+ return null;
573
+ // Only act on assignment targets: `ref.prop = ...` or `ref.prop <op>= ...`
574
+ if (!ts.isBinaryExpression(node.parent) ||
575
+ node.parent.left !== node ||
576
+ !isAssignmentOperator(node.parent.operatorToken.kind)) {
577
+ return null;
323
578
  }
324
- // this.ref.prop
325
- if (ts.isPropertyAccessExpression(expr) && expr.expression.kind === ts.SyntaxKind.ThisKeyword) {
326
- return expr.name.text;
579
+ const assignment = node.parent;
580
+ // A plain `=` to a writable signal is migrated to `.set()` by trySetRewrite
581
+ if (assignment.operatorToken.kind === ts.SyntaxKind.EqualsToken && signal_map_1.EUI_WRITABLE_SIGNAL_MAP[cls]?.has(propName)) {
582
+ return null;
583
+ }
584
+ // Only comment out when the assignment IS the whole statement — otherwise we'd
585
+ // delete unrelated logic from a larger statement.
586
+ const statement = node.parent.parent;
587
+ if (!statement || !ts.isExpressionStatement(statement) || statement.expression !== assignment) {
588
+ return null;
589
+ }
590
+ // The statement must stand on its own (a direct child of a block/source), not
591
+ // be the unbraced body of an `if`/`for`/`while` etc. — commenting those out by
592
+ // line would swallow the surrounding `if (...)` and break the code.
593
+ const parent = statement.parent;
594
+ if (!parent ||
595
+ !(ts.isBlock(parent) || ts.isSourceFile(parent) || ts.isModuleBlock(parent) || ts.isCaseClause(parent) || ts.isDefaultClause(parent))) {
596
+ return null;
597
+ }
598
+ const stmtStart = statement.getStart(sourceFile);
599
+ const stmtEnd = statement.getEnd(); // includes the trailing semicolon
600
+ const lineStart = getLineStartPosition(source, stmtStart);
601
+ const indent = source.slice(lineStart, stmtStart);
602
+ // Commenting works per line: the statement must be alone on its lines, otherwise
603
+ // (e.g. `run() { ref.prop = 1; }`) we would comment out surrounding code.
604
+ const eol = source.indexOf('\n', stmtEnd);
605
+ const restOfLine = source.slice(stmtEnd, eol === -1 ? source.length : eol);
606
+ if (indent.trim() !== '' || restOfLine.trim() !== '') {
607
+ return null;
608
+ }
609
+ // The statement text, as written (may span multiple lines).
610
+ const statementText = source.slice(stmtStart, stmtEnd);
611
+ // Comment out every line of the statement, preserving each line's own
612
+ // indentation (insert `// ` after the leading whitespace). The first line's
613
+ // indentation was stripped by starting the replacement at lineStart, so we
614
+ // re-add it explicitly.
615
+ const commentedStatement = statementText
616
+ .split('\n')
617
+ .map((line, i) => {
618
+ if (i === 0)
619
+ return `${indent}// ${line}`;
620
+ const lineIndent = line.slice(0, line.length - line.trimStart().length);
621
+ return `${lineIndent}// ${line.trimStart()}`;
622
+ })
623
+ .join('\n');
624
+ const todo = `${indent}// ${WRITE_TODO_MARKER} '${propName}' is now a signal input and cannot be assigned directly.\n` +
625
+ `${indent}// Set it via a template binding ([${propName}]="...") or componentRef.setInput('${propName}', ...).\n` +
626
+ `${indent}// The original statement is commented out below so the build does not fail:\n`;
627
+ // Replace the statement (from the start of its line, to drop the original
628
+ // indentation we re-add) with the TODO + commented-out statement.
629
+ return {
630
+ start: lineStart,
631
+ end: stmtEnd,
632
+ replacement: todo + commentedStatement,
633
+ };
634
+ }
635
+ /** `ref.prop = value;` on a writable signal -> `ref.prop.set(value);` (two zero-width-safe edits). */
636
+ function trySetRewrite(node, euiRefs, sourceFile) {
637
+ const assignment = node.parent;
638
+ if (!ts.isBinaryExpression(assignment) ||
639
+ assignment.left !== node ||
640
+ assignment.operatorToken.kind !== ts.SyntaxKind.EqualsToken ||
641
+ !ts.isExpressionStatement(assignment.parent)) {
642
+ return [];
643
+ }
644
+ const cls = trackedClass(node.expression, euiRefs);
645
+ if (!cls || !signal_map_1.EUI_WRITABLE_SIGNAL_MAP[cls]?.has(node.name.text))
646
+ return [];
647
+ return [
648
+ { start: node.getEnd(), end: assignment.right.getStart(sourceFile), replacement: '.set(' },
649
+ { start: assignment.right.getEnd(), end: assignment.right.getEnd(), replacement: ')', after: true },
650
+ ];
651
+ }
652
+ /** `ref.out.subscribe(...)` -> `outputToObservable(ref.out).subscribe(...)`. */
653
+ function tryWrapOutput(node, euiRefs, sourceFile) {
654
+ const parent = node.parent;
655
+ if (!ts.isPropertyAccessExpression(parent) || parent.expression !== node || !OBSERVABLE_METHODS.has(parent.name.text)) {
656
+ return null;
657
+ }
658
+ const cls = trackedClass(node.expression, euiRefs);
659
+ if (!cls || !signal_map_1.EUI_OUTPUT_MAP[cls]?.has(node.name.text))
660
+ return null;
661
+ const start = node.getStart(sourceFile);
662
+ return [
663
+ { start, end: start, replacement: 'outputToObservable(' },
664
+ { start: node.getEnd(), end: node.getEnd(), replacement: ')', after: true },
665
+ ];
666
+ }
667
+ /** Marker for a read of a property that was a @HostBinding and no longer exists. */
668
+ const HOST_TODO_MARKER = 'TODO(eui-signals):';
669
+ function tryHostBindingTodo(node, euiRefs, sourceFile, source) {
670
+ const propName = node.name.text;
671
+ const cls = trackedClass(node.expression, euiRefs);
672
+ if (!cls || !signal_map_1.EUI_HOST_BINDING_REMOVED_MAP[cls]?.has(propName) || EUI_SIGNAL_MAP[cls]?.has(propName))
673
+ return null;
674
+ return flagTodo(node, sourceFile, source, `'${propName}' was a @HostBinding`, `'${propName}' was a @HostBinding property of ${cls} and no longer exists on the instance ` +
675
+ '(moved to static host metadata). Remove or replace this access.');
676
+ }
677
+ /**
678
+ * Inserts a `// TODO(eui-signals): <message>` line above the enclosing statement / class member.
679
+ * `key` identifies the TODO for idempotency (looked for in the comment lines right above).
680
+ */
681
+ function flagTodo(node, sourceFile, source, key, message) {
682
+ // Anchor on the enclosing statement / class member
683
+ let anchor = node;
684
+ while (anchor.parent &&
685
+ !(ts.isBlock(anchor.parent) ||
686
+ ts.isSourceFile(anchor.parent) ||
687
+ ts.isModuleBlock(anchor.parent) ||
688
+ ts.isCaseClause(anchor.parent) ||
689
+ ts.isDefaultClause(anchor.parent) ||
690
+ ts.isClassLike(anchor.parent))) {
691
+ anchor = anchor.parent;
692
+ }
693
+ const lineStart = getLineStartPosition(source, anchor.getStart(sourceFile));
694
+ const indent = source.slice(lineStart).match(/^[ \t]*/)[0];
695
+ const text = `${indent}// ${HOST_TODO_MARKER} ${message}\n`;
696
+ // Idempotent: look at the contiguous comment lines right above
697
+ const above = source.slice(0, lineStart).split('\n').slice(-8).reverse();
698
+ for (const line of above.slice(1)) {
699
+ if (!line.trim().startsWith('//'))
700
+ break;
701
+ if (line.includes(`${HOST_TODO_MARKER} ${key}`) || line.includes(key))
702
+ return null;
703
+ }
704
+ // A single-line anchor like `run() { ... }` shares its line with other code: still fine, the comment goes above the line.
705
+ return { start: lineStart, end: lineStart, replacement: text };
706
+ }
707
+ /**
708
+ * An output (OutputEmitterRef) used as a value:
709
+ * - an argument of an rxjs combinator (`merge(ref.out, ...)`, also inside an array) is wrapped in `outputToObservable()`;
710
+ * - any other use that is not `.emit()` / `.subscribe()` & co / already wrapped is flagged with a TODO.
711
+ */
712
+ function tryOutputUsage(node, euiRefs, sourceFile, source) {
713
+ const cls = trackedClass(node.expression, euiRefs);
714
+ if (!cls || !signal_map_1.EUI_OUTPUT_MAP[cls]?.has(node.name.text))
715
+ return null;
716
+ const parent = node.parent;
717
+ // handled elsewhere (tryWrapOutput) or fine as is
718
+ if (ts.isPropertyAccessExpression(parent) && parent.expression === node)
719
+ return null;
720
+ if (ts.isNonNullExpression(parent) || ts.isParenthesizedExpression(parent) || ts.isAsExpression(parent))
721
+ return null;
722
+ // declared / written outputs are not reads
723
+ if (ts.isBinaryExpression(parent) && parent.left === node)
724
+ return null;
725
+ // argument of a combinator?
726
+ let arg = node;
727
+ if (ts.isArrayLiteralExpression(arg.parent))
728
+ arg = arg.parent;
729
+ const call = arg.parent;
730
+ if (ts.isCallExpression(call) && call.arguments.includes(arg)) {
731
+ const callee = ts.isIdentifier(call.expression) ? call.expression.text : null;
732
+ if (callee === 'outputToObservable')
733
+ return null; // already migrated
734
+ if (callee && OBSERVABLE_COMBINATORS.has(callee)) {
735
+ const start = node.getStart(sourceFile);
736
+ return {
737
+ edits: [
738
+ { start, end: start, replacement: 'outputToObservable(' },
739
+ { start: node.getEnd(), end: node.getEnd(), replacement: ')', after: true },
740
+ ],
741
+ };
742
+ }
743
+ }
744
+ return {
745
+ edits: [],
746
+ todo: flagTodo(node, sourceFile, source, `output '${node.name.text}'`, `output '${node.name.text}' of ${cls} is an OutputEmitterRef, not an Observable. Wrap it with outputToObservable() ` +
747
+ '(@angular/core/rxjs-interop) where an Observable is needed.'),
748
+ };
749
+ }
750
+ /** Destructuring of a tracked reference, or storing it in a field/variable we cannot follow. */
751
+ function tryAliasTodo(node, euiRefs, sourceFile, source) {
752
+ if (ts.isVariableDeclaration(node) && node.initializer && !ts.isIdentifier(node.name)) {
753
+ const cls = trackedClass(node.initializer, euiRefs);
754
+ if (cls) {
755
+ return flagTodo(node, sourceFile, source, `destructuring of ${cls}`, `destructuring of ${cls} cannot be migrated automatically: its signal inputs/outputs must be read as ref.prop() / outputToObservable(ref.out).`);
756
+ }
757
+ }
758
+ if (ts.isBinaryExpression(node) &&
759
+ node.operatorToken.kind === ts.SyntaxKind.EqualsToken &&
760
+ !ts.isIdentifier(unwrap(node.left)) &&
761
+ ts.isExpressionStatement(node.parent)) {
762
+ const cls = trackedClass(node.right, euiRefs);
763
+ if (cls) {
764
+ return flagTodo(node, sourceFile, source, `aliasing of ${cls}`, `aliasing of ${cls}: this copy is not tracked, so its signal inputs/outputs must be updated manually (ref.prop()).`);
765
+ }
327
766
  }
328
767
  return null;
329
768
  }
769
+ /** Adds `outputToObservable` to the file's imports (merging into an existing rxjs-interop import). */
770
+ function buildOutputImportEdit(sourceFile) {
771
+ let lastImportEnd = 0;
772
+ for (const stmt of sourceFile.statements) {
773
+ if (!ts.isImportDeclaration(stmt))
774
+ continue;
775
+ lastImportEnd = stmt.getEnd();
776
+ if (!ts.isStringLiteral(stmt.moduleSpecifier) || stmt.moduleSpecifier.text !== '@angular/core/rxjs-interop')
777
+ continue;
778
+ const bindings = stmt.importClause?.namedBindings;
779
+ if (bindings && ts.isNamedImports(bindings)) {
780
+ if (bindings.elements.some((e) => e.name.text === 'outputToObservable'))
781
+ return null;
782
+ const last = bindings.elements[bindings.elements.length - 1];
783
+ if (last) {
784
+ return { start: last.getEnd(), end: last.getEnd(), replacement: ', outputToObservable' };
785
+ }
786
+ }
787
+ }
788
+ const line = 'import { outputToObservable } from \'@angular/core/rxjs-interop\';';
789
+ return lastImportEnd === 0
790
+ ? { start: 0, end: 0, replacement: `${line}\n` }
791
+ : { start: lastImportEnd, end: lastImportEnd, replacement: `\n${line}` };
792
+ }
793
+ /** True if `edit`'s position falls within any of the given ranges. */
794
+ function isInsideAnyRange(edit, ranges) {
795
+ return ranges.some((range) => edit.start >= range.start && edit.end <= range.end);
796
+ }
797
+ /** Returns the index of the first character of the line containing `pos`. */
798
+ function getLineStartPosition(source, pos) {
799
+ const newlineIndex = source.lastIndexOf('\n', pos - 1);
800
+ return newlineIndex === -1 ? 0 : newlineIndex + 1;
801
+ }
330
802
  // ---------------------------------------------------------------------------
331
803
  // Template ref resolution
332
804
  // ---------------------------------------------------------------------------
@@ -434,19 +906,16 @@ function unwrapExpression(expression) {
434
906
  * 2. Match element attributes against attribute selectors (e.g. [euiAutocomplete] → EuiAutocompleteComponent)
435
907
  */
436
908
  function collectTemplateRefs(nodes, refMap) {
437
- for (const node of nodes) {
438
- if (node instanceof compiler_1.TmplAstElement) {
439
- if (node.references && node.references.length > 0) {
440
- const euiClass = resolveElementToEuiClass(node);
441
- if (euiClass) {
442
- for (const ref of node.references) {
443
- refMap.set(ref.name, euiClass);
444
- }
445
- }
446
- }
447
- collectTemplateRefs(node.children, refMap);
909
+ (0, template_walk_1.forEachElement)(nodes, (node) => {
910
+ if (node.references === undefined || node.references.length === 0)
911
+ return;
912
+ const euiClass = resolveElementToEuiClass(node);
913
+ if (!euiClass)
914
+ return;
915
+ for (const ref of node.references) {
916
+ refMap.set(ref.name, euiClass);
448
917
  }
449
- }
918
+ });
450
919
  }
451
920
  /**
452
921
  * Given a template element, resolves it to an EUI class name by checking:
@@ -456,8 +925,8 @@ function collectTemplateRefs(nodes, refMap) {
456
925
  function resolveElementToEuiClass(element) {
457
926
  const tag = element.name;
458
927
  // Direct tag match: eui-alert, eui-dialog, etc.
459
- if (signal_map_1.EUI_SELECTOR_TO_CLASS[tag]) {
460
- return signal_map_1.EUI_SELECTOR_TO_CLASS[tag];
928
+ if (EUI_SELECTOR_TO_CLASS[tag]) {
929
+ return EUI_SELECTOR_TO_CLASS[tag];
461
930
  }
462
931
  // Attribute selector match: check all attributes against known patterns
463
932
  const allAttrNames = [
@@ -467,13 +936,13 @@ function resolveElementToEuiClass(element) {
467
936
  for (const attrName of allAttrNames) {
468
937
  // Try tag[attr] pattern first (e.g. 'button[euiButton]', 'input[euiAutocomplete]')
469
938
  const tagAttrSelector = `${tag}[${attrName}]`;
470
- if (signal_map_1.EUI_SELECTOR_TO_CLASS[tagAttrSelector]) {
471
- return signal_map_1.EUI_SELECTOR_TO_CLASS[tagAttrSelector];
939
+ if (EUI_SELECTOR_TO_CLASS[tagAttrSelector]) {
940
+ return EUI_SELECTOR_TO_CLASS[tagAttrSelector];
472
941
  }
473
942
  // Try [attr] pattern (e.g. '[euiTooltip]', '[euiLoading]')
474
943
  const attrSelector = `[${attrName}]`;
475
- if (signal_map_1.EUI_SELECTOR_TO_CLASS[attrSelector]) {
476
- return signal_map_1.EUI_SELECTOR_TO_CLASS[attrSelector];
944
+ if (EUI_SELECTOR_TO_CLASS[attrSelector]) {
945
+ return EUI_SELECTOR_TO_CLASS[attrSelector];
477
946
  }
478
947
  }
479
948
  return null;
@@ -484,7 +953,8 @@ function resolveElementToEuiClass(element) {
484
953
  function applyEdits(source, edits) {
485
954
  const unique = deduplicateEdits(edits);
486
955
  let result = source;
487
- for (const edit of unique.sort((a, b) => b.start - a.start)) {
956
+ // Descending by position; at equal positions `after` edits are applied first so they land last.
957
+ for (const edit of unique.sort((a, b) => b.start - a.start || Number(!!b.after) - Number(!!a.after))) {
488
958
  result = result.slice(0, edit.start) + edit.replacement + result.slice(edit.end);
489
959
  }
490
960
  return result;
@@ -492,7 +962,7 @@ function applyEdits(source, edits) {
492
962
  function deduplicateEdits(edits) {
493
963
  const seen = new Map();
494
964
  for (const edit of edits) {
495
- const key = `${edit.start}:${edit.end}`;
965
+ const key = `${edit.start}:${edit.end}:${edit.replacement}`;
496
966
  seen.set(key, edit);
497
967
  }
498
968
  return Array.from(seen.values());