@taiga-ui/cdk 4.0.0-rc.2 → 4.0.0-rc.4

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 (192) hide show
  1. package/classes/control.d.ts +1 -1
  2. package/constants/used-icons.d.ts +1 -1
  3. package/constants/version.d.ts +1 -1
  4. package/constants/version.js +1 -1
  5. package/directives/auto-focus/autofocus.options.d.ts +1 -1
  6. package/directives/for/for.directive.d.ts +3 -3
  7. package/directives/platform/platform.directive.d.ts +1 -1
  8. package/directives/value-changes/value-changes.directive.d.ts +3 -3
  9. package/esm2022/classes/control.mjs +2 -2
  10. package/esm2022/constants/used-icons.mjs +5 -5
  11. package/esm2022/constants/version.mjs +2 -2
  12. package/esm2022/directives/active-zone/active-zone.directive.mjs +2 -2
  13. package/esm2022/directives/auto-focus/handlers/ios.handler.mjs +3 -3
  14. package/esm2022/directives/click-outside/click-outside.directive.mjs +2 -2
  15. package/esm2022/directives/droppable/droppable.directive.mjs +3 -3
  16. package/esm2022/directives/for/for.directive.mjs +6 -6
  17. package/esm2022/directives/hovered/hovered.service.mjs +2 -2
  18. package/esm2022/directives/obscured/obscured.directive.mjs +2 -2
  19. package/esm2022/directives/obscured/obscured.service.mjs +2 -2
  20. package/esm2022/directives/pan/pan.service.mjs +2 -2
  21. package/esm2022/directives/platform/platform.directive.mjs +6 -6
  22. package/esm2022/directives/swipe/swipe.service.mjs +2 -2
  23. package/esm2022/directives/value-changes/value-changes.directive.mjs +6 -6
  24. package/esm2022/directives/zoom/zoom.service.mjs +4 -4
  25. package/esm2022/observables/control-value.mjs +2 -2
  26. package/esm2022/observables/drag-and-drop-from.mjs +2 -2
  27. package/esm2022/observables/events.mjs +3 -3
  28. package/esm2022/observables/if-map.mjs +2 -2
  29. package/esm2022/observables/must-be-present.mjs +2 -2
  30. package/esm2022/observables/zone.mjs +4 -4
  31. package/esm2022/pipes/filter/filter.pipe.mjs +2 -2
  32. package/esm2022/services/popover.service.mjs +3 -3
  33. package/esm2022/services/scroll.service.mjs +2 -2
  34. package/esm2022/services/static-request.service.mjs +1 -1
  35. package/esm2022/tokens/active-element.mjs +3 -3
  36. package/esm2022/tokens/removed-element.mjs +2 -2
  37. package/esm2022/utils/color/get-gradient-data.mjs +6 -0
  38. package/esm2022/utils/color/hex-to-rgb.mjs +2 -2
  39. package/esm2022/utils/color/index.mjs +3 -1
  40. package/esm2022/utils/color/parse-color.mjs +3 -3
  41. package/esm2022/utils/color/parse-gradient.mjs +70 -0
  42. package/esm2022/utils/color/rgb-to-hex.mjs +2 -2
  43. package/esm2022/utils/dom/get-element-obscurers.mjs +2 -2
  44. package/esm2022/utils/dom/get-element-point.mjs +6 -0
  45. package/esm2022/utils/dom/index.mjs +2 -1
  46. package/esm2022/utils/focus/focused-in.mjs +7 -0
  47. package/esm2022/utils/focus/index.mjs +2 -1
  48. package/esm2022/utils/miscellaneous/mark-control-as-touched-and-validate.mjs +3 -3
  49. package/esm2022/utils/miscellaneous/with-styles.mjs +2 -2
  50. package/fesm2022/taiga-ui-cdk-classes.mjs +1 -1
  51. package/fesm2022/taiga-ui-cdk-classes.mjs.map +1 -1
  52. package/fesm2022/taiga-ui-cdk-constants.mjs +5 -5
  53. package/fesm2022/taiga-ui-cdk-constants.mjs.map +1 -1
  54. package/fesm2022/taiga-ui-cdk-directives-active-zone.mjs +1 -1
  55. package/fesm2022/taiga-ui-cdk-directives-active-zone.mjs.map +1 -1
  56. package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs +2 -2
  57. package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs.map +1 -1
  58. package/fesm2022/taiga-ui-cdk-directives-click-outside.mjs +1 -1
  59. package/fesm2022/taiga-ui-cdk-directives-click-outside.mjs.map +1 -1
  60. package/fesm2022/taiga-ui-cdk-directives-droppable.mjs +2 -2
  61. package/fesm2022/taiga-ui-cdk-directives-droppable.mjs.map +1 -1
  62. package/fesm2022/taiga-ui-cdk-directives-for.mjs +5 -5
  63. package/fesm2022/taiga-ui-cdk-directives-for.mjs.map +1 -1
  64. package/fesm2022/taiga-ui-cdk-directives-hovered.mjs +1 -1
  65. package/fesm2022/taiga-ui-cdk-directives-hovered.mjs.map +1 -1
  66. package/fesm2022/taiga-ui-cdk-directives-obscured.mjs +2 -2
  67. package/fesm2022/taiga-ui-cdk-directives-obscured.mjs.map +1 -1
  68. package/fesm2022/taiga-ui-cdk-directives-pan.mjs +1 -1
  69. package/fesm2022/taiga-ui-cdk-directives-pan.mjs.map +1 -1
  70. package/fesm2022/taiga-ui-cdk-directives-platform.mjs +5 -5
  71. package/fesm2022/taiga-ui-cdk-directives-platform.mjs.map +1 -1
  72. package/fesm2022/taiga-ui-cdk-directives-swipe.mjs +1 -1
  73. package/fesm2022/taiga-ui-cdk-directives-swipe.mjs.map +1 -1
  74. package/fesm2022/taiga-ui-cdk-directives-value-changes.mjs +5 -5
  75. package/fesm2022/taiga-ui-cdk-directives-value-changes.mjs.map +1 -1
  76. package/fesm2022/taiga-ui-cdk-directives-zoom.mjs +3 -3
  77. package/fesm2022/taiga-ui-cdk-directives-zoom.mjs.map +1 -1
  78. package/fesm2022/taiga-ui-cdk-observables.mjs +9 -9
  79. package/fesm2022/taiga-ui-cdk-observables.mjs.map +1 -1
  80. package/fesm2022/taiga-ui-cdk-pipes-filter.mjs +1 -1
  81. package/fesm2022/taiga-ui-cdk-pipes-filter.mjs.map +1 -1
  82. package/fesm2022/taiga-ui-cdk-services.mjs +3 -3
  83. package/fesm2022/taiga-ui-cdk-services.mjs.map +1 -1
  84. package/fesm2022/taiga-ui-cdk-tokens.mjs +3 -3
  85. package/fesm2022/taiga-ui-cdk-tokens.mjs.map +1 -1
  86. package/fesm2022/taiga-ui-cdk-utils-color.mjs +80 -5
  87. package/fesm2022/taiga-ui-cdk-utils-color.mjs.map +1 -1
  88. package/fesm2022/taiga-ui-cdk-utils-dom.mjs +7 -2
  89. package/fesm2022/taiga-ui-cdk-utils-dom.mjs.map +1 -1
  90. package/fesm2022/taiga-ui-cdk-utils-focus.mjs +8 -2
  91. package/fesm2022/taiga-ui-cdk-utils-focus.mjs.map +1 -1
  92. package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs +3 -3
  93. package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs.map +1 -1
  94. package/package.json +6 -6
  95. package/schematics/ng-add/index.js +1 -1
  96. package/schematics/ng-add/steps/add-taiga-icons.js +1 -1
  97. package/schematics/ng-add/steps/add-taiga-modules.js +3 -3
  98. package/schematics/ng-update/steps/icons/replace-imports.js +5 -5
  99. package/schematics/ng-update/steps/index.d.ts +1 -0
  100. package/schematics/ng-update/steps/index.js +1 -0
  101. package/schematics/ng-update/steps/remove-module.js +2 -2
  102. package/schematics/ng-update/steps/rename-types.js +2 -2
  103. package/schematics/ng-update/steps/replace-deep-import.js +2 -2
  104. package/schematics/ng-update/steps/replace-enums.js +2 -2
  105. package/schematics/ng-update/steps/replace-identifier.js +1 -1
  106. package/schematics/ng-update/steps/replace-package-name.d.ts +5 -0
  107. package/schematics/ng-update/steps/replace-package-name.js +19 -0
  108. package/schematics/ng-update/steps/replace-services.js +5 -5
  109. package/schematics/ng-update/steps/show-warnings.js +4 -4
  110. package/schematics/ng-update/utils/replace-text.js +1 -1
  111. package/schematics/ng-update/utils/templates/replace-attr-values.js +3 -3
  112. package/schematics/ng-update/utils/templates/replace-attrs.js +1 -1
  113. package/schematics/ng-update/utils/templates/template-comments.js +4 -2
  114. package/schematics/ng-update/v3/constants/templates.js +9 -9
  115. package/schematics/ng-update/v3/index.js +1 -1
  116. package/schematics/ng-update/v3/steps/migrate-date-time.js +10 -10
  117. package/schematics/ng-update/v3/steps/migrate-polymorpheus.js +8 -8
  118. package/schematics/ng-update/v3/steps/migrate-progress.js +4 -4
  119. package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-range.js +3 -3
  120. package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-slider.js +4 -4
  121. package/schematics/ng-update/v3/steps/migrate-taiga-proprietary-icons.js +2 -2
  122. package/schematics/ng-update/v3/steps/migrate-templates.js +16 -16
  123. package/schematics/ng-update/v3/steps/migrate-textfield-controller.js +8 -8
  124. package/schematics/ng-update/v3/steps/miscellaneous.js +5 -5
  125. package/schematics/ng-update/v3/steps/replace-functions.js +12 -12
  126. package/schematics/ng-update/v3/steps/replace-styles.js +2 -2
  127. package/schematics/ng-update/v3-36/index.js +7 -17
  128. package/schematics/ng-update/v3-40/index.js +1 -1
  129. package/schematics/ng-update/v3-5/steps/migrate-expand-templates.js +4 -4
  130. package/schematics/ng-update/v4/index.js +9 -6
  131. package/schematics/ng-update/v4/migrate-css-vars/palette.d.ts +11 -2
  132. package/schematics/ng-update/v4/migrate-css-vars/palette.js +18 -8
  133. package/schematics/ng-update/v4/migrate-css-vars/rename-css-vars.js +10 -2
  134. package/schematics/ng-update/v4/migrate-icons/index.js +8 -6
  135. package/schematics/ng-update/v4/migrate-icons/rename-icons.js +2 -2
  136. package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.d.ts +2 -0
  137. package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.js +66 -0
  138. package/schematics/ng-update/v4/steps/constants/attr-to-directive-replace.js +2 -2
  139. package/schematics/ng-update/v4/steps/constants/attr-with-values-to-replace.js +9 -1
  140. package/schematics/ng-update/v4/steps/constants/attrs-to-replace.js +10 -9
  141. package/schematics/ng-update/v4/steps/constants/enums.js +31 -0
  142. package/schematics/ng-update/v4/steps/constants/html-comments.js +10 -0
  143. package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.js +180 -118
  144. package/schematics/ng-update/v4/steps/constants/inputs-to-remove.js +1 -1
  145. package/schematics/ng-update/v4/steps/constants/migration-warnings.js +5 -0
  146. package/schematics/ng-update/v4/steps/constants/modules-to-remove.js +8 -0
  147. package/schematics/ng-update/v4/steps/constants/modules-to-replace.d.ts +12 -0
  148. package/schematics/ng-update/v4/steps/constants/modules-to-replace.js +15 -0
  149. package/schematics/ng-update/v4/steps/constants/tags-to-replace.js +5 -4
  150. package/schematics/ng-update/v4/steps/constants/types.js +6 -0
  151. package/schematics/ng-update/v4/steps/index.d.ts +4 -0
  152. package/schematics/ng-update/v4/steps/index.js +4 -0
  153. package/schematics/ng-update/v4/steps/migrate-all-country-iso-codes.js +1 -1
  154. package/schematics/ng-update/v4/steps/migrate-destroy-service.js +7 -4
  155. package/schematics/ng-update/v4/steps/migrate-legacy-mask.js +2 -2
  156. package/schematics/ng-update/v4/steps/migrate-option-providers.js +2 -2
  157. package/schematics/ng-update/v4/steps/migrate-proprietary.js +3 -3
  158. package/schematics/ng-update/v4/steps/migrate-styles.js +1 -1
  159. package/schematics/ng-update/v4/steps/migrate-templates.js +1 -1
  160. package/schematics/ng-update/v4/steps/templates/migrate-avatar.js +24 -6
  161. package/schematics/ng-update/v4/steps/templates/migrate-badge.js +4 -4
  162. package/schematics/ng-update/v4/steps/templates/migrate-expandable.js +2 -2
  163. package/schematics/ng-update/v4/steps/templates/migrate-focusable.js +1 -1
  164. package/schematics/ng-update/v4/steps/templates/migrate-labeled.js +1 -3
  165. package/schematics/ng-update/v4/steps/templates/migrate-money.js +1 -1
  166. package/schematics/ng-update/v4/steps/templates/migrate-thumbnail-card.js +1 -1
  167. package/schematics/ng-update/v4/steps/templates/toggles/common.d.ts +1 -1
  168. package/schematics/ng-update/v4/steps/templates/toggles/common.js +3 -3
  169. package/schematics/ng-update/v4/steps/update-packages.d.ts +4 -0
  170. package/schematics/ng-update/v4/steps/update-packages.js +29 -0
  171. package/schematics/ng-update/v4/steps/utils/remove-attrs.js +1 -1
  172. package/schematics/ng-update/v4/steps/utils/replace-modules-with-providers.d.ts +13 -0
  173. package/schematics/ng-update/v4/steps/utils/replace-modules-with-providers.js +47 -0
  174. package/schematics/ng-update/v4/steps/utils/replace-substrings.js +1 -1
  175. package/schematics/ng-update/v4/tests/migrate-destroy-service/utils.js +1 -0
  176. package/schematics/utils/add-unique-import.js +1 -1
  177. package/schematics/utils/angular-json-manipulations.js +4 -4
  178. package/schematics/utils/get-named-import-references.js +4 -4
  179. package/schematics/utils/get-standalone-bootstrap-function.js +2 -2
  180. package/schematics/utils/import-manipulations.js +1 -1
  181. package/schematics/utils/push-to-array-property.js +1 -1
  182. package/schematics/utils/templates/elements.js +16 -13
  183. package/schematics/utils/templates/get-component-templates.js +1 -1
  184. package/schematics/utils/templates/inputs.js +1 -1
  185. package/schematics/utils/templates/ng-component-input-manipulations.js +5 -5
  186. package/utils/color/get-gradient-data.d.ts +1 -0
  187. package/utils/color/index.d.ts +2 -0
  188. package/utils/color/parse-gradient.d.ts +10 -0
  189. package/utils/dom/get-element-point.d.ts +2 -0
  190. package/utils/dom/index.d.ts +1 -0
  191. package/utils/focus/focused-in.d.ts +2 -0
  192. package/utils/focus/index.d.ts +1 -0
