@taiga-ui/cdk 4.0.0-rc.7 → 4.0.0-rc.9

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 (145) hide show
  1. package/constants/used-icons.d.ts +1 -1
  2. package/constants/version.d.ts +1 -1
  3. package/constants/version.js +1 -1
  4. package/esm2022/constants/used-icons.mjs +9 -1
  5. package/esm2022/constants/version.mjs +2 -2
  6. package/esm2022/services/index.mjs +2 -2
  7. package/esm2022/services/theme-color.service.mjs +30 -0
  8. package/fesm2022/taiga-ui-cdk-constants.mjs +9 -1
  9. package/fesm2022/taiga-ui-cdk-constants.mjs.map +1 -1
  10. package/fesm2022/taiga-ui-cdk-services.mjs +19 -22
  11. package/fesm2022/taiga-ui-cdk-services.mjs.map +1 -1
  12. package/package.json +5 -6
  13. package/schematics/ng-update/interfaces/html-comment.d.ts +3 -2
  14. package/schematics/ng-update/interfaces/replacement-attribute-value.d.ts +6 -2
  15. package/schematics/ng-update/interfaces/replacement-identifier.d.ts +4 -11
  16. package/schematics/ng-update/steps/replace-identifier.js +16 -12
  17. package/schematics/ng-update/utils/templates/replace-attr-values.js +39 -10
  18. package/schematics/ng-update/utils/templates/template-comments.js +7 -1
  19. package/schematics/ng-update/v4/index.js +3 -0
  20. package/schematics/ng-update/v4/migrate-icons/index.js +2 -2
  21. package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.d.ts +2 -1
  22. package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.js +19 -6
  23. package/schematics/ng-update/v4/steps/constants/attr-with-values-to-replace.js +42 -2
  24. package/schematics/ng-update/v4/steps/constants/attrs-to-replace.js +34 -3
  25. package/schematics/ng-update/v4/steps/constants/html-comments.js +9 -0
  26. package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.js +243 -220
  27. package/schematics/ng-update/v4/steps/constants/inputs-to-remove.js +1 -0
  28. package/schematics/ng-update/v4/steps/constants/migration-warnings.js +20 -0
  29. package/schematics/ng-update/v4/steps/constants/modules-to-remove.js +8 -0
  30. package/schematics/ng-update/v4/steps/constants/tags-to-replace.js +3 -2
  31. package/schematics/ng-update/v4/steps/constants/types.js +29 -0
  32. package/schematics/ng-update/v4/steps/index.d.ts +4 -1
  33. package/schematics/ng-update/v4/steps/index.js +4 -1
  34. package/schematics/ng-update/v4/steps/migrate-alert-service.d.ts +2 -0
  35. package/schematics/ng-update/v4/steps/migrate-alert-service.js +110 -0
  36. package/schematics/ng-update/v4/steps/migrate-month-context.d.ts +2 -0
  37. package/schematics/ng-update/v4/steps/migrate-month-context.js +39 -0
  38. package/schematics/ng-update/v4/steps/migrate-number-format-settings.d.ts +2 -0
  39. package/schematics/ng-update/v4/steps/migrate-number-format-settings.js +64 -0
  40. package/schematics/ng-update/v4/steps/migrate-templates.js +5 -0
  41. package/schematics/ng-update/v4/steps/{migrate-styles.js → styles/index.js} +13 -1
  42. package/schematics/ng-update/v4/steps/styles/migrate-less-scss-constants.d.ts +1 -0
  43. package/schematics/ng-update/v4/steps/styles/migrate-less-scss-constants.js +13 -0
  44. package/schematics/ng-update/v4/steps/styles/migrate-scrollbar-behavior.d.ts +1 -0
  45. package/schematics/ng-update/v4/steps/styles/migrate-scrollbar-behavior.js +10 -0
  46. package/schematics/ng-update/v4/steps/styles/migrate-shadow-mixins.d.ts +1 -0
  47. package/schematics/ng-update/v4/steps/styles/migrate-shadow-mixins.js +23 -0
  48. package/schematics/ng-update/v4/steps/styles/migrate-space-mixins.d.ts +1 -0
  49. package/schematics/ng-update/v4/steps/styles/migrate-space-mixins.js +20 -0
  50. package/schematics/ng-update/v4/steps/styles/migrate-text-mixins.d.ts +1 -0
  51. package/schematics/ng-update/v4/steps/styles/migrate-text-mixins.js +54 -0
  52. package/schematics/ng-update/v4/steps/templates/index.d.ts +3 -0
  53. package/schematics/ng-update/v4/steps/templates/index.js +3 -0
  54. package/schematics/ng-update/v4/steps/templates/migrate-avatar.js +10 -5
  55. package/schematics/ng-update/{v3/steps/migrate-polymorpheus.d.ts → v4/steps/templates/migrate-axes.d.ts} +2 -2
  56. package/schematics/ng-update/v4/steps/templates/migrate-axes.js +26 -0
  57. package/schematics/ng-update/v4/steps/templates/migrate-badge.js +7 -6
  58. package/schematics/ng-update/v4/steps/templates/migrate-badged-content.js +1 -1
  59. package/schematics/ng-update/v4/steps/templates/migrate-blocked.js +2 -1
  60. package/schematics/ng-update/v4/steps/templates/migrate-expandable.js +3 -2
  61. package/schematics/ng-update/v4/steps/templates/migrate-focusable.js +7 -4
  62. package/schematics/ng-update/v4/steps/templates/migrate-labeled.js +1 -1
  63. package/schematics/ng-update/{v3/steps/migrate-textfield-controller.d.ts → v4/steps/templates/migrate-mobile-tabs.d.ts} +2 -2
  64. package/schematics/ng-update/v4/steps/templates/migrate-mobile-tabs.js +45 -0
  65. package/schematics/ng-update/v4/steps/templates/migrate-notification.d.ts +8 -0
  66. package/schematics/ng-update/v4/steps/templates/migrate-notification.js +64 -0
  67. package/schematics/ng-update/v4/steps/templates/migrate-number-precision.d.ts +8 -0
  68. package/schematics/ng-update/v4/steps/templates/migrate-number-precision.js +36 -0
  69. package/schematics/ng-update/v4/steps/templates/migrate-overscroll.js +4 -6
  70. package/schematics/ng-update/v4/steps/templates/migrate-thumbnail-card.js +2 -1
  71. package/schematics/ng-update/v4/steps/templates/toggles/common.js +3 -2
  72. package/schematics/ng-update/v4/steps/templates/toggles/migrate-checkbox.js +2 -1
  73. package/schematics/ng-update/v4/steps/update-packages.js +13 -4
  74. package/schematics/utils/templates/elements.js +2 -1
  75. package/schematics/utils/templates/inputs.js +2 -1
  76. package/services/index.d.ts +1 -1
  77. package/services/theme-color.service.d.ts +16 -0
  78. package/esm2022/services/static-request.service.mjs +0 -33
  79. package/schematics/ng-update/v3/constants/breakpoints.d.ts +0 -82
  80. package/schematics/ng-update/v3/constants/breakpoints.js +0 -34
  81. package/schematics/ng-update/v3/constants/constants.d.ts +0 -2
  82. package/schematics/ng-update/v3/constants/constants.js +0 -466
  83. package/schematics/ng-update/v3/constants/deprecated-functions.d.ts +0 -2
  84. package/schematics/ng-update/v3/constants/deprecated-functions.js +0 -680
  85. package/schematics/ng-update/v3/constants/enums.d.ts +0 -2
  86. package/schematics/ng-update/v3/constants/enums.js +0 -284
  87. package/schematics/ng-update/v3/constants/modules.d.ts +0 -2
  88. package/schematics/ng-update/v3/constants/modules.js +0 -9
  89. package/schematics/ng-update/v3/constants/services.d.ts +0 -2
  90. package/schematics/ng-update/v3/constants/services.js +0 -53
  91. package/schematics/ng-update/v3/constants/templates.d.ts +0 -57
  92. package/schematics/ng-update/v3/constants/templates.js +0 -744
  93. package/schematics/ng-update/v3/constants/tui-interactive-selectors.d.ts +0 -1
  94. package/schematics/ng-update/v3/constants/tui-interactive-selectors.js +0 -55
  95. package/schematics/ng-update/v3/constants/types.d.ts +0 -2
  96. package/schematics/ng-update/v3/constants/types.js +0 -156
  97. package/schematics/ng-update/v3/constants/warnings.d.ts +0 -2
  98. package/schematics/ng-update/v3/constants/warnings.js +0 -111
  99. package/schematics/ng-update/v3/index.d.ts +0 -3
  100. package/schematics/ng-update/v3/index.js +0 -105
  101. package/schematics/ng-update/v3/schema.json +0 -13
  102. package/schematics/ng-update/v3/steps/migrate-date-time.d.ts +0 -2
  103. package/schematics/ng-update/v3/steps/migrate-date-time.js +0 -207
  104. package/schematics/ng-update/v3/steps/migrate-polymorpheus.js +0 -78
  105. package/schematics/ng-update/v3/steps/migrate-progress.d.ts +0 -8
  106. package/schematics/ng-update/v3/steps/migrate-progress.js +0 -49
  107. package/schematics/ng-update/v3/steps/migrate-sliders/index.d.ts +0 -3
  108. package/schematics/ng-update/v3/steps/migrate-sliders/index.js +0 -19
  109. package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-range.d.ts +0 -3
  110. package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-range.js +0 -103
  111. package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-slider.d.ts +0 -3
  112. package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-slider.js +0 -90
  113. package/schematics/ng-update/v3/steps/migrate-taiga-proprietary-icons.d.ts +0 -3
  114. package/schematics/ng-update/v3/steps/migrate-taiga-proprietary-icons.js +0 -70
  115. package/schematics/ng-update/v3/steps/migrate-templates.d.ts +0 -4
  116. package/schematics/ng-update/v3/steps/migrate-templates.js +0 -216
  117. package/schematics/ng-update/v3/steps/migrate-textfield-controller.js +0 -98
  118. package/schematics/ng-update/v3/steps/miscellaneous.d.ts +0 -2
  119. package/schematics/ng-update/v3/steps/miscellaneous.js +0 -81
  120. package/schematics/ng-update/v3/steps/replace-functions.d.ts +0 -2
  121. package/schematics/ng-update/v3/steps/replace-functions.js +0 -138
  122. package/schematics/ng-update/v3/steps/replace-styles.d.ts +0 -3
  123. package/schematics/ng-update/v3/steps/replace-styles.js +0 -33
  124. package/schematics/ng-update/v3-30/constants/constants.d.ts +0 -2
  125. package/schematics/ng-update/v3-30/constants/constants.js +0 -8
  126. package/schematics/ng-update/v3-30/constants/icons.d.ts +0 -4
  127. package/schematics/ng-update/v3-30/constants/icons.js +0 -993
  128. package/schematics/ng-update/v3-30/index.d.ts +0 -3
  129. package/schematics/ng-update/v3-30/index.js +0 -33
  130. package/schematics/ng-update/v3-35/constants/constants.d.ts +0 -2
  131. package/schematics/ng-update/v3-35/constants/constants.js +0 -8
  132. package/schematics/ng-update/v3-35/constants/icons.d.ts +0 -4
  133. package/schematics/ng-update/v3-35/constants/icons.js +0 -2537
  134. package/schematics/ng-update/v3-35/index.d.ts +0 -3
  135. package/schematics/ng-update/v3-35/index.js +0 -33
  136. package/schematics/ng-update/v3-36/index.d.ts +0 -3
  137. package/schematics/ng-update/v3-36/index.js +0 -23
  138. package/schematics/ng-update/v3-40/index.d.ts +0 -3
  139. package/schematics/ng-update/v3-40/index.js +0 -62
  140. package/schematics/ng-update/v3-5/index.d.ts +0 -3
  141. package/schematics/ng-update/v3-5/index.js +0 -20
  142. package/schematics/ng-update/v3-5/steps/migrate-expand-templates.d.ts +0 -3
  143. package/schematics/ng-update/v3-5/steps/migrate-expand-templates.js +0 -44
  144. package/services/static-request.service.d.ts +0 -8
  145. /package/schematics/ng-update/v4/steps/{migrate-styles.d.ts → styles/index.d.ts} +0 -0
