@taiga-ui/cdk 3.54.0-canary.e1ba43c → 3.55.0

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 (98) hide show
  1. package/bundles/taiga-ui-cdk-components-dialog-host.umd.js +2 -2
  2. package/bundles/taiga-ui-cdk-components-dialog-host.umd.js.map +1 -1
  3. package/bundles/taiga-ui-cdk-components-scroll-controls.umd.js +10 -10
  4. package/bundles/taiga-ui-cdk-components-scroll-controls.umd.js.map +1 -1
  5. package/bundles/taiga-ui-cdk-constants.umd.js +75 -75
  6. package/bundles/taiga-ui-cdk-constants.umd.js.map +1 -1
  7. package/bundles/taiga-ui-cdk-date-time.umd.js +2 -4
  8. package/bundles/taiga-ui-cdk-date-time.umd.js.map +1 -1
  9. package/bundles/taiga-ui-cdk-decorators.umd.js +12 -12
  10. package/bundles/taiga-ui-cdk-decorators.umd.js.map +1 -1
  11. package/bundles/taiga-ui-cdk-services.umd.js +10 -10
  12. package/bundles/taiga-ui-cdk-services.umd.js.map +1 -1
  13. package/bundles/taiga-ui-cdk-tokens.umd.js +23 -23
  14. package/bundles/taiga-ui-cdk-tokens.umd.js.map +1 -1
  15. package/bundles/taiga-ui-cdk-utils-color.umd.js +12 -12
  16. package/bundles/taiga-ui-cdk-utils-color.umd.js.map +1 -1
  17. package/bundles/taiga-ui-cdk-utils-dom.umd.js +5 -5
  18. package/bundles/taiga-ui-cdk-utils-dom.umd.js.map +1 -1
  19. package/bundles/taiga-ui-cdk-utils-math.umd.js +16 -16
  20. package/bundles/taiga-ui-cdk-utils-math.umd.js.map +1 -1
  21. package/bundles/taiga-ui-cdk-utils-miscellaneous.umd.js +3 -3
  22. package/bundles/taiga-ui-cdk-utils-miscellaneous.umd.js.map +1 -1
  23. package/bundles/taiga-ui-cdk-utils-svg.umd.js +23 -23
  24. package/bundles/taiga-ui-cdk-utils-svg.umd.js.map +1 -1
  25. package/constants/version.d.ts +1 -1
  26. package/constants/version.js +1 -1
  27. package/esm2015/components/dialog-host/dialog-host.component.js +3 -3
  28. package/esm2015/components/scroll-controls/scrollbar.directive.js +7 -7
  29. package/esm2015/constants/empty.js +9 -9
  30. package/esm2015/constants/matcher.js +4 -4
  31. package/esm2015/constants/used-icons.js +64 -64
  32. package/esm2015/constants/version.js +2 -2
  33. package/esm2015/date-time/day-range.js +2 -4
  34. package/esm2015/date-time/day.js +2 -2
  35. package/esm2015/decorators/default-prop.js +10 -10
  36. package/esm2015/decorators/required-setter.js +4 -4
  37. package/esm2015/services/scroll.service.js +11 -11
  38. package/esm2015/tokens/active-element.js +14 -14
  39. package/esm2015/utils/color/hex-to-rgba.js +9 -9
  40. package/esm2015/utils/color/hsv-to-rgb.js +5 -5
  41. package/esm2015/utils/dom/can-scroll.js +6 -6
  42. package/esm2015/utils/math/round.js +13 -13
  43. package/esm2015/utils/miscellaneous/clean-object.js +4 -4
  44. package/esm2015/utils/svg/svg-linear-gradient-processor.js +24 -24
  45. package/fesm2015/taiga-ui-cdk-components-dialog-host.js +2 -2
  46. package/fesm2015/taiga-ui-cdk-components-dialog-host.js.map +1 -1
  47. package/fesm2015/taiga-ui-cdk-components-scroll-controls.js +6 -6
  48. package/fesm2015/taiga-ui-cdk-components-scroll-controls.js.map +1 -1
  49. package/fesm2015/taiga-ui-cdk-constants.js +75 -75
  50. package/fesm2015/taiga-ui-cdk-constants.js.map +1 -1
  51. package/fesm2015/taiga-ui-cdk-date-time.js +2 -4
  52. package/fesm2015/taiga-ui-cdk-date-time.js.map +1 -1
  53. package/fesm2015/taiga-ui-cdk-decorators.js +12 -12
  54. package/fesm2015/taiga-ui-cdk-decorators.js.map +1 -1
  55. package/fesm2015/taiga-ui-cdk-services.js +10 -10
  56. package/fesm2015/taiga-ui-cdk-services.js.map +1 -1
  57. package/fesm2015/taiga-ui-cdk-tokens.js +15 -15
  58. package/fesm2015/taiga-ui-cdk-tokens.js.map +1 -1
  59. package/fesm2015/taiga-ui-cdk-utils-color.js +12 -12
  60. package/fesm2015/taiga-ui-cdk-utils-color.js.map +1 -1
  61. package/fesm2015/taiga-ui-cdk-utils-dom.js +5 -5
  62. package/fesm2015/taiga-ui-cdk-utils-dom.js.map +1 -1
  63. package/fesm2015/taiga-ui-cdk-utils-math.js +12 -12
  64. package/fesm2015/taiga-ui-cdk-utils-math.js.map +1 -1
  65. package/fesm2015/taiga-ui-cdk-utils-miscellaneous.js +3 -3
  66. package/fesm2015/taiga-ui-cdk-utils-miscellaneous.js.map +1 -1
  67. package/fesm2015/taiga-ui-cdk-utils-svg.js +23 -23
  68. package/fesm2015/taiga-ui-cdk-utils-svg.js.map +1 -1
  69. package/package.json +68 -68
  70. package/schematics/ng-add/index.js +10 -10
  71. package/schematics/ng-add/steps/add-taiga-modules.js +32 -32
  72. package/schematics/ng-add/steps/wrap-with-tui-root.js +21 -21
  73. package/schematics/ng-update/steps/rename-types.js +8 -8
  74. package/schematics/ng-update/steps/replace-enums.js +8 -8
  75. package/schematics/ng-update/steps/replace-services.js +8 -8
  76. package/schematics/ng-update/steps/show-warnings.js +4 -4
  77. package/schematics/ng-update/v3/index.js +17 -17
  78. package/schematics/ng-update/v3/steps/migrate-date-time.js +92 -92
  79. package/schematics/ng-update/v3/steps/migrate-polymorpheus.js +35 -35
  80. package/schematics/ng-update/v3/steps/migrate-progress.d.ts +4 -0
  81. package/schematics/ng-update/v3/steps/migrate-progress.js +15 -13
  82. package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-range.js +44 -44
  83. package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-slider.js +28 -28
  84. package/schematics/ng-update/v3/steps/migrate-templates.js +37 -36
  85. package/schematics/ng-update/v3/steps/migrate-textfield-controller.js +21 -21
  86. package/schematics/ng-update/v3/steps/miscellaneous.js +32 -32
  87. package/schematics/ng-update/v3/steps/replace-functions.js +18 -18
  88. package/schematics/ng-update/v3-30/index.js +3 -3
  89. package/schematics/ng-update/v3-35/index.js +3 -3
  90. package/schematics/ng-update/v3-40/index.js +9 -9
  91. package/schematics/ng-update/v3-5/steps/migrate-expand-templates.js +17 -17
  92. package/schematics/ng-update/v4/index.js +12 -12
  93. package/schematics/ng-update/v4/steps/migrate-templates.js +3 -3
  94. package/schematics/ng-update/v4/steps/restore-tui-mapper.js +6 -6
  95. package/schematics/ng-update/v4/steps/restore-tui-matcher.js +6 -6
  96. package/schematics/ng-update/v4/steps/templates/migrate-avatar.js +24 -24
  97. package/schematics/utils/angular-json-manipulations.js +8 -8
  98. package/schematics/utils/templates/get-component-templates.js +8 -8
