@taiga-ui/cdk 3.52.0 → 3.53.0-canary.0974e5c
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/bundles/taiga-ui-cdk-components-alert-host.umd.js +1 -1
- package/bundles/taiga-ui-cdk-components-alert-host.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-directives-autofilled.umd.js +1 -1
- package/bundles/taiga-ui-cdk-directives-autofilled.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-directives-for-async.umd.js +6 -1
- package/bundles/taiga-ui-cdk-directives-for-async.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-pipes-filter.umd.js +1 -1
- package/bundles/taiga-ui-cdk-pipes-filter.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-pipes-keys.umd.js +1 -1
- package/bundles/taiga-ui-cdk-pipes-keys.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-pipes-mapper.umd.js +1 -1
- package/bundles/taiga-ui-cdk-pipes-mapper.umd.js.map +1 -1
- package/bundles/taiga-ui-cdk-pipes-replace.umd.js +1 -1
- package/bundles/taiga-ui-cdk-pipes-replace.umd.js.map +1 -1
- package/constants/version.d.ts +1 -1
- package/constants/version.js +1 -1
- package/directives/for-async/for-async.directive.d.ts +4 -0
- package/directives/for-async/for-async.module.d.ts +2 -1
- package/esm2015/components/alert-host/alert-host.component.js +2 -2
- package/esm2015/constants/version.js +2 -2
- package/esm2015/directives/autofilled/autofilled.module.js +2 -2
- package/esm2015/directives/for-async/for-async.directive.js +5 -1
- package/esm2015/directives/for-async/for-async.module.js +3 -2
- package/esm2015/pipes/filter/filter.module.js +2 -2
- package/esm2015/pipes/keys/keys.module.js +2 -2
- package/esm2015/pipes/mapper/mapper.module.js +2 -2
- package/esm2015/pipes/replace/replace.module.js +2 -2
- package/fesm2015/taiga-ui-cdk-components-alert-host.js +2 -2
- package/fesm2015/taiga-ui-cdk-components-alert-host.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-directives-autofilled.js +1 -1
- package/fesm2015/taiga-ui-cdk-directives-autofilled.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-directives-for-async.js +6 -1
- package/fesm2015/taiga-ui-cdk-directives-for-async.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-filter.js +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-filter.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-keys.js +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-keys.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-mapper.js +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-mapper.js.map +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-replace.js +1 -1
- package/fesm2015/taiga-ui-cdk-pipes-replace.js.map +1 -1
- package/package.json +4 -6
- package/schematics/ng-update/interfaces/html-comment.d.ts +5 -0
- package/schematics/ng-update/interfaces/index.d.ts +14 -0
- package/schematics/ng-update/interfaces/index.js +17 -0
- package/schematics/ng-update/{v3/interfaces/attribute-to-directive.d.ts → interfaces/replacement-attribute-to-directive.d.ts} +1 -1
- package/schematics/ng-update/interfaces/{replaceable-attribute-value.d.ts → replacement-attribute-value.d.ts} +1 -1
- package/schematics/ng-update/interfaces/{replaceable-attribute.d.ts → replacement-attribute.d.ts} +1 -1
- package/schematics/ng-update/interfaces/{replacement-const.d.ts → replacement-identifier.d.ts} +1 -1
- package/schematics/ng-update/interfaces/replacement-service.d.ts +2 -2
- package/schematics/ng-update/interfaces/{replaceable-tag.d.ts → replacement-tag.d.ts} +1 -1
- package/schematics/ng-update/interfaces/{type-to-rename.d.ts → replacement-type.d.ts} +1 -1
- package/schematics/ng-update/interfaces/replacement-type.js +2 -0
- package/schematics/ng-update/steps/icons/replace-imports.d.ts +2 -2
- package/schematics/ng-update/steps/rename-types.d.ts +2 -2
- package/schematics/ng-update/steps/replace-identifier.d.ts +3 -3
- package/schematics/ng-update/steps/replace-identifier.js +5 -5
- package/schematics/ng-update/utils/templates/index.d.ts +6 -0
- package/schematics/ng-update/utils/templates/index.js +9 -0
- package/schematics/ng-update/utils/templates/remove-inputs.d.ts +2 -2
- package/schematics/ng-update/utils/templates/remove-inputs.js +2 -2
- package/schematics/ng-update/utils/templates/replace-attr-values.d.ts +3 -3
- package/schematics/ng-update/utils/templates/replace-attr-values.js +2 -2
- package/schematics/ng-update/utils/templates/replace-attrs-by-directives.d.ts +7 -0
- package/schematics/ng-update/utils/templates/replace-attrs-by-directives.js +18 -0
- package/schematics/ng-update/utils/templates/replace-attrs.d.ts +10 -0
- package/schematics/ng-update/utils/templates/replace-attrs.js +20 -0
- package/schematics/ng-update/utils/templates/replace-tags.d.ts +3 -3
- package/schematics/ng-update/utils/templates/replace-tags.js +2 -2
- package/schematics/ng-update/utils/templates/template-comments.d.ts +10 -0
- package/schematics/ng-update/utils/templates/template-comments.js +20 -0
- package/schematics/ng-update/v3/constants/constants.d.ts +2 -2
- package/schematics/ng-update/v3/constants/deprecated-functions.d.ts +2 -2
- package/schematics/ng-update/v3/constants/templates.d.ts +8 -8
- package/schematics/ng-update/v3/constants/types.d.ts +2 -2
- package/schematics/ng-update/v3/index.js +1 -1
- package/schematics/ng-update/v3/steps/migrate-templates.js +11 -16
- package/schematics/ng-update/v3-30/constants/constants.d.ts +2 -2
- package/schematics/ng-update/v3-35/constants/constants.d.ts +2 -2
- package/schematics/ng-update/v4/index.js +7 -6
- package/schematics/ng-update/v4/steps/constants/attr-to-directive-replace.d.ts +2 -0
- package/schematics/ng-update/v4/steps/constants/attr-to-directive-replace.js +40 -0
- package/schematics/ng-update/v4/steps/constants/attrs-to-replace.d.ts +2 -0
- package/schematics/ng-update/v4/steps/constants/attrs-to-replace.js +47 -0
- package/schematics/ng-update/v4/steps/constants/html-comments.d.ts +2 -0
- package/schematics/ng-update/v4/steps/constants/html-comments.js +10 -0
- package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.d.ts +2 -0
- package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.js +44 -0
- package/schematics/ng-update/v4/steps/constants/index.d.ts +6 -0
- package/schematics/ng-update/v4/steps/constants/index.js +9 -0
- package/schematics/ng-update/v4/steps/constants/inputs-to-remove.d.ts +2 -0
- package/schematics/ng-update/v4/steps/constants/inputs-to-remove.js +8 -0
- package/schematics/ng-update/v4/steps/constants/tags-to-replace.d.ts +2 -0
- package/schematics/ng-update/v4/steps/constants/tags-to-replace.js +7 -0
- package/schematics/ng-update/v4/steps/index.d.ts +3 -0
- package/schematics/ng-update/v4/steps/index.js +6 -0
- package/schematics/ng-update/v4/steps/migrate-templates.d.ts +3 -0
- package/schematics/ng-update/v4/steps/migrate-templates.js +49 -0
- package/schematics/ng-update/v4/steps/templates/index.d.ts +2 -0
- package/schematics/ng-update/v4/steps/templates/index.js +5 -0
- package/schematics/ng-update/v4/steps/templates/migrate-badge.d.ts +8 -0
- package/schematics/ng-update/v4/steps/templates/migrate-badge.js +29 -0
- package/schematics/ng-update/v4/steps/templates/toggles/common.d.ts +10 -0
- package/schematics/ng-update/v4/steps/templates/toggles/common.js +40 -0
- package/schematics/ng-update/v4/steps/templates/toggles/index.d.ts +3 -0
- package/schematics/ng-update/v4/steps/templates/toggles/index.js +6 -0
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-checkbox.d.ts +8 -0
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-checkbox.js +25 -0
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-radio.d.ts +8 -0
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-radio.js +25 -0
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-toggle.d.ts +8 -0
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-toggle.js +25 -0
- package/schematics/utils/add-import-to-closest-module.js +11 -1
- package/schematics/utils/angular/is-standalone-component.d.ts +2 -0
- package/schematics/utils/angular/is-standalone-component.js +22 -0
- package/schematics/ng-update/v4/steps/replace-thumbnail-card.d.ts +0 -4
- package/schematics/ng-update/v4/steps/replace-thumbnail-card.js +0 -86
- /package/schematics/ng-update/interfaces/{replaceable-attribute-value.js → html-comment.js} +0 -0
- /package/schematics/ng-update/interfaces/{replaceable-attribute.js → replacement-attribute-to-directive.js} +0 -0
- /package/schematics/ng-update/interfaces/{replaceable-tag.js → replacement-attribute-value.js} +0 -0
- /package/schematics/ng-update/interfaces/{replacement-const.js → replacement-attribute.js} +0 -0
- /package/schematics/ng-update/interfaces/{type-to-rename.js → replacement-identifier.js} +0 -0
- /package/schematics/ng-update/{v3/interfaces/attribute-to-directive.js → interfaces/replacement-tag.js} +0 -0
@@ -15,6 +15,7 @@ const ng_component_input_manipulations_1 = require("../../../utils/templates/ng-
|
|
15
15
|
const template_resource_1 = require("../../../utils/templates/template-resource");
|
16
16
|
const remove_inputs_1 = require("../../utils/templates/remove-inputs");
|
17
17
|
const replace_attr_values_1 = require("../../utils/templates/replace-attr-values");
|
18
|
+
const replace_attrs_1 = require("../../utils/templates/replace-attrs");
|
18
19
|
const replace_tag_1 = require("../../utils/templates/replace-tag");
|
19
20
|
const replace_tags_1 = require("../../utils/templates/replace-tags");
|
20
21
|
const templates_1 = require("../constants/templates");
|
@@ -26,7 +27,7 @@ function migrateTemplates(fileSystem, options) {
|
|
26
27
|
const componentWithTemplatesPaths = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
|
27
28
|
const actions = [
|
28
29
|
replaceV3Tags,
|
29
|
-
|
30
|
+
replaceV3Attrs,
|
30
31
|
replaceAttrsByDirective,
|
31
32
|
replaceBreadcrumbs,
|
32
33
|
replaceFieldError,
|
@@ -69,22 +70,16 @@ function replaceAttrsByDirective({ resource, fileSystem, }) {
|
|
69
70
|
});
|
70
71
|
});
|
71
72
|
}
|
72
|
-
function
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
...elements_1.findAttributeOnElementWithAttrs(template, from.attrName, from.withAttrsNames || [], from.filterFn),
|
79
|
-
];
|
80
|
-
offsets.forEach(offset => {
|
81
|
-
recorder.remove(offset + templateOffset, from.attrName.length);
|
82
|
-
recorder.insertRight(offset + templateOffset, to.attrName);
|
83
|
-
});
|
73
|
+
function replaceV3Attrs({ resource, recorder, fileSystem, }) {
|
74
|
+
replace_attrs_1.replaceAttrs({
|
75
|
+
resource,
|
76
|
+
recorder,
|
77
|
+
fileSystem,
|
78
|
+
data: templates_1.ATTRS_TO_REPLACE,
|
84
79
|
});
|
85
80
|
}
|
86
81
|
function replaceV3Tags({ resource, recorder, fileSystem, }) {
|
87
|
-
replace_tags_1.replaceTags({ resource, recorder, fileSystem,
|
82
|
+
replace_tags_1.replaceTags({ resource, recorder, fileSystem, data: templates_1.TAGS_TO_REPLACE });
|
88
83
|
}
|
89
84
|
function addHTMLCommentTags({ resource, recorder, fileSystem, }) {
|
90
85
|
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
@@ -215,9 +210,9 @@ function replaceInputValues({ resource, recorder, fileSystem, }) {
|
|
215
210
|
resource,
|
216
211
|
recorder,
|
217
212
|
fileSystem,
|
218
|
-
|
213
|
+
data: templates_1.REPLACE_ATTR_VALUE,
|
219
214
|
});
|
220
215
|
}
|
221
216
|
function removeV3Inputs({ resource, fileSystem, recorder, }) {
|
222
|
-
remove_inputs_1.removeInputs({ resource, recorder, fileSystem,
|
217
|
+
remove_inputs_1.removeInputs({ resource, recorder, fileSystem, data: templates_1.INPUTS_TO_REMOVE });
|
223
218
|
}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {
|
2
|
-
export declare const ICONS_TS:
|
1
|
+
import { ReplacementIdentifier } from '../../interfaces/replacement-identifier';
|
2
|
+
export declare const ICONS_TS: ReplacementIdentifier[];
|
@@ -1,2 +1,2 @@
|
|
1
|
-
import {
|
2
|
-
export declare const ICONS_TS:
|
1
|
+
import { ReplacementIdentifier } from '../../interfaces/replacement-identifier';
|
2
|
+
export declare const ICONS_TS: ReplacementIdentifier[];
|
@@ -9,9 +9,9 @@ const versions_1 = require("../../ng-add/constants/versions");
|
|
9
9
|
const colored_log_1 = require("../../utils/colored-log");
|
10
10
|
const get_execution_time_1 = require("../../utils/get-execution-time");
|
11
11
|
const project_root_1 = require("../../utils/project-root");
|
12
|
-
const
|
13
|
-
const
|
14
|
-
const
|
12
|
+
const replace_identifier_1 = require("../steps/replace-identifier");
|
13
|
+
const steps_1 = require("./steps");
|
14
|
+
const identifiers_to_replace_1 = require("./steps/constants/identifiers-to-replace");
|
15
15
|
function updateToV4(options) {
|
16
16
|
const t0 = perf_hooks_1.performance.now();
|
17
17
|
!options[`skip-logs`] &&
|
@@ -30,9 +30,10 @@ function main(options) {
|
|
30
30
|
return (tree, _context) => {
|
31
31
|
const project = ng_morph_1.createProject(tree, project_root_1.projectRoot(), constants_1.ALL_FILES);
|
32
32
|
const fileSystem = project.getFileSystem().fs;
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
replace_identifier_1.replaceIdentifiers(options, identifiers_to_replace_1.IDENTIFIERS_TO_REPLACE);
|
34
|
+
steps_1.restoreTuiMapper(options);
|
35
|
+
steps_1.restoreTuiMatcher(options);
|
36
|
+
steps_1.migrateTemplates(fileSystem, options);
|
36
37
|
fileSystem.commitEdits();
|
37
38
|
ng_morph_1.saveActiveProject();
|
38
39
|
};
|
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ATTRS_TO_DIRECTIVE_REPLACE = void 0;
|
4
|
+
exports.ATTRS_TO_DIRECTIVE_REPLACE = [
|
5
|
+
{
|
6
|
+
componentSelector: [
|
7
|
+
`tui-primitive-textfield`,
|
8
|
+
`tui-input-number`,
|
9
|
+
`tui-input-slider`,
|
10
|
+
],
|
11
|
+
inputProperty: `prefix`,
|
12
|
+
directive: `tuiTextfieldPrefix`,
|
13
|
+
directiveModule: {
|
14
|
+
name: `TuiTextfieldControllerModule`,
|
15
|
+
moduleSpecifier: `@taiga-ui/core`,
|
16
|
+
},
|
17
|
+
},
|
18
|
+
{
|
19
|
+
componentSelector: [
|
20
|
+
`tui-primitive-textfield`,
|
21
|
+
`tui-input-number`,
|
22
|
+
`tui-input-slider`,
|
23
|
+
],
|
24
|
+
inputProperty: `postfix`,
|
25
|
+
directive: `tuiTextfieldPostfix`,
|
26
|
+
directiveModule: {
|
27
|
+
name: `TuiTextfieldControllerModule`,
|
28
|
+
moduleSpecifier: `@taiga-ui/core`,
|
29
|
+
},
|
30
|
+
},
|
31
|
+
{
|
32
|
+
componentSelector: [`tui-primitive-textfield`],
|
33
|
+
inputProperty: `filler`,
|
34
|
+
directive: `tuiTextfieldFiller`,
|
35
|
+
directiveModule: {
|
36
|
+
name: `TuiTextfieldControllerModule`,
|
37
|
+
moduleSpecifier: `@taiga-ui/core`,
|
38
|
+
},
|
39
|
+
},
|
40
|
+
];
|
@@ -0,0 +1,47 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ATTRS_TO_REPLACE = void 0;
|
4
|
+
exports.ATTRS_TO_REPLACE = [
|
5
|
+
{
|
6
|
+
from: {
|
7
|
+
attrName: `brandLogo`,
|
8
|
+
withTagNames: [`tui-card`, `tui-thumbnail-card`],
|
9
|
+
},
|
10
|
+
to: { attrName: `iconLeft` },
|
11
|
+
},
|
12
|
+
{
|
13
|
+
from: {
|
14
|
+
attrName: `[brandLogo]`,
|
15
|
+
withTagNames: [`tui-card`, `tui-thumbnail-card`],
|
16
|
+
},
|
17
|
+
to: { attrName: `[iconLeft]` },
|
18
|
+
},
|
19
|
+
{
|
20
|
+
from: {
|
21
|
+
attrName: `[status]`,
|
22
|
+
withTagNames: [`tui-badge`],
|
23
|
+
},
|
24
|
+
to: { attrName: `[appearance]` },
|
25
|
+
},
|
26
|
+
{
|
27
|
+
from: {
|
28
|
+
attrName: `status`,
|
29
|
+
withTagNames: [`tui-badge`],
|
30
|
+
},
|
31
|
+
to: { attrName: `appearance` },
|
32
|
+
},
|
33
|
+
{
|
34
|
+
from: {
|
35
|
+
attrName: `item`,
|
36
|
+
withTagNames: [`tui-radio`],
|
37
|
+
},
|
38
|
+
to: { attrName: `value` },
|
39
|
+
},
|
40
|
+
{
|
41
|
+
from: {
|
42
|
+
attrName: `[item]`,
|
43
|
+
withTagNames: [`tui-radio`],
|
44
|
+
},
|
45
|
+
to: { attrName: `[value]` },
|
46
|
+
},
|
47
|
+
];
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.HTML_COMMENTS = void 0;
|
4
|
+
exports.HTML_COMMENTS = [
|
5
|
+
{
|
6
|
+
tag: `tui-toggle`,
|
7
|
+
withAttrs: [`singleColor`, `showLoader`],
|
8
|
+
comment: `toggle [singleColor] and [showLoader] inputs have been removed due to design changes`,
|
9
|
+
},
|
10
|
+
];
|
@@ -0,0 +1,44 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.IDENTIFIERS_TO_REPLACE = void 0;
|
4
|
+
exports.IDENTIFIERS_TO_REPLACE = [
|
5
|
+
{
|
6
|
+
from: { name: `TuiCardModule`, moduleSpecifier: `@taiga-ui/addon-commerce` },
|
7
|
+
to: { name: `TuiThumbnailCardModule`, moduleSpecifier: `@taiga-ui/addon-commerce` },
|
8
|
+
},
|
9
|
+
{
|
10
|
+
from: { name: `TuiCardComponent`, moduleSpecifier: `@taiga-ui/addon-commerce` },
|
11
|
+
to: {
|
12
|
+
name: `TuiThumbnailCardComponent`,
|
13
|
+
moduleSpecifier: `@taiga-ui/addon-commerce`,
|
14
|
+
},
|
15
|
+
},
|
16
|
+
{
|
17
|
+
from: { name: `TuiBadgeModule`, moduleSpecifier: `@taiga-ui/experimental` },
|
18
|
+
to: { name: `TuiBadgeModule`, moduleSpecifier: `@taiga-ui/kit` },
|
19
|
+
},
|
20
|
+
{
|
21
|
+
from: { name: `TuiCheckboxModule`, moduleSpecifier: `@taiga-ui/experimental` },
|
22
|
+
to: { name: `TuiCheckboxModule`, moduleSpecifier: `@taiga-ui/kit` },
|
23
|
+
},
|
24
|
+
{
|
25
|
+
from: { name: `TuiRadioModule`, moduleSpecifier: `@taiga-ui/experimental` },
|
26
|
+
to: { name: `TuiRadioModule`, moduleSpecifier: `@taiga-ui/kit` },
|
27
|
+
},
|
28
|
+
{
|
29
|
+
from: { name: `TuiToggleModule`, moduleSpecifier: `@taiga-ui/experimental` },
|
30
|
+
to: { name: `TuiToggleModule`, moduleSpecifier: `@taiga-ui/kit` },
|
31
|
+
},
|
32
|
+
{
|
33
|
+
from: { name: `TuiTextAreaModule`, moduleSpecifier: `@taiga-ui/kit` },
|
34
|
+
to: { name: `TuiTextareaModule`, moduleSpecifier: `@taiga-ui/kit` },
|
35
|
+
},
|
36
|
+
{
|
37
|
+
from: { name: `TuiTextAreaDirective`, moduleSpecifier: `@taiga-ui/kit` },
|
38
|
+
to: { name: `TuiTextareaDirective`, moduleSpecifier: `@taiga-ui/kit` },
|
39
|
+
},
|
40
|
+
{
|
41
|
+
from: { name: `TuiTextAreaComponent`, moduleSpecifier: `@taiga-ui/kit` },
|
42
|
+
to: { name: `TuiTextareaComponent`, moduleSpecifier: `@taiga-ui/kit` },
|
43
|
+
},
|
44
|
+
];
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const tslib_1 = require("tslib");
|
4
|
+
tslib_1.__exportStar(require("./attr-to-directive-replace"), exports);
|
5
|
+
tslib_1.__exportStar(require("./attrs-to-replace"), exports);
|
6
|
+
tslib_1.__exportStar(require("./html-comments"), exports);
|
7
|
+
tslib_1.__exportStar(require("./identifiers-to-replace"), exports);
|
8
|
+
tslib_1.__exportStar(require("./inputs-to-remove"), exports);
|
9
|
+
tslib_1.__exportStar(require("./tags-to-replace"), exports);
|
@@ -0,0 +1,8 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.INPUTS_TO_REMOVE = void 0;
|
4
|
+
exports.INPUTS_TO_REMOVE = [
|
5
|
+
{ inputName: `active`, tags: [`tui-card`, `tui-thumbnail-card`] },
|
6
|
+
{ inputName: `showLoader`, tags: [`tui-toggle`] },
|
7
|
+
{ inputName: `singleColor`, tags: [`tui-toggle`] },
|
8
|
+
];
|
@@ -0,0 +1,6 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const tslib_1 = require("tslib");
|
4
|
+
tslib_1.__exportStar(require("./migrate-templates"), exports);
|
5
|
+
tslib_1.__exportStar(require("./restore-tui-mapper"), exports);
|
6
|
+
tslib_1.__exportStar(require("./restore-tui-matcher"), exports);
|
@@ -0,0 +1,49 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.migrateTemplates = void 0;
|
4
|
+
const constants_1 = require("../../../constants");
|
5
|
+
const colored_log_1 = require("../../../utils/colored-log");
|
6
|
+
const progress_1 = require("../../../utils/progress");
|
7
|
+
const get_component_templates_1 = require("../../../utils/templates/get-component-templates");
|
8
|
+
const template_resource_1 = require("../../../utils/templates/template-resource");
|
9
|
+
const templates_1 = require("../../utils/templates");
|
10
|
+
const replace_attrs_by_directives_1 = require("../../utils/templates/replace-attrs-by-directives");
|
11
|
+
const constants_2 = require("./constants");
|
12
|
+
const templates_2 = require("./templates");
|
13
|
+
function migrateTemplates(fileSystem, options) {
|
14
|
+
!options[`skip-logs`] &&
|
15
|
+
colored_log_1.infoLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating templates...`);
|
16
|
+
const componentWithTemplatesPaths = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
|
17
|
+
const actions = [
|
18
|
+
getAction({ action: templates_1.addHTMLCommentTags, requiredData: constants_2.HTML_COMMENTS }),
|
19
|
+
getAction({
|
20
|
+
action: replace_attrs_by_directives_1.replaceAttrsByDirective,
|
21
|
+
requiredData: constants_2.ATTRS_TO_DIRECTIVE_REPLACE,
|
22
|
+
}),
|
23
|
+
getAction({ action: templates_1.replaceTags, requiredData: constants_2.TAGS_TO_REPLACE }),
|
24
|
+
getAction({ action: templates_1.replaceAttrs, requiredData: constants_2.ATTRS_TO_REPLACE }),
|
25
|
+
getAction({ action: templates_1.removeInputs, requiredData: constants_2.INPUTS_TO_REMOVE }),
|
26
|
+
templates_2.migrateBadgeValue,
|
27
|
+
templates_2.migrateCheckbox,
|
28
|
+
templates_2.migrateRadio,
|
29
|
+
templates_2.migrateToggle,
|
30
|
+
];
|
31
|
+
const progressLog = progress_1.setupProgressLogger({
|
32
|
+
total: componentWithTemplatesPaths.length,
|
33
|
+
});
|
34
|
+
componentWithTemplatesPaths.forEach(resource => {
|
35
|
+
const path = fileSystem.resolve(template_resource_1.getPathFromTemplateResource(resource));
|
36
|
+
const recorder = fileSystem.edit(path);
|
37
|
+
actions.forEach((action, actionIndex) => {
|
38
|
+
const isLastAction = actionIndex === actions.length - 1;
|
39
|
+
!options[`skip-logs`] && progressLog(action.name, isLastAction);
|
40
|
+
action({ resource, fileSystem, recorder });
|
41
|
+
});
|
42
|
+
});
|
43
|
+
!options[`skip-logs`] &&
|
44
|
+
colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} templates migrated \n`);
|
45
|
+
}
|
46
|
+
exports.migrateTemplates = migrateTemplates;
|
47
|
+
function getAction({ action, requiredData, }) {
|
48
|
+
return ({ resource, fileSystem, recorder, }) => action({ resource, fileSystem, recorder, data: requiredData });
|
49
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { UpdateRecorder } from '@angular-devkit/schematics';
|
2
|
+
import { DevkitFileSystem } from 'ng-morph';
|
3
|
+
import { TemplateResource } from '../../../interfaces';
|
4
|
+
export declare function migrateBadgeValue({ resource, recorder, fileSystem, }: {
|
5
|
+
fileSystem: DevkitFileSystem;
|
6
|
+
recorder: UpdateRecorder;
|
7
|
+
resource: TemplateResource;
|
8
|
+
}): void;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.migrateBadgeValue = void 0;
|
4
|
+
const elements_1 = require("../../../../utils/templates/elements");
|
5
|
+
const template_resource_1 = require("../../../../utils/templates/template-resource");
|
6
|
+
function migrateBadgeValue({ resource, recorder, fileSystem, }) {
|
7
|
+
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
8
|
+
const templateOffset = template_resource_1.getTemplateOffset(resource);
|
9
|
+
const elements = elements_1.findElementsWithAttributeOnTag(template, [`[value]`, `value`], [`tui-badge`]);
|
10
|
+
elements.forEach(({ attrs, sourceCodeLocation }) => {
|
11
|
+
var _a;
|
12
|
+
const attr = attrs.find(attr => attr.name === `[value]` || attr.name === `value`);
|
13
|
+
if (!attr) {
|
14
|
+
return;
|
15
|
+
}
|
16
|
+
const attrValue = attr === null || attr === void 0 ? void 0 : attr.value;
|
17
|
+
const insertTo = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.endTag.startOffset;
|
18
|
+
if (!attrValue || !insertTo) {
|
19
|
+
return;
|
20
|
+
}
|
21
|
+
recorder.insertRight(insertTo + templateOffset, attr.name === `value` ? attrValue : `{{ ${attrValue} }}`);
|
22
|
+
const attrOffset = (_a = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[attr.name];
|
23
|
+
if (attrOffset) {
|
24
|
+
const { startOffset, endOffset } = attrOffset;
|
25
|
+
recorder.remove(templateOffset + startOffset - 1, endOffset - startOffset + 1);
|
26
|
+
}
|
27
|
+
});
|
28
|
+
}
|
29
|
+
exports.migrateBadgeValue = migrateBadgeValue;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { UpdateRecorder } from '@angular-devkit/schematics';
|
2
|
+
import { Attribute, ElementLocation } from 'parse5';
|
3
|
+
export declare function replaceOpenTag(sourceCodeLocation: ElementLocation, recorder: UpdateRecorder, templateOffset: number, { tag, directive, type }: {
|
4
|
+
tag: string;
|
5
|
+
directive: string;
|
6
|
+
type: string;
|
7
|
+
}): void;
|
8
|
+
export declare function replaceSizeAttr(attrs: Attribute[], sourceCodeLocation: ElementLocation, recorder: UpdateRecorder, templateOffset: number): void;
|
9
|
+
export declare function removeClosingTag(sourceCodeLocation: ElementLocation, recorder: UpdateRecorder, templateOffset: number): void;
|
10
|
+
export declare function closeStartTag({ startTag }: ElementLocation, recorder: UpdateRecorder, templateOffset: number): void;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.closeStartTag = exports.removeClosingTag = exports.replaceSizeAttr = exports.replaceOpenTag = void 0;
|
4
|
+
const sizeMap = {
|
5
|
+
l: `m`,
|
6
|
+
m: `s`,
|
7
|
+
};
|
8
|
+
function replaceOpenTag(sourceCodeLocation, recorder, templateOffset, { tag, directive, type }) {
|
9
|
+
const { startTag } = sourceCodeLocation;
|
10
|
+
const { startOffset, startCol } = startTag;
|
11
|
+
const spaces = ` `.repeat(startCol + 3);
|
12
|
+
recorder.remove(templateOffset + startOffset, `<${tag}`.length);
|
13
|
+
recorder.insertRight(templateOffset + startOffset, `<input\n${spaces}${directive}\n${spaces}type="${type}"`);
|
14
|
+
}
|
15
|
+
exports.replaceOpenTag = replaceOpenTag;
|
16
|
+
function replaceSizeAttr(attrs, sourceCodeLocation, recorder, templateOffset) {
|
17
|
+
var _a;
|
18
|
+
const sizeAttr = attrs.find(attr => attr.name === `size`);
|
19
|
+
if (sizeAttr) {
|
20
|
+
const { startOffset, endOffset } = ((_a = sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[sizeAttr.name]) || {
|
21
|
+
startOffset: 0,
|
22
|
+
endOffset: 0,
|
23
|
+
};
|
24
|
+
recorder.remove(templateOffset + startOffset, endOffset - startOffset);
|
25
|
+
recorder.insertRight(templateOffset + startOffset, `size="${sizeMap[sizeAttr.value] || sizeAttr.value}"`);
|
26
|
+
}
|
27
|
+
}
|
28
|
+
exports.replaceSizeAttr = replaceSizeAttr;
|
29
|
+
function removeClosingTag(sourceCodeLocation, recorder, templateOffset) {
|
30
|
+
const { endTag } = sourceCodeLocation;
|
31
|
+
const { startOffset, endOffset } = endTag;
|
32
|
+
const from = templateOffset + startOffset;
|
33
|
+
const to = endOffset - startOffset;
|
34
|
+
recorder.remove(from, to);
|
35
|
+
}
|
36
|
+
exports.removeClosingTag = removeClosingTag;
|
37
|
+
function closeStartTag({ startTag }, recorder, templateOffset) {
|
38
|
+
recorder.insertRight(templateOffset + startTag.endOffset - 1, `/`);
|
39
|
+
}
|
40
|
+
exports.closeStartTag = closeStartTag;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const tslib_1 = require("tslib");
|
4
|
+
tslib_1.__exportStar(require("./migrate-checkbox"), exports);
|
5
|
+
tslib_1.__exportStar(require("./migrate-radio"), exports);
|
6
|
+
tslib_1.__exportStar(require("./migrate-toggle"), exports);
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { UpdateRecorder } from '@angular-devkit/schematics';
|
2
|
+
import { DevkitFileSystem } from 'ng-morph';
|
3
|
+
import { TemplateResource } from '../../../../interfaces';
|
4
|
+
export declare function migrateCheckbox({ resource, recorder, fileSystem, }: {
|
5
|
+
fileSystem: DevkitFileSystem;
|
6
|
+
recorder: UpdateRecorder;
|
7
|
+
resource: TemplateResource;
|
8
|
+
}): void;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.migrateCheckbox = void 0;
|
4
|
+
const elements_1 = require("../../../../../utils/templates/elements");
|
5
|
+
const template_resource_1 = require("../../../../../utils/templates/template-resource");
|
6
|
+
const common_1 = require("./common");
|
7
|
+
function migrateCheckbox({ resource, recorder, fileSystem, }) {
|
8
|
+
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
9
|
+
const templateOffset = template_resource_1.getTemplateOffset(resource);
|
10
|
+
const elements = elements_1.findElementsByTagName(template, `tui-checkbox`);
|
11
|
+
elements.forEach(({ attrs, sourceCodeLocation }) => {
|
12
|
+
if (!sourceCodeLocation) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
common_1.replaceSizeAttr(attrs, sourceCodeLocation, recorder, templateOffset);
|
16
|
+
common_1.replaceOpenTag(sourceCodeLocation, recorder, templateOffset, {
|
17
|
+
tag: `tui-checkbox`,
|
18
|
+
directive: `tuiCheckbox`,
|
19
|
+
type: `checkbox`,
|
20
|
+
});
|
21
|
+
common_1.closeStartTag(sourceCodeLocation, recorder, templateOffset);
|
22
|
+
common_1.removeClosingTag(sourceCodeLocation, recorder, templateOffset);
|
23
|
+
});
|
24
|
+
}
|
25
|
+
exports.migrateCheckbox = migrateCheckbox;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { UpdateRecorder } from '@angular-devkit/schematics';
|
2
|
+
import { DevkitFileSystem } from 'ng-morph';
|
3
|
+
import { TemplateResource } from '../../../../interfaces';
|
4
|
+
export declare function migrateRadio({ resource, recorder, fileSystem, }: {
|
5
|
+
fileSystem: DevkitFileSystem;
|
6
|
+
recorder: UpdateRecorder;
|
7
|
+
resource: TemplateResource;
|
8
|
+
}): void;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.migrateRadio = void 0;
|
4
|
+
const elements_1 = require("../../../../../utils/templates/elements");
|
5
|
+
const template_resource_1 = require("../../../../../utils/templates/template-resource");
|
6
|
+
const common_1 = require("./common");
|
7
|
+
function migrateRadio({ resource, recorder, fileSystem, }) {
|
8
|
+
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
9
|
+
const templateOffset = template_resource_1.getTemplateOffset(resource);
|
10
|
+
const elements = elements_1.findElementsByTagName(template, `tui-radio`);
|
11
|
+
elements.forEach(({ attrs, sourceCodeLocation }) => {
|
12
|
+
if (!sourceCodeLocation) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
common_1.replaceSizeAttr(attrs, sourceCodeLocation, recorder, templateOffset);
|
16
|
+
common_1.replaceOpenTag(sourceCodeLocation, recorder, templateOffset, {
|
17
|
+
tag: `tui-radio`,
|
18
|
+
directive: `tuiRadio`,
|
19
|
+
type: `radio`,
|
20
|
+
});
|
21
|
+
common_1.closeStartTag(sourceCodeLocation, recorder, templateOffset);
|
22
|
+
common_1.removeClosingTag(sourceCodeLocation, recorder, templateOffset);
|
23
|
+
});
|
24
|
+
}
|
25
|
+
exports.migrateRadio = migrateRadio;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import { UpdateRecorder } from '@angular-devkit/schematics';
|
2
|
+
import { DevkitFileSystem } from 'ng-morph';
|
3
|
+
import { TemplateResource } from '../../../../interfaces';
|
4
|
+
export declare function migrateToggle({ resource, recorder, fileSystem, }: {
|
5
|
+
fileSystem: DevkitFileSystem;
|
6
|
+
recorder: UpdateRecorder;
|
7
|
+
resource: TemplateResource;
|
8
|
+
}): void;
|
@@ -0,0 +1,25 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.migrateToggle = void 0;
|
4
|
+
const elements_1 = require("../../../../../utils/templates/elements");
|
5
|
+
const template_resource_1 = require("../../../../../utils/templates/template-resource");
|
6
|
+
const common_1 = require("./common");
|
7
|
+
function migrateToggle({ resource, recorder, fileSystem, }) {
|
8
|
+
const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
|
9
|
+
const templateOffset = template_resource_1.getTemplateOffset(resource);
|
10
|
+
const elements = elements_1.findElementsByTagName(template, `tui-toggle`);
|
11
|
+
elements.forEach(({ attrs, sourceCodeLocation }) => {
|
12
|
+
if (!sourceCodeLocation) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
common_1.replaceSizeAttr(attrs, sourceCodeLocation, recorder, templateOffset);
|
16
|
+
common_1.replaceOpenTag(sourceCodeLocation, recorder, templateOffset, {
|
17
|
+
tag: `tui-toggle`,
|
18
|
+
directive: `tuiToggle`,
|
19
|
+
type: `checkbox`,
|
20
|
+
});
|
21
|
+
common_1.closeStartTag(sourceCodeLocation, recorder, templateOffset);
|
22
|
+
common_1.removeClosingTag(sourceCodeLocation, recorder, templateOffset);
|
23
|
+
});
|
24
|
+
}
|
25
|
+
exports.migrateToggle = migrateToggle;
|
@@ -2,12 +2,22 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.addImportToClosestModule = void 0;
|
4
4
|
const ng_morph_1 = require("ng-morph");
|
5
|
+
const add_import_to_component_1 = require("../utils/add-import-to-component");
|
5
6
|
const add_unique_import_1 = require("./add-unique-import");
|
7
|
+
const is_standalone_component_1 = require("./angular/is-standalone-component");
|
6
8
|
const ng_component_1 = require("./angular/ng-component");
|
7
9
|
const ng_module_1 = require("./angular/ng-module");
|
8
10
|
function addImportToClosestModule(componentPath, moduleName, moduleSpecifier) {
|
9
11
|
const [ngComponent] = ng_component_1.getNgComponents(componentPath);
|
10
|
-
|
12
|
+
if (!ngComponent) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
if (is_standalone_component_1.isStandaloneComponent(ngComponent)) {
|
16
|
+
add_import_to_component_1.addImportToComponent(ngComponent, moduleName, { unique: true });
|
17
|
+
add_unique_import_1.addUniqueImport(ngComponent.getSourceFile().getFilePath(), moduleName, moduleSpecifier);
|
18
|
+
return;
|
19
|
+
}
|
20
|
+
const ngModule = ng_module_1.findNgModule(ngComponent);
|
11
21
|
if (ngModule) {
|
12
22
|
ng_morph_1.addImportToNgModule(ngModule, moduleName, {
|
13
23
|
unique: true,
|