@exhaustive-ui/core 22.0.0-rc.2 → 22.0.0-rc.3

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 (211) hide show
  1. package/fesm2022/exhaustive-ui-core-accordion.mjs +5 -0
  2. package/fesm2022/exhaustive-ui-core-accordion.mjs.map +1 -1
  3. package/fesm2022/exhaustive-ui-core-autocomplete.mjs +12 -14
  4. package/fesm2022/exhaustive-ui-core-autocomplete.mjs.map +1 -1
  5. package/fesm2022/exhaustive-ui-core-avatargroup.mjs +3 -9
  6. package/fesm2022/exhaustive-ui-core-avatargroup.mjs.map +1 -1
  7. package/fesm2022/exhaustive-ui-core-badge.mjs +3 -34
  8. package/fesm2022/exhaustive-ui-core-badge.mjs.map +1 -1
  9. package/fesm2022/exhaustive-ui-core-basecomponent.mjs +3 -0
  10. package/fesm2022/exhaustive-ui-core-basecomponent.mjs.map +1 -1
  11. package/fesm2022/exhaustive-ui-core-baseinput.mjs +27 -7
  12. package/fesm2022/exhaustive-ui-core-baseinput.mjs.map +1 -1
  13. package/fesm2022/exhaustive-ui-core-blockui.mjs +13 -1
  14. package/fesm2022/exhaustive-ui-core-blockui.mjs.map +1 -1
  15. package/fesm2022/exhaustive-ui-core-breadcrumb.mjs +1 -1
  16. package/fesm2022/exhaustive-ui-core-breadcrumb.mjs.map +1 -1
  17. package/fesm2022/exhaustive-ui-core-button.mjs +10 -34
  18. package/fesm2022/exhaustive-ui-core-button.mjs.map +1 -1
  19. package/fesm2022/exhaustive-ui-core-carousel.mjs +5 -0
  20. package/fesm2022/exhaustive-ui-core-carousel.mjs.map +1 -1
  21. package/fesm2022/exhaustive-ui-core-cascadeselect.mjs +25 -11
  22. package/fesm2022/exhaustive-ui-core-cascadeselect.mjs.map +1 -1
  23. package/fesm2022/exhaustive-ui-core-checkbox.mjs +1 -1
  24. package/fesm2022/exhaustive-ui-core-checkbox.mjs.map +1 -1
  25. package/fesm2022/exhaustive-ui-core-config.mjs +1 -8
  26. package/fesm2022/exhaustive-ui-core-config.mjs.map +1 -1
  27. package/fesm2022/exhaustive-ui-core-confirmdialog.mjs +1 -1
  28. package/fesm2022/exhaustive-ui-core-confirmdialog.mjs.map +1 -1
  29. package/fesm2022/exhaustive-ui-core-confirmpopup.mjs +3 -8
  30. package/fesm2022/exhaustive-ui-core-confirmpopup.mjs.map +1 -1
  31. package/fesm2022/exhaustive-ui-core-contextmenu.mjs +16 -3
  32. package/fesm2022/exhaustive-ui-core-contextmenu.mjs.map +1 -1
  33. package/fesm2022/exhaustive-ui-core-dataview.mjs +2 -14
  34. package/fesm2022/exhaustive-ui-core-dataview.mjs.map +1 -1
  35. package/fesm2022/exhaustive-ui-core-datepicker.mjs +38 -4
  36. package/fesm2022/exhaustive-ui-core-datepicker.mjs.map +1 -1
  37. package/fesm2022/exhaustive-ui-core-dialog.mjs +12 -7
  38. package/fesm2022/exhaustive-ui-core-dialog.mjs.map +1 -1
  39. package/fesm2022/exhaustive-ui-core-dock.mjs +1 -1
  40. package/fesm2022/exhaustive-ui-core-dock.mjs.map +1 -1
  41. package/fesm2022/exhaustive-ui-core-dom.mjs +9 -2
  42. package/fesm2022/exhaustive-ui-core-dom.mjs.map +1 -1
  43. package/fesm2022/exhaustive-ui-core-drawer.mjs +6 -6
  44. package/fesm2022/exhaustive-ui-core-drawer.mjs.map +1 -1
  45. package/fesm2022/exhaustive-ui-core-dynamicdialog.mjs +19 -19
  46. package/fesm2022/exhaustive-ui-core-dynamicdialog.mjs.map +1 -1
  47. package/fesm2022/exhaustive-ui-core-editor.mjs +11 -0
  48. package/fesm2022/exhaustive-ui-core-editor.mjs.map +1 -1
  49. package/fesm2022/exhaustive-ui-core-fileupload.mjs +4 -1
  50. package/fesm2022/exhaustive-ui-core-fileupload.mjs.map +1 -1
  51. package/fesm2022/exhaustive-ui-core-galleria.mjs +12 -0
  52. package/fesm2022/exhaustive-ui-core-galleria.mjs.map +1 -1
  53. package/fesm2022/exhaustive-ui-core-image.mjs +7 -0
  54. package/fesm2022/exhaustive-ui-core-image.mjs.map +1 -1
  55. package/fesm2022/exhaustive-ui-core-imagecompare.mjs +5 -5
  56. package/fesm2022/exhaustive-ui-core-imagecompare.mjs.map +1 -1
  57. package/fesm2022/exhaustive-ui-core-inplace.mjs +6 -32
  58. package/fesm2022/exhaustive-ui-core-inplace.mjs.map +1 -1
  59. package/fesm2022/exhaustive-ui-core-inputgroupaddon.mjs +3 -9
  60. package/fesm2022/exhaustive-ui-core-inputgroupaddon.mjs.map +1 -1
  61. package/fesm2022/exhaustive-ui-core-inputmask.mjs +54 -27
  62. package/fesm2022/exhaustive-ui-core-inputmask.mjs.map +1 -1
  63. package/fesm2022/exhaustive-ui-core-inputnumber.mjs +9 -11
  64. package/fesm2022/exhaustive-ui-core-inputnumber.mjs.map +1 -1
  65. package/fesm2022/exhaustive-ui-core-inputotp.mjs +8 -3
  66. package/fesm2022/exhaustive-ui-core-inputotp.mjs.map +1 -1
  67. package/fesm2022/exhaustive-ui-core-inputtext.mjs +6 -14
  68. package/fesm2022/exhaustive-ui-core-inputtext.mjs.map +1 -1
  69. package/fesm2022/exhaustive-ui-core-listbox.mjs +53 -20
  70. package/fesm2022/exhaustive-ui-core-listbox.mjs.map +1 -1
  71. package/fesm2022/exhaustive-ui-core-megamenu.mjs +4 -1
  72. package/fesm2022/exhaustive-ui-core-megamenu.mjs.map +1 -1
  73. package/fesm2022/exhaustive-ui-core-menu.mjs +11 -5
  74. package/fesm2022/exhaustive-ui-core-menu.mjs.map +1 -1
  75. package/fesm2022/exhaustive-ui-core-menubar.mjs +8 -2
  76. package/fesm2022/exhaustive-ui-core-menubar.mjs.map +1 -1
  77. package/fesm2022/exhaustive-ui-core-message.mjs +5 -10
  78. package/fesm2022/exhaustive-ui-core-message.mjs.map +1 -1
  79. package/fesm2022/exhaustive-ui-core-metergroup.mjs +3 -0
  80. package/fesm2022/exhaustive-ui-core-metergroup.mjs.map +1 -1
  81. package/fesm2022/exhaustive-ui-core-motion.mjs +10 -1
  82. package/fesm2022/exhaustive-ui-core-motion.mjs.map +1 -1
  83. package/fesm2022/exhaustive-ui-core-multiselect.mjs +77 -38
  84. package/fesm2022/exhaustive-ui-core-multiselect.mjs.map +1 -1
  85. package/fesm2022/exhaustive-ui-core-orderlist.mjs +14 -19
  86. package/fesm2022/exhaustive-ui-core-orderlist.mjs.map +1 -1
  87. package/fesm2022/exhaustive-ui-core-organizationchart.mjs +3 -1
  88. package/fesm2022/exhaustive-ui-core-organizationchart.mjs.map +1 -1
  89. package/fesm2022/exhaustive-ui-core-overlay.mjs +28 -0
  90. package/fesm2022/exhaustive-ui-core-overlay.mjs.map +1 -1
  91. package/fesm2022/exhaustive-ui-core-panel.mjs +12 -2
  92. package/fesm2022/exhaustive-ui-core-panel.mjs.map +1 -1
  93. package/fesm2022/exhaustive-ui-core-panelmenu.mjs +61 -13
  94. package/fesm2022/exhaustive-ui-core-panelmenu.mjs.map +1 -1
  95. package/fesm2022/exhaustive-ui-core-password.mjs +37 -26
  96. package/fesm2022/exhaustive-ui-core-password.mjs.map +1 -1
  97. package/fesm2022/exhaustive-ui-core-picklist.mjs +11 -25
  98. package/fesm2022/exhaustive-ui-core-picklist.mjs.map +1 -1
  99. package/fesm2022/exhaustive-ui-core-popover.mjs +2 -2
  100. package/fesm2022/exhaustive-ui-core-popover.mjs.map +1 -1
  101. package/fesm2022/exhaustive-ui-core-radiobutton.mjs +8 -4
  102. package/fesm2022/exhaustive-ui-core-radiobutton.mjs.map +1 -1
  103. package/fesm2022/exhaustive-ui-core-scroller.mjs +91 -10
  104. package/fesm2022/exhaustive-ui-core-scroller.mjs.map +1 -1
  105. package/fesm2022/exhaustive-ui-core-select.mjs +36 -4
  106. package/fesm2022/exhaustive-ui-core-select.mjs.map +1 -1
  107. package/fesm2022/exhaustive-ui-core-selectbutton.mjs +3 -8
  108. package/fesm2022/exhaustive-ui-core-selectbutton.mjs.map +1 -1
  109. package/fesm2022/exhaustive-ui-core-slider.mjs +6 -0
  110. package/fesm2022/exhaustive-ui-core-slider.mjs.map +1 -1
  111. package/fesm2022/exhaustive-ui-core-speeddial.mjs +1 -1
  112. package/fesm2022/exhaustive-ui-core-speeddial.mjs.map +1 -1
  113. package/fesm2022/exhaustive-ui-core-splitbutton.mjs +1 -1
  114. package/fesm2022/exhaustive-ui-core-splitbutton.mjs.map +1 -1
  115. package/fesm2022/exhaustive-ui-core-stepper.mjs +7 -11
  116. package/fesm2022/exhaustive-ui-core-stepper.mjs.map +1 -1
  117. package/fesm2022/exhaustive-ui-core-steps.mjs +1 -1
  118. package/fesm2022/exhaustive-ui-core-steps.mjs.map +1 -1
  119. package/fesm2022/exhaustive-ui-core-table.mjs +227 -32
  120. package/fesm2022/exhaustive-ui-core-table.mjs.map +1 -1
  121. package/fesm2022/exhaustive-ui-core-tabs.mjs +16 -1
  122. package/fesm2022/exhaustive-ui-core-tabs.mjs.map +1 -1
  123. package/fesm2022/exhaustive-ui-core-textarea.mjs +1 -1
  124. package/fesm2022/exhaustive-ui-core-textarea.mjs.map +1 -1
  125. package/fesm2022/exhaustive-ui-core-tieredmenu.mjs +60 -16
  126. package/fesm2022/exhaustive-ui-core-tieredmenu.mjs.map +1 -1
  127. package/fesm2022/exhaustive-ui-core-toast.mjs +6 -2
  128. package/fesm2022/exhaustive-ui-core-toast.mjs.map +1 -1
  129. package/fesm2022/exhaustive-ui-core-toggleswitch.mjs +2 -9
  130. package/fesm2022/exhaustive-ui-core-toggleswitch.mjs.map +1 -1
  131. package/fesm2022/exhaustive-ui-core-tooltip.mjs +9 -17
  132. package/fesm2022/exhaustive-ui-core-tooltip.mjs.map +1 -1
  133. package/fesm2022/exhaustive-ui-core-tree.mjs +99 -28
  134. package/fesm2022/exhaustive-ui-core-tree.mjs.map +1 -1
  135. package/fesm2022/exhaustive-ui-core-treeselect.mjs +1 -1
  136. package/fesm2022/exhaustive-ui-core-treeselect.mjs.map +1 -1
  137. package/fesm2022/exhaustive-ui-core-treetable.mjs +75 -19
  138. package/fesm2022/exhaustive-ui-core-treetable.mjs.map +1 -1
  139. package/fesm2022/exhaustive-ui-core-utils.mjs +15 -0
  140. package/fesm2022/exhaustive-ui-core-utils.mjs.map +1 -1
  141. package/package.json +5 -5
  142. package/schematics/migrations/config-input-style-to-variant/migration.js +70 -0
  143. package/schematics/migrations/remove-dead-inputs/migration.js +46 -7
  144. package/schematics/migrations/removed-exports/migration.js +73 -0
  145. package/schematics/migrations/renamed-inputs/migration.js +54 -3
  146. package/schematics/migrations/renamed-outputs/migration.js +89 -0
  147. package/schematics/migrations/renamed-templates/migration.js +59 -0
  148. package/schematics/migrations/styleclass-to-class/migration.js +5 -0
  149. package/schematics/migrations.json +23 -3
  150. package/schematics/utils/config-signal.js +115 -0
  151. package/schematics/utils/removed-exports.js +172 -0
  152. package/schematics/utils/removed-inputs.js +0 -0
  153. package/schematics/utils/renamed-inputs.js +20 -9
  154. package/schematics/utils/renamed-outputs.js +154 -0
  155. package/schematics/utils/renamed-templates.js +142 -0
  156. package/schematics/utils/versions.json +8 -8
  157. package/types/exhaustive-ui-core-api.d.ts +0 -10
  158. package/types/exhaustive-ui-core-autocomplete.d.ts +4 -9
  159. package/types/exhaustive-ui-core-avatargroup.d.ts +1 -6
  160. package/types/exhaustive-ui-core-badge.d.ts +1 -14
  161. package/types/exhaustive-ui-core-basecomponent.d.ts +3 -0
  162. package/types/exhaustive-ui-core-baseinput.d.ts +3 -3
  163. package/types/exhaustive-ui-core-button.d.ts +4 -25
  164. package/types/exhaustive-ui-core-cascadeselect.d.ts +5 -2
  165. package/types/exhaustive-ui-core-config.d.ts +0 -8
  166. package/types/exhaustive-ui-core-confirmpopup.d.ts +1 -6
  167. package/types/exhaustive-ui-core-contextmenu.d.ts +3 -0
  168. package/types/exhaustive-ui-core-dataview.d.ts +1 -11
  169. package/types/exhaustive-ui-core-datepicker.d.ts +1 -0
  170. package/types/exhaustive-ui-core-dialog.d.ts +1 -1
  171. package/types/exhaustive-ui-core-drawer.d.ts +2 -2
  172. package/types/exhaustive-ui-core-dynamicdialog.d.ts +3 -12
  173. package/types/exhaustive-ui-core-editor.d.ts +5 -0
  174. package/types/exhaustive-ui-core-fileupload.d.ts +3 -0
  175. package/types/exhaustive-ui-core-galleria.d.ts +12 -0
  176. package/types/exhaustive-ui-core-image.d.ts +1 -0
  177. package/types/exhaustive-ui-core-imagecompare.d.ts +2 -2
  178. package/types/exhaustive-ui-core-inplace.d.ts +3 -11
  179. package/types/exhaustive-ui-core-inputgroupaddon.d.ts +1 -6
  180. package/types/exhaustive-ui-core-inputmask.d.ts +2 -2
  181. package/types/exhaustive-ui-core-inputtext.d.ts +3 -10
  182. package/types/exhaustive-ui-core-listbox.d.ts +12 -6
  183. package/types/exhaustive-ui-core-megamenu.d.ts +3 -0
  184. package/types/exhaustive-ui-core-menu.d.ts +6 -11
  185. package/types/exhaustive-ui-core-menubar.d.ts +5 -11
  186. package/types/exhaustive-ui-core-message.d.ts +1 -8
  187. package/types/exhaustive-ui-core-metergroup.d.ts +3 -0
  188. package/types/exhaustive-ui-core-multiselect.d.ts +13 -10
  189. package/types/exhaustive-ui-core-orderlist.d.ts +2 -12
  190. package/types/exhaustive-ui-core-organizationchart.d.ts +3 -1
  191. package/types/exhaustive-ui-core-overlay.d.ts +8 -0
  192. package/types/exhaustive-ui-core-panel.d.ts +2 -0
  193. package/types/exhaustive-ui-core-panelmenu.d.ts +9 -0
  194. package/types/exhaustive-ui-core-password.d.ts +19 -14
  195. package/types/exhaustive-ui-core-picklist.d.ts +1 -16
  196. package/types/exhaustive-ui-core-radiobutton.d.ts +4 -1
  197. package/types/exhaustive-ui-core-scroller.d.ts +10 -0
  198. package/types/exhaustive-ui-core-select.d.ts +11 -27
  199. package/types/exhaustive-ui-core-selectbutton.d.ts +1 -6
  200. package/types/exhaustive-ui-core-stepper.d.ts +3 -11
  201. package/types/exhaustive-ui-core-table.d.ts +32 -4
  202. package/types/exhaustive-ui-core-tieredmenu.d.ts +8 -0
  203. package/types/exhaustive-ui-core-toast.d.ts +3 -0
  204. package/types/exhaustive-ui-core-toggleswitch.d.ts +1 -7
  205. package/types/exhaustive-ui-core-tooltip.d.ts +3 -10
  206. package/types/exhaustive-ui-core-tree.d.ts +17 -1
  207. package/types/exhaustive-ui-core-treetable.d.ts +24 -5
  208. package/types/exhaustive-ui-core-types-multiselect.d.ts +0 -6
  209. package/types/exhaustive-ui-core-types-table.d.ts +1 -1
  210. package/types/exhaustive-ui-core-types-tree.d.ts +5 -0
  211. package/types/exhaustive-ui-core-utils.d.ts +15 -0
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RENAMED_TEMPLATE_GROUPS = void 0;
4
+ exports.default = default_1;
5
+ const package_json_1 = require("../../utils/package-json");
6
+ const renamed_templates_1 = require("../../utils/renamed-templates");
7
+ /**
8
+ * Templates removed in this version in favor of the name their deprecation pointed to. MultiSelect's
9
+ * `removetokenicon` → `chipicon`: both received the same `{ class }` context and rendered the same
10
+ * chip remove icon (chipicon won when both were given).
11
+ */
12
+ exports.RENAMED_TEMPLATE_GROUPS = ['p-multiSelect', 'p-multiselect', 'p-multi-select'].map((selector) => ({ selector, renames: [{ from: 'removetokenicon', to: 'chipicon' }] }));
13
+ /**
14
+ * Renames the templates listed in {@link RENAMED_TEMPLATE_GROUPS} inside the matching elements:
15
+ * `<ng-template #removetokenicon>` and `<ng-template pTemplate="removetokenicon">` become
16
+ * `#chipicon` / `pTemplate="chipicon"`. An element that already projects a `chipicon` template is
17
+ * reported instead: the removed one was never rendered there, delete it by hand.
18
+ */
19
+ function default_1() {
20
+ return (tree, context) => {
21
+ let filesChanged = 0;
22
+ let renamedCount = 0;
23
+ const conflicts = [];
24
+ tree.visit((path) => {
25
+ if (package_json_1.SKIP_DIRS.test(path)) {
26
+ return;
27
+ }
28
+ const isHtml = path.endsWith('.html');
29
+ if (!isHtml && !path.endsWith('.ts') && !path.endsWith('.mts')) {
30
+ return;
31
+ }
32
+ const original = tree.read(path)?.toString();
33
+ if (original === undefined) {
34
+ return;
35
+ }
36
+ const result = isHtml ? (0, renamed_templates_1.renameTemplatesInHtml)(original, exports.RENAMED_TEMPLATE_GROUPS) : (0, renamed_templates_1.renameTemplatesInTypeScript)(path, original, exports.RENAMED_TEMPLATE_GROUPS);
37
+ if (result.changed) {
38
+ tree.overwrite(path, result.text);
39
+ filesChanged++;
40
+ renamedCount += result.renamed.length;
41
+ context.logger.info(`${path}: renamed ${result.renamed.join(', ')} template(s)`);
42
+ }
43
+ conflicts.push(...result.conflictLines.map((line) => `${path}:${line}`));
44
+ });
45
+ if (renamedCount > 0) {
46
+ context.logger.info(`Renamed ${renamedCount} template(s) across ${filesChanged} file(s).`);
47
+ }
48
+ else {
49
+ context.logger.info('No removed templates were found to rename.');
50
+ }
51
+ if (conflicts.length > 0) {
52
+ context.logger.warn(`Found ${conflicts.length} p-multiselect element(s) projecting both a removetokenicon and a chipicon template — only chipicon was rendered, delete the removetokenicon one:`);
53
+ for (const conflict of conflicts) {
54
+ context.logger.warn(` ${conflict}`);
55
+ }
56
+ }
57
+ return tree;
58
+ };
59
+ }
@@ -27,6 +27,11 @@ exports.MIGRATED_SELECTORS = [
27
27
  'p-timeline',
28
28
  'p-toolbar',
29
29
  'p-avatar',
30
+ 'p-avatarGroup',
31
+ 'p-avatar-group',
32
+ 'p-avatargroup',
33
+ 'p-inputgroup-addon',
34
+ 'p-inputGroupAddon',
30
35
  'p-chip',
31
36
  'p-inputgroup',
32
37
  'p-inputGroup',
@@ -9,22 +9,42 @@
9
9
  "styleclass-to-class": {
10
10
  "version": "22.0.0",
11
11
  "factory": "./migrations/styleclass-to-class/migration",
12
- "description": "Rewrite styleClass/[styleClass] to class/[class] on selectors whose styleClass input was removed in this version in favor of the native class attribute: p-toast, p-message, p-tag, p-skeleton, p-card, p-radiobutton/p-radioButton/p-radio-button, p-progressbar/p-progressBar/p-progress-bar, p-divider, p-progressspinner/p-progressSpinner/p-progress-spinner, p-timeline, p-toolbar, p-avatar, p-chip, p-inputgroup/p-inputGroup/p-input-group, p-iconfield/p-iconField/p-icon-field, p-inputicon/p-inputIcon/p-input-icon, p-toggleswitch/p-toggleSwitch/p-toggle-switch, p-colorpicker/p-colorPicker/p-color-picker, p-metergroup/p-meterGroup/p-meter-group, p-inplace, p-togglebutton/p-toggleButton/p-toggle-button, p-terminal, p-blockui/p-blockUI/p-block-ui, p-badge, p-checkbox/p-checkBox/p-check-box, p-panel, p-dock, p-accordion, p-knob, p-splitter, p-scrollpanel/p-scrollPanel/p-scroll-panel, p-image, p-editor, p-slider, p-paginator, p-organizationchart/p-organizationChart/p-organization-chart, p-carousel, p-dataview/p-dataView/p-data-view, p-splitbutton/p-splitButton/p-split-button, p-password, p-inputnumber/p-inputNumber/p-input-number, p-menubar, p-panelmenu/p-panelMenu/p-panel-menu, p-megamenu/p-megaMenu/p-mega-menu, p-cascadeselect/p-cascadeSelect/p-cascade-select, p-datepicker/p-datePicker/p-date-picker, p-tree, p-select, p-listbox/p-listBox/p-list-box, p-orderlist/p-orderList/p-order-list, p-table, p-autocomplete/p-autoComplete/p-auto-complete, p-multiselect/p-multiSelect/p-multi-select and p-treetable/p-treeTable/p-tree-table."
12
+ "description": "Rewrite styleClass/[styleClass] to class/[class] on selectors whose styleClass input was removed in this version in favor of the native class attribute: p-toast, p-message, p-tag, p-skeleton, p-card, p-radiobutton/p-radioButton/p-radio-button, p-progressbar/p-progressBar/p-progress-bar, p-divider, p-progressspinner/p-progressSpinner/p-progress-spinner, p-timeline, p-toolbar, p-avatar, p-avatarGroup/p-avatar-group/p-avatargroup, p-inputgroup-addon/p-inputGroupAddon, p-chip, p-inputgroup/p-inputGroup/p-input-group, p-iconfield/p-iconField/p-icon-field, p-inputicon/p-inputIcon/p-input-icon, p-toggleswitch/p-toggleSwitch/p-toggle-switch, p-colorpicker/p-colorPicker/p-color-picker, p-metergroup/p-meterGroup/p-meter-group, p-inplace, p-togglebutton/p-toggleButton/p-toggle-button, p-terminal, p-blockui/p-blockUI/p-block-ui, p-badge, p-checkbox/p-checkBox/p-check-box, p-panel, p-dock, p-accordion, p-knob, p-splitter, p-scrollpanel/p-scrollPanel/p-scroll-panel, p-image, p-editor, p-slider, p-paginator, p-organizationchart/p-organizationChart/p-organization-chart, p-carousel, p-dataview/p-dataView/p-data-view, p-splitbutton/p-splitButton/p-split-button, p-password, p-inputnumber/p-inputNumber/p-input-number, p-menubar, p-panelmenu/p-panelMenu/p-panel-menu, p-megamenu/p-megaMenu/p-mega-menu, p-cascadeselect/p-cascadeSelect/p-cascade-select, p-datepicker/p-datePicker/p-date-picker, p-tree, p-select, p-listbox/p-listBox/p-list-box, p-orderlist/p-orderList/p-order-list, p-table, p-autocomplete/p-autoComplete/p-auto-complete, p-multiselect/p-multiSelect/p-multi-select and p-treetable/p-treeTable/p-tree-table."
13
13
  },
14
14
  "remove-dead-inputs": {
15
15
  "version": "22.0.0",
16
16
  "factory": "./migrations/remove-dead-inputs/migration",
17
- "description": "Remove usages of inputs removed in this version that had already stopped doing anything: showTransformOptions, hideTransformOptions, showTransitionOptions and hideTransitionOptions of p-toast; showTransformOptions, hideTransformOptions, showTransitionOptions and hideTransitionOptions of p-toastItem; showTransitionOptions and hideTransitionOptions of p-message; showTransitionOptions and hideTransitionOptions of p-overlay; showTransitionOptions and hideTransitionOptions of p-colorPicker/p-colorpicker/p-color-picker; size of p-overlayBadge/p-overlay-badge/p-overlaybadge; transitionOptions of p-fieldset; transitionOptions of p-panel; transitionOptions of p-accordion; showTransitionOptions and hideTransitionOptions of p-scrollTop/p-scrolltop/p-scroll-top; showTransitionOptions and hideTransitionOptions of p-confirmpopup; inputId of p-togglebutton/p-toggleButton/p-toggle-button; showTransitionOptions, hideTransitionOptions and ariaCloseLabel of p-popover; showTransitionOptions, hideTransitionOptions, modalEnterAnimation and modalLeaveAnimation of p-image; transitionOptions of p-drawer; showTransitionOptions and hideTransitionOptions of p-menu; showTransitionOptions, hideTransitionOptions and plain of p-splitbutton/p-splitButton/p-split-button; showTransitionOptions and hideTransitionOptions of p-password; badgeClass of p-button; autoZIndex, baseZIndex and popup of p-contextMenuSub/p-contextmenu-sub; showTransitionOptions and hideTransitionOptions of p-tieredMenu/p-tieredmenu/p-tiered-menu; autoZIndex and baseZIndex of p-menubar; autoZIndex, baseZIndex, mobileActive, ariaLabel and ariaLabelledBy of p-menubarSub/p-menubarsub; transitionOptions and tabindex of p-panelMenu/p-panelmenu/p-panel-menu; disabled and queryMatches of p-megaMenuSub/p-megamenu-sub; showTransitionOptions, hideTransitionOptions and containerClass of p-galleria; removeStyleClass of p-fileupload/p-fileUpload; inputLabel and emptyMessage of p-cascadeSelect/p-cascadeselect/p-cascade-select; showTransitionOptions and hideTransitionOptions of p-datePicker/p-datepicker/p-date-picker; transitionOptions and rtl of p-dialog; closeAriaLabel, acceptAriaLabel, rejectAriaLabel, rtl, transitionOptions, focusTrap and defaultFocus of p-confirmDialog/p-confirmdialog/p-confirm-dialog; rowNode, root, firstChild and lastChild of p-treeNode; visible and itemSize of p-selectItem; frozenColumns and frozenWidth of p-table; autoZIndex, baseZIndex, showTransitionOptions and hideTransitionOptions of p-autoComplete/p-autocomplete/p-auto-complete; filterFields of p-multiSelect/p-multiselect/p-multi-select. The dead dir input of p-splitbutton/p-splitButton/p-split-button is removed too, but its dir/[dir] bindings are left in place: they keep working as the host element's native dir attribute. Programmatic reads/writes of the removed names are reported for manual review."
17
+ "description": "Remove usages of inputs removed in this version that had already stopped doing anything: showTransformOptions, hideTransformOptions, showTransitionOptions and hideTransitionOptions of p-toast; showTransformOptions, hideTransformOptions, showTransitionOptions and hideTransitionOptions of p-toastItem; showTransitionOptions and hideTransitionOptions of p-message; showTransitionOptions and hideTransitionOptions of p-overlay; showTransitionOptions and hideTransitionOptions of p-colorPicker/p-colorpicker/p-color-picker; size of p-overlayBadge/p-overlay-badge/p-overlaybadge; transitionOptions of p-fieldset; transitionOptions of p-panel; transitionOptions of p-accordion; showTransitionOptions and hideTransitionOptions of p-scrollTop/p-scrolltop/p-scroll-top; showTransitionOptions and hideTransitionOptions of p-confirmpopup; inputId of p-togglebutton/p-toggleButton/p-toggle-button; showTransitionOptions, hideTransitionOptions and ariaCloseLabel of p-popover; showTransitionOptions, hideTransitionOptions, modalEnterAnimation and modalLeaveAnimation of p-image; transitionOptions of p-drawer; showTransitionOptions and hideTransitionOptions of p-menu; showTransitionOptions, hideTransitionOptions and plain of p-splitbutton/p-splitButton/p-split-button; showTransitionOptions and hideTransitionOptions of p-password; badgeClass of p-button; autoZIndex, baseZIndex and popup of p-contextMenuSub/p-contextmenu-sub; showTransitionOptions and hideTransitionOptions of p-tieredMenu/p-tieredmenu/p-tiered-menu; autoZIndex and baseZIndex of p-menubar; autoZIndex, baseZIndex, mobileActive, ariaLabel and ariaLabelledBy of p-menubarSub/p-menubarsub; transitionOptions and tabindex of p-panelMenu/p-panelmenu/p-panel-menu; disabled and queryMatches of p-megaMenuSub/p-megamenu-sub; showTransitionOptions, hideTransitionOptions and containerClass of p-galleria; removeStyleClass of p-fileupload/p-fileUpload; inputLabel and emptyMessage of p-cascadeSelect/p-cascadeselect/p-cascade-select; showTransitionOptions and hideTransitionOptions of p-datePicker/p-datepicker/p-date-picker; transitionOptions and rtl of p-dialog; closeAriaLabel, acceptAriaLabel, rejectAriaLabel, rtl, transitionOptions, focusTrap and defaultFocus of p-confirmDialog/p-confirmdialog/p-confirm-dialog; rowNode, root, firstChild and lastChild of p-treeNode; visible and itemSize of p-selectItem; frozenColumns and frozenWidth of p-table; autoZIndex, baseZIndex, showTransitionOptions and hideTransitionOptions of p-autoComplete/p-autocomplete/p-auto-complete; filterFields of p-multiSelect/p-multiselect/p-multi-select; transitionOptions of p-stepper; autoHighlight of p-autoComplete/p-autocomplete/p-auto-complete; searchLocale of p-listbox/p-listBox/p-list-box; gridStyleClass and trackBy of p-dataView/p-dataview/p-data-view; trackBy and header of p-orderList/p-orderlist/p-order-list; trackBy, sourceTrackBy and targetTrackBy of p-pickList/p-picklist/p-pick-list; size of p-toggleswitch/p-toggleSwitch/p-toggle-switch; tabindex of p-selectButton/p-selectbutton/p-select-button; baseZIndex of p-confirmpopup; ariaLabelAsc and ariaLabelDesc of p-treeTableSortIcon/p-treetable-sort-icon/p-tree-table-sort-icon. The dead dir input of p-splitbutton/p-splitButton/p-split-button is removed too, but its dir/[dir] bindings are left in place: they keep working as the host element's native dir attribute. Programmatic reads/writes of the removed names are reported for manual review."
18
18
  },
19
19
  "config-overlay-options-signal": {
20
20
  "version": "22.0.0",
21
21
  "factory": "./migrations/config-overlay-options-signal/migration",
22
22
  "description": "Rewrite programmatic access to Exhaustive.overlayOptions, which is a signal in this version: assignments become .set(value) and reads become () calls."
23
23
  },
24
+ "renamed-outputs": {
25
+ "version": "22.0.0",
26
+ "factory": "./migrations/renamed-outputs/migration",
27
+ "description": "Rename event bindings of outputs renamed in this version to the name the other components use: onFilterEvent to onFilter on p-orderList/p-orderlist/p-order-list; selectAllChange to onSelectAllChange on p-table; onPanelShow to onShow and onPanelHide to onHide on p-multiSelect/p-multiselect/p-multi-select. The event payloads are unchanged, so $event keeps working. A p-table [(selectAll)] two-way binding, which relied on selectAllChange, is reported for manual review, as are programmatic references to the old names."
28
+ },
29
+ "config-input-style-to-variant": {
30
+ "version": "22.0.0",
31
+ "factory": "./migrations/config-input-style-to-variant/migration",
32
+ "description": "Rename the global inputStyle option, removed in this version, to inputVariant (same values): the inputStyle key of provideExhaustive()/setConfig() config objects, and reads and writes of Exhaustive.inputStyle. Config objects that set both names, receivers that cannot be proven to be the Exhaustive service and template reads are reported for manual review."
33
+ },
34
+ "renamed-templates": {
35
+ "version": "22.0.0",
36
+ "factory": "./migrations/renamed-templates/migration",
37
+ "description": "Rename templates removed in this version to their replacement inside the elements that project them: the removetokenicon template (#removetokenicon or pTemplate=\"removetokenicon\") becomes chipicon in p-multiSelect/p-multiselect/p-multi-select; both receive the same context. An element that already projects a chipicon template is reported for manual review."
38
+ },
39
+ "removed-exports": {
40
+ "version": "22.0.0",
41
+ "factory": "./migrations/removed-exports/migration",
42
+ "description": "Update imports of exports renamed or removed in this version: Password_VALUE_ACCESSOR becomes PASSWORD_VALUE_ACCESSOR; the empty InplaceDisplay/InplaceContent wrapper components are dropped from imports and their <p-inplacedisplay>/<p-inplacecontent> elements become <span> (Inplace projects the pInplaceDisplay/pInplaceContent attributes). Imports of rendering internals that are no longer exported (the SelectItem option component of Select, SafeHtmlPipe, MapperPipe, RadioControlRegistry, MenubarService) are reported for manual review."
43
+ },
24
44
  "renamed-inputs": {
25
45
  "version": "22.0.0",
26
46
  "factory": "./migrations/renamed-inputs/migration",
27
- "description": "Rename bindings of deprecated input aliases removed in this version to their replacement: showCloseIcon to closable on p-drawer; dropdownAppendTo to appendTo on p-paginator; maxLength to maxlength on p-password; minLength to minQueryLength on p-autoComplete/p-autocomplete/p-auto-complete; containerStyleClass to class and containerStyle to style on p-treeSelect/p-treeselect/p-tree-select; virtualRowHeight to virtualScrollItemSize on p-treeTable/p-treetable/p-tree-table. A tag that already binds the replacement is reported for manual review, as are programmatic reads/writes of the removed names."
47
+ "description": "Rename bindings of deprecated input aliases removed in this version to their replacement: showCloseIcon to closable on p-drawer; dropdownAppendTo to appendTo on p-paginator; maxLength to maxlength on p-password; minLength to minQueryLength on p-autoComplete/p-autocomplete/p-auto-complete; containerStyleClass to class and containerStyle to style on p-treeSelect/p-treeselect/p-tree-select; virtualRowHeight to virtualScrollItemSize on p-treeTable/p-treetable/p-tree-table; filterPlaceHolder to filterPlaceholder on p-listbox/p-listBox/p-list-box and p-multiSelect/p-multiselect/p-multi-select; ariaLabelledby to ariaLabelledBy on p-imageCompare/p-imagecompare/p-image-compare; ariaCloseLabel to closeAriaLabel on p-drawer; content (the alias that set the header template) to headerTemplate on p-dialog; the deprecated pass-through aliases of attribute directives on any element carrying them: ptButtonDirective to pButtonPT on [pButton], ptButtonLabel to pButtonLabelPT on [pButtonLabel], ptButtonIcon to pButtonIconPT on [pButtonIcon], ptBadgeDirective to pBadgePT on [pBadge], ptInputText to pInputTextPT on [pInputText], ptTooltip to pTooltipPT on [pTooltip]; size to badgeSize on [pBadge] placed on a plain element (on a component or an input/select, size belongs to the element). A tag that already binds the replacement is reported for manual review, as are programmatic reads/writes of the removed names."
28
48
  }
29
49
  }