@@ -11,50 +11,6 @@ const get_component_templates_1 = require("../../../../utils/templates/get-compo
11
11
  const ng_component_input_manipulations_1 = require("../../../../utils/templates/ng-component-input-manipulations");
12
12
  const MIN_LABELS_MIGRATION_METHOD_NAME = `tuiMigrationInputRangeMinLabel`;
13
13
  const MAX_LABELS_MIGRATION_METHOD_NAME = `tuiMigrationInputRangeMaxLabel`;
14
- function migrateInputRange(fileSystem, options) {
15
- const templateResources = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
16
- const COMPONENTS_WITH_MIN_LABELS = new Set();
17
- const COMPONENTS_WITH_MAX_LABELS = new Set();
18
- let progressLog = progress_1.setupProgressLogger({
19
- total: templateResources.length,
20
- prefix: `[replaceMinMaxLabel]`,
21
- });
22
- templateResources.forEach(templateResource => {
23
- !options[`skip-logs`] && progressLog(templateResource.componentPath);
24
- replaceMinLabel(templateResource, fileSystem, COMPONENTS_WITH_MIN_LABELS);
25
- replaceMaxLabel(templateResource, fileSystem, COMPONENTS_WITH_MAX_LABELS);
26
- });
27
- save(fileSystem);
28
- progressLog = progress_1.setupProgressLogger({
29
- total: COMPONENTS_WITH_MIN_LABELS.size,
30
- prefix: `[COMPONENTS_WITH_MIN_LABELS]`,
31
- });
32
- Array.from(COMPONENTS_WITH_MIN_LABELS).forEach(componentPath => {
33
- !options[`skip-logs`] && progressLog(componentPath);
34
- addMinMaxLabelMethod(componentPath, MIN_LABELS_MIGRATION_METHOD_NAME, [
35
- `const currentValue = context.$implicit;`,
36
- `const minValue = 0; // TODO: (Taiga UI migration) replace with the MIN value of the input-range`,
37
- `const minLabelText = "Min"; // TODO: (Taiga UI migration) replace with the required label`,
38
- `if (currentValue === minValue) return minLabelText;`,
39
- `return String(currentValue);`,
40
- ]);
41
- });
42
- progressLog = progress_1.setupProgressLogger({
43
- total: COMPONENTS_WITH_MAX_LABELS.size,
44
- prefix: `[COMPONENTS_WITH_MAX_LABELS]`,
45
- });
46
- Array.from(COMPONENTS_WITH_MAX_LABELS).forEach(componentPath => {
47
- !options[`skip-logs`] && progressLog(componentPath);
48
- addMinMaxLabelMethod(componentPath, MAX_LABELS_MIGRATION_METHOD_NAME, [
49
- `const currentValue = context.$implicit;`,
50
- `const maxValue = 100; // TODO: (Taiga UI migration) replace with the MAX value of the input`,
51
- `const maxLabelText = "Max"; // TODO: (Taiga UI migration) replace with the required label`,
52
- `if (currentValue === maxValue) return maxLabelText;`,
53
- `return String(currentValue);`,
54
- ]);
55
- });
56
- }
57
- exports.migrateInputRange = migrateInputRange;
58
14
  function replaceMinLabel(templateResource, fileSystem, modifiedComponentStorage) {
59
15
  const wasModified = ng_component_input_manipulations_1.replaceInputProperty({
60
16
  templateResource,
@@ -102,3 +58,47 @@ function save(fileSystem) {
102
58
  ng_morph_1.saveActiveProject();
103
59
  ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, project_root_1.projectRoot(), constants_1.ALL_FILES));
104
60
  }
61
+ function migrateInputRange(fileSystem, options) {
62
+ const templateResources = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
63
+ const COMPONENTS_WITH_MIN_LABELS = new Set();
64
+ const COMPONENTS_WITH_MAX_LABELS = new Set();
65
+ let progressLog = progress_1.setupProgressLogger({
66
+ total: templateResources.length,
67
+ prefix: `[replaceMinMaxLabel]`,
68
+ });
69
+ templateResources.forEach(templateResource => {
70
+ !options[`skip-logs`] && progressLog(templateResource.componentPath);
71
+ replaceMinLabel(templateResource, fileSystem, COMPONENTS_WITH_MIN_LABELS);
72
+ replaceMaxLabel(templateResource, fileSystem, COMPONENTS_WITH_MAX_LABELS);
73
+ });
74
+ save(fileSystem);
75
+ progressLog = progress_1.setupProgressLogger({
76
+ total: COMPONENTS_WITH_MIN_LABELS.size,
77
+ prefix: `[COMPONENTS_WITH_MIN_LABELS]`,
78
+ });
79
+ Array.from(COMPONENTS_WITH_MIN_LABELS).forEach(componentPath => {
80
+ !options[`skip-logs`] && progressLog(componentPath);
81
+ addMinMaxLabelMethod(componentPath, MIN_LABELS_MIGRATION_METHOD_NAME, [
82
+ `const currentValue = context.$implicit;`,
83
+ `const minValue = 0; // TODO: (Taiga UI migration) replace with the MIN value of the input-range`,
84
+ `const minLabelText = "Min"; // TODO: (Taiga UI migration) replace with the required label`,
85
+ `if (currentValue === minValue) return minLabelText;`,
86
+ `return String(currentValue);`,
87
+ ]);
88
+ });
89
+ progressLog = progress_1.setupProgressLogger({
90
+ total: COMPONENTS_WITH_MAX_LABELS.size,
91
+ prefix: `[COMPONENTS_WITH_MAX_LABELS]`,
92
+ });
93
+ Array.from(COMPONENTS_WITH_MAX_LABELS).forEach(componentPath => {
94
+ !options[`skip-logs`] && progressLog(componentPath);
95
+ addMinMaxLabelMethod(componentPath, MAX_LABELS_MIGRATION_METHOD_NAME, [
96
+ `const currentValue = context.$implicit;`,
97
+ `const maxValue = 100; // TODO: (Taiga UI migration) replace with the MAX value of the input`,
98
+ `const maxLabelText = "Max"; // TODO: (Taiga UI migration) replace with the required label`,
99
+ `if (currentValue === maxValue) return maxLabelText;`,
100
+ `return String(currentValue);`,
101
+ ]);
102
+ });
103
+ }
104
+ exports.migrateInputRange = migrateInputRange;
@@ -10,34 +10,6 @@ const project_root_1 = require("../../../../utils/project-root");
10
10
  const elements_1 = require("../../../../utils/templates/elements");
11
11
  const get_component_templates_1 = require("../../../../utils/templates/get-component-templates");
12
12
  const ng_component_input_manipulations_1 = require("../../../../utils/templates/ng-component-input-manipulations");
13
- function migrateInputSlider(fileSystem, options) {
14
- const templateResources = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
15
- const COMPONENTS_WITH_MIN_MAX_LABELS = new Set();
16
- let progressLog = progress_1.setupProgressLogger({
17
- total: templateResources.length,
18
- prefix: `[replaceMinMaxLabels]`,
19
- });
20
- templateResources.forEach(templateResource => {
21
- !options[`skip-logs`] && progressLog(templateResource.componentPath);
22
- replaceMinMaxLabels(templateResource, fileSystem, COMPONENTS_WITH_MIN_MAX_LABELS);
23
- });
24
- /**
25
- * We should update virtual file tree
26
- * otherwise all following ng-morph commands will overwrite all previous template manipulations
27
- * */
28
- fileSystem.commitEdits();
29
- ng_morph_1.saveActiveProject();
30
- ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, project_root_1.projectRoot(), constants_1.ALL_FILES));
31
- progressLog = progress_1.setupProgressLogger({
32
- total: COMPONENTS_WITH_MIN_MAX_LABELS.size,
33
- prefix: `[addMinMaxLabelMethod]`,
34
- });
35
- Array.from(COMPONENTS_WITH_MIN_MAX_LABELS).forEach(componentPath => {
36
- !options[`skip-logs`] && progressLog(componentPath);
37
- addMinMaxLabelMethod(componentPath);
38
- });
39
- }
40
- exports.migrateInputSlider = migrateInputSlider;
41
13
  const MIN_MAX_LABELS_MIGRATION_METHOD_NAME = `tuiMigrationMinMaxLabel`;
