@taiga-ui/cdk 3.11.0 → 3.12.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.
- package/abstract/dialog.service.d.ts +1 -1
- package/bundles/taiga-ui-cdk-abstract.umd.js +1 -1
- package/bundles/taiga-ui-cdk-abstract.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-coercion.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-constants.umd.js +1 -1
- package/bundles/taiga-ui-cdk-constants.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-date-time.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-auto-focus.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-checked.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-droppable.umd.js +3 -1
- package/bundles/taiga-ui-cdk-directives-droppable.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-element.umd.js +18 -332
- package/bundles/taiga-ui-cdk-directives-element.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-for-async.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-overscroll.umd.js +3 -1
- package/bundles/taiga-ui-cdk-directives-overscroll.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-prevent-default.umd.js +3 -1
- package/bundles/taiga-ui-cdk-directives-prevent-default.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-observables.umd.js +16 -16
- package/bundles/taiga-ui-cdk-observables.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-services.umd.js +9 -3
- package/bundles/taiga-ui-cdk-services.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-dom.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-focus.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-math.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-utils-svg.umd.js +5 -2
- package/bundles/taiga-ui-cdk-utils-svg.umd.js.map +1 -1
- package/coercion/coerce-boolean-property.d.ts +1 -1
- package/constants/version.d.ts +1 -1
- package/constants/version.js +1 -1
- package/date-time/time.d.ts +1 -1
- package/date-time/year.d.ts +1 -1
- package/directives/auto-focus/autofocus.directive.d.ts +1 -1
- package/directives/checked/checked.directive.d.ts +1 -1
- package/directives/droppable/droppable.directive.d.ts +1 -1
- package/directives/element/element.directive.d.ts +2 -1
- package/directives/for-async/for-async.directive.d.ts +1 -1
- package/directives/overscroll/overscroll.directive.d.ts +1 -1
- package/directives/prevent-default/prevent-default.directive.d.ts +1 -1
- package/esm2015/abstract/dialog.directive.js +3 -3
- package/esm2015/abstract/dialog.service.js +1 -1
- package/esm2015/coercion/coerce-boolean-property.js +1 -1
- package/esm2015/constants/version.js +2 -2
- package/esm2015/date-time/time.js +1 -1
- package/esm2015/date-time/year.js +1 -1
- package/esm2015/directives/auto-focus/autofocus.directive.js +1 -1
- package/esm2015/directives/checked/checked.directive.js +1 -1
- package/esm2015/directives/droppable/droppable.directive.js +5 -3
- package/esm2015/directives/element/element.directive.js +18 -4
- package/esm2015/directives/for-async/for-async.directive.js +1 -1
- package/esm2015/directives/overscroll/overscroll.directive.js +5 -3
- package/esm2015/directives/prevent-default/prevent-default.directive.js +5 -3
- package/esm2015/interfaces/alert-context.js +1 -1
- package/esm2015/interfaces/swipe.js +1 -1
- package/esm2015/interfaces/zoom.js +1 -1
- package/esm2015/observables/control-value.js +15 -0
- package/esm2015/observables/index.js +2 -2
- package/esm2015/observables/must-be-present.js +1 -1
- package/esm2015/services/focus-visible.service.js +5 -3
- package/esm2015/services/obscured.service.js +4 -2
- package/esm2015/services/resize.service.js +5 -3
- package/esm2015/types/autocomplete.js +1 -1
- package/esm2015/types/dialog.js +1 -1
- package/esm2015/types/event-with.js +1 -1
- package/esm2015/types/input-mode.js +1 -1
- package/esm2015/types/input-type.js +1 -1
- package/esm2015/types/overscroll-mode.js +1 -1
- package/esm2015/types/time-mode.js +1 -1
- package/esm2015/utils/dom/element-checks.js +1 -1
- package/esm2015/utils/focus/set-native-mouse-focused.js +1 -1
- package/esm2015/utils/math/to-int.js +1 -1
- package/esm2015/utils/svg/svg-linear-gradient-processor.js +6 -3
- package/fesm2015/taiga-ui-cdk-abstract.js +2 -2
- package/fesm2015/taiga-ui-cdk-abstract.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-coercion.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-constants.js +1 -1
- package/fesm2015/taiga-ui-cdk-constants.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-date-time.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-auto-focus.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-checked.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-droppable.js +4 -2
- package/fesm2015/taiga-ui-cdk-directives-droppable.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-element.js +17 -3
- package/fesm2015/taiga-ui-cdk-directives-element.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-for-async.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-overscroll.js +4 -2
- package/fesm2015/taiga-ui-cdk-directives-overscroll.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-prevent-default.js +4 -2
- package/fesm2015/taiga-ui-cdk-directives-prevent-default.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-observables.js +15 -15
- package/fesm2015/taiga-ui-cdk-observables.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-services.js +10 -4
- package/fesm2015/taiga-ui-cdk-services.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-dom.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-focus.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-math.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-utils-svg.js +5 -2
- package/fesm2015/taiga-ui-cdk-utils-svg.js.map +1 -1
- package/interfaces/alert-context.d.ts +1 -1
- package/interfaces/swipe.d.ts +1 -1
- package/interfaces/zoom.d.ts +1 -1
- package/observables/{replay-control-value-changes.d.ts → control-value.d.ts} +0 -0
- package/observables/index.d.ts +1 -1
- package/observables/must-be-present.d.ts +1 -1
- package/package.json +5 -5
- package/schematics/constants/file-globs.js +2 -2
- package/schematics/constants/taiga-styles.js +4 -4
- package/schematics/ng-add/constants/modules.d.ts +4 -4
- package/schematics/ng-add/constants/modules.js +12 -12
- package/schematics/ng-add/constants/packages.js +1 -1
- package/schematics/ng-add/constants/versions.js +3 -3
- package/schematics/ng-add/index.d.ts +2 -2
- package/schematics/ng-add/index.js +11 -12
- package/schematics/ng-add/schema.d.ts +9 -2
- package/schematics/ng-add/schema.json +1 -1
- package/schematics/ng-add/setup-project.d.ts +2 -2
- package/schematics/ng-add/steps/add-taiga-icons.d.ts +3 -3
- package/schematics/ng-add/steps/add-taiga-icons.js +8 -9
- package/schematics/ng-add/steps/add-taiga-modules.d.ts +2 -2
- package/schematics/ng-add/steps/add-taiga-modules.js +7 -7
- package/schematics/ng-add/steps/add-taiga-styles.d.ts +2 -2
- package/schematics/ng-add/steps/add-taiga-styles.js +3 -4
- package/schematics/ng-add/steps/wrap-with-tui-root.d.ts +2 -2
- package/schematics/ng-add/steps/wrap-with-tui-root.js +14 -14
- package/schematics/ng-update/constants/consts.d.ts +1 -1
- package/schematics/ng-update/constants/consts.js +177 -177
- package/schematics/ng-update/constants/deprecated-functions.js +410 -405
- package/schematics/ng-update/constants/enums.js +123 -123
- package/schematics/ng-update/constants/modules.js +4 -4
- package/schematics/ng-update/constants/services.d.ts +2 -2
- package/schematics/ng-update/constants/services.js +16 -16
- package/schematics/ng-update/constants/templates.d.ts +1 -1
- package/schematics/ng-update/constants/templates.js +276 -276
- package/schematics/ng-update/constants/tui-interactive-selectors.js +50 -50
- package/schematics/ng-update/constants/types.d.ts +1 -1
- package/schematics/ng-update/constants/types.js +87 -87
- package/schematics/ng-update/constants/warnings.js +62 -62
- package/schematics/ng-update/index.d.ts +3 -3
- package/schematics/ng-update/index.js +44 -40
- package/schematics/ng-update/interfaces/asset.d.ts +6 -0
- package/schematics/ng-update/interfaces/asset.js +2 -0
- package/schematics/ng-update/steps/migrate-date-time.d.ts +2 -1
- package/schematics/ng-update/steps/migrate-date-time.js +55 -49
- package/schematics/ng-update/steps/migrate-polymorpheus.d.ts +1 -1
- package/schematics/ng-update/steps/migrate-polymorpheus.js +14 -14
- package/schematics/ng-update/steps/migrate-progress.d.ts +2 -1
- package/schematics/ng-update/steps/migrate-progress.js +16 -12
- package/schematics/ng-update/steps/migrate-sliders/index.d.ts +2 -1
- package/schematics/ng-update/steps/migrate-sliders/index.js +13 -9
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-range.d.ts +2 -1
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-range.js +35 -33
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-slider.d.ts +2 -1
- package/schematics/ng-update/steps/migrate-sliders/migrate-input-slider.js +34 -33
- package/schematics/ng-update/steps/migrate-taiga-proprietary-icons.d.ts +2 -2
- package/schematics/ng-update/steps/migrate-taiga-proprietary-icons.js +29 -27
- package/schematics/ng-update/steps/migrate-templates.d.ts +2 -1
- package/schematics/ng-update/steps/migrate-templates.js +36 -32
- package/schematics/ng-update/steps/migrate-textfield-controller.d.ts +1 -1
- package/schematics/ng-update/steps/migrate-textfield-controller.js +34 -34
- package/schematics/ng-update/steps/miscellaneous.d.ts +2 -1
- package/schematics/ng-update/steps/miscellaneous.js +21 -19
- package/schematics/ng-update/steps/remove-module.d.ts +2 -1
- package/schematics/ng-update/steps/remove-module.js +6 -4
- package/schematics/ng-update/steps/rename-types.d.ts +2 -1
- package/schematics/ng-update/steps/rename-types.js +10 -8
- package/schematics/ng-update/steps/replace-const.d.ts +2 -1
- package/schematics/ng-update/steps/replace-const.js +8 -6
- package/schematics/ng-update/steps/replace-deep-import.d.ts +2 -1
- package/schematics/ng-update/steps/replace-deep-import.js +10 -5
- package/schematics/ng-update/steps/replace-enums.d.ts +2 -1
- package/schematics/ng-update/steps/replace-enums.js +8 -6
- package/schematics/ng-update/steps/replace-functions.d.ts +2 -1
- package/schematics/ng-update/steps/replace-functions.js +17 -15
- package/schematics/ng-update/steps/replace-services.d.ts +2 -1
- package/schematics/ng-update/steps/replace-services.js +13 -11
- package/schematics/ng-update/steps/replace-styles.js +7 -5
- package/schematics/ng-update/steps/show-warnings.js +2 -2
- package/schematics/ng-update/v3-5/steps/migrate-expand-templates.d.ts +2 -1
- package/schematics/ng-update/v3-5/steps/migrate-expand-templates.js +12 -10
- package/schematics/utils/add-import-to-closest-module.js +2 -2
- package/schematics/utils/add-unique-import.js +1 -1
- package/schematics/utils/angular/ng-component.js +1 -1
- package/schematics/utils/angular/ng-module.js +1 -1
- package/schematics/utils/angular-json-manipulations.d.ts +3 -3
- package/schematics/utils/angular-json-manipulations.js +52 -37
- package/schematics/utils/colored-log.js +5 -5
- package/schematics/utils/create-angular-json.d.ts +1 -0
- package/schematics/utils/create-angular-json.js +28 -2
- package/schematics/utils/get-named-import-references.d.ts +1 -1
- package/schematics/utils/get-named-import-references.js +2 -2
- package/schematics/utils/get-project-target-options.d.ts +1 -1
- package/schematics/utils/get-project-target-options.js +1 -1
- package/schematics/utils/get-projects.d.ts +3 -0
- package/schematics/utils/get-projects.js +15 -0
- package/schematics/utils/progress.js +2 -2
- package/schematics/utils/replace-tag.d.ts +1 -1
- package/schematics/utils/replace-tag.js +4 -4
- package/schematics/utils/templates/elements.js +4 -4
- package/schematics/utils/templates/get-component-templates.js +6 -6
- package/schematics/utils/templates/ng-component-input-manipulations.d.ts +4 -4
- package/schematics/utils/templates/ng-component-input-manipulations.js +7 -7
- package/schematics/utils/templates/template-resource.d.ts +1 -1
- package/schematics/utils/templates/template-resource.js +3 -3
- package/services/focus-visible.service.d.ts +1 -1
- package/services/obscured.service.d.ts +2 -2
- package/services/resize.service.d.ts +1 -1
- package/types/autocomplete.d.ts +1 -1
- package/types/dialog.d.ts +2 -2
- package/types/event-with.d.ts +2 -2
- package/types/input-mode.d.ts +1 -1
- package/types/input-type.d.ts +1 -1
- package/types/overscroll-mode.d.ts +1 -1
- package/types/time-mode.d.ts +1 -1
- package/utils/dom/element-checks.d.ts +1 -1
- package/utils/focus/set-native-mouse-focused.d.ts +1 -1
- package/utils/math/to-int.d.ts +1 -1
- package/utils/svg/svg-linear-gradient-processor.d.ts +2 -1
- package/esm2015/observables/replay-control-value-changes.js +0 -15
- package/schematics/ng-update/constants/functions.d.ts +0 -0
- package/schematics/ng-update/constants/functions.js +0 -1
- package/schematics/utils/get-project.d.ts +0 -3
- package/schematics/utils/get-project.js +0 -13
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.migrateTextfieldController = void 0;
|
|
4
|
-
const
|
|
4
|
+
const ng_morph_1 = require("ng-morph");
|
|
5
5
|
const elements_1 = require("../../utils/templates/elements");
|
|
6
6
|
const ng_component_input_manipulations_1 = require("../../utils/templates/ng-component-input-manipulations");
|
|
7
|
-
const
|
|
7
|
+
const template_resource_1 = require("../../utils/templates/template-resource");
|
|
8
8
|
const TEXTFIELDS = [
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
`tui-input`,
|
|
10
|
+
`tui-primitive-textfield`,
|
|
11
|
+
`tui-text-area`,
|
|
12
|
+
`tui-combo-box`,
|
|
13
|
+
`tui-input-copy`,
|
|
14
|
+
`tui-input-date`,
|
|
15
|
+
`tui-input-date-range`,
|
|
16
|
+
`tui-input-date-time`,
|
|
17
|
+
`tui-input-number`,
|
|
18
|
+
`tui-input-password`,
|
|
19
|
+
`tui-input-count`,
|
|
20
|
+
`tui-input-number`,
|
|
21
|
+
`tui-input-phone`,
|
|
22
|
+
`tui-input-slider`,
|
|
23
|
+
`tui-input-card`,
|
|
24
24
|
];
|
|
25
25
|
const ATTRS_MAP = {
|
|
26
|
-
tuitextfieldautocomplete:
|
|
27
|
-
tuitextfieldinputmode:
|
|
28
|
-
tuitextfieldmaxlength:
|
|
29
|
-
tuitextfieldtype:
|
|
30
|
-
tuitextfieldexampletext:
|
|
31
|
-
'[tuitextfieldautocomplete]':
|
|
32
|
-
'[tuitextfieldinputmode]':
|
|
33
|
-
'[tuitextfieldmaxlength]':
|
|
34
|
-
'[tuitextfieldtype]':
|
|
35
|
-
'[tuitextfieldexampletext]':
|
|
26
|
+
tuitextfieldautocomplete: `autocomplete`,
|
|
27
|
+
tuitextfieldinputmode: `inputmode`,
|
|
28
|
+
tuitextfieldmaxlength: `maxlength`,
|
|
29
|
+
tuitextfieldtype: `type`,
|
|
30
|
+
tuitextfieldexampletext: `placeholder`,
|
|
31
|
+
'[tuitextfieldautocomplete]': `[attr.autocomplete]`,
|
|
32
|
+
'[tuitextfieldinputmode]': `[attr.inputmode]`,
|
|
33
|
+
'[tuitextfieldmaxlength]': `[attr.maxlength]`,
|
|
34
|
+
'[tuitextfieldtype]': `[attr.type]`,
|
|
35
|
+
'[tuitextfieldexampletext]': `[attr.placeholder]`,
|
|
36
36
|
};
|
|
37
37
|
const CONTROLLER_ITEMS = Object.keys(ATTRS_MAP).map(attr => attr.toLowerCase());
|
|
38
38
|
function migrateTextfieldController({ resource, fileSystem, recorder, }) {
|
|
@@ -44,8 +44,8 @@ function migrateTextfieldController({ resource, fileSystem, recorder, }) {
|
|
|
44
44
|
if (!attrs.length) {
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
const existingInput = elements_1.findElementsByFn(element.childNodes, el => (el.tagName ===
|
|
48
|
-
elements_1.hasElementAttribute(el,
|
|
47
|
+
const existingInput = elements_1.findElementsByFn(element.childNodes, el => (el.tagName === `input` || el.tagName === `textarea`) &&
|
|
48
|
+
elements_1.hasElementAttribute(el, `tuiTextfield`))[0];
|
|
49
49
|
if (existingInput) {
|
|
50
50
|
addAttrToExistingInput({ existingInput, attrs, recorder, templateOffset });
|
|
51
51
|
}
|
|
@@ -61,7 +61,7 @@ function insertTuiTextfieldInput({ element, attrs, recorder, templateOffset, })
|
|
|
61
61
|
const newAttrs = attrs
|
|
62
62
|
.map(attr => `${ATTRS_MAP[attr.name]}="${attr.value}"`)
|
|
63
63
|
.join(`\n`);
|
|
64
|
-
const content = element.tagName ===
|
|
64
|
+
const content = element.tagName === `tui-text-area`
|
|
65
65
|
? `<textarea tuiTextfield ${newAttrs}></textarea> `
|
|
66
66
|
: `<input tuiTextfield ${newAttrs}/> `;
|
|
67
67
|
const insertTo = (_b = (_a = element.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.endTag) === null || _b === void 0 ? void 0 : _b.startOffset;
|
|
@@ -72,7 +72,7 @@ function insertTuiTextfieldInput({ element, attrs, recorder, templateOffset, })
|
|
|
72
72
|
function addAttrToExistingInput({ existingInput, attrs, recorder, templateOffset, }) {
|
|
73
73
|
attrs.forEach(attr => {
|
|
74
74
|
var _a, _b, _c;
|
|
75
|
-
const insertTo = (_c = (_b = (_a = existingInput.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.attrs) === null || _b === void 0 ? void 0 : _b[
|
|
75
|
+
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;
|
|
76
76
|
if (insertTo) {
|
|
77
77
|
recorder.insertLeft(insertTo + templateOffset, ` ${ATTRS_MAP[attr.name]}="${attr.value}"`);
|
|
78
78
|
}
|
|
@@ -85,12 +85,12 @@ function removeOldInputs(recorder, template, templateOffset) {
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
function getTagsToRemove(attrName) {
|
|
88
|
-
return [
|
|
89
|
-
? TEXTFIELDS.filter(tag => tag !==
|
|
88
|
+
return [`[tuitextfieldmaxlength]`, `tuitextfieldmaxlength`].includes(attrName)
|
|
89
|
+
? TEXTFIELDS.filter(tag => tag !== `tui-text-area`)
|
|
90
90
|
: TEXTFIELDS;
|
|
91
91
|
}
|
|
92
92
|
const excludedAttrs = {
|
|
93
|
-
'tui-text-area': [
|
|
93
|
+
'tui-text-area': [`[tuitextfieldmaxlength]`, `tuitextfieldmaxlength`],
|
|
94
94
|
};
|
|
95
95
|
function exclusion({ tagName }, attrName) {
|
|
96
96
|
var _a;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { TuiSchema } from '../../ng-add/schema';
|
|
2
|
+
export declare function miscellaneousMigrations(options: TuiSchema): void;
|
|
@@ -1,34 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.miscellaneousMigrations = void 0;
|
|
4
|
-
const get_named_import_references_1 = require("../../utils/get-named-import-references");
|
|
5
4
|
const ng_morph_1 = require("ng-morph");
|
|
6
|
-
const insert_todo_1 = require("../../utils/insert-todo");
|
|
7
5
|
const colored_log_1 = require("../../utils/colored-log");
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const get_named_import_references_1 = require("../../utils/get-named-import-references");
|
|
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...`);
|
|
10
11
|
replaceEnumProperty({
|
|
11
|
-
enumName:
|
|
12
|
-
from:
|
|
13
|
-
to:
|
|
12
|
+
enumName: `TuiCurrency`,
|
|
13
|
+
from: `HongKong_dollar`,
|
|
14
|
+
to: `HongKongDollar`,
|
|
14
15
|
});
|
|
15
16
|
replaceEnumProperty({
|
|
16
|
-
enumName:
|
|
17
|
-
from:
|
|
18
|
-
to:
|
|
17
|
+
enumName: `TuiCurrencyCode`,
|
|
18
|
+
from: `HongKong_dollar`,
|
|
19
|
+
to: `HongKongDollar`,
|
|
19
20
|
});
|
|
20
21
|
replaceEnumProperty({
|
|
21
|
-
enumName:
|
|
22
|
-
from:
|
|
23
|
-
to:
|
|
22
|
+
enumName: `TuiCreditCardAutofillName`,
|
|
23
|
+
from: `CcExp_mounth`,
|
|
24
|
+
to: `CcExpMonth`,
|
|
24
25
|
});
|
|
25
26
|
replaceEnumProperty({
|
|
26
|
-
enumName:
|
|
27
|
-
from:
|
|
28
|
-
to:
|
|
27
|
+
enumName: `TuiCreditCardAutofillName`,
|
|
28
|
+
from: `CcExp_year`,
|
|
29
|
+
to: `CcExpYear`,
|
|
29
30
|
});
|
|
30
|
-
addWarningToMethod(
|
|
31
|
-
|
|
31
|
+
addWarningToMethod(`TuiDirectiveStylesService`, `addStyle`, `addStyle method has been removed. Use components approach`);
|
|
32
|
+
!options[`skip-logs`] &&
|
|
33
|
+
colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} miscellaneous migrated \n`);
|
|
32
34
|
}
|
|
33
35
|
exports.miscellaneousMigrations = miscellaneousMigrations;
|
|
34
36
|
function addWarningToMethod(className, method, message) {
|
|
@@ -60,7 +62,7 @@ function checkMethod(node, method, message) {
|
|
|
60
62
|
identifier.findReferencesAsNodes().forEach(ref => {
|
|
61
63
|
let parent = ref.getParent();
|
|
62
64
|
if ((ng_morph_1.Node.isPropertyAccessExpression(parent) &&
|
|
63
|
-
parent.getText().startsWith(
|
|
65
|
+
parent.getText().startsWith(`this.`)) ||
|
|
64
66
|
ng_morph_1.Node.isCallExpression(parent)) {
|
|
65
67
|
parent = parent.getParentIfKind(ng_morph_1.SyntaxKind.PropertyAccessExpression);
|
|
66
68
|
}
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.removeModule = exports.removeModules = void 0;
|
|
4
4
|
const ng_morph_1 = require("ng-morph");
|
|
5
|
+
const colored_log_1 = require("../../utils/colored-log");
|
|
5
6
|
const get_named_import_references_1 = require("../../utils/get-named-import-references");
|
|
6
7
|
const import_manipulations_1 = require("../../utils/import-manipulations");
|
|
7
8
|
const modules_1 = require("../constants/modules");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
function removeModules(options) {
|
|
10
|
+
!options[`skip-logs`] &&
|
|
11
|
+
colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} removing modules...`);
|
|
11
12
|
modules_1.REMOVED_MODULES.forEach(({ name, moduleSpecifier }) => removeModule(name, moduleSpecifier));
|
|
12
|
-
|
|
13
|
+
!options[`skip-logs`] &&
|
|
14
|
+
colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} modules removed \n`);
|
|
13
15
|
}
|
|
14
16
|
exports.removeModules = removeModules;
|
|
15
17
|
function removeModule(name, moduleSpecifier) {
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { TuiSchema } from '../../ng-add/schema';
|
|
2
|
+
export declare function renameTypes(options: TuiSchema): void;
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renameTypes = void 0;
|
|
4
4
|
const ng_morph_1 = require("ng-morph");
|
|
5
|
+
const colored_log_1 = require("../../utils/colored-log");
|
|
5
6
|
const get_named_import_references_1 = require("../../utils/get-named-import-references");
|
|
6
|
-
const types_1 = require("../constants/types");
|
|
7
7
|
const import_manipulations_1 = require("../../utils/import-manipulations");
|
|
8
|
-
const
|
|
9
|
-
function renameTypes() {
|
|
10
|
-
|
|
8
|
+
const types_1 = require("../constants/types");
|
|
9
|
+
function renameTypes(options) {
|
|
10
|
+
!options[`skip-logs`] &&
|
|
11
|
+
colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} renaming types...`);
|
|
11
12
|
types_1.TYPES_TO_RENAME.forEach(({ from, to, moduleSpecifier, preserveGenerics }) => renameType(from, to, moduleSpecifier, preserveGenerics));
|
|
12
|
-
|
|
13
|
+
!options[`skip-logs`] &&
|
|
14
|
+
colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} types renamed \n`);
|
|
13
15
|
}
|
|
14
16
|
exports.renameTypes = renameTypes;
|
|
15
17
|
function renameType(from, to, moduleSpecifier, preserveGenerics = false) {
|
|
@@ -21,7 +23,7 @@ function renameType(from, to, moduleSpecifier, preserveGenerics = false) {
|
|
|
21
23
|
}
|
|
22
24
|
else if (ng_morph_1.Node.isTypeReferenceNode(parent)) {
|
|
23
25
|
const targetType = preserveGenerics && to ? addGeneric(to, parent.getTypeArguments()) : to;
|
|
24
|
-
parent.replaceWithText(targetType ||
|
|
26
|
+
parent.replaceWithText(targetType || `any`);
|
|
25
27
|
}
|
|
26
28
|
});
|
|
27
29
|
}
|
|
@@ -36,10 +38,10 @@ function processImport(node, from, to) {
|
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
40
|
function removeGeneric(type) {
|
|
39
|
-
return type.replace(/<.*>$/gi,
|
|
41
|
+
return type.replace(/<.*>$/gi, ``);
|
|
40
42
|
}
|
|
41
43
|
function addGeneric(typeName, generics) {
|
|
42
44
|
const typeArgs = generics.map(t => t.getType().getText());
|
|
43
|
-
const genericType = typeArgs.length ? `<${typeArgs.join(
|
|
45
|
+
const genericType = typeArgs.length ? `<${typeArgs.join(`, `)}>` : ``;
|
|
44
46
|
return typeName + genericType;
|
|
45
47
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TuiSchema } from '../../ng-add/schema';
|
|
1
2
|
import { ReplacementConst } from '../constants/consts';
|
|
2
|
-
export declare function replaceConstants(): void;
|
|
3
|
+
export declare function replaceConstants(options: TuiSchema): void;
|
|
3
4
|
export declare function replaceConst({ from, to }: ReplacementConst): void;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.replaceConst = exports.replaceConstants = void 0;
|
|
4
|
-
const get_named_import_references_1 = require("../../utils/get-named-import-references");
|
|
5
4
|
const ng_morph_1 = require("ng-morph");
|
|
6
|
-
const import_manipulations_1 = require("../../utils/import-manipulations");
|
|
7
5
|
const add_unique_import_1 = require("../../utils/add-unique-import");
|
|
8
|
-
const consts_1 = require("../constants/consts");
|
|
9
6
|
const colored_log_1 = require("../../utils/colored-log");
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
const get_named_import_references_1 = require("../../utils/get-named-import-references");
|
|
8
|
+
const import_manipulations_1 = require("../../utils/import-manipulations");
|
|
9
|
+
const consts_1 = require("../constants/consts");
|
|
10
|
+
function replaceConstants(options) {
|
|
11
|
+
!options[`skip-logs`] &&
|
|
12
|
+
colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} replacing constants...`);
|
|
12
13
|
consts_1.CONSTS_TO_REPLACE.forEach(constToReplace => replaceConst(constToReplace));
|
|
13
|
-
|
|
14
|
+
!options[`skip-logs`] &&
|
|
15
|
+
colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} constants replaced \n`);
|
|
14
16
|
}
|
|
15
17
|
exports.replaceConstants = replaceConstants;
|
|
16
18
|
function replaceConst({ from, to }) {
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { TuiSchema } from '../../ng-add/schema';
|
|
2
|
+
export declare function replaceDeepImports(options: TuiSchema): void;
|
|
@@ -2,16 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.replaceDeepImports = void 0;
|
|
4
4
|
const ng_morph_1 = require("ng-morph");
|
|
5
|
-
const colored_log_1 = require("../../utils/colored-log");
|
|
6
5
|
const constants_1 = require("../../constants");
|
|
6
|
+
const colored_log_1 = require("../../utils/colored-log");
|
|
7
7
|
const DEEP_REGEX = /(@taiga-ui\/\w+)\/.*/;
|
|
8
|
-
function replaceDeepImports() {
|
|
9
|
-
|
|
8
|
+
function replaceDeepImports(options) {
|
|
9
|
+
if (options[`skip-deep-imports`]) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
!options[`skip-logs`] &&
|
|
13
|
+
colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} replacing deep imports...`);
|
|
10
14
|
const deepImports = ng_morph_1.getImports(constants_1.ALL_TS_FILES).filter(imp => DEEP_REGEX.test(imp.getModuleSpecifier().getLiteralValue()));
|
|
11
15
|
ng_morph_1.editImports(deepImports, deepImport => {
|
|
12
|
-
const specifier = deepImport.moduleSpecifier.replace(DEEP_REGEX,
|
|
16
|
+
const specifier = deepImport.moduleSpecifier.replace(DEEP_REGEX, `$1`);
|
|
13
17
|
return { moduleSpecifier: specifier };
|
|
14
18
|
});
|
|
15
|
-
|
|
19
|
+
!options[`skip-logs`] &&
|
|
20
|
+
colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} deep imports replaced \n`);
|
|
16
21
|
}
|
|
17
22
|
exports.replaceDeepImports = replaceDeepImports;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { TuiSchema } from '../../ng-add/schema';
|
|
2
|
+
export declare function replaceEnums(options: TuiSchema): void;
|
|
@@ -2,20 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.replaceEnums = void 0;
|
|
4
4
|
const ng_morph_1 = require("ng-morph");
|
|
5
|
+
const colored_log_1 = require("../../utils/colored-log");
|
|
5
6
|
const get_named_import_references_1 = require("../../utils/get-named-import-references");
|
|
6
|
-
const enums_1 = require("../constants/enums");
|
|
7
7
|
const import_manipulations_1 = require("../../utils/import-manipulations");
|
|
8
|
-
const
|
|
9
|
-
function replaceEnums() {
|
|
10
|
-
|
|
8
|
+
const enums_1 = require("../constants/enums");
|
|
9
|
+
function replaceEnums(options) {
|
|
10
|
+
!options[`skip-logs`] &&
|
|
11
|
+
colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} replacing enums imports...`);
|
|
11
12
|
enums_1.ENUMS_TO_REPLACE.forEach(({ name, replaceValues, keepAsType }) => replaceEnumWithString(name, replaceValues, keepAsType));
|
|
12
|
-
|
|
13
|
+
!options[`skip-logs`] &&
|
|
14
|
+
colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} enums replaced \n`);
|
|
13
15
|
}
|
|
14
16
|
exports.replaceEnums = replaceEnums;
|
|
15
17
|
function replaceEnumWithString(enumName, replaceValues, keepAsType = true) {
|
|
16
18
|
var _a;
|
|
17
19
|
const references = get_named_import_references_1.getNamedImportReferences(enumName);
|
|
18
|
-
for (
|
|
20
|
+
for (const ref of references) {
|
|
19
21
|
const parent = ref.getParent();
|
|
20
22
|
if (ng_morph_1.Node.isImportSpecifier(parent) && !(keepAsType && containTypeRef(parent))) {
|
|
21
23
|
import_manipulations_1.removeImport(parent);
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { TuiSchema } from '../../ng-add/schema';
|
|
2
|
+
export declare function replaceFunctions(options: TuiSchema): void;
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.replaceFunctions = void 0;
|
|
4
|
-
const get_named_import_references_1 = require("../../utils/get-named-import-references");
|
|
5
4
|
const ng_morph_1 = require("ng-morph");
|
|
5
|
+
const colored_log_1 = require("../../utils/colored-log");
|
|
6
|
+
const get_named_import_references_1 = require("../../utils/get-named-import-references");
|
|
6
7
|
const import_manipulations_1 = require("../../utils/import-manipulations");
|
|
7
8
|
const deprecated_functions_1 = require("../constants/deprecated-functions");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
replacePadStart(get_named_import_references_1.getNamedImportReferences(
|
|
12
|
-
replaceFallbackValue(get_named_import_references_1.getNamedImportReferences(
|
|
13
|
-
replaceCustomEvent(get_named_import_references_1.getNamedImportReferences(
|
|
14
|
-
replaceClosestElement(get_named_import_references_1.getNamedImportReferences(
|
|
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`));
|
|
15
16
|
replaceDeprecatedFunction();
|
|
16
17
|
modifyFormatNumberArgs();
|
|
17
18
|
modifyClosestFocusable();
|
|
18
|
-
|
|
19
|
+
!options[`skip-logs`] &&
|
|
20
|
+
colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} functions replaced \n`);
|
|
19
21
|
}
|
|
20
22
|
exports.replaceFunctions = replaceFunctions;
|
|
21
23
|
function replaceDeprecatedFunction() {
|
|
@@ -40,7 +42,7 @@ function replacePadStart(references) {
|
|
|
40
42
|
}
|
|
41
43
|
else if (ng_morph_1.Node.isCallExpression(parent)) {
|
|
42
44
|
const [targetString, length, pad] = parent.getArguments();
|
|
43
|
-
parent.replaceWithText(`${targetString.getText()}.padStart(${length.getText()}, ${(_a = pad === null || pad === void 0 ? void 0 : pad.getText()) !== null && _a !== void 0 ? _a :
|
|
45
|
+
parent.replaceWithText(`${targetString.getText()}.padStart(${length.getText()}, ${(_a = pad === null || pad === void 0 ? void 0 : pad.getText()) !== null && _a !== void 0 ? _a : `" "`})`);
|
|
44
46
|
}
|
|
45
47
|
});
|
|
46
48
|
}
|
|
@@ -53,7 +55,7 @@ function replaceClosestElement(references) {
|
|
|
53
55
|
else if (ng_morph_1.Node.isCallExpression(parent)) {
|
|
54
56
|
const [firstArg, secondArg] = parent.getArguments();
|
|
55
57
|
const firstArgText = firstArg.getText();
|
|
56
|
-
const element = firstArgText.includes(
|
|
58
|
+
const element = firstArgText.includes(` as `) // e.g, `getClosestElement(el as Element, ...)`
|
|
57
59
|
? `(${firstArgText})`
|
|
58
60
|
: firstArgText;
|
|
59
61
|
parent.replaceWithText(`${element}.closest(${secondArg.getText()})`);
|
|
@@ -86,8 +88,8 @@ function replaceFallbackValue(references) {
|
|
|
86
88
|
}
|
|
87
89
|
function modifyFormatNumberArgs() {
|
|
88
90
|
[
|
|
89
|
-
...get_named_import_references_1.getNamedImportReferences(
|
|
90
|
-
...get_named_import_references_1.getNamedImportReferences(
|
|
91
|
+
...get_named_import_references_1.getNamedImportReferences(`formatNumber`, `@taiga-ui/core`),
|
|
92
|
+
...get_named_import_references_1.getNamedImportReferences(`tuiFormatNumber`, `@taiga-ui/core`),
|
|
91
93
|
]
|
|
92
94
|
.map(ref => ref.getParent())
|
|
93
95
|
.filter(ng_morph_1.Node.isCallExpression)
|
|
@@ -96,7 +98,7 @@ function modifyFormatNumberArgs() {
|
|
|
96
98
|
if (args.length > 1) {
|
|
97
99
|
const [value, decimalLimit = `Infinity`, decimalSeparator = `','`, thousandSeparator = `'\u00A0'`, zeroPadding = true,] = args.map(arg => arg.getText());
|
|
98
100
|
const notNullDecimalLimit = decimalLimit === `null` ? `Infinity` : decimalLimit;
|
|
99
|
-
const conditionalDecimalLimit = !Number.isNaN(
|
|
101
|
+
const conditionalDecimalLimit = !Number.isNaN(Number(notNullDecimalLimit))
|
|
100
102
|
? notNullDecimalLimit
|
|
101
103
|
: `${decimalLimit} === null ? Infinity : ${decimalLimit}`;
|
|
102
104
|
fn.replaceWithText(`tuiFormatNumber(${value}, {decimalLimit: ${conditionalDecimalLimit}, decimalSeparator: ${decimalSeparator}, thousandSeparator: ${thousandSeparator}, zeroPadding: ${zeroPadding}})`);
|
|
@@ -104,7 +106,7 @@ function modifyFormatNumberArgs() {
|
|
|
104
106
|
});
|
|
105
107
|
}
|
|
106
108
|
function modifyClosestFocusable() {
|
|
107
|
-
get_named_import_references_1.getNamedImportReferences(
|
|
109
|
+
get_named_import_references_1.getNamedImportReferences(`tuiGetClosestFocusable`, `@taiga-ui/cdk`)
|
|
108
110
|
.map(ref => ref.getParent())
|
|
109
111
|
.filter(ng_morph_1.Node.isCallExpression)
|
|
110
112
|
.forEach(fn => {
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { TuiSchema } from '../../ng-add/schema';
|
|
2
|
+
export declare function replaceServices(options: TuiSchema): void;
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.replaceServices = void 0;
|
|
4
|
-
const services_1 = require("../constants/services");
|
|
5
|
-
const get_named_import_references_1 = require("../../utils/get-named-import-references");
|
|
6
4
|
const ng_morph_1 = require("ng-morph");
|
|
7
|
-
const import_manipulations_1 = require("../../utils/import-manipulations");
|
|
8
5
|
const add_unique_import_1 = require("../../utils/add-unique-import");
|
|
9
6
|
const colored_log_1 = require("../../utils/colored-log");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
const get_named_import_references_1 = require("../../utils/get-named-import-references");
|
|
8
|
+
const import_manipulations_1 = require("../../utils/import-manipulations");
|
|
9
|
+
const services_1 = require("../constants/services");
|
|
10
|
+
function replaceServices(options) {
|
|
11
|
+
!options[`skip-logs`] &&
|
|
12
|
+
colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} replacing services...`);
|
|
13
|
+
services_1.SERVICES_TO_REPLACE.forEach(service => replaceService(service, options));
|
|
14
|
+
!options[`skip-logs`] &&
|
|
15
|
+
colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} services replaced \n`);
|
|
14
16
|
}
|
|
15
17
|
exports.replaceServices = replaceServices;
|
|
16
|
-
function replaceService({ from, to, replaceMethods }) {
|
|
17
|
-
|
|
18
|
+
function replaceService({ from, to, replaceMethods }, options) {
|
|
19
|
+
!options[`skip-logs`] &&
|
|
20
|
+
colored_log_1.processLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.PROCESSING_SYMBOL}replacing ${from.name}...`);
|
|
18
21
|
const references = get_named_import_references_1.getNamedImportReferences(from.name, from.moduleSpecifier);
|
|
19
22
|
references.forEach(ref => {
|
|
20
23
|
const parent = ref.getParent();
|
|
@@ -35,13 +38,12 @@ function replaceProperties(parent, replaceProperties) {
|
|
|
35
38
|
identifier.findReferencesAsNodes().forEach(ref => {
|
|
36
39
|
let parent = ref.getParent();
|
|
37
40
|
if ((ng_morph_1.Node.isPropertyAccessExpression(parent) &&
|
|
38
|
-
parent.getText().startsWith(
|
|
41
|
+
parent.getText().startsWith(`this.`)) ||
|
|
39
42
|
ng_morph_1.Node.isCallExpression(parent)) {
|
|
40
43
|
parent = parent.getParentIfKind(ng_morph_1.SyntaxKind.PropertyAccessExpression);
|
|
41
44
|
}
|
|
42
45
|
if (ng_morph_1.Node.isPropertyAccessExpression(parent)) {
|
|
43
46
|
replaceProperty(parent, replaceProperties);
|
|
44
|
-
return;
|
|
45
47
|
}
|
|
46
48
|
});
|
|
47
49
|
}
|
|
@@ -10,17 +10,19 @@ 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 = ng_morph_1.getActiveProject()) === null || _a === void 0 ? void 0 : _a.getSourceFiles(
|
|
13
|
+
(_a = 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-local`)) {
|
|
16
16
|
breakpoints_1.DEPRECATED_BREAKPOINTS.forEach(({ from, to }) => {
|
|
17
|
-
fullText = fullText.replace(new RegExp(`(?<=@media.*)(${from})(?=[\\s,{])`,
|
|
17
|
+
fullText = fullText.replace(new RegExp(`(?<=@media.*)(${from})(?=[\\s,{])`, `g`), to);
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
fullText = fullText
|
|
21
|
-
.replace(
|
|
22
|
-
.replace(
|
|
23
|
-
.replace(
|
|
21
|
+
.replace(`tui-wrapper`, `${exports.TUI_WARNING_WRAPPER_MIXINS}\n[tuiWrapper]`)
|
|
22
|
+
.replace(`&[data-state='hovered']`, `&[data-state='hover']`)
|
|
23
|
+
.replace(`&[data-state='pressed']`, `&[data-state='active']`)
|
|
24
|
+
.replace(`tui-portal-host`, `tui-dropdown-host`)
|
|
25
|
+
.replace(`tui-dropdown-box`, `tui-dropdown`);
|
|
24
26
|
sourceFile.replaceWithText(fullText.replace(`@import '~@taiga-ui/core/styles/taiga-ui-global';`, `${exports.TUI_WARNING_NORMALIZE}\n@import '~@taiga-ui/styles/taiga-ui-global';`));
|
|
25
27
|
});
|
|
26
28
|
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.showWarnings = void 0;
|
|
4
4
|
const ng_morph_1 = require("ng-morph");
|
|
5
|
-
const warnings_1 = require("../constants/warnings");
|
|
6
5
|
const constants_1 = require("../../constants");
|
|
6
|
+
const warnings_1 = require("../constants/warnings");
|
|
7
7
|
function showWarnings(context) {
|
|
8
8
|
warnings_1.MIGRATION_WARNINGS.forEach(warning => showWarning(warning, context));
|
|
9
9
|
}
|
|
10
10
|
exports.showWarnings = showWarnings;
|
|
11
|
-
function showWarning({ name, message, moduleSpecifier =
|
|
11
|
+
function showWarning({ name, message, moduleSpecifier = `**/**` }, { logger }) {
|
|
12
12
|
const references = ng_morph_1.getImports(constants_1.ALL_TS_FILES, {
|
|
13
13
|
moduleSpecifier,
|
|
14
14
|
namedImports: [name],
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { DevkitFileSystem } from 'ng-morph';
|
|
2
|
-
|
|
2
|
+
import { TuiSchema } from '../../../ng-add/schema';
|
|
3
|
+
export declare function migrateExpandTemplates(fileSystem: DevkitFileSystem, options: TuiSchema): void;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.migrateExpandTemplates = void 0;
|
|
4
|
-
const colored_log_1 = require("../../../utils/colored-log");
|
|
5
|
-
const get_component_templates_1 = require("../../../utils/templates/get-component-templates");
|
|
6
4
|
const constants_1 = require("../../../constants");
|
|
5
|
+
const colored_log_1 = require("../../../utils/colored-log");
|
|
7
6
|
const progress_1 = require("../../../utils/progress");
|
|
8
|
-
const template_resource_1 = require("../../../utils/templates/template-resource");
|
|
9
7
|
const elements_1 = require("../../../utils/templates/elements");
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const get_component_templates_1 = require("../../../utils/templates/get-component-templates");
|
|
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...`);
|
|
12
13
|
const componentWithTemplatesPaths = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
|
|
13
14
|
const progressLog = progress_1.setupProgressLogger({
|
|
14
15
|
total: componentWithTemplatesPaths.length,
|
|
@@ -16,23 +17,24 @@ function migrateExpandTemplates(fileSystem) {
|
|
|
16
17
|
componentWithTemplatesPaths.forEach(resource => {
|
|
17
18
|
const path = fileSystem.resolve(template_resource_1.getPathFromTemplateResource(resource));
|
|
18
19
|
const recorder = fileSystem.edit(path);
|
|
19
|
-
progressLog(
|
|
20
|
+
!options[`skip-logs`] && progressLog(`expand migration`, true);
|
|
20
21
|
migrateExpand({ resource, fileSystem, recorder });
|
|
21
22
|
});
|
|
22
|
-
|
|
23
|
+
!options[`skip-logs`] &&
|
|
24
|
+
colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} templates migrated \n`);
|
|
23
25
|
}
|
|
24
26
|
exports.migrateExpandTemplates = migrateExpandTemplates;
|
|
25
27
|
function migrateExpand({ resource, recorder, fileSystem, }) {
|
|
26
28
|
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
|
27
29
|
const templateOffset = template_resource_1.getTemplateOffset(resource);
|
|
28
|
-
const elements = elements_1.findElementsByTagName(template,
|
|
30
|
+
const elements = elements_1.findElementsByTagName(template, `tui-expand`);
|
|
29
31
|
elements.forEach(element => {
|
|
30
32
|
var _a;
|
|
31
|
-
const templateElement = elements_1.findElementsByFn(element.childNodes, el => el.tagName ===
|
|
33
|
+
const templateElement = elements_1.findElementsByFn(element.childNodes, el => el.tagName === `ng-template`)[0];
|
|
32
34
|
if (!templateElement) {
|
|
33
35
|
return;
|
|
34
36
|
}
|
|
35
|
-
const tuiExpandAttr = templateElement.attrs.find(attr => attr.name ===
|
|
37
|
+
const tuiExpandAttr = templateElement.attrs.find(attr => attr.name === `tuiexpandcontent`);
|
|
36
38
|
const insertTo = (_a = templateElement === null || templateElement === void 0 ? void 0 : templateElement.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.startTag.endOffset;
|
|
37
39
|
if (!insertTo || tuiExpandAttr) {
|
|
38
40
|
return;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addImportToClosestModule = void 0;
|
|
4
|
-
const ng_component_1 = require("./angular/ng-component");
|
|
5
|
-
const ng_module_1 = require("./angular/ng-module");
|
|
6
4
|
const ng_morph_1 = require("ng-morph");
|
|
7
5
|
const add_unique_import_1 = require("./add-unique-import");
|
|
6
|
+
const ng_component_1 = require("./angular/ng-component");
|
|
7
|
+
const ng_module_1 = require("./angular/ng-module");
|
|
8
8
|
function addImportToClosestModule(componentPath, moduleName, moduleSpecifier) {
|
|
9
9
|
const [ngComponent] = ng_component_1.getNgComponents(componentPath);
|
|
10
10
|
const ngModule = ngComponent ? ng_module_1.findNgModule(ngComponent) : null;
|