30
50
  }
@@ -34,6 +34,9 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.rewriteConfigPropertyToSignal = rewriteConfigPropertyToSignal;
37
+ exports.renameConfigProperty = renameConfigProperty;
38
+ exports.findConfigPropertyAccessesInHtml = findConfigPropertyAccessesInHtml;
39
+ exports.findConfigPropertyAccessesInTypeScript = findConfigPropertyAccessesInTypeScript;
37
40
  exports.findConfigPropertyLeftoversInHtml = findConfigPropertyLeftoversInHtml;
38
41
  exports.findConfigPropertyLeftoversInTypeScript = findConfigPropertyLeftoversInTypeScript;
39
42
  const ts = __importStar(require("typescript"));
@@ -115,6 +118,118 @@ function rewriteConfigPropertyToSignal(fileName, text, target) {
115
118
  }
116
119
  return { text: result, changed: true, writes, reads, leftovers };
117
120
  }
121
+ /**
122
+ * Renames a config-service property replaced by another one of the same shape, inside one
123
+ * TypeScript source file:
124
+ * - `x.from` becomes `x.to` wherever `x` is provably the service (same rules as
125
+ * rewriteConfigPropertyToSignal), so `config.from()` / `config.from.set(v)` keep working;
126
+ * - a `from` key of an object literal passed directly to one of `configCalls`
127
+ * (`provideExhaustive({ from: v })`, `config.setConfig({ from })`) becomes `to`.
128
+ *
129
+ * Reported instead: accesses on a receiver that only looks like a config object, and object
130
+ * literals that already set `to` next to `from` (the author has to pick one).
131
+ */
132
+ function renameConfigProperty(fileName, text, target) {
133
+ const sourceFile = ts.createSourceFile(fileName, text, ts.ScriptTarget.Latest, true);
134
+ const bindings = collectServiceBindings(sourceFile, target.className);
135
+ const edits = [];
136
+ const leftovers = [];
137
+ let renamed = 0;
138
+ const isServiceReceiver = (expression) => {
139
+ const unwrapped = unwrap(expression);
140
+ if (isInjectCall(unwrapped, target.className)) {
141
+ return true;
142
+ }
143
+ if (ts.isIdentifier(unwrapped)) {
144
+ return bindings.resolvesIdentifier(unwrapped);
145
+ }
146
+ if (ts.isPropertyAccessExpression(unwrapped) && unwrap(unwrapped.expression).kind === ts.SyntaxKind.ThisKeyword) {
147
+ return bindings.resolvesMember(unwrapped);
148
+ }
149
+ return false;
150
+ };
151
+ const isConfigCallArgument = (node) => {
152
+ const call = node.parent;
153
+ if (!call || !ts.isCallExpression(call) || !call.arguments.includes(node)) {
154
+ return false;
155
+ }
156
+ const callee = call.expression;
157
+ const name = ts.isIdentifier(callee) ? callee.text : ts.isPropertyAccessExpression(callee) ? callee.name.text : undefined;
158
+ return name !== undefined && target.configCalls.includes(name);
159
+ };
160
+ const keyOf = (property) => (property.name && (ts.isIdentifier(property.name) || ts.isStringLiteral(property.name)) ? property.name.text : undefined);
161
+ const visit = (node) => {
162
+ if (ts.isPropertyAccessExpression(node) && node.name.text === target.from) {
163
+ if (isServiceReceiver(node.expression)) {
164
+ edits.push({ start: node.name.getStart(sourceFile), end: node.name.getEnd(), replacement: target.to });
165
+ renamed++;
166
+ }
167
+ else if (looksLikeConfigReceiver(node.expression, sourceFile)) {
168
+ leftovers.push(lineOf(sourceFile, node));
169
+ }
170
+ }
171
+ else if (ts.isObjectLiteralExpression(node) && isConfigCallArgument(node)) {
172
+ const old = node.properties.filter((property) => keyOf(property) === target.from);
173
+ if (old.length > 0 && node.properties.some((property) => keyOf(property) === target.to)) {
174
+ leftovers.push(lineOf(sourceFile, old[0]));
175
+ }
176
+ else {
177
+ for (const property of old) {
178
+ if (ts.isShorthandPropertyAssignment(property)) {
179
+ edits.push({ start: property.name.getStart(sourceFile), end: property.name.getEnd(), replacement: `${target.to}: ${target.from}` });
180
+ }
181
+ else if (property.name) {
182
+ const quote = ts.isStringLiteral(property.name) ? property.name.getText(sourceFile)[0] : '';
183
+ edits.push({ start: property.name.getStart(sourceFile), end: property.name.getEnd(), replacement: `${quote}${target.to}${quote}` });
184
+ }
185
+ renamed++;
186
+ }
187
+ }
188
+ }
189
+ ts.forEachChild(node, visit);
190
+ };
191
+ visit(sourceFile);
192
+ if (edits.length === 0) {
193
+ return { text, changed: false, renamed, leftovers };
194
+ }
195
+ edits.sort((a, b) => b.start - a.start);
196
+ let result = text;
197
+ for (const edit of edits) {
198
+ result = result.slice(0, edit.start) + edit.replacement + result.slice(edit.end);
199
+ }
200
+ return { text: result, changed: true, renamed, leftovers };
201
+ }
202
+ /**
203
+ * Finds every `<receiver>.prop` access of a config-looking receiver inside an HTML fragment, calls
204
+ * included. Returns the 1-based line (relative to the fragment) of each match.
205
+ */
206
+ function findConfigPropertyAccessesInHtml(html, property) {
207
+ const pattern = new RegExp(`\\b(?:config|primeng|exhaustive)\\w*(?:\\?\\.|\\.)${escapeRegExp(property)}\\b`, 'gi');
208
+ const lines = [];
209
+ for (const match of html.matchAll(pattern)) {
210
+ lines.push(html.slice(0, match.index).split('\n').length);
211
+ }
212
+ return lines;
213
+ }
214
+ /** Same scan, applied to the inline `template:` literals of `@Component` decorators. Returns 1-based lines within the file. */
215
+ function findConfigPropertyAccessesInTypeScript(fileName, text, property) {
216
+ return scanInlineTemplates(fileName, text, (html) => findConfigPropertyAccessesInHtml(html, property));
217
+ }
218
+ function scanInlineTemplates(fileName, text, scan) {
219
+ const sourceFile = ts.createSourceFile(fileName, text, ts.ScriptTarget.Latest, true);
220
+ const lines = [];
221
+ const visit = (node) => {
222
+ if (ts.isPropertyAssignment(node) && isDirectComponentTemplateProperty(node) && ts.isStringLiteralLike(node.initializer)) {
223
+ const start = node.initializer.getStart(sourceFile) + 1;
224
+ for (const line of scan(node.initializer.text)) {
225
+ lines.push(sourceFile.getLineAndCharacterOfPosition(start).line + line);
226
+ }
227
+ }
228
+ ts.forEachChild(node, visit);
229
+ };
230
+ visit(sourceFile);
231
+ return lines;
232
+ }
118
233
  /**
119
234
  * Finds `<receiver>.prop` reads of a config-looking receiver inside an HTML fragment — a template
120
235
  * file, or the body of an inline `template:` literal — that are not already calls. Returns the
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.replaceElementsInHtml = replaceElementsInHtml;
37
+ exports.applyExportChangesToTypeScript = applyExportChangesToTypeScript;
38
+ const ts = __importStar(require("typescript"));
39
+ const removed_inputs_1 = require("./removed-inputs");
40
+ function applyEdits(text, edits) {
41
+ edits.sort((a, b) => b.start - a.start);
42
+ let result = text;
43
+ for (const edit of edits) {
44
+ result = result.slice(0, edit.start) + edit.replacement + result.slice(edit.end);
45
+ }
46
+ return result;
47
+ }
48
+ /** Replaces the opening and closing tags of the removed wrapper elements with their plain replacement. */
49
+ function replaceElementsInHtml(html, elements) {
50
+ const replaced = [];
51
+ let text = html;
52
+ for (const [element, replacement] of Object.entries(elements)) {
53
+ text = text.replace(new RegExp(`<(/?)${(0, removed_inputs_1.escapeRegExp)(element)}(?=[\\s/>])`, 'g'), (_match, slash) => {
54
+ if (!slash) {
55
+ replaced.push(`<${element}> → <${replacement}>`);
56
+ }
57
+ return `<${slash}${replacement}`;
58
+ });
59
+ }
60
+ return { text, replaced };
61
+ }
62
+ /**
63
+ * Applies the export changes to one TypeScript file: renames the imports (and every use) of renamed
64
+ * exports, drops the imports and `imports: [...]` entries of dropped ones, replaces the removed
65
+ * wrapper elements in inline templates and reports imports of names that are no longer exported.
66
+ * An aliased import (`import { Old as Mine }`) only has its imported name renamed.
67
+ */
68
+ function applyExportChangesToTypeScript(fileName, text, changes) {
69
+ const sourceFile = ts.createSourceFile(fileName, text, ts.ScriptTarget.Latest, true);
70
+ const edits = [];
71
+ const applied = [];
72
+ const leftovers = [];
73
+ const renamedLocals = new Map();
74
+ const droppedLocals = new Set();
75
+ const lineOf = (node) => sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile)).line + 1;
76
+ for (const statement of sourceFile.statements) {
77
+ if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier)) {
78
+ continue;
79
+ }
80
+ const entry = statement.moduleSpecifier.text;
81
+ const bindings = statement.importClause?.namedBindings;
82
+ if (!bindings || !ts.isNamedImports(bindings)) {
83
+ continue;
84
+ }
85
+ const renamed = changes.renamed[entry] ?? {};
86
+ const dropped = changes.dropped[entry] ?? [];
87
+ const unexported = changes.unexported[entry] ?? [];
88
+ const kept = [];
89
+ for (const specifier of bindings.elements) {
90
+ const imported = (specifier.propertyName ?? specifier.name).text;
91
+ if (renamed[imported]) {
92
+ const target = specifier.propertyName ?? specifier.name;
93
+ edits.push({ start: target.getStart(sourceFile), end: target.getEnd(), replacement: renamed[imported] });
94
+ if (!specifier.propertyName) {
95
+ renamedLocals.set(imported, renamed[imported]);
96
+ }
97
+ applied.push(`${imported} → ${renamed[imported]}`);
98
+ kept.push(specifier);
99
+ }
100
+ else if (dropped.includes(imported)) {
101
+ droppedLocals.add(specifier.name.text);
102
+ applied.push(`removed ${imported}`);
103
+ }
104
+ else {
105
+ if (unexported.includes(imported)) {
106
+ leftovers.push(lineOf(specifier));
107
+ }
108
+ kept.push(specifier);
109
+ }
110
+ }
111
+ if (kept.length !== bindings.elements.length) {
112
+ if (kept.length === 0 && !statement.importClause?.name) {
113
+ const end = text[statement.getEnd()] === '\n' ? statement.getEnd() + 1 : statement.getEnd();
114
+ edits.push({ start: statement.getStart(sourceFile), end, replacement: '' });
115
+ }
116
+ else {
117
+ // rebuild the specifier list; renamed specifiers are rewritten here rather than by their own edit
118
+ for (let i = edits.length - 1; i >= 0; i--) {
119
+ if (edits[i].start >= bindings.getStart(sourceFile) && edits[i].end <= bindings.getEnd()) {
120
+ edits.splice(i, 1);
121
+ }
122
+ }
123
+ const list = kept.map((specifier) => {
124
+ const imported = (specifier.propertyName ?? specifier.name).text;
125
+ const name = renamed[imported] ?? imported;
126
+ return specifier.propertyName ? `${name} as ${specifier.name.text}` : name;
127
+ });
128
+ edits.push({ start: bindings.getStart(sourceFile), end: bindings.getEnd(), replacement: `{ ${list.join(', ')} }` });
129
+ }
130
+ }
131
+ }
132
+ const visit = (node) => {
133
+ if (ts.isIdentifier(node) && renamedLocals.has(node.text) && !ts.isImportSpecifier(node.parent)) {
134
+ const isPropertyName = (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node) || (ts.isPropertyAssignment(node.parent) && node.parent.name === node);
135
+ if (!isPropertyName) {
136
+ edits.push({ start: node.getStart(sourceFile), end: node.getEnd(), replacement: renamedLocals.get(node.text) });
137
+ }
138
+ }
139
+ else if (ts.isArrayLiteralExpression(node) && droppedLocals.size > 0) {
140
+ const elements = node.elements;
141
+ const isDropped = (element) => ts.isIdentifier(element) && droppedLocals.has(element.text);
142
+ if (elements.length > 0 && elements.every(isDropped)) {
143
+ edits.push({ start: elements[0].getStart(sourceFile), end: elements[elements.length - 1].getEnd(), replacement: '' });
144
+ }
145
+ else {
146
+ elements.forEach((element, index) => {
147
+ if (!isDropped(element)) {
148
+ return;
149
+ }
150
+ // remove the element with the separator after it, or before it when only dropped elements follow
151
+ const keptAfter = elements.slice(index + 1).some((other) => !isDropped(other));
152
+ const start = keptAfter ? element.getStart(sourceFile) : elements[index - 1].getEnd();
153
+ const end = keptAfter ? elements[index + 1].getStart(sourceFile) : element.getEnd();
154
+ edits.push({ start, end, replacement: '' });
155
+ });
156
+ }
157
+ }
158
+ else if (ts.isPropertyAssignment(node) && (0, removed_inputs_1.isDirectComponentTemplateProperty)(node) && ts.isStringLiteralLike(node.initializer)) {
159
+ const result = replaceElementsInHtml(node.initializer.text, changes.elements);
160
+ if (result.replaced.length > 0) {
161
+ edits.push({ start: node.initializer.getStart(sourceFile), end: node.initializer.getEnd(), replacement: (0, removed_inputs_1.encodeLiteralBody)(node.initializer, result.text) });
162
+ applied.push(...result.replaced);
163
+ }
164
+ }
165
+ ts.forEachChild(node, visit);
166
+ };
167
+ visit(sourceFile);
168
+ if (edits.length === 0) {
169
+ return { text, changed: false, applied, leftovers };
170
+ }
171
+ return { text: applyEdits(text, edits), changed: true, applied, leftovers };
172
+ }
Binary file
@@ -125,21 +125,32 @@ function applyEdits(text, edits) {
125
125
  * file or the body of an inline component template).
