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

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 (61) hide show
  1. package/classes/index.d.ts +0 -1
  2. package/constants/version.d.ts +1 -1
  3. package/constants/version.js +1 -1
  4. package/esm2022/classes/index.mjs +1 -2
  5. package/esm2022/constants/version.mjs +2 -2
  6. package/esm2022/directives/auto-focus/autofocus.options.mjs +3 -3
  7. package/esm2022/directives/copy-processor/copy-processor.directive.mjs +3 -3
  8. package/esm2022/directives/high-dpi/high-dpi.directive.mjs +3 -3
  9. package/esm2022/directives/obscured/obscured.service.mjs +3 -3
  10. package/esm2022/services/scroll.service.mjs +4 -4
  11. package/esm2022/tokens/active-element.mjs +3 -3
  12. package/esm2022/tokens/environment.mjs +15 -7
  13. package/esm2022/tokens/removed-element.mjs +3 -3
  14. package/esm2022/tokens/window-size.mjs +3 -3
  15. package/fesm2022/taiga-ui-cdk-classes.mjs +1 -15
  16. package/fesm2022/taiga-ui-cdk-classes.mjs.map +1 -1
  17. package/fesm2022/taiga-ui-cdk-constants.mjs +1 -1
  18. package/fesm2022/taiga-ui-cdk-constants.mjs.map +1 -1
  19. package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs +2 -2
  20. package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs.map +1 -1
  21. package/fesm2022/taiga-ui-cdk-directives-copy-processor.mjs +2 -2
  22. package/fesm2022/taiga-ui-cdk-directives-copy-processor.mjs.map +1 -1
  23. package/fesm2022/taiga-ui-cdk-directives-high-dpi.mjs +2 -2
  24. package/fesm2022/taiga-ui-cdk-directives-high-dpi.mjs.map +1 -1
  25. package/fesm2022/taiga-ui-cdk-directives-obscured.mjs +2 -2
  26. package/fesm2022/taiga-ui-cdk-directives-obscured.mjs.map +1 -1
  27. package/fesm2022/taiga-ui-cdk-services.mjs +3 -3
  28. package/fesm2022/taiga-ui-cdk-services.mjs.map +1 -1
  29. package/fesm2022/taiga-ui-cdk-tokens.mjs +19 -12
  30. package/fesm2022/taiga-ui-cdk-tokens.mjs.map +1 -1
  31. package/package.json +5 -5
  32. package/schematics/ng-update/interfaces/replacement-type.d.ts +4 -0
  33. package/schematics/ng-update/steps/rename-types.js +6 -2
  34. package/schematics/ng-update/steps/replace-identifier.js +9 -1
  35. package/schematics/ng-update/steps/replace-package-name.js +4 -5
  36. package/schematics/ng-update/v4/index.js +1 -0
  37. package/schematics/ng-update/v4/migrate-icons/rename-icons.js +5 -5
  38. package/schematics/ng-update/v4/steps/constants/attr-to-directive-replace.js +3 -2
  39. package/schematics/ng-update/v4/steps/constants/attr-with-values-to-replace.js +2 -1
  40. package/schematics/ng-update/v4/steps/constants/attrs-to-replace.js +53 -18
  41. package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.js +288 -25
  42. package/schematics/ng-update/v4/steps/constants/modules-to-remove.js +12 -0
  43. package/schematics/ng-update/v4/steps/constants/tags-to-replace.js +11 -0
  44. package/schematics/ng-update/v4/steps/constants/types.js +4 -1
  45. package/schematics/ng-update/v4/steps/migrate-styles.js +7 -1
  46. package/schematics/ng-update/v4/steps/migrate-templates.js +5 -2
  47. package/schematics/ng-update/v4/steps/templates/index.d.ts +3 -0
  48. package/schematics/ng-update/v4/steps/templates/index.js +3 -0
  49. package/schematics/ng-update/v4/steps/templates/migrate-badge.js +8 -0
  50. package/schematics/ng-update/v4/steps/templates/migrate-blocked.d.ts +8 -0
  51. package/schematics/ng-update/v4/steps/templates/migrate-blocked.js +34 -0
  52. package/schematics/ng-update/v4/steps/templates/migrate-button-appearance.d.ts +8 -0
  53. package/schematics/ng-update/v4/steps/templates/migrate-button-appearance.js +41 -0
  54. package/schematics/ng-update/v4/steps/templates/migrate-label.d.ts +8 -0
  55. package/schematics/ng-update/v4/steps/templates/migrate-label.js +39 -0
  56. package/schematics/ng-update/v4/steps/templates/migrate-labeled.js +2 -4
  57. package/schematics/ng-update/v4/steps/templates/toggles/migrate-checkbox.js +35 -0
  58. package/schematics/utils/get-named-import-references.js +4 -2
  59. package/tokens/environment.d.ts +1 -0
  60. package/classes/controller.d.ts +0 -9
  61. package/esm2022/classes/controller.mjs +0 -18
@@ -6,10 +6,18 @@ const add_unique_import_1 = require("../../utils/add-unique-import");
6
6
  const colored_log_1 = require("../../utils/colored-log");