42
14
  function replaceMinMaxLabels(templateResource, fileSystem, modifiedComponentStorage) {
43
15
  const wasMaxLabelModified = ng_component_input_manipulations_1.replaceInputProperty({
@@ -89,3 +61,31 @@ function addMinMaxLabelMethod(componentPath) {
89
61
  });
90
62
  }
91
63
  }
64
+ function migrateInputSlider(fileSystem, options) {
65
+ const templateResources = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
66
+ const COMPONENTS_WITH_MIN_MAX_LABELS = new Set();
67
+ let progressLog = progress_1.setupProgressLogger({
68
+ total: templateResources.length,
69
+ prefix: `[replaceMinMaxLabels]`,
70
+ });
71
+ templateResources.forEach(templateResource => {
72
+ !options[`skip-logs`] && progressLog(templateResource.componentPath);
73
+ replaceMinMaxLabels(templateResource, fileSystem, COMPONENTS_WITH_MIN_MAX_LABELS);
74
+ });
75
+ /**
76
+ * We should update virtual file tree
77
+ * otherwise all following ng-morph commands will overwrite all previous template manipulations
78
+ * */
79
+ fileSystem.commitEdits();
80
+ ng_morph_1.saveActiveProject();
81
+ ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, project_root_1.projectRoot(), constants_1.ALL_FILES));
82
+ progressLog = progress_1.setupProgressLogger({
83
+ total: COMPONENTS_WITH_MIN_MAX_LABELS.size,
84
+ prefix: `[addMinMaxLabelMethod]`,
85
+ });
86
+ Array.from(COMPONENTS_WITH_MIN_MAX_LABELS).forEach(componentPath => {
87
+ !options[`skip-logs`] && progressLog(componentPath);
88
+ addMinMaxLabelMethod(componentPath);
89
+ });
90
+ }
91
+ exports.migrateInputSlider = migrateInputSlider;
@@ -21,42 +21,6 @@ const replace_tags_1 = require("../../utils/templates/replace-tags");
21
21
  const templates_1 = require("../constants/templates");