@@ -7,6 +7,7 @@ exports.INPUTS_TO_REMOVE = [
7
7
  { inputName: 'showLoader', tags: ['tui-toggle'] },
8
8
  { inputName: 'singleColor', tags: ['tui-toggle'] },
9
9
  { inputName: 'hoverable', tags: ['tui-badge'] },
10
+ { inputName: 'singleColor', tags: ['tui-money'] },
10
11
  {
11
12
  inputName: 'iconAlign',
12
13
  tags: ['button', 'a'],
@@ -147,4 +147,24 @@ exports.MIGRATION_WARNINGS = [
147
147
  moduleSpecifier: '@taiga-ui/kit',
148
148
  message: 'TUI_ARROW is deprecated, Use tuiChevron directive instead. See example https://taiga-ui.dev/components/data-list#links',
149
149
  },
150
+ {
151
+ name: 'TuiMoneyComponent',
152
+ moduleSpecifier: '@taiga-ui/addon-commerce',
153
+ message: 'TuiMoneyComponent is deprecated, Use tuiAmount pipe instead. See example https://taiga-ui.dev/pipes/amount',
154
+ },
155
+ {
156
+ name: 'TuiIllustrationsModule',
157
+ moduleSpecifier: '@taiga-ui/proprietary-icons',
158
+ message: 'TuiIllustrationsModule was deleted. Import TuiIconPipe and use <img [src]="icon | tuiIcon" /> instead. See https://taiga-ui.tcsbank.ru/icons',
159
+ },
160
+ {
161
+ name: 'TuiIllustrationsPipe',
162
+ moduleSpecifier: '@taiga-ui/proprietary-icons',
163
+ message: 'TuiIllustrationsPipe was deleted. Import TuiIconPipe and use <img [src]="icon | tuiIcon" /> instead. See https://taiga-ui.tcsbank.ru/icons',
164
+ },
165
+ {
166
+ name: 'TuiIllustrationModePipe',
167
+ moduleSpecifier: '@taiga-ui/proprietary-icons',
168
+ message: 'TuiIllustrationModePipe was deleted. Import TuiIconPipe and use <img [src]="icon | tuiIcon" /> instead. See https://taiga-ui.tcsbank.ru/icons',
169
+ },
150
170
  ];
@@ -18,6 +18,10 @@ exports.MODULES_TO_REMOVE = [
18
18
  name: 'TuiPromptDialogModule',
19
19
  moduleSpecifier: '@taiga-ui/proprietary-core',
20
20
  },
21
+ {
22
+ name: 'TuiPromptModule',
23
+ moduleSpecifier: '@taiga-ui/kit',
24
+ },
21
25
  {
22
26
  name: 'TuiThemeTinkoff2023NightModule',
23
27
  moduleSpecifier: '@taiga-ui/proprietary-core',
@@ -38,4 +42,8 @@ exports.MODULES_TO_REMOVE = [
38
42
  name: 'TuiIconsModule',
39
43
  moduleSpecifier: '@taiga-ui/experimental',
40
44
  },
45
+ {
46
+ name: 'TuiMobileTabsModule',
47
+ moduleSpecifier: '@taiga-ui/addon-mobile',
48
+ },
41
49
  ];
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TAGS_TO_REPLACE = void 0;
4
+ const elements_1 = require("../../../../utils/templates/elements");
4
5
  exports.TAGS_TO_REPLACE = [
5
6
  { from: 'tui-card', to: 'tui-thumbnail-card' },
6
7
  { from: 'tui-text-area', to: 'tui-textarea' },
@@ -9,13 +10,13 @@ exports.TAGS_TO_REPLACE = [
9
10
  from: 'tui-input-count',
10
11
  to: 'tui-input-number',
11
12
  addAttributes: ['decimal="never"'],
12
- filterFn: (element) => element.attrs.some((attr) => attr.name === '[step]'),
13
+ filterFn: (element) => (0, elements_1.hasElementAttribute)(element, 'step'),
13
14
  },
14
15
  {
15
16
  from: 'tui-input-count',
16
17
  to: 'tui-input-number',
17
18
  addAttributes: ['decimal="never"', '[step]="1"'],
18
- filterFn: (element) => element.attrs.every((attr) => attr.name !== '[step]'),
19
+ filterFn: (element) => !(0, elements_1.hasElementAttribute)(element, 'step'),
19
20
  },
20
21
  {
21
22
  from: 'tui-money',
@@ -17,4 +17,33 @@ exports.TYPES_TO_RENAME = [
17
17
  moduleSpecifier: ['@taiga-ui/core'],
18
18
  removeImport: true,
19
19
  },
20
+ {
21
+ from: 'TuiIllustrationName',
22
+ moduleSpecifier: ['@taiga-ui/proprietary-icons'],
23
+ to: 'string',
24
+ removeImport: true,
25
+ },
26
+ {
27
+ from: 'TuiIllustrationCategory',
28
+ moduleSpecifier: ['@taiga-ui/proprietary-icons'],
29
+ to: 'string',
30
+ removeImport: true,
31
+ },
32
+ {
33
+ from: 'TuiNotificationT',
34
+ moduleSpecifier: ['@taiga-ui/core'],
35
+ to: 'string',
36
+ removeImport: true,
37
+ },
38
+ {
39
+ from: 'TuiMarkerIconMode',
40
+ moduleSpecifier: ['@taiga-ui/kit'],
41
+ to: 'string',
42
+ removeImport: true,
43
+ },
44
+ {
45
+ from: 'TuiOperationIcon',
46
+ moduleSpecifier: ['@taiga-ui/proprietary-banking'],
47
+ to: 'TuiFeedItemIcon',
48
+ },
20
49
  ];
@@ -1,10 +1,13 @@
1
+ export * from './migrate-alert-service';
1
2
  export * from './migrate-all-country-iso-codes';
2
3
  export * from './migrate-destroy-service';
3
4
  export * from './migrate-legacy-mask';
5
+ export * from './migrate-month-context';
6
+ export * from './migrate-number-format-settings';
4
7
  export * from './migrate-option-providers';
5
8
  export * from './migrate-proprietary';
6
- export * from './migrate-styles';
7
9
  export * from './migrate-templates';
8
10
  export * from './restore-tui-mapper';
9
11
  export * from './restore-tui-matcher';
12
+ export * from './styles';
10
13
  export * from './update-packages';
@@ -1,13 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./migrate-alert-service"), exports);
4
5
  tslib_1.__exportStar(require("./migrate-all-country-iso-codes"), exports);
5
6
  tslib_1.__exportStar(require("./migrate-destroy-service"), exports);
6
7
  tslib_1.__exportStar(require("./migrate-legacy-mask"), exports);
8
+ tslib_1.__exportStar(require("./migrate-month-context"), exports);
9
+ tslib_1.__exportStar(require("./migrate-number-format-settings"), exports);
7
10
  tslib_1.__exportStar(require("./migrate-option-providers"), exports);
8
11
  tslib_1.__exportStar(require("./migrate-proprietary"), exports);
9
- tslib_1.__exportStar(require("./migrate-styles"), exports);
10
12
  tslib_1.__exportStar(require("./migrate-templates"), exports);
11
13
  tslib_1.__exportStar(require("./restore-tui-mapper"), exports);
12
14
  tslib_1.__exportStar(require("./restore-tui-matcher"), exports);
15
+ tslib_1.__exportStar(require("./styles"), exports);
13
16
  tslib_1.__exportStar(require("./update-packages"), exports);
@@ -0,0 +1,2 @@
1
+ import type { TuiSchema } from '../../../ng-add/schema';
2
+ export declare function migrateAlertService(options: TuiSchema): void;
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrateAlertService = void 0;
4
+ const ng_morph_1 = require("ng-morph");
5
+ const colored_log_1 = require("../../../utils/colored-log");
6
+ const get_named_import_references_1 = require("../../../utils/get-named-import-references");
7
+ const OPTIONS_MIGRATIONS = {
8
+ autoClose: (property) => {
9
+ const [propertyKey, propertyValue] = property.getText().split(/\s?:\s?/);
10
+ switch (propertyValue) {
11
+ case 'true':
12
+ return property.replaceWithText(`${propertyKey}: 3_000`);
13
+ case 'false':
14
+ return property.replaceWithText(`${propertyKey}: 0`);
15
+ default:
16
+ return null;
17
+ }
18
+ },
19
+ defaultAutoCloseTime: (property) => property.replaceWithText(property.getText().replace('defaultAutoCloseTime', 'autoClose')),
20
+ status: (property) => property.replaceWithText(property.getText().replace('status', 'appearance')),
21
+ hasCloseButton: (property) => property.replaceWithText(property.getText().replace('hasCloseButton', 'closeable')),
22
+ hasIcon: (property) => {
23
+ const [, propertyValue] = property.getText().split(/\s?:\s?/);
24
+ switch (propertyValue) {
25
+ case 'false':
26
+ return property.replaceWithText("icon: ''");
27
+ case 'true':
28
+ return property.remove();
29
+ default:
30
+ return property.replaceWithText(`// TODO: (Taiga UI migration) "hasIcon" is deleted. Use "icon: ''" to hide icon. Use "icon: TUI_NOTIFICATION_DEFAULT_OPTIONS['icon']" to show it.\n${property.getText()}`);
31
+ }
32
+ },
33
+ };
34
+ function migrateAlertService(options) {
35
+ !options['skip-logs'] &&
36
+ (0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} replacing inject(TuiAlertService).open({autoClose: boolean})...`);
37
+ const alertServiceRefs = (0, get_named_import_references_1.getNamedImportReferences)('TuiAlertService', '@taiga-ui/core');
38
+ // inject(TuiAlertService).open(...)
39
+ const viaDirectInjects = alertServiceRefs.map((x) => x.getFirstAncestor((node) => node.isKind(ng_morph_1.SyntaxKind.CallExpression) &&
40
+ node.getFullText().includes('inject(TuiAlertService') &&
41
+ node.getFullText().includes('.open')));
42
+ // readonly alertService = inject(TuiAlertService);
43
+ const viaClassProperty = alertServiceRefs
44
+ .map((x) => {
45
+ var _a;
46
+ return (_a = x
47
+ .getFirstAncestorByKind(ng_morph_1.SyntaxKind.PropertyDeclaration)) === null || _a === void 0 ? void 0 : _a.findReferencesAsNodes();
48
+ })
49
+ .flat()
50
+ .map(toAlertServiceOpenCallExpression);
51
+ // constructor(private readonly legacyWayService: TuiAlertService) {}
52
+ const viaConstructorParam = alertServiceRefs
53
+ .map((x) => { var _a; return (_a = x.getFirstAncestorByKind(ng_morph_1.SyntaxKind.Parameter)) === null || _a === void 0 ? void 0 : _a.findReferencesAsNodes(); })
54
+ .flat()
55
+ .map(toAlertServiceOpenCallExpression);
56
+ const inlineAlertOptions = [
57
+ ...viaDirectInjects,
58
+ ...viaClassProperty,
59
+ ...viaConstructorParam,
60
+ ]
61
+ .map((callExpression) => {
62
+ if (!callExpression || callExpression.wasForgotten()) {
63
+ return;
64
+ }
65
+ const [, arg] = callExpression.getArguments();
66
+ return (arg === null || arg === void 0 ? void 0 : arg.isKind(ng_morph_1.SyntaxKind.PropertyAccessExpression))
67
+ ? findOptionsInitializer(arg)
68
+ : arg;
69
+ })
70
+ .filter(ng_morph_1.Node.isObjectLiteralExpression);
71
+ const standaloneAlertOptions = (0, get_named_import_references_1.getNamedImportReferences)('TuiAlertOptions', '@taiga-ui/core')
72
+ .map((n) => {
73
+ const type = n.getFirstAncestorByKind(ng_morph_1.SyntaxKind.TypeReference);
74
+ const siblings = [
75
+ ...((type === null || type === void 0 ? void 0 : type.getPreviousSiblings()) || []),
76
+ ...((type === null || type === void 0 ? void 0 : type.getNextSiblings()) || []),
77
+ ];
78
+ return siblings.find(ng_morph_1.Node.isObjectLiteralExpression);
79
+ })
80
+ .filter((x) => !!x);
81
+ [...inlineAlertOptions, ...standaloneAlertOptions].forEach((options) => {
82
+ Object.entries(OPTIONS_MIGRATIONS).forEach(([propertyName, migration]) => {
83
+ const property = options.getProperty(propertyName);
84
+ if (!property) {
85
+ return;
86
+ }
87
+ const isShorthandPropertyAssignment = ng_morph_1.Node.isShorthandPropertyAssignment(property) &&
88
+ !property.hasObjectAssignmentInitializer();
89
+ const previousPropertyText = property.getText();
90
+ migration(property);
91
+ if (isShorthandPropertyAssignment && !property.wasForgotten()) {
92
+ property.replaceWithText(`${property.getText()}: ${previousPropertyText}`);
93
+ }
94
+ });
95
+ });
96
+ !options['skip-logs'] &&
97
+ (0, colored_log_1.successLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} "true => 3_000" & "false => 0" were replaced \n`);
98
+ }
99
+ exports.migrateAlertService = migrateAlertService;
100
+ function toAlertServiceOpenCallExpression(node) {
101
+ return node === null || node === void 0 ? void 0 : node.getFirstAncestor((x) => x.isKind(ng_morph_1.SyntaxKind.CallExpression) && x.getFullText().includes('.open'));
102
+ }
103
+ function findOptionsInitializer(ref) {
104
+ var _a;
105
+ return (_a = ref === null || ref === void 0 ? void 0 : ref.getFirstChildByKind(ng_morph_1.SyntaxKind.Identifier)) === null || _a === void 0 ? void 0 : _a.findReferencesAsNodes().map((n) => {
106
+ var _a;
107
+ return (_a = n
108
+ .getFirstAncestorByKind(ng_morph_1.SyntaxKind.PropertyDeclaration)) === null || _a === void 0 ? void 0 : _a.getFirstChildByKind(ng_morph_1.SyntaxKind.ObjectLiteralExpression);
109
+ }).find(Boolean);
110
+ }
@@ -0,0 +1,2 @@
1
+ import type { TuiSchema } from '../../../ng-add/schema';
2
+ export declare function migrateMonthContext(options: TuiSchema): void;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrateMonthContext = 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
+ function migrateMonthContext(options) {
10
+ !options['skip-logs'] &&
11
+ (0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating TuiBooleanHandlerWithContext<TuiMonth, TuiMonthContext> ...`);
12
+ const monthContextRefs = (0, get_named_import_references_1.getNamedImportReferences)('TuiMonthContext', '@taiga-ui/kit');
13
+ monthContextRefs
14
+ .map((n) => n.getFirstAncestorByKind(ng_morph_1.SyntaxKind.TypeReference))
15
+ .forEach((ref) => {
16
+ if (!ref || ref.wasForgotten()) {
17
+ return;
18
+ }
19
+ const booleanHandlerWithContext = ref.getFirstAncestor((node) => node.isKind(ng_morph_1.SyntaxKind.TypeReference) &&
20
+ !!node
21
+ .getText()
22
+ .match(/TuiBooleanHandlerWithContext<\s*TuiMonth\s*,\s*TuiMonthContext\s*>/));
23
+ if (!booleanHandlerWithContext) {
24
+ return;
25
+ }
26
+ booleanHandlerWithContext.replaceWithText('TuiBooleanHandler<TuiMonth>');
27
+ (0, add_unique_import_1.addUniqueImport)(booleanHandlerWithContext.getSourceFile().getFilePath(), 'TuiBooleanHandler', '@taiga-ui/cdk');
28
+ });
29
+ [
30
+ ...monthContextRefs,
31
+ ...(0, get_named_import_references_1.getNamedImportReferences)('TuiBooleanHandlerWithContext', '@taiga-ui/kit'),
32
+ ]
33
+ .map((node) => !node.wasForgotten() &&
34
+ node.getFirstAncestorByKind(ng_morph_1.SyntaxKind.ImportSpecifier))
35
+ .filter((x) => !!x)
36
+ .forEach(import_manipulations_1.removeImport);
37
+ !options['skip-logs'] && (0, colored_log_1.titleLog)(`${colored_log_1.FINISH_SYMBOL} successfully migrated \n`);
38
+ }
39
+ exports.migrateMonthContext = migrateMonthContext;
@@ -0,0 +1,2 @@
1
+ import type { TuiSchema } from '../../../ng-add/schema';
2
+ export declare function migrateNumberFormatSettings(options: TuiSchema): void;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrateNumberFormatSettings = void 0;
4
+ const ng_morph_1 = require("ng-morph");
5
+ const colored_log_1 = require("../../../utils/colored-log");
6
+ const get_named_import_references_1 = require("../../../utils/get-named-import-references");
7
+ const OPTIONS_MIGRATIONS = {
8
+ decimalLimit: (property) => property.replaceWithText(property.getText().replace('decimalLimit', 'precision')),
9
+ decimal: (property) => {
10
+ const [, propertyValue] = property.getText().split(/\s?:\s?/);
11
+ property.replaceWithText(propertyValue.match(/^['"`]never['"`]$/)
12
+ ? 'precision: 0'
13
+ : property.getText().replace('decimal', 'decimalMode'));
14
+ },
15
+ zeroPadding: (property) => {
16
+ const [, propertyValue] = property.getText().split(/\s?:\s?/);
17
+ if (propertyValue === 'true') {
18
+ property.replaceWithText('decimalMode: "always"');
19
+ }
20
+ else {
21
+ property.replaceWithText(`// TODO: (Taiga UI migration) "zeroPadding" is deleted. Use "decimalMode" instead https://taiga-ui.dev/pipes/format-number/API \n${property.getText()}`);
22
+ }
23
+ },
24
+ };
25
+ function migrateNumberFormatSettings(options) {
26
+ !options['skip-logs'] &&
27
+ (0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating TuiNumberFormatSettings...`);
28
+ const asFunctionArgument = [
29
+ ...(0, get_named_import_references_1.getNamedImportReferences)('tuiFormatNumber', '@taiga-ui/core'),
30
+ ...(0, get_named_import_references_1.getNamedImportReferences)('tuiNumberFormatProvider', '@taiga-ui/core'),
31
+ ].map((n) => {
32
+ var _a;
33
+ return (_a = n
34
+ .getFirstAncestorByKind(ng_morph_1.SyntaxKind.CallExpression)) === null || _a === void 0 ? void 0 : _a.getFirstDescendantByKind(ng_morph_1.SyntaxKind.ObjectLiteralExpression);
35
+ });
36
+ const asStandaloneSettingsObject = (0, get_named_import_references_1.getNamedImportReferences)('TuiNumberFormatSettings', '@taiga-ui/core').map((n) => {
37
+ const type = n.getFirstAncestorByKind(ng_morph_1.SyntaxKind.TypeReference);
38
+ const siblings = [
39
+ ...((type === null || type === void 0 ? void 0 : type.getPreviousSiblings()) || []),
40
+ ...((type === null || type === void 0 ? void 0 : type.getNextSiblings()) || []),
41
+ ];
42
+ return siblings.find(ng_morph_1.Node.isObjectLiteralExpression);
43
+ });
44
+ [...asFunctionArgument, ...asStandaloneSettingsObject]
45
+ .filter(ng_morph_1.Node.isObjectLiteralExpression)
46
+ .forEach((options) => {
47
+ Object.entries(OPTIONS_MIGRATIONS).forEach(([propertyName, migration]) => {
48
+ const property = options.getProperty(propertyName);
49
+ if (!property) {
50
+ return;
51
+ }
52
+ const isShorthandPropertyAssignment = ng_morph_1.Node.isShorthandPropertyAssignment(property) &&
53
+ !property.hasObjectAssignmentInitializer();
54
+ const previousPropertyText = property.getText();
55
+ migration(property);
56
+ if (isShorthandPropertyAssignment && !property.wasForgotten()) {
57
+ property.replaceWithText(`${property.getText()}: ${previousPropertyText}`);
58
+ }
59
+ });
60
+ });
61
+ !options['skip-logs'] &&
62
+ (0, colored_log_1.successLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} migration of TuiNumberFormatSettings completes \n`);
63
+ }
64
+ exports.migrateNumberFormatSettings = migrateNumberFormatSettings;
@@ -11,6 +11,7 @@ const replace_attrs_by_directives_1 = require("../../utils/templates/replace-att
11
11
  const constants_2 = require("./constants");
12
12
  const templates_2 = require("./templates");
13
13
  const migrate_blocked_1 = require("./templates/migrate-blocked");
14
+ const migrate_number_precision_1 = require("./templates/migrate-number-precision");
14
15
  function getAction({ action, requiredData, }) {
15
16
  return ({ resource, fileSystem, recorder, }) => action({ resource, fileSystem, recorder, data: requiredData });
16
17
  }
@@ -28,6 +29,7 @@ function migrateTemplates(fileSystem, options) {
28
29
  getAction({ action: templates_1.replaceAttrs, requiredData: constants_2.ATTRS_TO_REPLACE }),
29
30
  getAction({ action: templates_1.replaceAttrValues, requiredData: constants_2.ATTR_WITH_VALUES_TO_REPLACE }),
30
31
  getAction({ action: templates_1.removeInputs, requiredData: constants_2.INPUTS_TO_REMOVE }),
32
+ templates_2.migrateAxes,
31
33
  templates_2.migrateBadge,
32
34
  templates_2.migrateCheckbox,
33
35
  templates_2.migrateFocusable,
@@ -37,6 +39,7 @@ function migrateTemplates(fileSystem, options) {
37
39
  templates_2.migrateExpandable,
38
40
  templates_2.migrateBadgedContent,
39
41
  templates_2.migratePreventDefault,
42
+ templates_2.migrateMobileTabs,
40
43
  templates_2.migrateMoney,
41
44
  templates_2.migrateLabeled,
42
45
  migrate_blocked_1.migrateBlocked,
@@ -45,6 +48,8 @@ function migrateTemplates(fileSystem, options) {
45
48
  templates_2.migrateOverscroll,
46
49
  templates_2.migrateButtonAppearance,
47
50
  templates_2.migrateLabel,
51
+ migrate_number_precision_1.migrateNumberPrecision,
52
+ templates_2.migrateNotification,
48
53
  ];
49
54
  const progressLog = (0, progress_1.setupProgressLogger)({
50
55
  total: componentWithTemplatesPaths.length,
@@ -3,6 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.migrateStyles = exports.TUI_RATING_WARNING = void 0;
4
4
  /// <reference lib="es2021" />
5
5
  const ng_morph_1 = require("ng-morph");
6
+ const migrate_less_scss_constants_1 = require("./migrate-less-scss-constants");
7
+ const migrate_scrollbar_behavior_1 = require("./migrate-scrollbar-behavior");
8
+ const migrate_shadow_mixins_1 = require("./migrate-shadow-mixins");
9
+ const migrate_space_mixins_1 = require("./migrate-space-mixins");
10
+ const migrate_text_mixins_1 = require("./migrate-text-mixins");
6
11
  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
12
  function migrateStyles() {
8
13
  var _a;
@@ -19,7 +24,14 @@ function migrateStyles() {
19
24
  .replaceAll('@taiga-ui/proprietary-core/styles/theme-tinkoff-mobile-2023', '@taiga-ui/proprietary/styles/tbank-theme-mobile.less')
20
25
  .replaceAll('@taiga-ui/proprietary-core/styles/theme-tinkoff-mobile', '@taiga-ui/proprietary/styles/tbank-theme-mobile.less')
21
26
  .replaceAll('@taiga-ui/proprietary-core/styles/theme-tinkoff', '@taiga-ui/proprietary/styles/tbank-theme');
22
- sourceFile.replaceWithText(fullText);
27
+ const newFileContent = [
28
+ migrate_space_mixins_1.migrateSpaceMixins,
29
+ migrate_text_mixins_1.migrateTextMixins,
30
+ migrate_shadow_mixins_1.migrateShadowMixins,
31
+ migrate_less_scss_constants_1.migrateLessSCSSConstants,
32
+ migrate_scrollbar_behavior_1.migrateScrollbarBehavior,
33
+ ].reduce((text, migrate) => migrate(text), fullText);
34
+ sourceFile.replaceWithText(newFileContent);
23
35
  });
24
36
  (0, ng_morph_1.saveActiveProject)();
25
37
  }
@@ -0,0 +1 @@
1
+ export declare function migrateLessSCSSConstants(fileContent: string): string;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrateLessSCSSConstants = void 0;
4
+ const MAPPING = {
5
+ space: '0.25rem',
6
+ };
7
+ function migrateLessSCSSConstants(fileContent) {
8
+ if (!fileContent.includes('@taiga-ui/core/styles/taiga-ui-local')) {
9
+ return fileContent;
10
+ }
11
+ return fileContent.replaceAll(new RegExp(`[$|@](${Object.keys(MAPPING).join('|')})`, 'g'), (_, variable) => MAPPING[variable]);
12
+ }
13
+ exports.migrateLessSCSSConstants = migrateLessSCSSConstants;
@@ -0,0 +1 @@
1
+ export declare function migrateScrollbarBehavior(fileContent: string): string;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrateScrollbarBehavior = void 0;
4
+ function migrateScrollbarBehavior(fileContent) {
5
+ if (!fileContent.includes('@taiga-ui/core/styles/taiga-ui-local')) {
6
+ return fileContent;
7
+ }
8
+ return fileContent.replaceAll('.scroll-behavior()', 'scroll-behavior: var(--tui-scroll-behavior)');
9
+ }
10
+ exports.migrateScrollbarBehavior = migrateScrollbarBehavior;
@@ -0,0 +1 @@
1
+ export declare function migrateShadowMixins(fileContent: string): string;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrateShadowMixins = void 0;
4
+ const MAPPING = {
5
+ 'shadow()': 'var(--tui-shadow-small)',
6
+ 'shadow(1)': 'var(--tui-shadow-small)',
7
+ 'shadow(2)': 'var(--tui-shadow-medium)',
8
+ 'shadow(3)': 'var(--tui-shadow-popup)',
9
+ 'shadow(4)': 'var(--tui-shadow-medium)',
10
+ 'shadow(5)': 'var(--tui-shadow-small-hover)',
11
+ 'shadow(6)': 'var(--tui-shadow-small)',
12
+ 'shadow(7)': 'var(--tui-shadow-popup)',
13
+ };
14
+ // .shadow(2);
15
+ // @include shadow(2);
16
+ const MIXIN_RE = /(?:@include\s|\.)(shadow\(\d*\))(\s?!important)?;/g;
17
+ function migrateShadowMixins(fileContent) {
18
+ if (!fileContent.includes('@taiga-ui/core/styles/taiga-ui-local')) {
19
+ return fileContent;
20
+ }
21
+ return fileContent.replaceAll(MIXIN_RE, (_, mixin, important = '') => `box-shadow: ${MAPPING[mixin]}${important};`);
22
+ }
23
+ exports.migrateShadowMixins = migrateShadowMixins;
@@ -0,0 +1 @@
1
+ export declare function migrateSpaceMixins(fileContent: string): string;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrateSpaceMixins = void 0;
4
+ const DIRECTION_MAPPING = {
5
+ all: ['margin'],
6
+ top: ['margin-top'],
7
+ bottom: ['margin-bottom'],
8
+ left: ['margin-left'],
9
+ right: ['margin-right'],
10
+ vertical: ['margin-top', 'margin-bottom'],
11
+ horizontal: ['margin-left', 'margin-right'],
12
+ };
13
+ const SPACE = 0.25;
14
+ // .tui-space(top, 4);
15
+ // @include tui-space(top, 4);
16
+ const MIXIN_RE = new RegExp(`(?:@include\\s|\\.)tui-space\\((?<direction>${Object.keys(DIRECTION_MAPPING).join('|')}),\\s?(?<size>-?\\d+)\\)(\\s?!important)?;`, 'g');
17
+ function migrateSpaceMixins(fileContent) {
18
+ return fileContent.replaceAll(MIXIN_RE, (_, direction, size, important = '') => `${DIRECTION_MAPPING[direction].map((property) => `${property}: ${Number(size) * SPACE}rem${important};`).join('\n')}`);
19
+ }
20
+ exports.migrateSpaceMixins = migrateSpaceMixins;
@@ -0,0 +1 @@
1
+ export declare function migrateTextMixins(fileContent: string): string;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrateTextMixins = void 0;
4
+ const MAPPING = {
5
+ 'text-h1': ['font: var(--tui-font-heading-1)'],
6
+ 'text-h2': ['font: var(--tui-font-heading-2)'],
7
+ 'text-h3': ['font: var(--tui-font-heading-3)'],
8
+ 'text-h4': ['font: var(--tui-font-heading-4)'],
9
+ 'text-h5': ['font: var(--tui-font-heading-5)'],
10
+ 'text-h6': ['font: var(--tui-font-heading-6)'],
11
+ 'text-body-xl-bold': ['font: var(--tui-font-text-xl)', 'font-weight: bold'],
12
+ 'text-body-xl': ['font: var(--tui-font-text-xl)'],
13
+ 'text-body-xs': ['font: var(--tui-font-text-xs)'],
14
+ 'text-caption-l-bold': [
15
+ 'font-size: 0.8125rem',
16
+ 'font-weight: bold',
17
+ 'font-family: var(--tui-font-text)',
18
+ 'letter-spacing: 0.0625rem',
19
+ 'text-transform: uppercase',
20
+ ],
21
+ 'text-caption-l': [
22
+ 'font-size: 0.8125rem',
23
+ 'font-weight: normal',
24
+ 'font-family: var(--tui-font-text)',
25
+ 'letter-spacing: 0.0625rem',
26
+ 'text-transform: uppercase',
27
+ ],
28
+ 'text-caption-bold': [
29
+ 'font-size: 0.6875rem',
30
+ 'font-weight: bold',
31
+ 'font-family: var(--tui-font-text)',
32
+ 'letter-spacing: 0.0625rem',
33
+ 'text-transform: uppercase',
34
+ ],
35
+ 'text-caption': [
36
+ 'font-size: 0.6875rem',
37
+ 'font-weight: normal',
38
+ 'font-family: var(--tui-font-text)',
39
+ 'letter-spacing: 0.0625rem',
40
+ 'text-transform: uppercase',
41
+ ],
42
+ };
43
+ // .tui-text-h1();
44
+ // @include tui-text-h1();
45
+ const MIXIN_RE = /(?:@include\s|\.)(text-[\w-]+)\(([\w-,\s]+)?\)(\s?!important)?;/g;
46
+ function migrateTextMixins(fileContent) {
47
+ if (!fileContent.includes('@taiga-ui/core/styles/taiga-ui-local')) {
48
+ return fileContent;
49
+ }
50
+ return fileContent.replaceAll(MIXIN_RE, (originalString, mixinName, important = '') => MAPPING[mixinName]
51
+ ? `${MAPPING[mixinName].map((newValue) => `${newValue}${important};`).join('\n')}`
52
+ : `${originalString} // TODO: this mixin was deleted. Replace it with inline styles. Find it source code in https://github.com/taiga-family/taiga-ui/blob/v3.x/projects/core/styles/mixins/text.less`);
53
+ }
54
+ exports.migrateTextMixins = migrateTextMixins;
@@ -1,4 +1,5 @@
1
1
  export * from './migrate-avatar';
2
+ export * from './migrate-axes';
2
3
  export * from './migrate-badge';
3
4
  export * from './migrate-badged-content';
4
5
  export * from './migrate-button-appearance';
@@ -6,7 +7,9 @@ export * from './migrate-expandable';
6
7
  export * from './migrate-focusable';
7
8
  export * from './migrate-label';
8
9
  export * from './migrate-labeled';
10
+ export * from './migrate-mobile-tabs';
9
11
  export * from './migrate-money';
12
+ export * from './migrate-notification';
10
13
  export * from './migrate-overscroll';
11
14
  export * from './migrate-prevent-default';
12
15
  export * from './migrate-progress-segmented';
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./migrate-avatar"), exports);
5
+ tslib_1.__exportStar(require("./migrate-axes"), exports);
5
6
  tslib_1.__exportStar(require("./migrate-badge"), exports);
6
7
  tslib_1.__exportStar(require("./migrate-badged-content"), exports);
7
8
  tslib_1.__exportStar(require("./migrate-button-appearance"), exports);
@@ -9,7 +10,9 @@ tslib_1.__exportStar(require("./migrate-expandable"), exports);
9
10
  tslib_1.__exportStar(require("./migrate-focusable"), exports);
10
11
  tslib_1.__exportStar(require("./migrate-label"), exports);
11
12
  tslib_1.__exportStar(require("./migrate-labeled"), exports);
13
+ tslib_1.__exportStar(require("./migrate-mobile-tabs"), exports);
12
14
  tslib_1.__exportStar(require("./migrate-money"), exports);
15
+ tslib_1.__exportStar(require("./migrate-notification"), exports);
13
16
  tslib_1.__exportStar(require("./migrate-overscroll"), exports);
14
17
  tslib_1.__exportStar(require("./migrate-prevent-default"), exports);
15
18
  tslib_1.__exportStar(require("./migrate-progress-segmented"), exports);