7
7
  const get_named_import_references_1 = require("../../utils/get-named-import-references");
8
8
  const import_manipulations_1 = require("../../utils/import-manipulations");
9
+ const progress_1 = require("../../utils/progress");
9
10
  function replaceIdentifiers(options, constants) {
10
11
  !options['skip-logs'] &&
11
12
  (0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} replacing identifiers...`);
12
- constants.forEach(replaceIdentifier);
13
+ const progressLog = (0, progress_1.setupProgressLogger)({
14
+ total: constants.length,
15
+ });
16
+ constants.forEach((item, index) => {
17
+ replaceIdentifier(item);
18
+ const last = index === constants.length - 1;
19
+ !options['skip-logs'] && progressLog(item.from.name, last);
20
+ });
13
21
  !options['skip-logs'] &&
14
22
  (0, colored_log_1.successLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} identifiers replaced \n`);
15
23
  }
@@ -6,13 +6,12 @@ const constants_1 = require("../../constants");
6
6
  const get_file_system_1 = require("../utils/get-file-system");
7
7
  const replace_text_1 = require("../utils/replace-text");
8
8
  function replacePackageName(oldPackage, newPackage, tree) {
9
- if (!(0, ng_morph_1.getPackageJsonDependency)(tree, oldPackage)) {
10
- return;
11
- }
12
9
  const fileSystem = (0, get_file_system_1.getFileSystem)(tree);
13
10
  (0, replace_text_1.replaceText)([{ from: oldPackage, to: newPackage.name }], constants_1.ALL_TS_FILES);
14
- (0, ng_morph_1.removePackageJsonDependency)(tree, oldPackage);
15
- (0, ng_morph_1.addPackageJsonDependency)(tree, newPackage);
11
+ if ((0, ng_morph_1.getPackageJsonDependency)(tree, oldPackage)) {
12
+ (0, ng_morph_1.removePackageJsonDependency)(tree, oldPackage);
13
+ (0, ng_morph_1.addPackageJsonDependency)(tree, newPackage);
14
+ }
16
15
  fileSystem.commitEdits();
17
16
  (0, ng_morph_1.saveActiveProject)();
18
17
  }