126
126
  */
127
127
  function renameInputsInHtml(html, groups) {
128
- const edits = [];
128
+ // keyed by tag start: several groups can match the same tag (an element carrying both pButton and
129
+ // pTooltip, or two groups of the same directive), so their renames are applied one after the other
130
+ const tags = new Map();
129
131
  const renamed = [];
130
- const conflictLines = [];
131
132
  for (const group of groups) {
132
133
  for (const tag of (0, removed_inputs_1.findOpeningTags)(html, group.selector)) {
133
- const result = renameOnTag(html.slice(tag.start, tag.end), group.renames);
134
- if (result.renamed.length > 0) {
135
- edits.push({ start: tag.start, end: tag.end, replacement: result.text });
136
- renamed.push(...result.renamed);
137
- }
138
- if (result.conflict) {
139
- conflictLines.push(lineOf(html, tag.start));
134
+ if (group.skipTag?.(tag.name)) {
135
+ continue;
140
136
  }
137
+ const current = tags.get(tag.start) ?? { end: tag.end, text: html.slice(tag.start, tag.end), conflict: false };
138
+ const result = renameOnTag(current.text, group.renames);
139
+ renamed.push(...result.renamed);
140
+ tags.set(tag.start, { end: tag.end, text: result.text, conflict: current.conflict || result.conflict });
141
+ }
142
+ }
143
+ const edits = [];
144
+ const conflictLines = [];
145
+ for (const [start, tag] of tags) {
146
+ if (tag.text !== html.slice(start, tag.end)) {
147
+ edits.push({ start, end: tag.end, replacement: tag.text });
148
+ }
149
+ if (tag.conflict) {
150
+ conflictLines.push(lineOf(html, start));
141
151
  }
142
152
  }
153
+ conflictLines.sort((a, b) => a - b);
143
154
  if (edits.length === 0) {
144
155
  return { text: html, changed: false, renamed, conflictLines };
145
156
  }
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.renameOutputsInHtml = renameOutputsInHtml;
37
+ exports.renameOutputsInTypeScript = renameOutputsInTypeScript;
38
+ exports.findTwoWayBindings = findTwoWayBindings;
39
+ exports.findTwoWayBindingsInTypeScript = findTwoWayBindingsInTypeScript;
40
+ const ts = __importStar(require("typescript"));
41
+ const removed_inputs_1 = require("./removed-inputs");
42
+ /**
43
+ * Matches the name of an event binding for `name` on an opening tag: `(name)="..."` or the
44
+ * canonical `on-name="..."` form. Group 1 is what precedes the name, group 2 what follows it. Meant
45
+ * to run against a quote-masked copy of the tag (see `maskQuotedValues`), so text inside another
46
+ * attribute's quoted value never matches.
47
+ */
48
+ function eventRegex(name) {
49
+ return new RegExp(`(?<=\\s)(\\(|on-)${(0, removed_inputs_1.escapeRegExp)(name)}(\\)|)(?=\\s*=)`, 'g');
50
+ }
51
+ /**
52
+ * Renames the event bindings of a single opening tag. Binding the same output twice is valid
53
+ * Angular, so a tag that already listens to the new name is renamed as well: both handlers keep
54
+ * running, as they did before.
55
+ */
56
+ function renameOnTag(tag, renames) {
57
+ let text = tag;
58
+ const renamed = [];
59
+ for (const { from, to } of renames) {
60
+ const masked = (0, removed_inputs_1.maskQuotedValues)(text);
61
+ const edits = [];
62
+ const regex = eventRegex(from);
63
+ let match;
64
+ while ((match = regex.exec(masked))) {
65
+ // `(name` without `)` or `on-name)` is part of something else
66
+ if ((match[1] === '(') !== (match[2] === ')')) {
67
+ continue;
68
+ }
69
+ edits.push({ start: match.index, end: match.index + match[0].length, replacement: `${match[1]}${to}${match[2]}` });
70
+ renamed.push(`${from} → ${to}`);
71
+ }
72
+ text = applyEdits(text, edits);
73
+ }
74
+ return { text, renamed };
75
+ }
76
+ function applyEdits(text, edits) {
77
+ edits.sort((a, b) => b.start - a.start);
78
+ let result = text;
79
+ for (const edit of edits) {
80
+ result = result.slice(0, edit.start) + edit.replacement + result.slice(edit.end);
81
+ }
82
+ return result;
83
+ }
84
+ /**
85
+ * Renames output bindings, scoped per-selector, in an HTML fragment (a standalone template file or
86
+ * the body of an inline component template).
87
+ */
88
+ function renameOutputsInHtml(html, groups) {
89
+ const edits = [];
90
+ const renamed = [];
91
+ for (const group of groups) {
92
+ for (const tag of (0, removed_inputs_1.findOpeningTags)(html, group.selector)) {
93
+ const result = renameOnTag(html.slice(tag.start, tag.end), group.renames);
94
+ if (result.renamed.length > 0) {
95
+ edits.push({ start: tag.start, end: tag.end, replacement: result.text });
96
+ renamed.push(...result.renamed);
97
+ }
98
+ }
99
+ }
100
+ if (edits.length === 0) {
101
+ return { text: html, changed: false, renamed };
102
+ }
103
+ return { text: applyEdits(html, edits), changed: true, renamed };
104
+ }
105
+ /** Same rename, applied only inside the `template` string literal of an `@Component` decorator. */
106
+ function renameOutputsInTypeScript(fileName, text, groups) {
107
+ const sourceFile = ts.createSourceFile(fileName, text, ts.ScriptTarget.Latest, true);
108
+ const edits = [];
109
+ const renamed = [];
110
+ const visit = (node) => {
111
+ if (ts.isPropertyAssignment(node) && (0, removed_inputs_1.isDirectComponentTemplateProperty)(node) && ts.isStringLiteralLike(node.initializer)) {
112
+ const initializer = node.initializer;
113
+ const result = renameOutputsInHtml(initializer.text, groups);
114
+ if (result.changed) {
115
+ edits.push({ start: initializer.getStart(sourceFile), end: initializer.getEnd(), replacement: (0, removed_inputs_1.encodeLiteralBody)(initializer, result.text) });
116
+ renamed.push(...result.renamed);
117
+ }
118
+ }
119
+ ts.forEachChild(node, visit);
120
+ };
121
+ visit(sourceFile);
122
+ if (edits.length === 0) {
123
+ return { text, changed: false, renamed };
124
+ }
125
+ return { text: applyEdits(text, edits), changed: true, renamed };
126
+ }
127
+ /**
128
+ * Finds tags of `selector` carrying a two-way binding `[(name)]` in an HTML fragment. Returns the
129
+ * 1-based line of each.
130
+ */
131
+ function findTwoWayBindings(html, selector, name) {
132
+ const lines = [];
133
+ const regex = new RegExp(`(?<=\\s)\\[\\(${(0, removed_inputs_1.escapeRegExp)(name)}\\)\\](?=\\s*=)`);
134
+ for (const tag of (0, removed_inputs_1.findOpeningTags)(html, selector)) {
135
+ if (regex.test((0, removed_inputs_1.maskQuotedValues)(html.slice(tag.start, tag.end)))) {
136
+ lines.push(html.slice(0, tag.start).split('\n').length);
137
+ }
138
+ }
139
+ return lines;
140
+ }
141
+ /** Same scan inside the inline `template` literals of a TypeScript file; returns 1-based lines within the file. */
142
+ function findTwoWayBindingsInTypeScript(fileName, text, selector, name) {
143
+ const sourceFile = ts.createSourceFile(fileName, text, ts.ScriptTarget.Latest, true);
144
+ const lines = [];
145
+ const visit = (node) => {
146
+ if (ts.isPropertyAssignment(node) && (0, removed_inputs_1.isDirectComponentTemplateProperty)(node) && ts.isStringLiteralLike(node.initializer)) {
147
+ const templateLine = sourceFile.getLineAndCharacterOfPosition(node.initializer.getStart(sourceFile)).line + 1;
148
+ lines.push(...findTwoWayBindings(node.initializer.text, selector, name).map((line) => templateLine + line - 1));
149
+ }
150
+ ts.forEachChild(node, visit);
151
+ };
152
+ visit(sourceFile);
153
+ return lines;
154
+ }