@@ -10,6 +10,6 @@ exports.INPUTS_TO_REMOVE = [
10
10
  {
11
11
  inputName: 'iconAlign',
12
12
  tags: ['button', 'a'],
13
- filterFn: el => (0, elements_1.hasElementAttribute)(el, 'tuiLink'),
13
+ filterFn: (el) => (0, elements_1.hasElementAttribute)(el, 'tuiLink'),
14
14
  },
15
15
  ];
@@ -142,4 +142,9 @@ exports.MIGRATION_WARNINGS = [
142
142
  moduleSpecifier: '@taiga-ui/kit',
143
143
  message: 'TUI_INPUT_NUMBER_OPTIONS "precision" and "decimal" have been moved to TUI_FORMAT_NUMBER_OPTIONS. See https://taiga-ui.dev/components/input-number#options ',
144
144
  },
145
+ {
146
+ name: 'TUI_ARROW',
147
+ moduleSpecifier: '@taiga-ui/kit',
148
+ message: 'TUI_ARROW is deprecated, Use tuiChevron directive instead. See example https://taiga-ui.dev/components/data-list#links',
149
+ },
145
150
  ];
@@ -18,4 +18,12 @@ exports.MODULES_TO_REMOVE = [
18
18
  name: 'TuiOverscrollModule',
19
19
  moduleSpecifier: '@taiga-ui/cdk',
20
20
  },