@@ -34,6 +34,7 @@ function main(options) {
34
34
  (0, steps_2.migrateDestroyService)(options);
35
35
  (0, steps_2.migrateOptionProviders)(options);
36
36
  (0, steps_2.migrateAllCountryIsoCodes)(options);
37
+ (0, ng_morph_1.saveActiveProject)();
37
38
  (0, steps_2.migrateTemplates)(fileSystem, options);
38
39
  (0, steps_1.showWarnings)(context, constants_1.MIGRATION_WARNINGS);
39
40
  fileSystem.commitEdits();
@@ -31,12 +31,12 @@ function renameIcons(pattern = constants_1.ALL_FILES) {
31
31
  sourceFiles.forEach((file) => {
32
32
  let text = file.getFullText();
33
33
  CHANGED_ICONS.map(({ from, to }) => ({
34
- from: new RegExp(`\\b${from}\\b`, 'g'),
34
+ from: new RegExp(`["'\`]${from}["'\`]`, 'g'),
35
35
  to,
36
36
  })).forEach(({ from, to }) => {
37
- text = text.replaceAll(from, to);
37
+ text = text.replaceAll(from, `"${to}"`);
38
38
  });
39
- const regex = /\btuiIcon(?!Button\b)[A-Z][a-zA-Z0-9]*\b/g;
39
+ const regex = /['"`]tuiIcon(?!Button\b)[A-Z][a-zA-Z0-9]*\b/g;
40
40
  text = text.replaceAll(regex, (match) => convertString(match));
41
41
  file.replaceWithText(text);
42
42
  });
@@ -44,7 +44,7 @@ function renameIcons(pattern = constants_1.ALL_FILES) {
44
44
  exports.renameIcons = renameIcons;
45
45
  function convertString(input) {
46
46
  let result = input
47
- .replace(/^tuiIcon/, '')
47
+ .replace(/["'`]tuiIcon/, '')
48
48
  .replace(/Large$/, '')
49
49
  .replaceAll(/([A-Z0-9])/g, '-$1')
50
50
  .toLowerCase();
@@ -53,5 +53,5 @@ function convertString(input) {
53
53
  result = result.replace('-circle', '');
54
54
  result = `circle${result}`;
55
55
  }
56
- return `@tui.${result.startsWith('-') ? result.slice(1) : result}`;
56
+ return `${input.slice(0, 1)}@tui.${result.startsWith('-') ? result.slice(1) : result}`;
57
57
  }
@@ -50,13 +50,14 @@ exports.ATTRS_TO_DIRECTIVE_REPLACE = [
50
50
  },
51
51
  },
52
52
  {
53
- componentSelector: ['button'],
53
+ componentSelector: ['button', 'a'],
54
54
  inputProperty: 'showLoader',
55
55
  directive: 'loading',
56
56
  directiveModule: {
57
57
  name: 'TuiButtonLoading',
58
58
  moduleSpecifier: '@taiga-ui/kit',
59
59
  },
60
- filterFn: (el) => (0, elements_1.hasElementAttribute)(el, 'tuiButton'),
60
+ filterFn: (el) => (0, elements_1.hasElementAttribute)(el, 'tuiButton') ||
61
+ (0, elements_1.hasElementAttribute)(el, 'tuiIconButton'),
61
62
  },
62
63
  ];
@@ -8,7 +8,8 @@ exports.ATTR_WITH_VALUES_TO_REPLACE = [
8
8
  newAttrName: '[style.border-radius.%]',
9
9
  values: [{ from: 'rounded', to: '100' }],
10
10
  withTagNames: ['button'],
11
- filterFn: (el) => (0, elements_1.hasElementAttribute)(el, 'tuiButton'),
11
+ filterFn: (el) => (0, elements_1.hasElementAttribute)(el, 'tuiButton') ||
12
+ (0, elements_1.hasElementAttribute)(el, 'tuiIconButton'),
12
13
  },
13
14
  {
14
15
  attrNames: ['tuiMode'],
@@ -10,6 +10,20 @@ exports.ATTRS_TO_REPLACE = [
10
10
  },
11
11
  to: { attrName: 'iconStart' },
12
12
  },
13
+ {
14
+ from: {
15
+ attrName: 'src',
16
+ withTagNames: ['tui-svg'],
17
+ },
18
+ to: { attrName: 'icon' },
19
+ },
20
+ {
21
+ from: {
22
+ attrName: '[src]',
23
+ withTagNames: ['tui-svg'],
24
+ },
25
+ to: { attrName: '[icon]' },
26
+ },
13
27
  {
14
28
  from: {
15
29
  attrName: '[brandLogo]',
@@ -34,14 +48,14 @@ exports.ATTRS_TO_REPLACE = [
34
48
  {
35
49
  from: {
36
50
  attrName: 'item',
37
- withTagNames: ['tui-radio'],
51
+ withTagNames: ['tui-radio', 'tui-radio-labeled', 'tui-radio-block'],
38
52
  },
39
53
  to: { attrName: 'value' },
40
54
  },
41
55
  {
42
56
  from: {
43
57
  attrName: '[item]',
44
- withTagNames: ['tui-radio'],
58
+ withTagNames: ['tui-radio', 'tui-radio-labeled', 'tui-radio-block'],
45
59
  },
46
60
  to: { attrName: '[value]' },
47
61
  },
@@ -59,20 +73,6 @@ exports.ATTRS_TO_REPLACE = [
59
73
  },
60
74
  to: { attrName: '(waResizeObserver)' },
61
75
  },
62
- {
63
- from: {
64
- attrName: 'item',
65
- withTagNames: ['tui-radio-labeled'],
66
- },
67
- to: { attrName: 'value' },
68
- },
69
- {
70
- from: {
71
- attrName: '[item]',
72
- withTagNames: ['tui-radio-labeled'],
73
- },
74
- to: { attrName: '[value]' },
75
- },
76
76
  // Hosted dropdown
77
77
  {
78
78
  from: {
@@ -167,17 +167,45 @@ exports.ATTRS_TO_REPLACE = [
167
167
  {
168
168
  from: {
169
169
  attrName: 'icon',
170
- withAttrsNames: ['tuiButton'],
170
+ withAttrsNames: ['tuiButton', 'tuiIconButton'],
171
171
  },
172
172
  to: { attrName: 'iconStart' },
173
173
  },
174
174
  {
175
175
  from: {
176
176
  attrName: '[icon]',
177
- withAttrsNames: ['tuiButton'],
177
+ withAttrsNames: ['tuiButton', 'tuiIconButton'],
178
178
  },
179
179
  to: { attrName: '[iconStart]' },
180
180
  },
181
+ {
182
+ from: {
183
+ attrName: 'iconLeft',
184
+ withAttrsNames: ['tuiButton', 'tuiIconButton'],
185
+ },
186
+ to: { attrName: 'iconStart' },
187
+ },
188
+ {
189
+ from: {
190
+ attrName: '[iconLeft]',
191
+ withAttrsNames: ['tuiButton', 'tuiIconButton'],
192
+ },
193
+ to: { attrName: '[iconStart]' },
194
+ },
195
+ {
196
+ from: {
197
+ attrName: 'iconRight',
198
+ withAttrsNames: ['tuiButton', 'tuiIconButton'],
199
+ },
200
+ to: { attrName: 'iconEnd' },
201
+ },
202
+ {
203
+ from: {
204
+ attrName: '[iconRight]',
205
+ withAttrsNames: ['tuiButton', 'tuiIconButton'],
206
+ },
207
+ to: { attrName: '[iconEnd]' },
208
+ },
181
209
  {
182
210
  from: {
183
211
  attrName: 'icon',
@@ -206,4 +234,11 @@ exports.ATTRS_TO_REPLACE = [
206
234
  },
207
235
  to: { attrName: '' },
208
236
  },
237
+ {
238
+ from: {
239
+ attrName: 'tuiTextfield',
240
+ withTagNames: ['input', 'textarea'],
241
+ },
242
+ to: { attrName: 'tuiTextfieldLegacy' },
243
+ },
209
244
  ];