22
22
  const migrate_polymorpheus_1 = require("./migrate-polymorpheus");
23
23
  const migrate_textfield_controller_1 = require("./migrate-textfield-controller");
24
- function migrateTemplates(fileSystem, options) {
25
- !options[`skip-logs`] &&
26
- colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating templates...`);
27
- const componentWithTemplatesPaths = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
28
- const actions = [
29
- replaceV3Tags,
30
- replaceV3Attrs,
31
- replaceAttrsByDirective,
32
- replaceBreadcrumbs,
33
- replaceFieldError,
34
- addHTMLCommentTags,
35
- addEditorProviders,
36
- migrateTuiHideSelectedPipe,
37
- removeV3Inputs,
38
- migrate_polymorpheus_1.migratePolymorpheus,
39
- migrate_textfield_controller_1.migrateTextfieldController,
40
- replaceInputValues,
41
- migrateBinaryAttributes,
42
- addWarningForFormatNumberPipe,
43
- ];
44
- const progressLog = progress_1.setupProgressLogger({
45
- total: componentWithTemplatesPaths.length,
46
- });
47
- componentWithTemplatesPaths.forEach(resource => {
48
- const path = fileSystem.resolve(template_resource_1.getPathFromTemplateResource(resource));
49
- const recorder = fileSystem.edit(path);
50
- actions.forEach((action, actionIndex) => {
51
- const isLastAction = actionIndex === actions.length - 1;
52
- !options[`skip-logs`] && progressLog(action.name, isLastAction);
53
- action({ resource, fileSystem, recorder });
54
- });
55
- });
56
- !options[`skip-logs`] &&
57
- colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} templates migrated \n`);
58
- }
59
- exports.migrateTemplates = migrateTemplates;
60
24
  function replaceAttrsByDirective({ resource, fileSystem, }) {
61
25
  templates_1.ATTR_TO_DIRECTIVE.forEach(({ componentSelector, directiveModule, directive, inputProperty, filterFn }) => {
62
26
  ng_component_input_manipulations_1.replaceInputPropertyByDirective({
@@ -108,6 +72,7 @@ function replaceBreadcrumbs({ resource, recorder, fileSystem, }) {
108
72
  if (!itemsValue || !insertTo) {
109
73
  return;
110
74
  }
75
+ // noinspection AngularMissingRequiredDirectiveInputBinding
111
76
  recorder.insertRight(insertTo + templateOffset, `
112
77
  <ng-container *ngFor="let item of ${itemsValue}">
113
78
  <a
@@ -216,3 +181,39 @@ function replaceInputValues({ resource, recorder, fileSystem, }) {
216
181
  function removeV3Inputs({ resource, fileSystem, recorder, }) {
217
182
  remove_inputs_1.removeInputs({ resource, recorder, fileSystem, data: templates_1.INPUTS_TO_REMOVE });
218
183
  }
184
+ function migrateTemplates(fileSystem, options) {
185
+ !options[`skip-logs`] &&
186
+ colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating templates...`);
187
+ const componentWithTemplatesPaths = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
188
+ const actions = [
189
+ replaceV3Tags,
190
+ replaceV3Attrs,
191
+ replaceAttrsByDirective,
192
+ replaceBreadcrumbs,
193
+ replaceFieldError,
194
+ addHTMLCommentTags,
195
+ addEditorProviders,
196
+ migrateTuiHideSelectedPipe,
197
+ removeV3Inputs,
198
+ migrate_polymorpheus_1.migratePolymorpheus,
199
+ migrate_textfield_controller_1.migrateTextfieldController,
200
+ replaceInputValues,
201
+ migrateBinaryAttributes,
202
+ addWarningForFormatNumberPipe,
203
+ ];
204
+ const progressLog = progress_1.setupProgressLogger({
205
+ total: componentWithTemplatesPaths.length,
206
+ });
207
+ componentWithTemplatesPaths.forEach(resource => {
208
+ const path = fileSystem.resolve(template_resource_1.getPathFromTemplateResource(resource));
209
+ const recorder = fileSystem.edit(path);
210
+ actions.forEach((action, actionIndex) => {
211
+ const isLastAction = actionIndex === actions.length - 1;
212
+ !options[`skip-logs`] && progressLog(action.name, isLastAction);
213
+ action({ resource, fileSystem, recorder });
214
+ });
215
+ });
216
+ !options[`skip-logs`] &&
217
+ colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} templates migrated \n`);
218
+ }
219
+ exports.migrateTemplates = migrateTemplates;
@@ -35,27 +35,6 @@ const ATTRS_MAP = {
35
35
  '[tuitextfieldexampletext]': `[attr.placeholder]`,
36
36
  };
37
37
  const CONTROLLER_ITEMS = Object.keys(ATTRS_MAP).map(attr => attr.toLowerCase());
38
- function migrateTextfieldController({ resource, fileSystem, recorder, }) {
39
- const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
40
- const templateOffset = template_resource_1.getTemplateOffset(resource);
41
- const elements = elements_1.findElementsByTagNames(template, TEXTFIELDS);
42
- elements.forEach(element => {
43
- const attrs = element.attrs.filter(attr => CONTROLLER_ITEMS.includes(attr.name) && !exclusion(element, attr.name));
44
- if (!attrs.length) {
45
- return;
46
- }
47
- const existingInput = elements_1.findElementsByFn(element.childNodes, el => (el.tagName === `input` || el.tagName === `textarea`) &&
48
- elements_1.hasElementAttribute(el, `tuiTextfield`))[0];
49
- if (existingInput) {
50
- addAttrToExistingInput({ existingInput, attrs, recorder, templateOffset });
51
- }
52
- else {
53
- insertTuiTextfieldInput({ element, attrs, recorder, templateOffset });
54
- }
55
- });
56
- removeOldInputs(recorder, template, templateOffset);
57
- }
58
- exports.migrateTextfieldController = migrateTextfieldController;
59
38
  function insertTuiTextfieldInput({ element, attrs, recorder, templateOffset, }) {
60
39
  var _a, _b;
61
40
  const newAttrs = attrs
@@ -96,3 +75,24 @@ function exclusion({ tagName }, attrName) {
96
75
  var _a;
97
76
  return (_a = excludedAttrs[tagName]) === null || _a === void 0 ? void 0 : _a.includes(attrName);
98
77
  }
78
+ function migrateTextfieldController({ resource, fileSystem, recorder, }) {
79
+ const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
80
+ const templateOffset = template_resource_1.getTemplateOffset(resource);
81
+ const elements = elements_1.findElementsByTagNames(template, TEXTFIELDS);
82
+ elements.forEach(element => {
83
+ const attrs = element.attrs.filter(attr => CONTROLLER_ITEMS.includes(attr.name) && !exclusion(element, attr.name));
84
+ if (!attrs.length) {
85
+ return;
86
+ }
87
+ const existingInput = elements_1.findElementsByFn(element.childNodes, el => (el.tagName === `input` || el.tagName === `textarea`) &&
88
+ elements_1.hasElementAttribute(el, `tuiTextfield`))[0];
89
+ if (existingInput) {
90
+ addAttrToExistingInput({ existingInput, attrs, recorder, templateOffset });
91
+ }
92
+ else {
93
+ insertTuiTextfieldInput({ element, attrs, recorder, templateOffset });
94
+ }
95
+ });
96
+ removeOldInputs(recorder, template, templateOffset);
97
+ }
98
+ exports.migrateTextfieldController = migrateTextfieldController;
@@ -5,38 +5,6 @@ const ng_morph_1 = require("ng-morph");
5
5
  const colored_log_1 = require("../../../utils/colored-log");
6
6
  const get_named_import_references_1 = require("../../../utils/get-named-import-references");
7
7
  const insert_todo_1 = require("../../../utils/insert-todo");
8
- function miscellaneousMigrations(options) {
9
- !options[`skip-logs`] &&
10
- colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} miscellaneous migrating...`);
11
- replaceEnumProperty({
12
- enumName: `TuiCurrency`,
13
- from: `HongKong_dollar`,
14
- to: `HongKongDollar`,
15
- });
16
- replaceEnumProperty({
17
- enumName: `TuiCurrencyCode`,
18
- from: `HongKong_dollar`,
19
- to: `HongKongDollar`,
20
- });
21
- replaceEnumProperty({
22
- enumName: `TuiCreditCardAutofillName`,
23
- /**
24
- * Do not mark `mounth` as incorrect.
25
- * cspell:ignore mounth
26
- */
27
- from: `CcExp_mounth`,
28
- to: `CcExpMonth`,
29
- });
30
- replaceEnumProperty({
31
- enumName: `TuiCreditCardAutofillName`,
32
- from: `CcExp_year`,
33
- to: `CcExpYear`,
34
- });
35
- addWarningToMethod(`TuiDirectiveStylesService`, `addStyle`, `addStyle method has been removed. Use components approach`);
36
- !options[`skip-logs`] &&
37
- colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} miscellaneous migrated \n`);
38
- }
39
- exports.miscellaneousMigrations = miscellaneousMigrations;
40
8
  function addWarningToMethod(className, method, message) {
41
9
  const references = get_named_import_references_1.getNamedImportReferences(className);
42
10
  references.forEach(ref => {
@@ -79,3 +47,35 @@ function checkMethod(node, method, message) {
79
47
  }
80
48
  });
81
49
  }
50
+ function miscellaneousMigrations(options) {
51
+ !options[`skip-logs`] &&
52
+ colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} miscellaneous migrating...`);
53
+ replaceEnumProperty({
54
+ enumName: `TuiCurrency`,
55
+ from: `HongKong_dollar`,
56
+ to: `HongKongDollar`,
57
+ });
58
+ replaceEnumProperty({
59
+ enumName: `TuiCurrencyCode`,
60
+ from: `HongKong_dollar`,
61
+ to: `HongKongDollar`,
62
+ });
63
+ replaceEnumProperty({
64
+ enumName: `TuiCreditCardAutofillName`,
65
+ /**
66
+ * Do not mark `mounth` as incorrect.
67
+ * cspell:ignore mounth
68
+ */
69
+ from: `CcExp_mounth`,
70
+ to: `CcExpMonth`,
71
+ });
72
+ replaceEnumProperty({
73
+ enumName: `TuiCreditCardAutofillName`,
74
+ from: `CcExp_year`,
75
+ to: `CcExpYear`,
76
+ });
77
+ addWarningToMethod(`TuiDirectiveStylesService`, `addStyle`, `addStyle method has been removed. Use components approach`);
78
+ !options[`skip-logs`] &&
79
+ colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} miscellaneous migrated \n`);
80
+ }
81
+ exports.miscellaneousMigrations = miscellaneousMigrations;
@@ -6,24 +6,6 @@ const colored_log_1 = require("../../../utils/colored-log");
6
6
  const get_named_import_references_1 = require("../../../utils/get-named-import-references");
7
7
  const import_manipulations_1 = require("../../../utils/import-manipulations");
8
8
  const deprecated_functions_1 = require("../constants/deprecated-functions");
9
- function replaceFunctions(options) {
10
- !options[`skip-logs`] &&
11
- colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} functions replacing...`);
12
- replacePadStart(get_named_import_references_1.getNamedImportReferences(`padStart`, `@taiga-ui/cdk`));
13
- replaceFallbackValue(get_named_import_references_1.getNamedImportReferences(`fallbackValue`, `@taiga-ui/cdk`));
14
- replaceCustomEvent(get_named_import_references_1.getNamedImportReferences(`tuiCustomEvent`, `@taiga-ui/cdk`));
15
- replaceClosestElement(get_named_import_references_1.getNamedImportReferences(`getClosestElement`, `@taiga-ui/cdk`));
16
- replaceNativeFocused([
17
- ...get_named_import_references_1.getNamedImportReferences(`tuiSetNativeFocused`, `@taiga-ui/cdk`),
18
- ...get_named_import_references_1.getNamedImportReferences(`setNativeFocused`, `@taiga-ui/cdk`),
19
- ]);
20
- replaceDeprecatedFunction();
21
- modifyFormatNumberArgs();
22
- modifyClosestFocusable();
23
- !options[`skip-logs`] &&
24
- colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} functions replaced \n`);
25
- }
26
- exports.replaceFunctions = replaceFunctions;
27
9
  function replaceDeprecatedFunction() {
28
10
  deprecated_functions_1.DEPRECATED_FUNCTIONS.forEach(({ from, to, moduleSpecifier }) => {
29
11
  get_named_import_references_1.getNamedImportReferences(from, moduleSpecifier).forEach(ref => {
@@ -136,3 +118,21 @@ function modifyClosestFocusable() {
136
118
  }
137
119
  });
138
120
  }
121
+ function replaceFunctions(options) {
122
+ !options[`skip-logs`] &&
123
+ colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} functions replacing...`);
124
+ replacePadStart(get_named_import_references_1.getNamedImportReferences(`padStart`, `@taiga-ui/cdk`));
125
+ replaceFallbackValue(get_named_import_references_1.getNamedImportReferences(`fallbackValue`, `@taiga-ui/cdk`));
126
+ replaceCustomEvent(get_named_import_references_1.getNamedImportReferences(`tuiCustomEvent`, `@taiga-ui/cdk`));
127
+ replaceClosestElement(get_named_import_references_1.getNamedImportReferences(`getClosestElement`, `@taiga-ui/cdk`));
128
+ replaceNativeFocused([
129
+ ...get_named_import_references_1.getNamedImportReferences(`tuiSetNativeFocused`, `@taiga-ui/cdk`),
130
+ ...get_named_import_references_1.getNamedImportReferences(`setNativeFocused`, `@taiga-ui/cdk`),
131
+ ]);
132
+ replaceDeprecatedFunction();
133
+ modifyFormatNumberArgs();
134
+ modifyClosestFocusable();
135
+ !options[`skip-logs`] &&
136
+ colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} functions replaced \n`);
137
+ }
138
+ exports.replaceFunctions = replaceFunctions;
@@ -8,6 +8,9 @@ const get_file_system_1 = require("../utils/get-file-system");
8
8
  const replace_text_1 = require("../utils/replace-text");
9
9
  const constants_1 = require("./constants/constants");
10
10
  const icons_1 = require("./constants/icons");
11
+ function hasProprietaryIcons(tree) {
12
+ return !!ng_morph_1.getPackageJsonDependency(tree, `@taiga-ui/proprietary-icons`);
13
+ }
11
14
  function updateToV3_30(options) {
12
15
  return (tree, _) => {
13
16
  if (!hasProprietaryIcons(tree)) {
@@ -27,6 +30,3 @@ function updateToV3_30(options) {
27
30
  };
28
31
  }
29
32
  exports.updateToV3_30 = updateToV3_30;
30
- function hasProprietaryIcons(tree) {
31
- return !!ng_morph_1.getPackageJsonDependency(tree, `@taiga-ui/proprietary-icons`);
32
- }
@@ -8,6 +8,9 @@ const get_file_system_1 = require("../utils/get-file-system");
8
8
  const replace_text_1 = require("../utils/replace-text");
9
9
  const constants_1 = require("./constants/constants");
10
10
  const icons_1 = require("./constants/icons");
11
+ function hasProprietaryIcons(tree) {
12
+ return !!ng_morph_1.getPackageJsonDependency(tree, `@taiga-ui/proprietary-icons`);
13
+ }
11
14
  function updateToV3_35(options) {
12
15
  return (tree, _) => {
13
16
  if (!hasProprietaryIcons(tree)) {
@@ -27,6 +30,3 @@ function updateToV3_35(options) {
27
30
  };
28
31
  }
29
32
  exports.updateToV3_35 = updateToV3_35;
30
- function hasProprietaryIcons(tree) {
31
- return !!ng_morph_1.getPackageJsonDependency(tree, `@taiga-ui/proprietary-icons`);
32
- }
@@ -11,15 +11,6 @@ const template_resource_1 = require("../../utils/templates/template-resource");
11
11
  const get_file_system_1 = require("../utils/get-file-system");
12
12
  const replace_text_1 = require("../utils/replace-text");
13
13
  const replace_tag_1 = require("../utils/templates/replace-tag");
14
- function updateToV3_40(options) {
15
- return (tree, _) => {
16
- const fileSystem = get_file_system_1.getFileSystem(tree);
17
- replaceTextareaTag(options, fileSystem);
18
- replaceTextareaReferenceTypes(options, fileSystem);
19
- !options[`skip-logs`] && colored_log_1.titleLog(`${colored_log_1.FINISH_SYMBOL} successfully migrated \n`);
20
- };
21
- }
22
- exports.updateToV3_40 = updateToV3_40;
23
14
  function replaceTextareaTag(options, fileSystem) {
24
15
  !options[`skip-logs`] &&
25
16
  colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} replacing <tui-text-area /> to <tui-textarea />`);