21
+ {
22
+ name: 'TuiThemeNightModule',
23
+ moduleSpecifier: '@taiga-ui/core',
24
+ },
25
+ {
26
+ name: 'TuiModeModule',
27
+ moduleSpecifier: '@taiga-ui/core',
28
+ },
21
29
  ];
@@ -0,0 +1,12 @@
1
+ interface ModuleToReplace {
2
+ from: {
3
+ name: string;
4
+ moduleSpecifier: string;
5
+ };
6
+ to: {
7
+ name: string;
8
+ providerSpecifier: string;
9
+ };
10
+ }
11
+ export declare const MODULES_TO_REPLACE_WITH_PROVIDERS: ModuleToReplace[];
12
+ export {};
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MODULES_TO_REPLACE_WITH_PROVIDERS = void 0;
4
+ exports.MODULES_TO_REPLACE_WITH_PROVIDERS = [
5
+ {
6
+ from: {
7
+ name: 'TuiMobileCalendarDialogModule',
8
+ moduleSpecifier: '@taiga-ui/addon-mobile',
9
+ },
10
+ to: {
11
+ name: 'tuiProvideMobileCalendar',
12
+ providerSpecifier: '@taiga-ui/addon-mobile',
13
+ },
14
+ },
15
+ ];
@@ -8,13 +8,13 @@ exports.TAGS_TO_REPLACE = [
8
8
  from: 'tui-input-count',
9
9
  to: 'tui-input-number',
10
10
  addAttributes: ['decimal="never"'],
11
- filterFn: element => element.attrs.some(attr => attr.name === '[step]'),
11
+ filterFn: (element) => element.attrs.some((attr) => attr.name === '[step]'),
12
12
  },
13
13
  {
14
14
  from: 'tui-input-count',
15
15
  to: 'tui-input-number',
16
16
  addAttributes: ['decimal="never"', '[step]="1"'],
17
- filterFn: element => element.attrs.every(attr => attr.name !== '[step]'),
17
+ filterFn: (element) => element.attrs.every((attr) => attr.name !== '[step]'),
18
18
  },
