@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.
- package/classes/control.d.ts +1 -1
- package/constants/used-icons.d.ts +1 -1
- package/constants/version.d.ts +1 -1
- package/constants/version.js +1 -1
- package/directives/auto-focus/autofocus.options.d.ts +1 -1
- package/directives/for/for.directive.d.ts +3 -3
- package/directives/platform/platform.directive.d.ts +1 -1
- package/directives/value-changes/value-changes.directive.d.ts +3 -3
- package/esm2022/classes/control.mjs +2 -2
- package/esm2022/constants/used-icons.mjs +5 -5
- package/esm2022/constants/version.mjs +2 -2
- package/esm2022/directives/active-zone/active-zone.directive.mjs +2 -2
- package/esm2022/directives/auto-focus/handlers/ios.handler.mjs +3 -3
- package/esm2022/directives/click-outside/click-outside.directive.mjs +2 -2
- package/esm2022/directives/droppable/droppable.directive.mjs +3 -3
- package/esm2022/directives/for/for.directive.mjs +6 -6
- package/esm2022/directives/hovered/hovered.service.mjs +2 -2
- package/esm2022/directives/obscured/obscured.directive.mjs +2 -2
- package/esm2022/directives/obscured/obscured.service.mjs +2 -2
- package/esm2022/directives/pan/pan.service.mjs +2 -2
- package/esm2022/directives/platform/platform.directive.mjs +6 -6
- package/esm2022/directives/swipe/swipe.service.mjs +2 -2
- package/esm2022/directives/value-changes/value-changes.directive.mjs +6 -6
- package/esm2022/directives/zoom/zoom.service.mjs +4 -4
- package/esm2022/observables/control-value.mjs +2 -2
- package/esm2022/observables/drag-and-drop-from.mjs +2 -2
- package/esm2022/observables/events.mjs +3 -3
- package/esm2022/observables/if-map.mjs +2 -2
- package/esm2022/observables/must-be-present.mjs +2 -2
- package/esm2022/observables/zone.mjs +4 -4
- package/esm2022/pipes/filter/filter.pipe.mjs +2 -2
- package/esm2022/services/popover.service.mjs +3 -3
- package/esm2022/services/scroll.service.mjs +2 -2
- package/esm2022/services/static-request.service.mjs +1 -1
- package/esm2022/tokens/active-element.mjs +3 -3
- package/esm2022/tokens/removed-element.mjs +2 -2
- package/esm2022/utils/color/get-gradient-data.mjs +6 -0
- package/esm2022/utils/color/hex-to-rgb.mjs +2 -2
- package/esm2022/utils/color/index.mjs +3 -1
- package/esm2022/utils/color/parse-color.mjs +3 -3
- package/esm2022/utils/color/parse-gradient.mjs +70 -0
- package/esm2022/utils/color/rgb-to-hex.mjs +2 -2
- package/esm2022/utils/dom/get-element-obscurers.mjs +2 -2
- package/esm2022/utils/dom/get-element-point.mjs +6 -0
- package/esm2022/utils/dom/index.mjs +2 -1
- package/esm2022/utils/focus/focused-in.mjs +7 -0
- package/esm2022/utils/focus/index.mjs +2 -1
- package/esm2022/utils/miscellaneous/mark-control-as-touched-and-validate.mjs +3 -3
- package/esm2022/utils/miscellaneous/with-styles.mjs +2 -2
- package/fesm2022/taiga-ui-cdk-classes.mjs +1 -1
- package/fesm2022/taiga-ui-cdk-classes.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-constants.mjs +5 -5
- package/fesm2022/taiga-ui-cdk-constants.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-active-zone.mjs +1 -1
- package/fesm2022/taiga-ui-cdk-directives-active-zone.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs +2 -2
- package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-click-outside.mjs +1 -1
- package/fesm2022/taiga-ui-cdk-directives-click-outside.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-droppable.mjs +2 -2
- package/fesm2022/taiga-ui-cdk-directives-droppable.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-for.mjs +5 -5
- package/fesm2022/taiga-ui-cdk-directives-for.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-hovered.mjs +1 -1
- package/fesm2022/taiga-ui-cdk-directives-hovered.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-obscured.mjs +2 -2
- package/fesm2022/taiga-ui-cdk-directives-obscured.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-pan.mjs +1 -1
- package/fesm2022/taiga-ui-cdk-directives-pan.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-platform.mjs +5 -5
- package/fesm2022/taiga-ui-cdk-directives-platform.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-swipe.mjs +1 -1
- package/fesm2022/taiga-ui-cdk-directives-swipe.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-value-changes.mjs +5 -5
- package/fesm2022/taiga-ui-cdk-directives-value-changes.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-zoom.mjs +3 -3
- package/fesm2022/taiga-ui-cdk-directives-zoom.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-observables.mjs +9 -9
- package/fesm2022/taiga-ui-cdk-observables.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-pipes-filter.mjs +1 -1
- package/fesm2022/taiga-ui-cdk-pipes-filter.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-services.mjs +3 -3
- package/fesm2022/taiga-ui-cdk-services.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-tokens.mjs +3 -3
- package/fesm2022/taiga-ui-cdk-tokens.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-utils-color.mjs +80 -5
- package/fesm2022/taiga-ui-cdk-utils-color.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-utils-dom.mjs +7 -2
- package/fesm2022/taiga-ui-cdk-utils-dom.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-utils-focus.mjs +8 -2
- package/fesm2022/taiga-ui-cdk-utils-focus.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs +3 -3
- package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs.map +1 -1
- package/package.json +6 -6
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-add/steps/add-taiga-icons.js +1 -1
- package/schematics/ng-add/steps/add-taiga-modules.js +3 -3
- package/schematics/ng-update/steps/icons/replace-imports.js +5 -5
- package/schematics/ng-update/steps/index.d.ts +1 -0
- package/schematics/ng-update/steps/index.js +1 -0
- package/schematics/ng-update/steps/remove-module.js +2 -2
- package/schematics/ng-update/steps/rename-types.js +2 -2
- package/schematics/ng-update/steps/replace-deep-import.js +2 -2
- package/schematics/ng-update/steps/replace-enums.js +2 -2
- package/schematics/ng-update/steps/replace-identifier.js +1 -1
- package/schematics/ng-update/steps/replace-package-name.d.ts +5 -0
- package/schematics/ng-update/steps/replace-package-name.js +19 -0
- package/schematics/ng-update/steps/replace-services.js +5 -5
- package/schematics/ng-update/steps/show-warnings.js +4 -4
- package/schematics/ng-update/utils/replace-text.js +1 -1
- package/schematics/ng-update/utils/templates/replace-attr-values.js +3 -3
- package/schematics/ng-update/utils/templates/replace-attrs.js +1 -1
- package/schematics/ng-update/utils/templates/template-comments.js +4 -2
- package/schematics/ng-update/v3/constants/templates.js +9 -9
- package/schematics/ng-update/v3/index.js +1 -1
- package/schematics/ng-update/v3/steps/migrate-date-time.js +10 -10
- package/schematics/ng-update/v3/steps/migrate-polymorpheus.js +8 -8
- package/schematics/ng-update/v3/steps/migrate-progress.js +4 -4
- package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-range.js +3 -3
- package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-slider.js +4 -4
- package/schematics/ng-update/v3/steps/migrate-taiga-proprietary-icons.js +2 -2
- package/schematics/ng-update/v3/steps/migrate-templates.js +16 -16
- package/schematics/ng-update/v3/steps/migrate-textfield-controller.js +8 -8
- package/schematics/ng-update/v3/steps/miscellaneous.js +5 -5
- package/schematics/ng-update/v3/steps/replace-functions.js +12 -12
- package/schematics/ng-update/v3/steps/replace-styles.js +2 -2
- package/schematics/ng-update/v3-36/index.js +7 -17
- package/schematics/ng-update/v3-40/index.js +1 -1
- package/schematics/ng-update/v3-5/steps/migrate-expand-templates.js +4 -4
- package/schematics/ng-update/v4/index.js +9 -6
- package/schematics/ng-update/v4/migrate-css-vars/palette.d.ts +11 -2
- package/schematics/ng-update/v4/migrate-css-vars/palette.js +18 -8
- package/schematics/ng-update/v4/migrate-css-vars/rename-css-vars.js +10 -2
- package/schematics/ng-update/v4/migrate-icons/index.js +8 -6
- package/schematics/ng-update/v4/migrate-icons/rename-icons.js +2 -2
- package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.d.ts +2 -0
- package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.js +66 -0
- package/schematics/ng-update/v4/steps/constants/attr-to-directive-replace.js +2 -2
- package/schematics/ng-update/v4/steps/constants/attr-with-values-to-replace.js +9 -1
- package/schematics/ng-update/v4/steps/constants/attrs-to-replace.js +10 -9
- package/schematics/ng-update/v4/steps/constants/enums.js +31 -0
- package/schematics/ng-update/v4/steps/constants/html-comments.js +10 -0
- package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.js +180 -118
- package/schematics/ng-update/v4/steps/constants/inputs-to-remove.js +1 -1
- package/schematics/ng-update/v4/steps/constants/migration-warnings.js +5 -0
- package/schematics/ng-update/v4/steps/constants/modules-to-remove.js +8 -0
- package/schematics/ng-update/v4/steps/constants/modules-to-replace.d.ts +12 -0
- package/schematics/ng-update/v4/steps/constants/modules-to-replace.js +15 -0
- package/schematics/ng-update/v4/steps/constants/tags-to-replace.js +5 -4
- package/schematics/ng-update/v4/steps/constants/types.js +6 -0
- package/schematics/ng-update/v4/steps/index.d.ts +4 -0
- package/schematics/ng-update/v4/steps/index.js +4 -0
- package/schematics/ng-update/v4/steps/migrate-all-country-iso-codes.js +1 -1
- package/schematics/ng-update/v4/steps/migrate-destroy-service.js +7 -4
- package/schematics/ng-update/v4/steps/migrate-legacy-mask.js +2 -2
- package/schematics/ng-update/v4/steps/migrate-option-providers.js +2 -2
- package/schematics/ng-update/v4/steps/migrate-proprietary.js +3 -3
- package/schematics/ng-update/v4/steps/migrate-styles.js +1 -1
- package/schematics/ng-update/v4/steps/migrate-templates.js +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-avatar.js +24 -6
- package/schematics/ng-update/v4/steps/templates/migrate-badge.js +4 -4
- package/schematics/ng-update/v4/steps/templates/migrate-expandable.js +2 -2
- package/schematics/ng-update/v4/steps/templates/migrate-focusable.js +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-labeled.js +1 -3
- package/schematics/ng-update/v4/steps/templates/migrate-money.js +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-thumbnail-card.js +1 -1
- package/schematics/ng-update/v4/steps/templates/toggles/common.d.ts +1 -1
- package/schematics/ng-update/v4/steps/templates/toggles/common.js +3 -3
- package/schematics/ng-update/v4/steps/update-packages.d.ts +4 -0
- package/schematics/ng-update/v4/steps/update-packages.js +29 -0
- package/schematics/ng-update/v4/steps/utils/remove-attrs.js +1 -1
- package/schematics/ng-update/v4/steps/utils/replace-modules-with-providers.d.ts +13 -0
- package/schematics/ng-update/v4/steps/utils/replace-modules-with-providers.js +47 -0
- package/schematics/ng-update/v4/steps/utils/replace-substrings.js +1 -1
- package/schematics/ng-update/v4/tests/migrate-destroy-service/utils.js +1 -0
- package/schematics/utils/add-unique-import.js +1 -1
- package/schematics/utils/angular-json-manipulations.js +4 -4
- package/schematics/utils/get-named-import-references.js +4 -4
- package/schematics/utils/get-standalone-bootstrap-function.js +2 -2
- package/schematics/utils/import-manipulations.js +1 -1
- package/schematics/utils/push-to-array-property.js +1 -1
- package/schematics/utils/templates/elements.js +16 -13
- package/schematics/utils/templates/get-component-templates.js +1 -1
- package/schematics/utils/templates/inputs.js +1 -1
- package/schematics/utils/templates/ng-component-input-manipulations.js +5 -5
- package/utils/color/get-gradient-data.d.ts +1 -0
- package/utils/color/index.d.ts +2 -0
- package/utils/color/parse-gradient.d.ts +10 -0
- package/utils/dom/get-element-point.d.ts +2 -0
- package/utils/dom/index.d.ts +1 -0
- package/utils/focus/focused-in.d.ts +2 -0
- package/utils/focus/index.d.ts +1 -0
@@ -580,7 +580,7 @@ exports.ATTR_TO_DIRECTIVE = [
|
|
580
580
|
name: 'TuiTextfieldControllerModule',
|
581
581
|
moduleSpecifier: '@taiga-ui/core',
|
582
582
|
},
|
583
|
-
filterFn: element => { var _a; return ((_a = element.attrs.find(attr => attr.name === 'iconalign')) === null || _a === void 0 ? void 0 : _a.value) === 'right'; },
|
583
|
+
filterFn: (element) => { var _a; return ((_a = element.attrs.find((attr) => attr.name === 'iconalign')) === null || _a === void 0 ? void 0 : _a.value) === 'right'; },
|
584
584
|
},
|
585
585
|
{
|
586
586
|
componentSelector: 'tui-input',
|
@@ -590,10 +590,10 @@ exports.ATTR_TO_DIRECTIVE = [
|
|
590
590
|
name: 'TuiTextfieldControllerModule',
|
591
591
|
moduleSpecifier: '@taiga-ui/core',
|
592
592
|
},
|
593
|
-
filterFn: element => {
|
593
|
+
filterFn: (element) => {
|
594
594
|
var _a;
|
595
595
|
return !(0, elements_1.hasElementAttribute)(element, 'iconAlign') ||
|
596
|
-
((_a = element.attrs.find(attr => attr.name === 'iconalign')) === null || _a === void 0 ? void 0 : _a.value) === 'left';
|
596
|
+
((_a = element.attrs.find((attr) => attr.name === 'iconalign')) === null || _a === void 0 ? void 0 : _a.value) === 'left';
|
597
597
|
},
|
598
598
|
},
|
599
599
|
{
|
@@ -604,10 +604,10 @@ exports.ATTR_TO_DIRECTIVE = [
|
|
604
604
|
name: 'TuiTextfieldControllerModule',
|
605
605
|
moduleSpecifier: '@taiga-ui/core',
|
606
606
|
},
|
607
|
-
filterFn: element => {
|
607
|
+
filterFn: (element) => {
|
608
608
|
var _a;
|
609
609
|
return !(0, elements_1.hasElementAttribute)(element, 'iconAlign') ||
|
610
|
-
((_a = element.attrs.find(attr => attr.name === 'iconalign')) === null || _a === void 0 ? void 0 : _a.value) === 'right';
|
610
|
+
((_a = element.attrs.find((attr) => attr.name === 'iconalign')) === null || _a === void 0 ? void 0 : _a.value) === 'right';
|
611
611
|
},
|
612
612
|
},
|
613
613
|
{
|
@@ -618,7 +618,7 @@ exports.ATTR_TO_DIRECTIVE = [
|
|
618
618
|
name: 'TuiTextfieldControllerModule',
|
619
619
|
moduleSpecifier: '@taiga-ui/core',
|
620
620
|
},
|
621
|
-
filterFn: element => { var _a; return ((_a = element.attrs.find(attr => attr.name === 'iconalign')) === null || _a === void 0 ? void 0 : _a.value) === 'left'; },
|
621
|
+
filterFn: (element) => { var _a; return ((_a = element.attrs.find((attr) => attr.name === 'iconalign')) === null || _a === void 0 ? void 0 : _a.value) === 'left'; },
|
622
622
|
},
|
623
623
|
{
|
624
624
|
componentSelector: 'tui-input-tag',
|
@@ -628,10 +628,10 @@ exports.ATTR_TO_DIRECTIVE = [
|
|
628
628
|
name: 'TuiTextfieldControllerModule',
|
629
629
|
moduleSpecifier: '@taiga-ui/core',
|
630
630
|
},
|
631
|
-
filterFn: element => {
|
631
|
+
filterFn: (element) => {
|
632
632
|
var _a;
|
633
633
|
return !(0, elements_1.hasElementAttribute)(element, 'iconAlign') ||
|
634
|
-
((_a = element.attrs.find(attr => attr.name === 'iconalign')) === null || _a === void 0 ? void 0 : _a.value) === 'right';
|
634
|
+
((_a = element.attrs.find((attr) => attr.name === 'iconalign')) === null || _a === void 0 ? void 0 : _a.value) === 'right';
|
635
635
|
},
|
636
636
|
},
|
637
637
|
{
|
@@ -642,7 +642,7 @@ exports.ATTR_TO_DIRECTIVE = [
|
|
642
642
|
name: 'TuiTextfieldControllerModule',
|
643
643
|
moduleSpecifier: '@taiga-ui/core',
|
644
644
|
},
|
645
|
-
filterFn: element => { var _a; return ((_a = element.attrs.find(attr => attr.name === 'iconalign')) === null || _a === void 0 ? void 0 : _a.value) === 'left'; },
|
645
|
+
filterFn: (element) => { var _a; return ((_a = element.attrs.find((attr) => attr.name === 'iconalign')) === null || _a === void 0 ? void 0 : _a.value) === 'left'; },
|
646
646
|
},
|
647
647
|
{
|
648
648
|
componentSelector: '*',
|
@@ -70,7 +70,7 @@ function addTaigaStyles(options) {
|
|
70
70
|
`– Manually replace "${taiga_styles_1.TAIGA_GLOBAL_OLD_STYLE}" with "${taiga_styles_1.TAIGA_GLOBAL_NEW_STYLE}" inside "styles" of angular.json (don't forget to install "@taiga-ui/styles")`);
|
71
71
|
return;
|
72
72
|
}
|
73
|
-
return (0, angular_json_manipulations_1.addStylesToAngularJson)(options, context, taigaStyles, existingStyles => !!(existingStyles === null || existingStyles === void 0 ? void 0 : existingStyles.some(style => typeof style === 'string' && style.includes('tinkoff-theme'))), stylesToReplace, tree);
|
73
|
+
return (0, angular_json_manipulations_1.addStylesToAngularJson)(options, context, taigaStyles, (existingStyles) => !!(existingStyles === null || existingStyles === void 0 ? void 0 : existingStyles.some((style) => typeof style === 'string' && style.includes('tinkoff-theme'))), stylesToReplace, tree);
|
74
74
|
});
|
75
75
|
}
|
76
76
|
function showNormalizeWarning() {
|
@@ -9,7 +9,7 @@ const get_named_import_references_1 = require("../../../utils/get-named-import-r
|
|
9
9
|
const insert_todo_1 = require("../../../utils/insert-todo");
|
10
10
|
function migrateProperty({ namedImport, moduleSpecifier, from, callback, }) {
|
11
11
|
const references = (0, get_named_import_references_1.getNamedImportReferences)(namedImport, moduleSpecifier);
|
12
|
-
references.forEach(ref => {
|
12
|
+
references.forEach((ref) => {
|
13
13
|
if (ref.wasForgotten()) {
|
14
14
|
return;
|
15
15
|
}
|
@@ -19,7 +19,7 @@ function migrateProperty({ namedImport, moduleSpecifier, from, callback, }) {
|
|
19
19
|
}
|
20
20
|
if (ng_morph_1.Node.isNewExpression(parent)) {
|
21
21
|
const accessExpression = parent.getFirstAncestorByKind(ng_morph_1.SyntaxKind.PropertyAccessExpression);
|
22
|
-
const searched = accessExpression === null || accessExpression === void 0 ? void 0 : accessExpression.getChildrenOfKind(ng_morph_1.SyntaxKind.Identifier).find(identifier => identifier.getText() === from);
|
22
|
+
const searched = accessExpression === null || accessExpression === void 0 ? void 0 : accessExpression.getChildrenOfKind(ng_morph_1.SyntaxKind.Identifier).find((identifier) => identifier.getText() === from);
|
23
23
|
if (searched && accessExpression) {
|
24
24
|
callback(accessExpression);
|
25
25
|
return;
|
@@ -28,7 +28,7 @@ function migrateProperty({ namedImport, moduleSpecifier, from, callback, }) {
|
|
28
28
|
if (ng_morph_1.Node.isPropertyAccessExpression(parent)) {
|
29
29
|
const searched = parent
|
30
30
|
.getChildrenOfKind(ng_morph_1.SyntaxKind.Identifier)
|
31
|
-
.find(identifier => identifier.getText() === from);
|
31
|
+
.find((identifier) => identifier.getText() === from);
|
32
32
|
if (searched && !parent.wasForgotten()) {
|
33
33
|
callback(parent);
|
34
34
|
return;
|
@@ -66,8 +66,8 @@ function replaceIdentifierReferences(identifier, from, callback) {
|
|
66
66
|
* If `identifier` is equal to `var` from `method1` (1),
|
67
67
|
* then `identifier.findReferencesAsNodes` will return array with 2 references: (2) and (3).
|
68
68
|
*/
|
69
|
-
.filter(ref => !areBothObjectDestructuring(ref, identifier))
|
70
|
-
.forEach(ref => {
|
69
|
+
.filter((ref) => !areBothObjectDestructuring(ref, identifier))
|
70
|
+
.forEach((ref) => {
|
71
71
|
if (ref.wasForgotten()) {
|
72
72
|
return;
|
73
73
|
}
|
@@ -85,7 +85,7 @@ function replaceIdentifierReferences(identifier, from, callback) {
|
|
85
85
|
if (ng_morph_1.Node.isPropertyAccessExpression(parent)) {
|
86
86
|
const searched = parent
|
87
87
|
.getChildrenOfKind(ng_morph_1.SyntaxKind.Identifier)
|
88
|
-
.find(identifier => identifier.getText() === from);
|
88
|
+
.find((identifier) => identifier.getText() === from);
|
89
89
|
if (searched) {
|
90
90
|
callback(parent);
|
91
91
|
}
|
@@ -121,7 +121,7 @@ function dateTimeMigrations(options) {
|
|
121
121
|
namedImport: 'TuiDay',
|
122
122
|
moduleSpecifier: '@taiga-ui/cdk',
|
123
123
|
from: 'formattedDay',
|
124
|
-
callback: node => node.replaceWithText(node.getText().replace('formattedDay', 'getFormattedDay("DMY", ".")')),
|
124
|
+
callback: (node) => node.replaceWithText(node.getText().replace('formattedDay', 'getFormattedDay("DMY", ".")')),
|
125
125
|
});
|
126
126
|
!options['skip-logs'] &&
|
127
127
|
(0, colored_log_1.processLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.PROCESSING_SYMBOL}TuiDay.formattedDay ` +
|
@@ -131,7 +131,7 @@ function dateTimeMigrations(options) {
|
|
131
131
|
namedImport: 'TuiDayRange',
|
132
132
|
moduleSpecifier: '@taiga-ui/cdk',
|
133
133
|
from: 'formattedDayRange',
|
134
|
-
callback: node => node.replaceWithText(node
|
134
|
+
callback: (node) => node.replaceWithText(node
|
135
135
|
.getText()
|
136
136
|
.replace('formattedDayRange', 'getFormattedDayRange("DMY", ".")')),
|
137
137
|
});
|
@@ -143,7 +143,7 @@ function dateTimeMigrations(options) {
|
|
143
143
|
namedImport: 'TuiDayRange',
|
144
144
|
moduleSpecifier: '@taiga-ui/cdk',
|
145
145
|
from: 'normalizeParse',
|
146
|
-
callback: node => {
|
146
|
+
callback: (node) => {
|
147
147
|
const parent = node.getParent();
|
148
148
|
if (ng_morph_1.Node.isCallExpression(parent)) {
|
149
149
|
changeNormalizeArgs(parent);
|
@@ -195,7 +195,7 @@ function dateTimeMigrations(options) {
|
|
195
195
|
namedImport,
|
196
196
|
moduleSpecifier: '@taiga-ui/cdk',
|
197
197
|
from: field,
|
198
|
-
callback: node => insertTodoBeforeNode(node, message),
|
198
|
+
callback: (node) => insertTodoBeforeNode(node, message),
|
199
199
|
});
|
200
200
|
!options['skip-logs'] &&
|
201
201
|
(0, colored_log_1.processLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.PROCESSING_SYMBOL}${namedImport}.${field} ` +
|
@@ -18,9 +18,9 @@ function insertPolymorpheus({ element, contentVal, contextVal, recorder, templat
|
|
18
18
|
}
|
19
19
|
function removeOldInputs(recorder, template, templateOffset) {
|
20
20
|
const offsets = [
|
21
|
-
...(0, ng_component_input_manipulations_1.getInputPropertyOffsets)(template, '[content]', ['*'], el => (0, elements_1.hasElementAttribute)(el, 'polymorpheus-outlet')),
|
22
|
-
...(0, ng_component_input_manipulations_1.getInputPropertyOffsets)(template, '[context]', ['*'], el => (0, elements_1.hasElementAttribute)(el, 'polymorpheus-outlet')),
|
23
|
-
...(0, ng_component_input_manipulations_1.getInputPropertyOffsets)(template, 'polymorpheus-outlet', ['*'], el => (0, elements_1.hasElementAttribute)(el, 'polymorpheus-outlet')),
|
21
|
+
...(0, ng_component_input_manipulations_1.getInputPropertyOffsets)(template, '[content]', ['*'], (el) => (0, elements_1.hasElementAttribute)(el, 'polymorpheus-outlet')),
|
22
|
+
...(0, ng_component_input_manipulations_1.getInputPropertyOffsets)(template, '[context]', ['*'], (el) => (0, elements_1.hasElementAttribute)(el, 'polymorpheus-outlet')),
|
23
|
+
...(0, ng_component_input_manipulations_1.getInputPropertyOffsets)(template, 'polymorpheus-outlet', ['*'], (el) => (0, elements_1.hasElementAttribute)(el, 'polymorpheus-outlet')),
|
24
24
|
];
|
25
25
|
offsets.forEach(([start, end]) => {
|
26
26
|
recorder.remove(start + templateOffset, end - start);
|
@@ -28,7 +28,7 @@ function removeOldInputs(recorder, template, templateOffset) {
|
|
28
28
|
}
|
29
29
|
function insertPolymorpheusWithDefault({ template, defaultTemplateEl, recorder, templateOffset, contentVal, contextVal, }) {
|
30
30
|
var _a, _b;
|
31
|
-
const templateVar = defaultTemplateEl.attrs.find(attr => attr.name.startsWith('let-'));
|
31
|
+
const templateVar = defaultTemplateEl.attrs.find((attr) => attr.name.startsWith('let-'));
|
32
32
|
let templateVarName = templateVar === null || templateVar === void 0 ? void 0 : templateVar.name;
|
33
33
|
if (templateVarName === null || templateVarName === void 0 ? void 0 : templateVarName.startsWith('let-')) {
|
34
34
|
templateVarName = (_a = template.match(new RegExp(templateVarName, 'i'))) === null || _a === void 0 ? void 0 : _a[0];
|
@@ -45,11 +45,11 @@ function migratePolymorpheus({ resource, fileSystem, recorder, }) {
|
|
45
45
|
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
46
46
|
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
47
47
|
const elements = (0, elements_1.findElementsWithAttribute)(template, 'polymorpheus-outlet');
|
48
|
-
elements.forEach(element => {
|
48
|
+
elements.forEach((element) => {
|
49
49
|
var _a, _b;
|
50
|
-
const contentVal = (_a = element.attrs.find(attr => attr.name === '[content]')) === null || _a === void 0 ? void 0 : _a.value;
|
51
|
-
const contextVal = (_b = element.attrs.find(attr => attr.name === '[context]')) === null || _b === void 0 ? void 0 : _b.value;
|
52
|
-
const defaultTemplateEl = (0, elements_1.findElementsByFn)(element.childNodes, el => el.tagName === 'ng-template')[0];
|
50
|
+
const contentVal = (_a = element.attrs.find((attr) => attr.name === '[content]')) === null || _a === void 0 ? void 0 : _a.value;
|
51
|
+
const contextVal = (_b = element.attrs.find((attr) => attr.name === '[context]')) === null || _b === void 0 ? void 0 : _b.value;
|
52
|
+
const defaultTemplateEl = (0, elements_1.findElementsByFn)(element.childNodes, (el) => el.tagName === 'ng-template')[0];
|
53
53
|
if (!contentVal) {
|
54
54
|
return;
|
55
55
|
}
|
@@ -17,9 +17,9 @@ function replaceProgressColorSegmentsPipe(templateResource, fileSystem) {
|
|
17
17
|
const recorder = fileSystem.edit(path);
|
18
18
|
(0, elements_1.findElementsWithAttribute)(template, PROPERTY_FOR_DEPRECATED_PIPES)
|
19
19
|
.filter(isProgressWithDeprecatedPipe)
|
20
|
-
.forEach(progressEl => {
|
20
|
+
.forEach((progressEl) => {
|
21
21
|
var _a, _b;
|
22
|
-
const oldValue = ((_a = progressEl.attrs.find(attr => attr.name === PROPERTY_FOR_DEPRECATED_PIPES)) === null || _a === void 0 ? void 0 : _a.value) || '';
|
22
|
+
const oldValue = ((_a = progressEl.attrs.find((attr) => attr.name === PROPERTY_FOR_DEPRECATED_PIPES)) === null || _a === void 0 ? void 0 : _a.value) || '';
|
23
23
|
const newValue = oldValue.replaceAll(exports.DEPRECATED_PROGRESS_PIPES_REG, '');
|
24
24
|
const attrLocations = (_b = progressEl.sourceCodeLocation) === null || _b === void 0 ? void 0 : _b.attrs;
|
25
25
|
if (attrLocations) {
|
@@ -32,14 +32,14 @@ function replaceProgressColorSegmentsPipe(templateResource, fileSystem) {
|
|
32
32
|
exports.replaceProgressColorSegmentsPipe = replaceProgressColorSegmentsPipe;
|
33
33
|
function isProgressWithDeprecatedPipe(element) {
|
34
34
|
return (element.tagName === 'progress' &&
|
35
|
-
element.attrs.some(attr => attr.name === PROPERTY_FOR_DEPRECATED_PIPES &&
|
35
|
+
element.attrs.some((attr) => attr.name === PROPERTY_FOR_DEPRECATED_PIPES &&
|
36
36
|
attr.value.match(exports.DEPRECATED_PROGRESS_PIPES_REG)));
|
37
37
|
}
|
38
38
|
exports.isProgressWithDeprecatedPipe = isProgressWithDeprecatedPipe;
|
39
39
|
function migrateProgress(fileSystem, options) {
|
40
40
|
!options['skip-logs'] &&
|
41
41
|
(0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating progress bars...`);
|
42
|
-
(0, get_component_templates_1.getComponentTemplates)(constants_1.ALL_TS_FILES).forEach(templateResource => replaceProgressColorSegmentsPipe(templateResource, fileSystem));
|
42
|
+
(0, get_component_templates_1.getComponentTemplates)(constants_1.ALL_TS_FILES).forEach((templateResource) => replaceProgressColorSegmentsPipe(templateResource, fileSystem));
|
43
43
|
fileSystem.commitEdits();
|
44
44
|
(0, ng_morph_1.saveActiveProject)();
|
45
45
|
(0, ng_morph_1.setActiveProject)((0, ng_morph_1.createProject)(fileSystem.tree, (0, project_root_1.projectRoot)(), constants_1.ALL_FILES));
|
@@ -65,7 +65,7 @@ function migrateInputRange(fileSystem, options) {
|
|
65
65
|
total: templateResources.length,
|
66
66
|
prefix: '[replaceMinMaxLabel]',
|
67
67
|
});
|
68
|
-
templateResources.forEach(templateResource => {
|
68
|
+
templateResources.forEach((templateResource) => {
|
69
69
|
!options['skip-logs'] && progressLog(templateResource.componentPath);
|
70
70
|
replaceMinLabel(templateResource, fileSystem, COMPONENTS_WITH_MIN_LABELS);
|
71
71
|
replaceMaxLabel(templateResource, fileSystem, COMPONENTS_WITH_MAX_LABELS);
|
@@ -75,7 +75,7 @@ function migrateInputRange(fileSystem, options) {
|
|
75
75
|
total: COMPONENTS_WITH_MIN_LABELS.size,
|
76
76
|
prefix: '[COMPONENTS_WITH_MIN_LABELS]',
|
77
77
|
});
|
78
|
-
Array.from(COMPONENTS_WITH_MIN_LABELS).forEach(componentPath => {
|
78
|
+
Array.from(COMPONENTS_WITH_MIN_LABELS).forEach((componentPath) => {
|
79
79
|
!options['skip-logs'] && progressLog(componentPath);
|
80
80
|
addMinMaxLabelMethod(componentPath, MIN_LABELS_MIGRATION_METHOD_NAME, [
|
81
81
|
'const currentValue = context.$implicit;',
|
@@ -89,7 +89,7 @@ function migrateInputRange(fileSystem, options) {
|
|
89
89
|
total: COMPONENTS_WITH_MAX_LABELS.size,
|
90
90
|
prefix: '[COMPONENTS_WITH_MAX_LABELS]',
|
91
91
|
});
|
92
|
-
Array.from(COMPONENTS_WITH_MAX_LABELS).forEach(componentPath => {
|
92
|
+
Array.from(COMPONENTS_WITH_MAX_LABELS).forEach((componentPath) => {
|
93
93
|
!options['skip-logs'] && progressLog(componentPath);
|
94
94
|
addMinMaxLabelMethod(componentPath, MAX_LABELS_MIGRATION_METHOD_NAME, [
|
95
95
|
'const currentValue = context.$implicit;',
|
@@ -26,14 +26,14 @@ function replaceMinMaxLabels(templateResource, fileSystem, modifiedComponentStor
|
|
26
26
|
from: 'minLabel',
|
27
27
|
to: '[valueContent]',
|
28
28
|
newValue: MIN_MAX_LABELS_MIGRATION_METHOD_NAME,
|
29
|
-
filterFn: element => !(0, elements_1.hasElementAttribute)(element, 'maxLabel'),
|
29
|
+
filterFn: (element) => !(0, elements_1.hasElementAttribute)(element, 'maxLabel'),
|
30
30
|
});
|
31
31
|
(0, ng_component_input_manipulations_1.removeInputProperty)({
|
32
32
|
templateResource,
|
33
33
|
fileSystem,
|
34
34
|
componentSelector: 'tui-input-slider',
|
35
35
|
inputProperty: 'minLabel',
|
36
|
-
filterFn: element => (0, elements_1.hasElementAttribute)(element, 'maxLabel'),
|
36
|
+
filterFn: (element) => (0, elements_1.hasElementAttribute)(element, 'maxLabel'),
|
37
37
|
});
|
38
38
|
if (wasMaxLabelModified || wasMinLabelModified) {
|
39
39
|
modifiedComponentStorage.add(templateResource.componentPath);
|
@@ -67,7 +67,7 @@ function migrateInputSlider(fileSystem, options) {
|
|
67
67
|
total: templateResources.length,
|
68
68
|
prefix: '[replaceMinMaxLabels]',
|
69
69
|
});
|
70
|
-
templateResources.forEach(templateResource => {
|
70
|
+
templateResources.forEach((templateResource) => {
|
71
71
|
!options['skip-logs'] && progressLog(templateResource.componentPath);
|
72
72
|
replaceMinMaxLabels(templateResource, fileSystem, COMPONENTS_WITH_MIN_MAX_LABELS);
|
73
73
|
});
|
@@ -82,7 +82,7 @@ function migrateInputSlider(fileSystem, options) {
|
|
82
82
|
total: COMPONENTS_WITH_MIN_MAX_LABELS.size,
|
83
83
|
prefix: '[addMinMaxLabelMethod]',
|
84
84
|
});
|
85
|
-
Array.from(COMPONENTS_WITH_MIN_MAX_LABELS).forEach(componentPath => {
|
85
|
+
Array.from(COMPONENTS_WITH_MIN_MAX_LABELS).forEach((componentPath) => {
|
86
86
|
!options['skip-logs'] && progressLog(componentPath);
|
87
87
|
addMinMaxLabelMethod(componentPath);
|
88
88
|
});
|
@@ -31,7 +31,7 @@ function migrateTaigaProprietaryIcons(options) {
|
|
31
31
|
return;
|
32
32
|
}
|
33
33
|
return (0, ng_morph_1.getSourceFiles)('**/angular.json').length > 0
|
34
|
-
? (0, workspace_1.updateWorkspace)(workspace => {
|
34
|
+
? (0, workspace_1.updateWorkspace)((workspace) => {
|
35
35
|
if (proprietaryIcons === null) {
|
36
36
|
return;
|
37
37
|
}
|
@@ -51,7 +51,7 @@ function migrateTaigaProprietaryIcons(options) {
|
|
51
51
|
}
|
52
52
|
if (Array.isArray(targetOptions === null || targetOptions === void 0 ? void 0 : targetOptions.assets)) {
|
53
53
|
const tdsSrc = '@taiga-ui/proprietary-tds-icons/src';
|
54
|
-
const hasIcons = targetOptions.assets.find(asset => {
|
54
|
+
const hasIcons = targetOptions.assets.find((asset) => {
|
55
55
|
var _a;
|
56
56
|
return (0, is_string_1.tuiIsString)(asset)
|
57
57
|
? asset.includes(tdsSrc)
|
@@ -52,9 +52,9 @@ function addHTMLCommentTags({ resource, recorder, fileSystem, }) {
|
|
52
52
|
...(0, elements_1.findElementsWithAttribute)(template, withAttr),
|
53
53
|
...(0, elements_1.findElementsWithAttribute)(template, `[${withAttr}]`),
|
54
54
|
]
|
55
|
-
.filter(el => el.tagName === tag)
|
56
|
-
.map(el => { var _a; return (((_a = el.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.startOffset) || 0) + templateOffset; });
|
57
|
-
elementStartOffsets.forEach(offset => {
|
55
|
+
.filter((el) => el.tagName === tag)
|
56
|
+
.map((el) => { var _a; return (((_a = el.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.startOffset) || 0) + templateOffset; });
|
57
|
+
elementStartOffsets.forEach((offset) => {
|
58
58
|
recorder.insertRight(offset, `<!-- ${insert_todo_1.TODO_MARK} ${comment} -->\n`);
|
59
59
|
});
|
60
60
|
});
|
@@ -63,9 +63,9 @@ function replaceBreadcrumbs({ resource, recorder, fileSystem, }) {
|
|
63
63
|
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
64
64
|
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
65
65
|
const elements = (0, elements_1.findElementsByTagName)(template, 'tui-breadcrumbs');
|
66
|
-
elements.forEach(element => {
|
66
|
+
elements.forEach((element) => {
|
67
67
|
var _a, _b, _c, _d, _e;
|
68
|
-
const itemsAttr = element.attrs.find(attr => attr.name === '[items]');
|
68
|
+
const itemsAttr = element.attrs.find((attr) => attr.name === '[items]');
|
69
69
|
const itemsValue = itemsAttr === null || itemsAttr === void 0 ? void 0 : itemsAttr.value;
|
70
70
|
const insertTo = (_c = (_b = (_a = element === null || element === void 0 ? void 0 : element.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.startTag) === null || _b === void 0 ? void 0 : _b.endOffset) !== null && _c !== void 0 ? _c : 0;
|
71
71
|
if (!itemsValue || !insertTo) {
|
@@ -90,9 +90,9 @@ function replaceFieldError({ resource, recorder, fileSystem, }) {
|
|
90
90
|
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
91
91
|
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
92
92
|
const elements = (0, elements_1.findElementsByTagName)(template, 'tui-field-error');
|
93
|
-
elements.forEach(element => {
|
93
|
+
elements.forEach((element) => {
|
94
94
|
var _a, _b;
|
95
|
-
const orderAttr = element.attrs.find(attr => attr.name === '[order]');
|
95
|
+
const orderAttr = element.attrs.find((attr) => attr.name === '[order]');
|
96
96
|
const orderVal = orderAttr === null || orderAttr === void 0 ? void 0 : orderAttr.value;
|
97
97
|
if (orderAttr) {
|
98
98
|
const { startOffset = 0, endOffset = 0 } = ((_b = (_a = element.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.attrs) === null || _b === void 0 ? void 0 : _b['[order]']) || {};
|
@@ -107,7 +107,7 @@ function replaceFieldError({ resource, recorder, fileSystem, }) {
|
|
107
107
|
}
|
108
108
|
function addEditorProviders({ resource, fileSystem, }) {
|
109
109
|
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
110
|
-
const elements = (0, elements_1.findElementsByTagName)(template, 'tui-editor').filter(element => !(0, elements_1.hasElementAttribute)(element, 'new'));
|
110
|
+
const elements = (0, elements_1.findElementsByTagName)(template, 'tui-editor').filter((element) => !(0, elements_1.hasElementAttribute)(element, 'new'));
|
111
111
|
if (elements.length) {
|
112
112
|
const componentPath = resource.componentPath;
|
113
113
|
const componentClass = (0, ng_morph_1.getNgComponents)(componentPath);
|
@@ -123,10 +123,10 @@ const HIDE_SELECTED_PIPE_WITH_ARGS_REG = /\|\s*tuiHideSelected(\s*:\s*[^|'"]*)?/
|
|
123
123
|
function migrateTuiHideSelectedPipe({ resource, fileSystem, recorder, }) {
|
124
124
|
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
125
125
|
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
126
|
-
const elementsWithPipe = (0, elements_1.findElementsInTemplateByFn)(template, el => { var _a; return (_a = el.attrs) === null || _a === void 0 ? void 0 : _a.some(attr => attr.value.match(HIDE_SELECTED_PIPE_WITH_ARGS_REG)); });
|
127
|
-
elementsWithPipe.forEach(el => {
|
126
|
+
const elementsWithPipe = (0, elements_1.findElementsInTemplateByFn)(template, (el) => { var _a; return (_a = el.attrs) === null || _a === void 0 ? void 0 : _a.some((attr) => attr.value.match(HIDE_SELECTED_PIPE_WITH_ARGS_REG)); });
|
127
|
+
elementsWithPipe.forEach((el) => {
|
128
128
|
var _a;
|
129
|
-
const { name, value: oldValue } = el.attrs.find(attr => attr.value.match(HIDE_SELECTED_PIPE_WITH_ARGS_REG)) ||
|
129
|
+
const { name, value: oldValue } = el.attrs.find((attr) => attr.value.match(HIDE_SELECTED_PIPE_WITH_ARGS_REG)) ||
|
130
130
|
{};
|
131
131
|
const attrLocations = (_a = el.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.attrs;
|
132
132
|
if (!name || !oldValue || !attrLocations) {
|
@@ -142,12 +142,12 @@ function migrateTuiHideSelectedPipe({ resource, fileSystem, recorder, }) {
|
|
142
142
|
function migrateBinaryAttributes({ resource, fileSystem, recorder, }) {
|
143
143
|
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
144
144
|
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
145
|
-
templates_1.TRUTHY_BOOLEAN_INPUT_TO_HTML_BINARY_ATTRIBUTE.forEach(attrName => {
|
146
|
-
const elements = (0, elements_1.findElementsInTemplateByFn)(template, el => {
|
145
|
+
templates_1.TRUTHY_BOOLEAN_INPUT_TO_HTML_BINARY_ATTRIBUTE.forEach((attrName) => {
|
146
|
+
const elements = (0, elements_1.findElementsInTemplateByFn)(template, (el) => {
|
147
147
|
var _a;
|
148
|
-
return (_a = el.attrs) === null || _a === void 0 ? void 0 : _a.some(attr => attr.value === 'true' && attr.name.includes(attrName.toLowerCase()));
|
148
|
+
return (_a = el.attrs) === null || _a === void 0 ? void 0 : _a.some((attr) => attr.value === 'true' && attr.name.includes(attrName.toLowerCase()));
|
149
149
|
});
|
150
|
-
elements.forEach(el => {
|
150
|
+
elements.forEach((el) => {
|
151
151
|
var _a;
|
152
152
|
const attrLocations = (_a = el.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.attrs;
|
153
153
|
if (!attrLocations) {
|
@@ -201,7 +201,7 @@ function migrateTemplates(fileSystem, options) {
|
|
201
201
|
const progressLog = (0, progress_1.setupProgressLogger)({
|
202
202
|
total: componentWithTemplatesPaths.length,
|
203
203
|
});
|
204
|
-
componentWithTemplatesPaths.forEach(resource => {
|
204
|
+
componentWithTemplatesPaths.forEach((resource) => {
|
205
205
|
const path = fileSystem.resolve((0, template_resource_1.getPathFromTemplateResource)(resource));
|
206
206
|
const recorder = fileSystem.edit(path);
|
207
207
|
actions.forEach((action, actionIndex) => {
|
@@ -34,11 +34,11 @@ const ATTRS_MAP = {
|
|
34
34
|
'[tuitextfieldtype]': '[attr.type]',
|
35
35
|
'[tuitextfieldexampletext]': '[attr.placeholder]',
|
36
36
|
};
|
37
|
-
const CONTROLLER_ITEMS = Object.keys(ATTRS_MAP).map(attr => attr.toLowerCase());
|
37
|
+
const CONTROLLER_ITEMS = Object.keys(ATTRS_MAP).map((attr) => attr.toLowerCase());
|
38
38
|
function insertTuiTextfieldInput({ element, attrs, recorder, templateOffset, }) {
|
39
39
|
var _a, _b;
|
40
40
|
const newAttrs = attrs
|
41
|
-
.map(attr => `${ATTRS_MAP[attr.name]}="${attr.value}"`)
|
41
|
+
.map((attr) => `${ATTRS_MAP[attr.name]}="${attr.value}"`)
|
42
42
|
.join('\n');
|
43
43
|
const content = element.tagName === 'tui-text-area'
|
44
44
|
? `<textarea tuiTextfield ${newAttrs}></textarea> `
|
@@ -49,7 +49,7 @@ function insertTuiTextfieldInput({ element, attrs, recorder, templateOffset, })
|
|
49
49
|
}
|
50
50
|
}
|
51
51
|
function addAttrToExistingInput({ existingInput, attrs, recorder, templateOffset, }) {
|
52
|
-
attrs.forEach(attr => {
|
52
|
+
attrs.forEach((attr) => {
|
53
53
|
var _a, _b, _c;
|
54
54
|
const insertTo = (_c = (_b = (_a = existingInput.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.attrs) === null || _b === void 0 ? void 0 : _b.tuitextfield) === null || _c === void 0 ? void 0 : _c.endOffset;
|
55
55
|
if (insertTo) {
|
@@ -58,14 +58,14 @@ function addAttrToExistingInput({ existingInput, attrs, recorder, templateOffset
|
|
58
58
|
});
|
59
59
|
}
|
60
60
|
function removeOldInputs(recorder, template, templateOffset) {
|
61
|
-
const offsets = (0, ng_morph_1.arrayFlat)(CONTROLLER_ITEMS.map(item => (0, ng_component_input_manipulations_1.getInputPropertyOffsets)(template, item, getTagsToRemove(item))));
|
61
|
+
const offsets = (0, ng_morph_1.arrayFlat)(CONTROLLER_ITEMS.map((item) => (0, ng_component_input_manipulations_1.getInputPropertyOffsets)(template, item, getTagsToRemove(item))));
|
62
62
|
offsets.forEach(([start, end]) => {
|
63
63
|
recorder.remove(start + templateOffset, end - start);
|
64
64
|
});
|
65
65
|
}
|
66
66
|
function getTagsToRemove(attrName) {
|
67
67
|
return ['[tuitextfieldmaxlength]', 'tuitextfieldmaxlength'].includes(attrName)
|
68
|
-
? TEXTFIELDS.filter(tag => tag !== 'tui-text-area')
|
68
|
+
? TEXTFIELDS.filter((tag) => tag !== 'tui-text-area')
|
69
69
|
: TEXTFIELDS;
|
70
70
|
}
|
71
71
|
const excludedAttrs = {
|
@@ -79,12 +79,12 @@ function migrateTextfieldController({ resource, fileSystem, recorder, }) {
|
|
79
79
|
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
80
80
|
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
81
81
|
const elements = (0, 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));
|
82
|
+
elements.forEach((element) => {
|
83
|
+
const attrs = element.attrs.filter((attr) => CONTROLLER_ITEMS.includes(attr.name) && !exclusion(element, attr.name));
|
84
84
|
if (!attrs.length) {
|
85
85
|
return;
|
86
86
|
}
|
87
|
-
const existingInput = (0, elements_1.findElementsByFn)(element.childNodes, el => (el.tagName === 'input' || el.tagName === 'textarea') &&
|
87
|
+
const existingInput = (0, elements_1.findElementsByFn)(element.childNodes, (el) => (el.tagName === 'input' || el.tagName === 'textarea') &&
|
88
88
|
(0, elements_1.hasElementAttribute)(el, 'tuiTextfield'))[0];
|
89
89
|
if (existingInput) {
|
90
90
|
addAttrToExistingInput({ existingInput, attrs, recorder, templateOffset });
|
@@ -7,7 +7,7 @@ const get_named_import_references_1 = require("../../../utils/get-named-import-r
|
|
7
7
|
const insert_todo_1 = require("../../../utils/insert-todo");
|
8
8
|
function addWarningToMethod(className, method, message) {
|
9
9
|
const references = (0, get_named_import_references_1.getNamedImportReferences)(className);
|
10
|
-
references.forEach(ref => {
|
10
|
+
references.forEach((ref) => {
|
11
11
|
const parent = ref.getParent();
|
12
12
|
if (ng_morph_1.Node.isTypeReference(parent)) {
|
13
13
|
checkMethod(parent, method, message);
|
@@ -16,12 +16,12 @@ function addWarningToMethod(className, method, message) {
|
|
16
16
|
}
|
17
17
|
function replaceEnumProperty({ enumName, from, to, }) {
|
18
18
|
const references = (0, get_named_import_references_1.getNamedImportReferences)(enumName);
|
19
|
-
references.forEach(ref => {
|
19
|
+
references.forEach((ref) => {
|
20
20
|
const parent = ref.getParent();
|
21
21
|
if (!ng_morph_1.Node.isPropertyAccessExpression(parent)) {
|
22
22
|
return;
|
23
23
|
}
|
24
|
-
parent.getChildren().forEach(node => {
|
24
|
+
parent.getChildren().forEach((node) => {
|
25
25
|
if (node.getText() === from) {
|
26
26
|
node.replaceWithText(to);
|
27
27
|
}
|
@@ -31,7 +31,7 @@ function replaceEnumProperty({ enumName, from, to, }) {
|
|
31
31
|
function checkMethod(node, method, message) {
|
32
32
|
const statement = node.getParent();
|
33
33
|
const identifier = statement.getChildrenOfKind(ng_morph_1.SyntaxKind.Identifier)[0];
|
34
|
-
identifier.findReferencesAsNodes().forEach(ref => {
|
34
|
+
identifier.findReferencesAsNodes().forEach((ref) => {
|
35
35
|
let parent = ref.getParent();
|
36
36
|
if ((ng_morph_1.Node.isPropertyAccessExpression(parent) &&
|
37
37
|
parent.getText().startsWith('this.')) ||
|
@@ -39,7 +39,7 @@ function checkMethod(node, method, message) {
|
|
39
39
|
parent = parent.getParentIfKind(ng_morph_1.SyntaxKind.PropertyAccessExpression);
|
40
40
|
}
|
41
41
|
if (ng_morph_1.Node.isPropertyAccessExpression(parent)) {
|
42
|
-
parent.getChildrenOfKind(ng_morph_1.SyntaxKind.Identifier).forEach(identifier => {
|
42
|
+
parent.getChildrenOfKind(ng_morph_1.SyntaxKind.Identifier).forEach((identifier) => {
|
43
43
|
if (identifier.getText() === method) {
|
44
44
|
(0, insert_todo_1.insertTodo)(identifier, message);
|
45
45
|
}
|
@@ -8,7 +8,7 @@ const import_manipulations_1 = require("../../../utils/import-manipulations");
|
|
8
8
|
const deprecated_functions_1 = require("../constants/deprecated-functions");
|
9
9
|
function replaceDeprecatedFunction() {
|
10
10
|
deprecated_functions_1.DEPRECATED_FUNCTIONS.forEach(({ from, to, moduleSpecifier }) => {
|
11
|
-
(0, get_named_import_references_1.getNamedImportReferences)(from, moduleSpecifier).forEach(ref => {
|
11
|
+
(0, get_named_import_references_1.getNamedImportReferences)(from, moduleSpecifier).forEach((ref) => {
|
12
12
|
if (ref.wasForgotten()) {
|
13
13
|
return;
|
14
14
|
}
|
@@ -20,7 +20,7 @@ function replaceDeprecatedFunction() {
|
|
20
20
|
});
|
21
21
|
}
|
22
22
|
function replacePadStart(references) {
|
23
|
-
references.forEach(ref => {
|
23
|
+
references.forEach((ref) => {
|
24
24
|
var _a;
|
25
25
|
const parent = ref.getParent();
|
26
26
|
if (ng_morph_1.Node.isImportSpecifier(parent)) {
|
@@ -33,7 +33,7 @@ function replacePadStart(references) {
|
|
33
33
|
});
|
34
34
|
}
|
35
35
|
function replaceNativeFocused(references) {
|
36
|
-
references.forEach(ref => {
|
36
|
+
references.forEach((ref) => {
|
37
37
|
const parent = ref.getParent();
|
38
38
|
if (ng_morph_1.Node.isImportSpecifier(parent)) {
|
39
39
|
(0, import_manipulations_1.removeImport)(parent);
|
@@ -48,7 +48,7 @@ function replaceNativeFocused(references) {
|
|
48
48
|
});
|
49
49
|
}
|
50
50
|
function replaceClosestElement(references) {
|
51
|
-
references.forEach(ref => {
|
51
|
+
references.forEach((ref) => {
|
52
52
|
const parent = ref.getParent();
|
53
53
|
if (ng_morph_1.Node.isImportSpecifier(parent)) {
|
54
54
|
(0, import_manipulations_1.removeImport)(parent);
|
@@ -64,7 +64,7 @@ function replaceClosestElement(references) {
|
|
64
64
|
});
|
65
65
|
}
|
66
66
|
function replaceCustomEvent(references) {
|
67
|
-
references.forEach(ref => {
|
67
|
+
references.forEach((ref) => {
|
68
68
|
const parent = ref.getParent();
|
69
69
|
if (ng_morph_1.Node.isImportSpecifier(parent)) {
|
70
70
|
(0, import_manipulations_1.removeImport)(parent);
|
@@ -76,7 +76,7 @@ function replaceCustomEvent(references) {
|
|
76
76
|
});
|
77
77
|
}
|
78
78
|
function replaceFallbackValue(references) {
|
79
|
-
references.forEach(ref => {
|
79
|
+
references.forEach((ref) => {
|
80
80
|
const parent = ref.getParent();
|
81
81
|
if (ng_morph_1.Node.isImportSpecifier(parent)) {
|
82
82
|
(0, import_manipulations_1.removeImport)(parent);
|
@@ -92,12 +92,12 @@ function modifyFormatNumberArgs() {
|
|
92
92
|
...(0, get_named_import_references_1.getNamedImportReferences)('formatNumber', '@taiga-ui/core'),
|
93
93
|
...(0, get_named_import_references_1.getNamedImportReferences)('tuiFormatNumber', '@taiga-ui/core'),
|
94
94
|
]
|
95
|
-
.map(ref => ref.getParent())
|
95
|
+
.map((ref) => ref.getParent())
|
96
96
|
.filter(ng_morph_1.Node.isCallExpression)
|
97
|
-
.forEach(fn => {
|
97
|
+
.forEach((fn) => {
|
98
98
|
const args = fn.getArguments();
|
99
99
|
if (args.length > 1) {
|
100
|
-
const [value, decimalLimit = 'Infinity', decimalSeparator = "','", thousandSeparator = "'\u00A0'", zeroPadding = true,] = args.map(arg => arg.getText());
|
100
|
+
const [value, decimalLimit = 'Infinity', decimalSeparator = "','", thousandSeparator = "'\u00A0'", zeroPadding = true,] = args.map((arg) => arg.getText());
|
101
101
|
const notNullDecimalLimit = decimalLimit === 'null' ? 'Infinity' : decimalLimit;
|
102
102
|
const conditionalDecimalLimit = !Number.isNaN(Number(notNullDecimalLimit))
|
103
103
|
? notNullDecimalLimit
|
@@ -108,12 +108,12 @@ function modifyFormatNumberArgs() {
|
|
108
108
|
}
|
109
109
|
function modifyClosestFocusable() {
|
110
110
|
(0, get_named_import_references_1.getNamedImportReferences)('tuiGetClosestFocusable', '@taiga-ui/cdk')
|
111
|
-
.map(ref => ref.getParent())
|
111
|
+
.map((ref) => ref.getParent())
|
112
112
|
.filter(ng_morph_1.Node.isCallExpression)
|
113
|
-
.forEach(fn => {
|
113
|
+
.forEach((fn) => {
|
114
114
|
const args = fn.getArguments();
|
115
115
|
if (args.length > 1) {
|
116
|
-
const [initial, prev = false, root, keyboard = true] = args.map(arg => arg.getText());
|
116
|
+
const [initial, prev = false, root, keyboard = true] = args.map((arg) => arg.getText());
|
117
117
|
fn.replaceWithText(`tuiGetClosestFocusable({initial: ${initial}, root: ${root}, previous: ${prev}, keyboard: ${keyboard}})`);
|
118
118
|
}
|
119
119
|
});
|
@@ -10,7 +10,7 @@ exports.TUI_WARNING_NORMALIZE = `
|
|
10
10
|
exports.TUI_WARNING_WRAPPER_MIXINS = '// TODO: (Taiga UI migration): use mixins to customize tuiWrapper. See https://taiga-ui.dev/wrapper';
|
11
11
|
function replaceStyles() {
|
12
12
|
var _a;
|
13
|
-
(_a = (0, ng_morph_1.getActiveProject)()) === null || _a === void 0 ? void 0 : _a.getSourceFiles('**/**.less').forEach(sourceFile => {
|
13
|
+
(_a = (0, ng_morph_1.getActiveProject)()) === null || _a === void 0 ? void 0 : _a.getSourceFiles('**/**.less').forEach((sourceFile) => {
|
14
14
|
let fullText = sourceFile.getFullText();
|
15
15
|
if (fullText.includes('taiga-ui')) {
|
16
16
|
breakpoints_1.DEPRECATED_BREAKPOINTS.forEach(({ from, to }) => {
|
@@ -26,7 +26,7 @@ function replaceStyles() {
|
|
26
26
|
.replace('--tui-color-link', '--tui-link')
|
27
27
|
.replaceAll("@import '~@taiga-ui", "@import '@taiga-ui")
|
28
28
|
.replaceAll("@import '@taiga-ui/core/styles/taiga-ui-global", `${exports.TUI_WARNING_NORMALIZE}\n@import '@taiga-ui/styles/taiga-ui-global`)
|
29
|
-
.replaceAll(/@import '@taiga-ui\/.+(.less)?';/g, val => `${val.replace("';", '')}.less';`.replace('.less.less', '.less'));
|
29
|
+
.replaceAll(/@import '@taiga-ui\/.+(.less)?';/g, (val) => `${val.replace("';", '')}.less';`.replace('.less.less', '.less'));
|
30
30
|
sourceFile.replaceWithText(fullText);
|
31
31
|
});
|
32
32
|
}
|