@@ -59,3 +50,12 @@ function replaceTextareaReferenceTypes(options, fileSystem) {
59
50
  ng_morph_1.saveActiveProject();
60
51
  ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, project_root_1.projectRoot(), constants_1.ALL_FILES));
61
52
  }
53
+ function updateToV3_40(options) {
54
+ return (tree, _) => {
55
+ const fileSystem = get_file_system_1.getFileSystem(tree);
56
+ replaceTextareaTag(options, fileSystem);
57
+ replaceTextareaReferenceTypes(options, fileSystem);
58
+ !options[`skip-logs`] && colored_log_1.titleLog(`${colored_log_1.FINISH_SYMBOL} successfully migrated \n`);
59
+ };
60
+ }
61
+ exports.updateToV3_40 = updateToV3_40;
@@ -7,23 +7,6 @@ const progress_1 = require("../../../utils/progress");
7
7
  const elements_1 = require("../../../utils/templates/elements");
8
8
  const get_component_templates_1 = require("../../../utils/templates/get-component-templates");
9
9
  const template_resource_1 = require("../../../utils/templates/template-resource");
10
- function migrateExpandTemplates(fileSystem, options) {
11
- !options[`skip-logs`] &&
12
- colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating templates...`);
13
- const componentWithTemplatesPaths = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
14
- const progressLog = progress_1.setupProgressLogger({
15
- total: componentWithTemplatesPaths.length,
16
- });
17
- componentWithTemplatesPaths.forEach(resource => {
18
- const path = fileSystem.resolve(template_resource_1.getPathFromTemplateResource(resource));
19
- const recorder = fileSystem.edit(path);
20
- !options[`skip-logs`] && progressLog(`expand migration`, true);
21
- migrateExpand({ resource, fileSystem, recorder });
22
- });
23
- !options[`skip-logs`] &&
24
- colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} templates migrated \n`);
25
- }
26
- exports.migrateExpandTemplates = migrateExpandTemplates;
27
10
  function migrateExpand({ resource, recorder, fileSystem, }) {
28
11
  const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
29
12
  const templateOffset = template_resource_1.getTemplateOffset(resource);
@@ -42,3 +25,20 @@ function migrateExpand({ resource, recorder, fileSystem, }) {
42
25
  recorder.insertRight(insertTo + templateOffset - 1, ` tuiExpandContent`);
43
26
  });