19
19
  {
20
20
  from: 'tui-money',
@@ -33,12 +33,12 @@ exports.TAGS_TO_REPLACE = [
33
33
  {
34
34
  from: 'tui-hosted-dropdown',
35
35
  to: 'div',
36
- filterFn: el => el.attrs.some(attr => attr.name === '[open]' || attr.name === '[(open)]'),
36
+ filterFn: (el) => el.attrs.some((attr) => attr.name === '[open]' || attr.name === '[(open)]'),
37
37
  },
38
38
  {
39
39
  from: 'tui-hosted-dropdown',
40
40
  to: 'div',
41
- filterFn: el => el.attrs.every(attr => attr.name !== '[open]' && attr.name !== '[(open)]'),
41
+ filterFn: (el) => el.attrs.every((attr) => attr.name !== '[open]' && attr.name !== '[(open)]'),
42
42
  addAttributes: ['tuiDropdownOpen'],
43
43
  },
44
44
  {
@@ -50,4 +50,5 @@ exports.TAGS_TO_REPLACE = [
50
50
  from: 'tui-marker-icon',
51
51
  to: 'tui-avatar',
52
52
  },
53
+ { from: 'tui-input-card-grouped', to: 'tui-input-card-group' },
53
54
  ];
@@ -8,4 +8,10 @@ exports.TYPES_TO_RENAME = [
8
8
  moduleSpecifier: ['@taiga-ui/addon-doc'],
9
9
  removeImport: true,
10
10
  },
11
+ {
12
+ from: 'TuiBrightness',
13
+ to: "'onDark' | 'onLight'",
14
+ moduleSpecifier: ['@taiga-ui/core'],
15
+ removeImport: true,
16
+ },
11
17
  ];
@@ -1,6 +1,10 @@
1
1
  export * from './migrate-all-country-iso-codes';
2
2
  export * from './migrate-destroy-service';
3
3
  export * from './migrate-legacy-mask';
4
+ export * from './migrate-option-providers';
5
+ export * from './migrate-proprietary';
6
+ export * from './migrate-styles';
4
7
  export * from './migrate-templates';
5
8
  export * from './restore-tui-mapper';
6
9
  export * from './restore-tui-matcher';
10
+ export * from './update-packages';
@@ -4,6 +4,10 @@ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./migrate-all-country-iso-codes"), exports);
5
5
  tslib_1.__exportStar(require("./migrate-destroy-service"), exports);
6
6
  tslib_1.__exportStar(require("./migrate-legacy-mask"), exports);
7
+ tslib_1.__exportStar(require("./migrate-option-providers"), exports);
8
+ tslib_1.__exportStar(require("./migrate-proprietary"), exports);
9
+ tslib_1.__exportStar(require("./migrate-styles"), exports);
7
10
  tslib_1.__exportStar(require("./migrate-templates"), exports);
8
11
  tslib_1.__exportStar(require("./restore-tui-mapper"), exports);
9
12
  tslib_1.__exportStar(require("./restore-tui-matcher"), exports);
13
+ tslib_1.__exportStar(require("./update-packages"), exports);
@@ -9,7 +9,7 @@ function migrateAllCountryIsoCodes(options) {
9
9
  !options['skip-logs'] &&
10
10
  (0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating Object.values(TuiCountryIsoCode)...`);
11
11
  const references = (0, get_named_import_references_1.getNamedImportReferences)('TuiCountryIsoCode', '@taiga-ui/i18n');
12
- references.forEach(ref => {
12
+ references.forEach((ref) => {
13
13
  if (ref.wasForgotten()) {
14
14
  return;
15
15
  }
@@ -12,7 +12,7 @@ function migrateDestroyService(options) {
12
12
  (0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating TuiDestroyService => takeUntilDestroyed ...`);
13
13
  const references = (0, get_named_import_references_1.getNamedImportReferences)('TuiDestroyService', '@taiga-ui/cdk');
14
14
  const nodesForComments = [];
15
- references.forEach(ref => {
15
+ references.forEach((ref) => {
16
16
  var _a;
17
17
  if (ref.wasForgotten()) {
18
18
  return;
@@ -30,7 +30,7 @@ function migrateDestroyService(options) {
30
30
  // providers: [TuiDestroyService]
31
31
  const index = parent
32
32
  .getElements()
33
- .findIndex(el => el.getText() === 'TuiDestroyService');
33
+ .findIndex((el) => el.getText() === 'TuiDestroyService');
34
34
  parent.removeElement(index);
35
35
  }
36
36
  else if (ng_morph_1.Node.isTypeReference(parent)) {
@@ -67,7 +67,7 @@ function migrateDestroyService(options) {
67
67
  else {
68
68
  nodesForComments.push(ref);
69
69
  }
70
- destroyObservableUsages.forEach(node => {
70
+ destroyObservableUsages.forEach((node) => {
71
71
  const possibleTakeUntil = findTakeUntil(node);
72
72
  if (!possibleTakeUntil) {
73
73
  return;
@@ -103,7 +103,7 @@ function migrateDestroyService(options) {
103
103
  * ---
104
104
  * @see https://ts-morph.com/manipulation/#strongwarningstrong
105
105
  */
106
- nodesForComments.forEach(ref => {
106
+ nodesForComments.forEach((ref) => {
107
107
  if (ref.wasForgotten()) {
108
108
  return;
109
109
  }
@@ -117,6 +117,9 @@ function migrateDestroyService(options) {
117
117
  }
118
118
  exports.migrateDestroyService = migrateDestroyService;
119
119
  function findTakeUntil(node, maxDepth = 10) {
120
+ if (node.wasForgotten()) {
121
+ return null;
122
+ }
120
123
  if (ng_morph_1.Node.isCallExpression(node) && node.getText().includes('takeUntil(')) {
121
124
  return node;
122
125
  }
@@ -18,7 +18,7 @@ function migrateTuiMaskedMoneyValueIsEmpty(options) {
18
18
  !options['skip-logs'] &&
19
19
  (0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} tuiMaskedMoneyValueIsEmpty`);
20
20
  const references = (0, get_named_import_references_1.getNamedImportReferences)('tuiMaskedMoneyValueIsEmpty', '@taiga-ui/core');
21
- references.forEach(ref => {
21
+ references.forEach((ref) => {
22
22
  if (ref.wasForgotten()) {
23
23
  return;
24
24
  }
@@ -37,7 +37,7 @@ function migrateTuiMaskedNumberStringToNumber(options) {
37
37
  !options['skip-logs'] &&
38
38
  (0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} tuiMaskedNumberStringToNumber`);
39
39
  const references = (0, get_named_import_references_1.getNamedImportReferences)('tuiMaskedNumberStringToNumber', '@taiga-ui/core');
40
- references.forEach(ref => {
40
+ references.forEach((ref) => {
41
41
  if (ref.wasForgotten()) {
42
42
  return;
43
43
  }
@@ -19,7 +19,7 @@ function migrateInputNumberOptions(options) {
19
19
  ...(0, get_named_import_references_1.getNamedImportReferences)('tuiInputNumberOptionsProvider', '@taiga-ui/kit'),
20
20
  ...(0, get_named_import_references_1.getNamedImportReferences)('tuiInputNumberOptionsProvider', '@taiga-ui/legacy'),
21
21
  ];
22
- references.forEach(ref => {
22
+ references.forEach((ref) => {
23
23
  if (ref.wasForgotten()) {
24
24
  return;
25
25
  }
@@ -33,7 +33,7 @@ function migrateInputNumberOptions(options) {
33
33
  const decimal = value.getProperty('decimal');
34
34
  [precision, decimal]
35
35
  .filter((property) => !!property)
36
- .forEach(property => property.remove());
36
+ .forEach((property) => property.remove());
37
37
  if (precision || decimal) {
38
38
  (0, insert_todo_1.insertTodo)(parent, '"precision" and "decimal" options have been moved to FormatNumberOptions. See https://taiga-ui.dev/components/input-number#options');
39
39
  }
@@ -24,7 +24,7 @@ function migrateProprietary(fileSystem, options) {
24
24
  exports.migrateProprietary = migrateProprietary;
25
25
  function replaceScopePackages() {
26
26
  var _a;
27
- (_a = (0, ng_morph_1.getActiveProject)()) === null || _a === void 0 ? void 0 : _a.getSourceFiles('**/**.{ts,less,scss}').forEach(sourceFile => {
27
+ (_a = (0, ng_morph_1.getActiveProject)()) === null || _a === void 0 ? void 0 : _a.getSourceFiles('**/**.{ts,less,scss}').forEach((sourceFile) => {
28
28
  let fullText = sourceFile.getFullText();
29
29
  fullText = fullText
30
30
  .replaceAll('@taiga-ui/proprietary-core', '@taiga-ui/proprietary')
@@ -38,7 +38,7 @@ function replaceScopePackages() {
38
38
  }
39
39
  function replaceProprietaryIconPath() {
40
40
  var _a;
41
- (_a = (0, ng_morph_1.getActiveProject)()) === null || _a === void 0 ? void 0 : _a.getSourceFiles('**/{angular,project}.json').forEach(sourceFile => {
41
+ (_a = (0, ng_morph_1.getActiveProject)()) === null || _a === void 0 ? void 0 : _a.getSourceFiles('**/{angular,project}.json').forEach((sourceFile) => {
42
42
  let fullText = sourceFile.getFullText();
43
43
  fullText = fullText
44
44
  .replaceAll('node_modules/@taiga-ui/proprietary-icons/src', '@taiga-ui/proprietary/design-tokens/icons/src')
@@ -56,7 +56,7 @@ function removeProprietaryPackages(fileSystem) {
56
56
  '@taiga-ui/proprietary-icons',
57
57
  '@taiga-ui/proprietary-tds-icons',
58
58
  '@taiga-ui/proprietary-tds-palette',
59
- ].forEach(name => (0, ng_morph_1.removePackageJsonDependency)(fileSystem.tree, name));
59
+ ].forEach((name) => (0, ng_morph_1.removePackageJsonDependency)(fileSystem.tree, name));
60
60
  (0, ng_morph_1.addPackageJsonDependency)(fileSystem.tree, {
61
61
  name: '@taiga-ui/proprietary',
62
62
  version: version_1.TUI_VERSION,
@@ -6,7 +6,7 @@ const ng_morph_1 = require("ng-morph");
6
6
  exports.TUI_RATING_WARNING = '// TODO: (Taiga UI migration): use css to customize rating gap and size. See https://taiga-ui.dev/components/rating#basic';
7
7
  function migrateStyles() {
8
8
  var _a;
9
- (_a = (0, ng_morph_1.getActiveProject)()) === null || _a === void 0 ? void 0 : _a.getSourceFiles('**/**.{less,sass,scss,css}').forEach(sourceFile => {
9
+ (_a = (0, ng_morph_1.getActiveProject)()) === null || _a === void 0 ? void 0 : _a.getSourceFiles('**/**.{less,sass,scss,css}').forEach((sourceFile) => {
10
10
  let fullText = sourceFile.getFullText();
11
11
  fullText = fullText
12
12
  // eslint-disable-next-line
@@ -46,7 +46,7 @@ function migrateTemplates(fileSystem, options) {
46
46
  const progressLog = (0, progress_1.setupProgressLogger)({
47
47
  total: componentWithTemplatesPaths.length,
48
48
  });
49
- componentWithTemplatesPaths.forEach(resource => {
49
+ componentWithTemplatesPaths.forEach((resource) => {
50
50
  const path = fileSystem.resolve((0, template_resource_1.getPathFromTemplateResource)(resource));
51
51
  const recorder = fileSystem.edit(path);
52
52
  actions.forEach((action, actionIndex) => {
@@ -3,8 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.migrateAvatar = void 0;
4
4
  const add_import_to_closest_module_1 = require("../../../../utils/add-import-to-closest-module");
5
5
  const elements_1 = require("../../../../utils/templates/elements");
6
+ const inputs_1 = require("../../../../utils/templates/inputs");
6
7
  const template_resource_1 = require("../../../../utils/templates/template-resource");
7
8
  const remove_attrs_1 = require("../utils/remove-attrs");
9
+ const common_1 = require("./toggles/common");
10
+ const sizeMap = {
11
+ xxs: 'xs',
12
+ xs: 's',
13
+ s: 'm',
14
+ m: 'l',
15
+ l: 'xl',
16
+ xl: 'xxl',
17
+ xxl: 'xxl',
18
+ };
8
19
  function addModules(componentPath, modules) {
9
20
  modules.forEach(({ moduleName, moduleSpecifier }) => {
10
21
  (0, add_import_to_closest_module_1.addImportToClosestModule)(componentPath, moduleName, moduleSpecifier);
@@ -22,13 +33,20 @@ function normalizeAttrValue(attrName, attrValue) {
22
33
  function migrateAvatar({ resource, recorder, fileSystem, }) {
23
34
  const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
24
35
  const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
25
- const elements = (0, elements_1.findElementsByTagName)(template, 'tui-avatar');
26
- elements.forEach(({ attrs, sourceCodeLocation }) => {
36
+ const avatarElements = (0, elements_1.findElementsByTagName)(template, 'tui-avatar');
37
+ const markerIconElements = (0, elements_1.findElementsByTagName)(template, 'tui-marker-icon');
38
+ [...avatarElements, ...markerIconElements].forEach(({ attrs, sourceCodeLocation }) => {
39
+ if (!sourceCodeLocation) {
40
+ return;
41
+ }
42
+ (0, common_1.replaceSizeAttr)(attrs, sourceCodeLocation, recorder, templateOffset, sizeMap);
43
+ });
44
+ avatarElements.forEach(({ attrs, sourceCodeLocation }) => {
27
45
  var _a, _b;
28
- const avatarUrlAttr = attrs.find(attr => attr.name === '[avatarurl]' || attr.name === 'avatarurl');
29
- const fallbackAttr = attrs.find(attr => attr.name === '[fallback]' || attr.name === 'fallback');
30
- const textAttr = attrs.find(attr => attr.name === '[text]' || attr.name === 'text');
31
- const roundedAttr = attrs.find(attr => attr.name === '[rounded]' || attr.name === 'rounded');
46
+ const avatarUrlAttr = (0, inputs_1.findAttr)(attrs, 'avatarurl');
47
+ const fallbackAttr = (0, inputs_1.findAttr)(attrs, 'fallback');
48
+ const textAttr = (0, inputs_1.findAttr)(attrs, 'text');
49
+ const roundedAttr = (0, inputs_1.findAttr)(attrs, 'rounded');
32
50
  if ((!avatarUrlAttr && !textAttr) || !sourceCodeLocation) {
33
51
  return;
34
52
  }
@@ -11,13 +11,13 @@ function migrateBadge({ resource, recorder, fileSystem, }) {
11
11
  if (!sourceCodeLocation) {
12
12
  return;
13
13
  }
14
- const valueAttr = attrs.find(attr => attr.name === '[value]' || attr.name === 'value');
14
+ const valueAttr = attrs.find((attr) => attr.name === '[value]' || attr.name === 'value');
15
15
  // migration for icon-only badges
16
16
  if (!valueAttr) {
17
17
  addTodo(recorder, sourceCodeLocation, templateOffset);
18
18
  return;
19
19
  }
20
- const svg = childNodes === null || childNodes === void 0 ? void 0 : childNodes.find(node => node.nodeName === 'tui-svg');
20
+ const svg = childNodes === null || childNodes === void 0 ? void 0 : childNodes.find((node) => node.nodeName === 'tui-svg');
21
21
  if (svg) {
22
22
  migrateIcon({ svg, sourceCodeLocation, recorder, templateOffset });
23
23
  }
@@ -32,13 +32,13 @@ function migrateBadge({ resource, recorder, fileSystem, }) {
32
32
  exports.migrateBadge = migrateBadge;
33
33
  function migrateIcon({ svg, sourceCodeLocation, recorder, templateOffset, }) {
34
34
  var _a, _b, _c, _d, _e;
35
- const src = (_a = svg.attrs) === null || _a === void 0 ? void 0 : _a.find(attr => attr.name === 'src');
35
+ const src = (_a = svg.attrs) === null || _a === void 0 ? void 0 : _a.find((attr) => attr.name === 'src');
36
36
  const srcValue = src === null || src === void 0 ? void 0 : src.value;
37
37
  if (!srcValue) {
38
38
  return;
39
39
  }
40
40
  const insertTo = templateOffset + (((_b = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.startTag) === null || _b === void 0 ? void 0 : _b.endOffset) || 0) - 1;
41
- recorder.insertRight(insertTo, `${(src === null || src === void 0 ? void 0 : src.name) === 'src' ? 'iconLeft' : '[iconLeft]'}="${srcValue}"`);
41
+ recorder.insertRight(insertTo, `${(src === null || src === void 0 ? void 0 : src.name) === 'src' ? 'iconStart' : '[iconStart]'}="${srcValue}"`);
42
42
  recorder.remove(((_c = svg.sourceCodeLocation) === null || _c === void 0 ? void 0 : _c.startOffset) || 0, (((_d = svg.sourceCodeLocation) === null || _d === void 0 ? void 0 : _d.endOffset) || 0) -
43
43
  (((_e = svg.sourceCodeLocation) === null || _e === void 0 ? void 0 : _e.startOffset) || 0));
44
44
  }
@@ -9,7 +9,7 @@ function migrateExpandable({ resource, recorder, fileSystem, }) {
9
9
  const elements = (0, elements_1.findElementsWithAttributeOnTag)(template, ['[expandable]'], ['tui-input-tag', 'tui-multi-select', 'tui-input-date']);
10
10
  elements.forEach(({ attrs, sourceCodeLocation }) => {
11
11
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
12
- const expandableAttr = attrs.find(attr => attr.name === '[expandable]');
12
+ const expandableAttr = attrs.find((attr) => attr.name === '[expandable]');
13
13
  if (!expandableAttr) {
14
14
  return;
15
15
  }
@@ -17,7 +17,7 @@ function migrateExpandable({ resource, recorder, fileSystem, }) {
17
17
  const expandableStart = (_c = (_b = (_a = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[expandableAttr.name]) === null || _b === void 0 ? void 0 : _b.startOffset) !== null && _c !== void 0 ? _c : 0;
18
18
  const expandableEnd = (_f = (_e = (_d = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.attrs) === null || _d === void 0 ? void 0 : _d[expandableAttr.name]) === null || _e === void 0 ? void 0 : _e.endOffset) !== null && _f !== void 0 ? _f : 0;
19
19
  if (expandableValue === 'false') {
20
- const rowsAttr = attrs.find(attr => attr.name === '[rows]');
20
+ const rowsAttr = attrs.find((attr) => attr.name === '[rows]');
21
21
  const insertTo = ((_h = (_g = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.startTag) === null || _g === void 0 ? void 0 : _g.endOffset) !== null && _h !== void 0 ? _h : 0) - 1;
22
22
  recorder.insertRight(templateOffset + insertTo, rowsAttr ? '' : '[rows]="1"');
23
23
  }
@@ -13,7 +13,7 @@ function migrateFocusable({ resource, recorder, fileSystem, }) {
13
13
  if (!sourceCodeLocation) {
14
14
  return;
15
15
  }
16
- const focusableAttr = attrs.find(attr => attr.name === LEGACY_ATTRIBUTE_NAME);
16
+ const focusableAttr = attrs.find((attr) => attr.name === LEGACY_ATTRIBUTE_NAME);
17
17
  const attributeLocation = (_a = sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[LEGACY_ATTRIBUTE_NAME];
18
18
  if (!focusableAttr || !attributeLocation) {
19
19
  return;
@@ -32,9 +32,7 @@ function migrateLabeled({ resource, recorder, fileSystem, }) {
32
32
  if (!sourceCodeLocation) {
33
33
  return;
34
34
  }
35
- (0, add_import_to_closest_module_1.addImportToClosestModule)(resource.componentPath, tagName === 'tui-checkbox-labeled'
36
- ? 'TuiCheckboxComponent'
37
- : 'TuiRadioComponent', '@taiga-ui/kit');
35
+ (0, add_import_to_closest_module_1.addImportToClosestModule)(resource.componentPath, tagName === 'tui-checkbox-labeled' ? 'TuiCheckbox' : 'TuiRadio', '@taiga-ui/kit');
38
36
  recorder.insertRight(templateOffset + ((_b = (_a = sourceCodeLocation.startTag) === null || _a === void 0 ? void 0 : _a.startOffset) !== null && _b !== void 0 ? _b : 1) - 1, '<label tuiLabel>');
39
37
  recorder.insertRight(templateOffset + ((_d = (_c = sourceCodeLocation.endTag) === null || _c === void 0 ? void 0 : _c.startOffset) !== null && _d !== void 0 ? _d : 1) - 1, '\n</label>');
40
38
  recorder.remove(templateOffset + ((_f = (_e = sourceCodeLocation.endTag) === null || _e === void 0 ? void 0 : _e.startOffset) !== null && _f !== void 0 ? _f : 0), tagName === 'tui-checkbox-labeled'
@@ -33,7 +33,7 @@ function migrateMoney({ resource, recorder, fileSystem, }) {
33
33
  if (decimalAttr || precisionAttr) {
34
34
  (0, add_import_to_closest_module_1.addImportToClosestModule)(resource.componentPath, 'TuiNumberFormat', '@taiga-ui/core');
35
35
  const format = JSON.stringify((0, clean_object_1.cleanObject)({
36
- decimal: decimalAttr === null || decimalAttr === void 0 ? void 0 : decimalAttr.value,
36
+ decimalMode: decimalAttr === null || decimalAttr === void 0 ? void 0 : decimalAttr.value,
37
37
  precision: precisionAttr === null || precisionAttr === void 0 ? void 0 : precisionAttr.value,
38
38
  }));
39
39
  const formatPart = `[tuiNumberFormat]='${format}'`;
@@ -11,7 +11,7 @@ function migrateThumbnailCard({ resource, recorder, fileSystem, }) {
11
11
  if (!sourceCodeLocation) {
12
12
  return;
13
13
  }
14
- const valueAttr = attrs.find(attr => attr.name === '[cardnumber]' || attr.name === 'cardnumber');
14
+ const valueAttr = attrs.find((attr) => attr.name === '[cardnumber]' || attr.name === 'cardnumber');
15
15
  if (!valueAttr) {
16
16
  return;
17
17
  }
@@ -5,6 +5,6 @@ export declare function replaceOpenTag(sourceCodeLocation: ElementLocation, reco
5
5
  directive: string;
6
6
  type: string;
7
7
  }): void;
8
- export declare function replaceSizeAttr(attrs: Attribute[], sourceCodeLocation: ElementLocation, recorder: UpdateRecorder, templateOffset: number): void;
8
+ export declare function replaceSizeAttr(attrs: Attribute[], sourceCodeLocation: ElementLocation, recorder: UpdateRecorder, templateOffset: number, map?: Record<string, string>): void;
9
9
  export declare function removeClosingTag(sourceCodeLocation: ElementLocation, recorder: UpdateRecorder, templateOffset: number): void;
10
10
  export declare function closeStartTag({ startTag, endTag }: ElementLocation, recorder: UpdateRecorder, templateOffset: number): void;
@@ -15,16 +15,16 @@ function replaceOpenTag(sourceCodeLocation, recorder, templateOffset, { tag, dir
15
15
  recorder.insertRight(templateOffset + startTag.startOffset, `<input\n${spaces}${directive}\n${spaces}type="${type}"`);
16
16
  }
17
17
  exports.replaceOpenTag = replaceOpenTag;
18
- function replaceSizeAttr(attrs, sourceCodeLocation, recorder, templateOffset) {
18
+ function replaceSizeAttr(attrs, sourceCodeLocation, recorder, templateOffset, map = sizeMap) {
19
19
  var _a;
20
- const sizeAttr = attrs.find(attr => attr.name === 'size');
20
+ const sizeAttr = attrs.find((attr) => attr.name === 'size');
21
21
  if (sizeAttr) {
22
22
  const { startOffset, endOffset } = ((_a = sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[sizeAttr.name]) || {
23
23
  startOffset: 0,
24
24
  endOffset: 0,
25
25
  };
26
26
  recorder.remove(templateOffset + startOffset, endOffset - startOffset);
27
- recorder.insertRight(templateOffset + startOffset, `size="${sizeMap[sizeAttr.value] || sizeAttr.value}"`);
27
+ recorder.insertRight(templateOffset + startOffset, `size="${map[sizeAttr.value] || sizeAttr.value}"`);
28
28
  }
29
29
  }
30
30
  exports.replaceSizeAttr = replaceSizeAttr;
@@ -0,0 +1,4 @@
1
+ /// <reference lib="es2021" />
2
+ import type { DevkitFileSystem } from 'ng-morph';
3
+ import type { TuiSchema } from '../../../ng-add/schema';
4
+ export declare function updatePackages({ tree }: DevkitFileSystem, _: TuiSchema): void;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updatePackages = void 0;
4
+ const ng_morph_1 = require("ng-morph");
5
+ const version_1 = require("../../../../constants/version");
6
+ const steps_1 = require("../../steps");
7
+ function updatePackages({ tree }, _) {
8
+ const packagesToRemove = ['@taiga-ui/addon-tablebars', '@taiga-ui/addon-preview'];
9
+ packagesToRemove.forEach((pkg) => {
10
+ (0, ng_morph_1.removePackageJsonDependency)(tree, pkg);
11
+ });
12
+ (0, ng_morph_1.addPackageJsonDependency)(tree, {
13
+ name: '@taiga-ui/legacy',
14
+ version: version_1.TUI_VERSION,
15
+ });
16
+ (0, steps_1.replacePackageName)('@tinkoff/ng-polymorpheus', {
17
+ name: '@taiga-ui/polymorpheus',
18
+ version: '^4.6.4',
19
+ }, tree);
20
+ (0, steps_1.replacePackageName)('@tinkoff/ng-event-plugins', {
21
+ name: '@taiga-ui/event-plugins',
22
+ version: '^4.0.1',
23
+ }, tree);
24
+ (0, steps_1.replacePackageName)('@tinkoff/tui-editor', {
25
+ name: '@taiga-ui/editor',
26
+ version: '^2.0.0',
27
+ }, tree);
28
+ }
29
+ exports.updatePackages = updatePackages;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.removeAttrs = void 0;
4
4
  function removeAttrs(attrs, sourceCodeLocation, recorder, templateOffset) {
5
- attrs.forEach(attr => {
5
+ attrs.forEach((attr) => {
6
6
  var _a;
7
7
  const attrOffset = (_a = sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[attr.name];
8
8
  if (attrOffset) {
@@ -0,0 +1,13 @@
1
+ import type { TuiSchema } from '../../../../ng-add/schema';
2
+ interface ModuleToReplace {
3
+ from: {
4
+ name: string;
5
+ moduleSpecifier: string;
6
+ };
7
+ to: {
8
+ name: string;
9
+ providerSpecifier: string;
10
+ };
11
+ }
12
+ export declare const replaceModulesWithProviders: (options: TuiSchema, list: ModuleToReplace[]) => void;
13
+ export {};
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.replaceModulesWithProviders = void 0;
4
+ const ng_morph_1 = require("ng-morph");
5
+ const add_unique_import_1 = require("../../../../utils/add-unique-import");
6
+ const colored_log_1 = require("../../../../utils/colored-log");
7
+ const get_named_import_references_1 = require("../../../../utils/get-named-import-references");
8
+ const import_manipulations_1 = require("../../../../utils/import-manipulations");
9
+ const replaceModulesWithProviders = (options, list) => {
10
+ !options['skip-logs'] &&
11
+ (0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} replacing modules with providers...`);
12
+ list.forEach(replaceModule);
13
+ !options['skip-logs'] &&
14
+ (0, colored_log_1.successLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} modules replaced \n`);
15
+ };
16
+ exports.replaceModulesWithProviders = replaceModulesWithProviders;
17
+ function replaceModule({ from, to }) {
18
+ const references = (0, get_named_import_references_1.getNamedImportReferences)(from.name, from.moduleSpecifier);
19
+ references.forEach((ref) => {
20
+ if (ref.wasForgotten()) {
21
+ return;
22
+ }
23
+ const parent = ref.getParent();
24
+ if (ng_morph_1.Node.isImportSpecifier(parent)) {
25
+ (0, import_manipulations_1.removeImport)(parent);
26
+ addImport(to, parent.getSourceFile().getFilePath());
27
+ }
28
+ else if (ng_morph_1.Node.isArrayLiteralExpression(parent)) {
29
+ parent.removeElement(ref.getChildIndex());
30
+ addProvider(to, parent.getSourceFile().getFilePath());
31
+ }
32
+ });
33
+ }
34
+ function addImport(identifier, filePath) {
35
+ (0, add_unique_import_1.addUniqueImport)(filePath, identifier.name, identifier.providerSpecifier);
36
+ }
37
+ function addProvider(identifier, filePath) {
38
+ const provider = `${identifier.name}()`;
39
+ const componentClass = (0, ng_morph_1.getNgComponents)(filePath)[0];
40
+ if (componentClass) {
41
+ (0, ng_morph_1.addProviderToComponent)(componentClass, provider);
42
+ }
43
+ const moduleClass = (0, ng_morph_1.getNgModules)(filePath)[0];
44
+ if (moduleClass) {
45
+ (0, ng_morph_1.addProviderToNgModule)(moduleClass, provider);
46
+ }
47
+ }
@@ -9,7 +9,7 @@ function replaceSubstring(text, replacement) {
9
9
  function replaceSubstrings(text, replacements) {
10
10
  let transformed = text;
11
11
  let acc = 0;
12
- replacements.forEach(replacement => {
12
+ replacements.forEach((replacement) => {
13
13
  replacement.start += acc;
14
14
  transformed = replaceSubstring(transformed, replacement);
15
15
  acc += replacement.to.length - replacement.from.length;
@@ -13,6 +13,7 @@ function runMigration(before) {
13
13
  const runner = new testing_1.SchematicTestRunner('schematics', collectionPath);
14
14
  (0, ng_morph_1.setActiveProject)((0, ng_morph_1.createProject)(host));
15
15
  (0, ng_morph_1.createSourceFile)('test/app/test.component.ts', before);
16
+ (0, ng_morph_1.createSourceFile)('package.json', '{}');
16
17
  (0, ng_morph_1.saveActiveProject)();
17
18
  const tree = yield runner.runSchematic('updateToV4', { 'skip-logs': process.env['TUI_CI'] === 'true' }, host);
18
19
  return tree.readContent('test/app/test.component.ts');
@@ -16,7 +16,7 @@ function addUniqueImport(filePath, namedImport, moduleSpecifier) {
16
16
  if (existingDeclaration.length) {
17
17
  const modules = existingDeclaration[0]
18
18
  .getNamedImports()
19
- .map(namedImport => namedImport.getText());
19
+ .map((namedImport) => namedImport.getText());
20
20
  (0, ng_morph_1.editImports)(existingDeclaration[0], () => ({
21
21
  namedImports: [...modules, namedImport],
22
22
  }));
@@ -10,7 +10,7 @@ const versions_1 = require("../ng-add/constants/versions");
10
10
  const get_project_target_options_1 = require("./get-project-target-options");
11
11
  const get_projects_1 = require("./get-projects");
12
12
  function hasTaigaIcons(assets) {
13
- return !!(assets === null || assets === void 0 ? void 0 : assets.find(asset => {
13
+ return !!(assets === null || assets === void 0 ? void 0 : assets.find((asset) => {
14
14
  var _a;
15
15
  return (0, is_string_1.tuiIsString)(asset)
16
16
  ? asset.includes('taiga-ui')
@@ -33,7 +33,7 @@ function isInvalidAngularJson(tree) {
33
33
  exports.isInvalidAngularJson = isInvalidAngularJson;
34
34
  function addStylesToAngularJson(options, context, taigaStyles, filter, stylesToReplace, tree) {
35
35
  const MANUAL_MIGRATION_TIPS = `Add styles ${taigaStyles.join(',')} to angular.json manually.`;
36
- return (0, workspace_1.updateWorkspace)(workspace => {
36
+ return (0, workspace_1.updateWorkspace)((workspace) => {
37
37
  const projects = (0, get_projects_1.getProjects)(options, workspace);
38
38
  if (!projects.length) {
39
39
  context.logger.warn(`[WARNING]: Target project not found. ${MANUAL_MIGRATION_TIPS}`);
@@ -59,11 +59,11 @@ function addStylesToAngularJson(options, context, taigaStyles, filter, stylesToR
59
59
  targetOptions.styles = taigaStyles;
60
60
  }
61
61
  if (stylesToReplace &&
62
- (styles === null || styles === void 0 ? void 0 : styles.filter(style => style !== stylesToReplace.from))) {
62
+ (styles === null || styles === void 0 ? void 0 : styles.filter((style) => style !== stylesToReplace.from))) {
63
63
  targetOptions.styles = Array.from(new Set([
64
64
  ...taigaStyles,
65
65
  ...stylesToReplace.to,
66
- ...styles.filter(style => style !== stylesToReplace.from),
66
+ ...styles.filter((style) => style !== stylesToReplace.from),
67
67
  ]));
68
68
  }
69
69
  else {