44
27
  }
28
+ function migrateExpandTemplates(fileSystem, options) {
29
+ !options[`skip-logs`] &&
30
+ colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating templates...`);
31
+ const componentWithTemplatesPaths = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
32
+ const progressLog = progress_1.setupProgressLogger({
33
+ total: componentWithTemplatesPaths.length,
34
+ });
35
+ componentWithTemplatesPaths.forEach(resource => {
36
+ const path = fileSystem.resolve(template_resource_1.getPathFromTemplateResource(resource));
37
+ const recorder = fileSystem.edit(path);
38
+ !options[`skip-logs`] && progressLog(`expand migration`, true);
39
+ migrateExpand({ resource, fileSystem, recorder });
40
+ });
41
+ !options[`skip-logs`] &&
42
+ colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} templates migrated \n`);
43
+ }
44
+ exports.migrateExpandTemplates = migrateExpandTemplates;
@@ -12,6 +12,18 @@ const project_root_1 = require("../../utils/project-root");
12
12
  const replace_identifier_1 = require("../steps/replace-identifier");
13
13
  const steps_1 = require("./steps");
14
14
  const identifiers_to_replace_1 = require("./steps/constants/identifiers-to-replace");
15
+ function main(options) {
16
+ return (tree, _context) => {
17
+ const project = ng_morph_1.createProject(tree, project_root_1.projectRoot(), constants_1.ALL_FILES);
18
+ const fileSystem = project.getFileSystem().fs;
19
+ replace_identifier_1.replaceIdentifiers(options, identifiers_to_replace_1.IDENTIFIERS_TO_REPLACE);
20
+ steps_1.restoreTuiMapper(options);
21
+ steps_1.restoreTuiMatcher(options);
22
+ steps_1.migrateTemplates(fileSystem, options);
23
+ fileSystem.commitEdits();
24
+ ng_morph_1.saveActiveProject();
25
+ };
26
+ }
15
27
  function updateToV4(options) {
16
28
  const t0 = perf_hooks_1.performance.now();
17
29
  !options[`skip-logs`] &&
@@ -26,15 +38,3 @@ function updateToV4(options) {
26
38
  ]);
27
39
  }
28
40
  exports.updateToV4 = updateToV4;
29
- function main(options) {
30
- return (tree, _context) => {
31
- const project = ng_morph_1.createProject(tree, project_root_1.projectRoot(), constants_1.ALL_FILES);
32
- const fileSystem = project.getFileSystem().fs;
33
- replace_identifier_1.replaceIdentifiers(options, identifiers_to_replace_1.IDENTIFIERS_TO_REPLACE);
34
- steps_1.restoreTuiMapper(options);
35
- steps_1.restoreTuiMatcher(options);
36
- steps_1.migrateTemplates(fileSystem, options);
37
- fileSystem.commitEdits();
38
- ng_morph_1.saveActiveProject();
39
- };
40
- }
@@ -10,6 +10,9 @@ const templates_1 = require("../../utils/templates");
10
10
  const replace_attrs_by_directives_1 = require("../../utils/templates/replace-attrs-by-directives");
11
11
  const constants_2 = require("./constants");
12
12
  const templates_2 = require("./templates");
13
+ function getAction({ action, requiredData, }) {
14
+ return ({ resource, fileSystem, recorder, }) => action({ resource, fileSystem, recorder, data: requiredData });
15
+ }
13
16
  function migrateTemplates(fileSystem, options) {
14
17
  !options[`skip-logs`] &&
15
18
  colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating templates...`);
@@ -45,6 +48,3 @@ function migrateTemplates(fileSystem, options) {
45
48
  colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} templates migrated \n`);
46
49
  }
47
50
  exports.migrateTemplates = migrateTemplates;
48
- function getAction({ action, requiredData, }) {
49
- return ({ resource, fileSystem, recorder, }) => action({ resource, fileSystem, recorder, data: requiredData });
50
- }
@@ -5,12 +5,6 @@ const ng_morph_1 = require("ng-morph");
5
5
  const colored_log_1 = require("../../../utils/colored-log");
6
6
  const get_named_import_references_1 = require("../../../utils/get-named-import-references");
7
7
  const replace_identifier_1 = require("../../steps/replace-identifier");
8
- function restoreTuiMapper(options) {
9
- updateTuiMapper(options);
10
- renameTuiTypedMapper(options);
11
- !options[`skip-logs`] && colored_log_1.titleLog(`${colored_log_1.FINISH_SYMBOL} successfully migrated \n`);
12
- }
13
- exports.restoreTuiMapper = restoreTuiMapper;
14
8
  function updateTuiMapper(options) {
15
9
  !options[`skip-logs`] &&
16
10
  colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} updating TuiMapper typing to the typed version`);
@@ -38,3 +32,9 @@ function renameTuiTypedMapper(options) {
38
32
  to: { name: `TuiMapper`, moduleSpecifier: `@taiga-ui/cdk` },
39
33
  });
40
34
  }
35
+ function restoreTuiMapper(options) {
36
+ updateTuiMapper(options);
37
+ renameTuiTypedMapper(options);
38
+ !options[`skip-logs`] && colored_log_1.titleLog(`${colored_log_1.FINISH_SYMBOL} successfully migrated \n`);
39
+ }
40
+ exports.restoreTuiMapper = restoreTuiMapper;
@@ -5,12 +5,6 @@ const ng_morph_1 = require("ng-morph");
5
5
  const colored_log_1 = require("../../../utils/colored-log");
6
6
  const get_named_import_references_1 = require("../../../utils/get-named-import-references");
7
7
  const replace_identifier_1 = require("../../steps/replace-identifier");
8
- function restoreTuiMatcher(options) {
9
- updateTuiMatcher(options);
10
- renameTuiTypedMatcher(options);
11
- !options[`skip-logs`] && colored_log_1.titleLog(`${colored_log_1.FINISH_SYMBOL} successfully migrated \n`);
12
- }
13
- exports.restoreTuiMatcher = restoreTuiMatcher;
14
8
  function updateTuiMatcher(options) {
15
9
  !options[`skip-logs`] &&
16
10
  colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} updating TuiMatcher typing to the typed version`);
@@ -38,3 +32,9 @@ function renameTuiTypedMatcher(options) {
38
32
  to: { name: `TuiMatcher`, moduleSpecifier: `@taiga-ui/cdk` },
39
33
  });
40
34
  }
35
+ function restoreTuiMatcher(options) {
36
+ updateTuiMatcher(options);
37
+ renameTuiTypedMatcher(options);
38
+ !options[`skip-logs`] && colored_log_1.titleLog(`${colored_log_1.FINISH_SYMBOL} successfully migrated \n`);
39
+ }
40
+ exports.restoreTuiMatcher = restoreTuiMatcher;