@taiga-ui/cdk 4.0.0-alpha.0 → 4.0.0-rc.10
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/index.d.ts +0 -1
- package/constants/used-icons.d.ts +1 -1
- package/constants/version.d.ts +1 -1
- package/constants/version.js +1 -1
- package/esm2022/classes/index.mjs +1 -2
- package/esm2022/constants/used-icons.mjs +9 -1
- package/esm2022/constants/version.mjs +2 -2
- package/esm2022/directives/auto-focus/autofocus.options.mjs +3 -3
- package/esm2022/directives/copy-processor/copy-processor.directive.mjs +3 -3
- package/esm2022/directives/high-dpi/high-dpi.directive.mjs +3 -3
- package/esm2022/directives/obscured/obscured.service.mjs +3 -3
- package/esm2022/services/index.mjs +2 -2
- package/esm2022/services/scroll.service.mjs +4 -4
- package/esm2022/services/theme-color.service.mjs +30 -0
- package/esm2022/tokens/active-element.mjs +3 -3
- package/esm2022/tokens/environment.mjs +15 -7
- package/esm2022/tokens/removed-element.mjs +3 -3
- package/esm2022/tokens/window-size.mjs +3 -3
- package/esm2022/utils/focus/focused-in.mjs +7 -0
- package/esm2022/utils/focus/index.mjs +2 -1
- package/fesm2022/taiga-ui-cdk-classes.mjs +1 -15
- package/fesm2022/taiga-ui-cdk-classes.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-constants.mjs +9 -1
- package/fesm2022/taiga-ui-cdk-constants.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-copy-processor.mjs +2 -2
- package/fesm2022/taiga-ui-cdk-directives-copy-processor.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-high-dpi.mjs +2 -2
- package/fesm2022/taiga-ui-cdk-directives-high-dpi.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-services.mjs +22 -25
- package/fesm2022/taiga-ui-cdk-services.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-tokens.mjs +19 -12
- package/fesm2022/taiga-ui-cdk-tokens.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/package.json +356 -67
- package/schematics/ng-update/interfaces/html-comment.d.ts +3 -2
- package/schematics/ng-update/interfaces/replacement-attribute-value.d.ts +6 -2
- package/schematics/ng-update/interfaces/replacement-identifier.d.ts +4 -10
- package/schematics/ng-update/interfaces/replacement-type.d.ts +4 -0
- package/schematics/ng-update/steps/rename-types.js +6 -2
- package/schematics/ng-update/steps/replace-identifier.js +30 -8
- package/schematics/ng-update/steps/replace-package-name.js +4 -5
- package/schematics/ng-update/utils/templates/replace-attr-values.js +39 -10
- package/schematics/ng-update/utils/templates/template-comments.js +7 -1
- package/schematics/ng-update/v4/index.js +9 -1
- package/schematics/ng-update/v4/migrate-icons/index.js +2 -2
- package/schematics/ng-update/v4/migrate-icons/rename-icons.js +13 -5
- package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.d.ts +2 -1
- package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.js +19 -6
- package/schematics/ng-update/v4/steps/constants/attr-to-directive-replace.js +3 -2
- package/schematics/ng-update/v4/steps/constants/attr-with-values-to-replace.js +44 -3
- package/schematics/ng-update/v4/steps/constants/attrs-to-replace.js +107 -21
- package/schematics/ng-update/v4/steps/constants/html-comments.js +9 -0
- package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.js +552 -213
- package/schematics/ng-update/v4/steps/constants/index.d.ts +1 -0
- package/schematics/ng-update/v4/steps/constants/index.js +1 -0
- package/schematics/ng-update/v4/steps/constants/inputs-to-remove.js +1 -0
- package/schematics/ng-update/v4/steps/constants/migration-warnings.js +20 -0
- package/schematics/ng-update/v4/steps/constants/modules-to-remove.js +20 -0
- package/schematics/ng-update/v4/steps/constants/modules-to-replace.d.ts +7 -6
- package/schematics/ng-update/v4/steps/constants/modules-to-replace.js +1 -0
- package/schematics/ng-update/v4/steps/constants/services.d.ts +2 -0
- package/schematics/ng-update/v4/steps/constants/services.js +15 -0
- package/schematics/ng-update/v4/steps/constants/tags-to-replace.js +14 -2
- package/schematics/ng-update/v4/steps/constants/types.js +33 -1
- package/schematics/ng-update/v4/steps/index.d.ts +4 -1
- package/schematics/ng-update/v4/steps/index.js +4 -1
- package/schematics/ng-update/v4/steps/migrate-alert-service.d.ts +2 -0
- package/schematics/ng-update/v4/steps/migrate-alert-service.js +110 -0
- package/schematics/ng-update/v4/steps/migrate-month-context.d.ts +2 -0
- package/schematics/ng-update/v4/steps/migrate-month-context.js +39 -0
- package/schematics/ng-update/v4/steps/migrate-number-format-settings.d.ts +2 -0
- package/schematics/ng-update/v4/steps/migrate-number-format-settings.js +64 -0
- package/schematics/ng-update/v4/steps/migrate-root.d.ts +3 -0
- package/schematics/ng-update/v4/steps/migrate-root.js +61 -0
- package/schematics/ng-update/v4/steps/migrate-templates.js +10 -2
- package/schematics/ng-update/v4/steps/styles/index.js +38 -0
- package/schematics/ng-update/v4/steps/styles/migrate-less-scss-constants.d.ts +1 -0
- package/schematics/ng-update/v4/steps/styles/migrate-less-scss-constants.js +13 -0
- package/schematics/ng-update/v4/steps/styles/migrate-scrollbar-behavior.d.ts +1 -0
- package/schematics/ng-update/v4/steps/styles/migrate-scrollbar-behavior.js +10 -0
- package/schematics/ng-update/v4/steps/styles/migrate-shadow-mixins.d.ts +1 -0
- package/schematics/ng-update/v4/steps/styles/migrate-shadow-mixins.js +23 -0
- package/schematics/ng-update/v4/steps/styles/migrate-space-mixins.d.ts +1 -0
- package/schematics/ng-update/v4/steps/styles/migrate-space-mixins.js +20 -0
- package/schematics/ng-update/v4/steps/styles/migrate-text-mixins.d.ts +1 -0
- package/schematics/ng-update/v4/steps/styles/migrate-text-mixins.js +54 -0
- package/schematics/ng-update/v4/steps/templates/index.d.ts +6 -0
- package/schematics/ng-update/v4/steps/templates/index.js +6 -0
- package/schematics/ng-update/v4/steps/templates/migrate-avatar.js +10 -5
- package/schematics/ng-update/{v3/steps/migrate-polymorpheus.d.ts → v4/steps/templates/migrate-axes.d.ts} +2 -2
- package/schematics/ng-update/v4/steps/templates/migrate-axes.js +26 -0
- package/schematics/ng-update/v4/steps/templates/migrate-badge.js +15 -6
- package/schematics/ng-update/v4/steps/templates/migrate-badged-content.js +1 -1
- package/schematics/ng-update/{v3/steps/migrate-textfield-controller.d.ts → v4/steps/templates/migrate-blocked.d.ts} +2 -2
- package/schematics/ng-update/v4/steps/templates/migrate-blocked.js +35 -0
- package/schematics/ng-update/v4/steps/templates/migrate-button-appearance.d.ts +8 -0
- package/schematics/ng-update/v4/steps/templates/migrate-button-appearance.js +41 -0
- package/schematics/ng-update/v4/steps/templates/migrate-expandable.js +3 -2
- package/schematics/ng-update/v4/steps/templates/migrate-focusable.js +7 -4
- package/schematics/ng-update/v4/steps/templates/migrate-label.d.ts +8 -0
- package/schematics/ng-update/v4/steps/templates/migrate-label.js +39 -0
- package/schematics/ng-update/v4/steps/templates/migrate-labeled.js +5 -7
- package/schematics/ng-update/v4/steps/templates/migrate-mobile-tabs.d.ts +8 -0
- package/schematics/ng-update/v4/steps/templates/migrate-mobile-tabs.js +45 -0
- package/schematics/ng-update/v4/steps/templates/migrate-notification.d.ts +8 -0
- package/schematics/ng-update/v4/steps/templates/migrate-notification.js +64 -0
- package/schematics/ng-update/v4/steps/templates/migrate-number-precision.d.ts +8 -0
- package/schematics/ng-update/v4/steps/templates/migrate-number-precision.js +36 -0
- package/schematics/ng-update/v4/steps/templates/migrate-overscroll.js +4 -6
- package/schematics/ng-update/v4/steps/templates/migrate-thumbnail-card.js +2 -1
- package/schematics/ng-update/v4/steps/templates/toggles/common.js +3 -2
- package/schematics/ng-update/v4/steps/templates/toggles/migrate-checkbox.js +36 -0
- package/schematics/ng-update/v4/steps/update-packages.js +21 -8
- package/schematics/ng-update/v4/steps/utils/replace-modules-with-providers.d.ts +1 -11
- package/schematics/ng-update/v4/steps/utils/replace-modules-with-providers.js +8 -4
- package/schematics/utils/get-named-import-references.js +4 -2
- package/schematics/utils/templates/elements.js +2 -1
- package/schematics/utils/templates/inputs.js +2 -1
- package/services/index.d.ts +1 -1
- package/services/theme-color.service.d.ts +16 -0
- package/tokens/environment.d.ts +1 -0
- package/utils/focus/focused-in.d.ts +2 -0
- package/utils/focus/index.d.ts +1 -0
- package/classes/controller.d.ts +0 -9
- package/esm2022/classes/controller.mjs +0 -18
- package/esm2022/services/static-request.service.mjs +0 -33
- package/schematics/ng-update/v3/constants/breakpoints.d.ts +0 -82
- package/schematics/ng-update/v3/constants/breakpoints.js +0 -34
- package/schematics/ng-update/v3/constants/constants.d.ts +0 -2
- package/schematics/ng-update/v3/constants/constants.js +0 -466
- package/schematics/ng-update/v3/constants/deprecated-functions.d.ts +0 -2
- package/schematics/ng-update/v3/constants/deprecated-functions.js +0 -680
- package/schematics/ng-update/v3/constants/enums.d.ts +0 -2
- package/schematics/ng-update/v3/constants/enums.js +0 -284
- package/schematics/ng-update/v3/constants/modules.d.ts +0 -2
- package/schematics/ng-update/v3/constants/modules.js +0 -9
- package/schematics/ng-update/v3/constants/services.d.ts +0 -2
- package/schematics/ng-update/v3/constants/services.js +0 -53
- package/schematics/ng-update/v3/constants/templates.d.ts +0 -57
- package/schematics/ng-update/v3/constants/templates.js +0 -744
- package/schematics/ng-update/v3/constants/tui-interactive-selectors.d.ts +0 -1
- package/schematics/ng-update/v3/constants/tui-interactive-selectors.js +0 -55
- package/schematics/ng-update/v3/constants/types.d.ts +0 -2
- package/schematics/ng-update/v3/constants/types.js +0 -156
- package/schematics/ng-update/v3/constants/warnings.d.ts +0 -2
- package/schematics/ng-update/v3/constants/warnings.js +0 -111
- package/schematics/ng-update/v3/index.d.ts +0 -3
- package/schematics/ng-update/v3/index.js +0 -105
- package/schematics/ng-update/v3/schema.json +0 -13
- package/schematics/ng-update/v3/steps/migrate-date-time.d.ts +0 -2
- package/schematics/ng-update/v3/steps/migrate-date-time.js +0 -207
- package/schematics/ng-update/v3/steps/migrate-polymorpheus.js +0 -78
- package/schematics/ng-update/v3/steps/migrate-progress.d.ts +0 -8
- package/schematics/ng-update/v3/steps/migrate-progress.js +0 -49
- package/schematics/ng-update/v3/steps/migrate-sliders/index.d.ts +0 -3
- package/schematics/ng-update/v3/steps/migrate-sliders/index.js +0 -19
- package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-range.d.ts +0 -3
- package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-range.js +0 -103
- package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-slider.d.ts +0 -3
- package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-slider.js +0 -90
- package/schematics/ng-update/v3/steps/migrate-taiga-proprietary-icons.d.ts +0 -3
- package/schematics/ng-update/v3/steps/migrate-taiga-proprietary-icons.js +0 -70
- package/schematics/ng-update/v3/steps/migrate-templates.d.ts +0 -4
- package/schematics/ng-update/v3/steps/migrate-templates.js +0 -216
- package/schematics/ng-update/v3/steps/migrate-textfield-controller.js +0 -98
- package/schematics/ng-update/v3/steps/miscellaneous.d.ts +0 -2
- package/schematics/ng-update/v3/steps/miscellaneous.js +0 -81
- package/schematics/ng-update/v3/steps/replace-functions.d.ts +0 -2
- package/schematics/ng-update/v3/steps/replace-functions.js +0 -138
- package/schematics/ng-update/v3/steps/replace-styles.d.ts +0 -3
- package/schematics/ng-update/v3/steps/replace-styles.js +0 -33
- package/schematics/ng-update/v3-30/constants/constants.d.ts +0 -2
- package/schematics/ng-update/v3-30/constants/constants.js +0 -8
- package/schematics/ng-update/v3-30/constants/icons.d.ts +0 -4
- package/schematics/ng-update/v3-30/constants/icons.js +0 -993
- package/schematics/ng-update/v3-30/index.d.ts +0 -3
- package/schematics/ng-update/v3-30/index.js +0 -33
- package/schematics/ng-update/v3-35/constants/constants.d.ts +0 -2
- package/schematics/ng-update/v3-35/constants/constants.js +0 -8
- package/schematics/ng-update/v3-35/constants/icons.d.ts +0 -4
- package/schematics/ng-update/v3-35/constants/icons.js +0 -2537
- package/schematics/ng-update/v3-35/index.d.ts +0 -3
- package/schematics/ng-update/v3-35/index.js +0 -33
- package/schematics/ng-update/v3-36/index.d.ts +0 -3
- package/schematics/ng-update/v3-36/index.js +0 -23
- package/schematics/ng-update/v3-40/index.d.ts +0 -3
- package/schematics/ng-update/v3-40/index.js +0 -62
- package/schematics/ng-update/v3-5/index.d.ts +0 -3
- package/schematics/ng-update/v3-5/index.js +0 -20
- package/schematics/ng-update/v3-5/steps/migrate-expand-templates.d.ts +0 -3
- package/schematics/ng-update/v3-5/steps/migrate-expand-templates.js +0 -44
- package/schematics/ng-update/v4/steps/migrate-styles.js +0 -20
- package/services/static-request.service.d.ts +0 -8
- /package/schematics/ng-update/v4/steps/{migrate-styles.d.ts → styles/index.d.ts} +0 -0
@@ -1,216 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.migrateTemplates = void 0;
|
4
|
-
const ng_morph_1 = require("ng-morph");
|
5
|
-
const constants_1 = require("../../../constants");
|
6
|
-
const add_import_to_closest_module_1 = require("../../../utils/add-import-to-closest-module");
|
7
|
-
const add_unique_import_1 = require("../../../utils/add-unique-import");
|
8
|
-
const colored_log_1 = require("../../../utils/colored-log");
|
9
|
-
const insert_todo_1 = require("../../../utils/insert-todo");
|
10
|
-
const progress_1 = require("../../../utils/progress");
|
11
|
-
const elements_1 = require("../../../utils/templates/elements");
|
12
|
-
const get_component_templates_1 = require("../../../utils/templates/get-component-templates");
|
13
|
-
const ng_component_input_manipulations_1 = require("../../../utils/templates/ng-component-input-manipulations");
|
14
|
-
const template_resource_1 = require("../../../utils/templates/template-resource");
|
15
|
-
const remove_inputs_1 = require("../../utils/templates/remove-inputs");
|
16
|
-
const replace_attr_values_1 = require("../../utils/templates/replace-attr-values");
|
17
|
-
const replace_attrs_1 = require("../../utils/templates/replace-attrs");
|
18
|
-
const replace_tag_1 = require("../../utils/templates/replace-tag");
|
19
|
-
const replace_tags_1 = require("../../utils/templates/replace-tags");
|
20
|
-
const templates_1 = require("../constants/templates");
|
21
|
-
const migrate_polymorpheus_1 = require("./migrate-polymorpheus");
|
22
|
-
const migrate_textfield_controller_1 = require("./migrate-textfield-controller");
|
23
|
-
function replaceAttrsByDirective({ resource, fileSystem, }) {
|
24
|
-
templates_1.ATTR_TO_DIRECTIVE.forEach(({ componentSelector, directiveModule, directive, inputProperty, filterFn }) => {
|
25
|
-
(0, ng_component_input_manipulations_1.replaceInputPropertyByDirective)({
|
26
|
-
componentSelector,
|
27
|
-
directiveModule,
|
28
|
-
directive,
|
29
|
-
inputProperty,
|
30
|
-
fileSystem,
|
31
|
-
templateResource: resource,
|
32
|
-
filterFn,
|
33
|
-
});
|
34
|
-
});
|
35
|
-
}
|
36
|
-
function replaceV3Attrs({ resource, recorder, fileSystem, }) {
|
37
|
-
(0, replace_attrs_1.replaceAttrs)({
|
38
|
-
resource,
|
39
|
-
recorder,
|
40
|
-
fileSystem,
|
41
|
-
data: templates_1.ATTRS_TO_REPLACE,
|
42
|
-
});
|
43
|
-
}
|
44
|
-
function replaceV3Tags({ resource, recorder, fileSystem, }) {
|
45
|
-
(0, replace_tags_1.replaceTags)({ resource, recorder, fileSystem, data: templates_1.TAGS_TO_REPLACE });
|
46
|
-
}
|
47
|
-
function addHTMLCommentTags({ resource, recorder, fileSystem, }) {
|
48
|
-
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
49
|
-
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
50
|
-
templates_1.TEMPLATE_COMMENTS.forEach(({ comment, tag, withAttr }) => {
|
51
|
-
const elementStartOffsets = [
|
52
|
-
...(0, elements_1.findElementsWithAttribute)(template, withAttr),
|
53
|
-
...(0, elements_1.findElementsWithAttribute)(template, `[${withAttr}]`),
|
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) => {
|
58
|
-
recorder.insertRight(offset, `<!-- ${insert_todo_1.TODO_MARK} ${comment} -->\n`);
|
59
|
-
});
|
60
|
-
});
|
61
|
-
}
|
62
|
-
function replaceBreadcrumbs({ resource, recorder, fileSystem, }) {
|
63
|
-
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
64
|
-
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
65
|
-
const elements = (0, elements_1.findElementsByTagName)(template, 'tui-breadcrumbs');
|
66
|
-
elements.forEach((element) => {
|
67
|
-
var _a, _b, _c, _d, _e;
|
68
|
-
const itemsAttr = element.attrs.find((attr) => attr.name === '[items]');
|
69
|
-
const itemsValue = itemsAttr === null || itemsAttr === void 0 ? void 0 : itemsAttr.value;
|
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
|
-
if (!itemsValue || !insertTo) {
|
72
|
-
return;
|
73
|
-
}
|
74
|
-
// noinspection AngularMissingRequiredDirectiveInputBinding
|
75
|
-
recorder.insertRight(insertTo + templateOffset, `
|
76
|
-
<ng-container *ngFor="let item of ${itemsValue}">
|
77
|
-
<a
|
78
|
-
*tuiItem
|
79
|
-
tuiLink
|
80
|
-
[routerLink]="item.routerLink"
|
81
|
-
>
|
82
|
-
{{ item.caption }}
|
83
|
-
</a>
|
84
|
-
</ng-container>`);
|
85
|
-
const { startOffset = 0, endOffset = 0 } = ((_e = (_d = element.sourceCodeLocation) === null || _d === void 0 ? void 0 : _d.attrs) === null || _e === void 0 ? void 0 : _e['[items]']) || {};
|
86
|
-
recorder.remove(templateOffset + startOffset - 1, endOffset - startOffset + 1);
|
87
|
-
});
|
88
|
-
}
|
89
|
-
function replaceFieldError({ resource, recorder, fileSystem, }) {
|
90
|
-
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
91
|
-
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
92
|
-
const elements = (0, elements_1.findElementsByTagName)(template, 'tui-field-error');
|
93
|
-
elements.forEach((element) => {
|
94
|
-
var _a, _b;
|
95
|
-
const orderAttr = element.attrs.find((attr) => attr.name === '[order]');
|
96
|
-
const orderVal = orderAttr === null || orderAttr === void 0 ? void 0 : orderAttr.value;
|
97
|
-
if (orderAttr) {
|
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]']) || {};
|
99
|
-
recorder.remove(templateOffset + startOffset - 1, endOffset - startOffset + 1);
|
100
|
-
}
|
101
|
-
const input = `[error]="${orderVal !== null && orderVal !== void 0 ? orderVal : '[]'} | tuiFieldError | async"`;
|
102
|
-
(0, replace_tag_1.replaceTag)(recorder, element.sourceCodeLocation, 'tui-field-error', 'tui-error', templateOffset, [input]);
|
103
|
-
});
|
104
|
-
if (elements.length) {
|
105
|
-
(0, add_import_to_closest_module_1.addImportToClosestModule)(resource.componentPath, 'TuiError', '@taiga-ui/core');
|
106
|
-
}
|
107
|
-
}
|
108
|
-
function addEditorProviders({ resource, fileSystem, }) {
|
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'));
|
111
|
-
if (elements.length) {
|
112
|
-
const componentPath = resource.componentPath;
|
113
|
-
const componentClass = (0, ng_morph_1.getNgComponents)(componentPath);
|
114
|
-
(0, ng_morph_1.addProviderToComponent)(componentClass[0], `{
|
115
|
-
provide: TUI_EDITOR_EXTENSIONS,
|
116
|
-
useValue: defaultEditorExtensions
|
117
|
-
}`, { unique: true });
|
118
|
-
(0, add_unique_import_1.addUniqueImport)(componentPath, 'TUI_EDITOR_EXTENSIONS', '@taiga-ui/addon-editor');
|
119
|
-
(0, add_unique_import_1.addUniqueImport)(componentPath, 'defaultEditorExtensions', '@taiga-ui/addon-editor');
|
120
|
-
}
|
121
|
-
}
|
122
|
-
const HIDE_SELECTED_PIPE_WITH_ARGS_REG = /\|\s*tuiHideSelected(\s*:\s*[^|'"]*)?/gi;
|
123
|
-
function migrateTuiHideSelectedPipe({ resource, fileSystem, recorder, }) {
|
124
|
-
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
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) => {
|
128
|
-
var _a;
|
129
|
-
const { name, value: oldValue } = el.attrs.find((attr) => attr.value.match(HIDE_SELECTED_PIPE_WITH_ARGS_REG)) ||
|
130
|
-
{};
|
131
|
-
const attrLocations = (_a = el.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.attrs;
|
132
|
-
if (!name || !oldValue || !attrLocations) {
|
133
|
-
return;
|
134
|
-
}
|
135
|
-
const newValue = oldValue.replaceAll(HIDE_SELECTED_PIPE_WITH_ARGS_REG, '| tuiHideSelected');
|
136
|
-
const { startOffset } = attrLocations[name];
|
137
|
-
const valueOffset = templateOffset + startOffset + name.length + '="'.length;
|
138
|
-
recorder.remove(valueOffset, oldValue.length);
|
139
|
-
recorder.insertRight(valueOffset, newValue);
|
140
|
-
});
|
141
|
-
}
|
142
|
-
function migrateBinaryAttributes({ resource, fileSystem, recorder, }) {
|
143
|
-
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
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) => {
|
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()));
|
149
|
-
});
|
150
|
-
elements.forEach((el) => {
|
151
|
-
var _a;
|
152
|
-
const attrLocations = (_a = el.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.attrs;
|
153
|
-
if (!attrLocations) {
|
154
|
-
return;
|
155
|
-
}
|
156
|
-
const { startOffset, endOffset } = attrLocations[`[${attrName.toLowerCase()}]`] ||
|
157
|
-
attrLocations[attrName.toLowerCase()];
|
158
|
-
recorder.remove(templateOffset + startOffset, endOffset - startOffset);
|
159
|
-
recorder.insertRight(templateOffset + startOffset, attrName);
|
160
|
-
});
|
161
|
-
});
|
162
|
-
}
|
163
|
-
function addWarningForFormatNumberPipe({ resource, fileSystem, recorder, }) {
|
164
|
-
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
165
|
-
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
166
|
-
if (template.match(/\|\s*tuiFormatNumber\s*:\s/gi)) {
|
167
|
-
recorder.insertLeft(templateOffset && templateOffset + 1, `<!-- ${insert_todo_1.TODO_MARK} tuiFormatNumber pipe has new API. See https://taiga-ui.dev/pipes/format-number -->`);
|
168
|
-
}
|
169
|
-
}
|
170
|
-
function replaceInputValues({ resource, recorder, fileSystem, }) {
|
171
|
-
(0, replace_attr_values_1.replaceAttrValues)({
|
172
|
-
resource,
|
173
|
-
recorder,
|
174
|
-
fileSystem,
|
175
|
-
data: templates_1.REPLACE_ATTR_VALUE,
|
176
|
-
});
|
177
|
-
}
|
178
|
-
function removeV3Inputs({ resource, fileSystem, recorder, }) {
|
179
|
-
(0, remove_inputs_1.removeInputs)({ resource, recorder, fileSystem, data: templates_1.INPUTS_TO_REMOVE });
|
180
|
-
}
|
181
|
-
function migrateTemplates(fileSystem, options) {
|
182
|
-
!options['skip-logs'] &&
|
183
|
-
(0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating templates...`);
|
184
|
-
const componentWithTemplatesPaths = (0, get_component_templates_1.getComponentTemplates)(constants_1.ALL_TS_FILES);
|
185
|
-
const actions = [
|
186
|
-
replaceV3Tags,
|
187
|
-
replaceV3Attrs,
|
188
|
-
replaceAttrsByDirective,
|
189
|
-
replaceBreadcrumbs,
|
190
|
-
replaceFieldError,
|
191
|
-
addHTMLCommentTags,
|
192
|
-
addEditorProviders,
|
193
|
-
migrateTuiHideSelectedPipe,
|
194
|
-
removeV3Inputs,
|
195
|
-
migrate_polymorpheus_1.migratePolymorpheus,
|
196
|
-
migrate_textfield_controller_1.migrateTextfieldController,
|
197
|
-
replaceInputValues,
|
198
|
-
migrateBinaryAttributes,
|
199
|
-
addWarningForFormatNumberPipe,
|
200
|
-
];
|
201
|
-
const progressLog = (0, progress_1.setupProgressLogger)({
|
202
|
-
total: componentWithTemplatesPaths.length,
|
203
|
-
});
|
204
|
-
componentWithTemplatesPaths.forEach((resource) => {
|
205
|
-
const path = fileSystem.resolve((0, template_resource_1.getPathFromTemplateResource)(resource));
|
206
|
-
const recorder = fileSystem.edit(path);
|
207
|
-
actions.forEach((action, actionIndex) => {
|
208
|
-
const isLastAction = actionIndex === actions.length - 1;
|
209
|
-
!options['skip-logs'] && progressLog(action.name, isLastAction);
|
210
|
-
action({ resource, fileSystem, recorder });
|
211
|
-
});
|
212
|
-
});
|
213
|
-
!options['skip-logs'] &&
|
214
|
-
(0, colored_log_1.successLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} templates migrated \n`);
|
215
|
-
}
|
216
|
-
exports.migrateTemplates = migrateTemplates;
|
@@ -1,98 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.migrateTextfieldController = void 0;
|
4
|
-
const ng_morph_1 = require("ng-morph");
|
5
|
-
const elements_1 = require("../../../utils/templates/elements");
|
6
|
-
const ng_component_input_manipulations_1 = require("../../../utils/templates/ng-component-input-manipulations");
|
7
|
-
const template_resource_1 = require("../../../utils/templates/template-resource");
|
8
|
-
const TEXTFIELDS = [
|
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
|
-
];
|
25
|
-
const ATTRS_MAP = {
|
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
|
-
};
|
37
|
-
const CONTROLLER_ITEMS = Object.keys(ATTRS_MAP).map((attr) => attr.toLowerCase());
|
38
|
-
function insertTuiTextfieldInput({ element, attrs, recorder, templateOffset, }) {
|
39
|
-
var _a, _b;
|
40
|
-
const newAttrs = attrs
|
41
|
-
.map((attr) => `${ATTRS_MAP[attr.name]}="${attr.value}"`)
|
42
|
-
.join('\n');
|
43
|
-
const content = element.tagName === 'tui-text-area'
|
44
|
-
? `<textarea tuiTextfield ${newAttrs}></textarea> `
|
45
|
-
: `<input tuiTextfield ${newAttrs}/> `;
|
46
|
-
const insertTo = (_b = (_a = element.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.endTag) === null || _b === void 0 ? void 0 : _b.startOffset;
|
47
|
-
if (insertTo) {
|
48
|
-
recorder.insertRight(insertTo + templateOffset, content);
|
49
|
-
}
|
50
|
-
}
|
51
|
-
function addAttrToExistingInput({ existingInput, attrs, recorder, templateOffset, }) {
|
52
|
-
attrs.forEach((attr) => {
|
53
|
-
var _a, _b, _c;
|
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
|
-
if (insertTo) {
|
56
|
-
recorder.insertLeft(insertTo + templateOffset, ` ${ATTRS_MAP[attr.name]}="${attr.value}"`);
|
57
|
-
}
|
58
|
-
});
|
59
|
-
}
|
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))));
|
62
|
-
offsets.forEach(([start, end]) => {
|
63
|
-
recorder.remove(start + templateOffset, end - start);
|
64
|
-
});
|
65
|
-
}
|
66
|
-
function getTagsToRemove(attrName) {
|
67
|
-
return ['[tuitextfieldmaxlength]', 'tuitextfieldmaxlength'].includes(attrName)
|
68
|
-
? TEXTFIELDS.filter((tag) => tag !== 'tui-text-area')
|
69
|
-
: TEXTFIELDS;
|
70
|
-
}
|
71
|
-
const excludedAttrs = {
|
72
|
-
'tui-text-area': ['[tuitextfieldmaxlength]', 'tuitextfieldmaxlength'],
|
73
|
-
};
|
74
|
-
function exclusion({ tagName }, attrName) {
|
75
|
-
var _a;
|
76
|
-
return (_a = excludedAttrs[tagName]) === null || _a === void 0 ? void 0 : _a.includes(attrName);
|
77
|
-
}
|
78
|
-
function migrateTextfieldController({ resource, fileSystem, recorder, }) {
|
79
|
-
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
80
|
-
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
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));
|
84
|
-
if (!attrs.length) {
|
85
|
-
return;
|
86
|
-
}
|
87
|
-
const existingInput = (0, elements_1.findElementsByFn)(element.childNodes, (el) => (el.tagName === 'input' || el.tagName === 'textarea') &&
|
88
|
-
(0, elements_1.hasElementAttribute)(el, 'tuiTextfield'))[0];
|
89
|
-
if (existingInput) {
|
90
|
-
addAttrToExistingInput({ existingInput, attrs, recorder, templateOffset });
|
91
|
-
}
|
92
|
-
else {
|
93
|
-
insertTuiTextfieldInput({ element, attrs, recorder, templateOffset });
|
94
|
-
}
|
95
|
-
});
|
96
|
-
removeOldInputs(recorder, template, templateOffset);
|
97
|
-
}
|
98
|
-
exports.migrateTextfieldController = migrateTextfieldController;
|
@@ -1,81 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.miscellaneousMigrations = void 0;
|
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");
|
7
|
-
const insert_todo_1 = require("../../../utils/insert-todo");
|
8
|
-
function addWarningToMethod(className, method, message) {
|
9
|
-
const references = (0, get_named_import_references_1.getNamedImportReferences)(className);
|
10
|
-
references.forEach((ref) => {
|
11
|
-
const parent = ref.getParent();
|
12
|
-
if (ng_morph_1.Node.isTypeReference(parent)) {
|
13
|
-
checkMethod(parent, method, message);
|
14
|
-
}
|
15
|
-
});
|
16
|
-
}
|
17
|
-
function replaceEnumProperty({ enumName, from, to, }) {
|
18
|
-
const references = (0, get_named_import_references_1.getNamedImportReferences)(enumName);
|
19
|
-
references.forEach((ref) => {
|
20
|
-
const parent = ref.getParent();
|
21
|
-
if (!ng_morph_1.Node.isPropertyAccessExpression(parent)) {
|
22
|
-
return;
|
23
|
-
}
|
24
|
-
parent.getChildren().forEach((node) => {
|
25
|
-
if (node.getText() === from) {
|
26
|
-
node.replaceWithText(to);
|
27
|
-
}
|
28
|
-
});
|
29
|
-
});
|
30
|
-
}
|
31
|
-
function checkMethod(node, method, message) {
|
32
|
-
const statement = node.getParent();
|
33
|
-
const identifier = statement.getChildrenOfKind(ng_morph_1.SyntaxKind.Identifier)[0];
|
34
|
-
identifier.findReferencesAsNodes().forEach((ref) => {
|
35
|
-
let parent = ref.getParent();
|
36
|
-
if ((ng_morph_1.Node.isPropertyAccessExpression(parent) &&
|
37
|
-
parent.getText().startsWith('this.')) ||
|
38
|
-
ng_morph_1.Node.isCallExpression(parent)) {
|
39
|
-
parent = parent.getParentIfKind(ng_morph_1.SyntaxKind.PropertyAccessExpression);
|
40
|
-
}
|
41
|
-
if (ng_morph_1.Node.isPropertyAccessExpression(parent)) {
|
42
|
-
parent.getChildrenOfKind(ng_morph_1.SyntaxKind.Identifier).forEach((identifier) => {
|
43
|
-
if (identifier.getText() === method) {
|
44
|
-
(0, insert_todo_1.insertTodo)(identifier, message);
|
45
|
-
}
|
46
|
-
});
|
47
|
-
}
|
48
|
-
});
|
49
|
-
}
|
50
|
-
function miscellaneousMigrations(options) {
|
51
|
-
!options['skip-logs'] &&
|
52
|
-
(0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} miscellaneous migrating...`);
|
53
|
-
replaceEnumProperty({
|
54
|
-
enumName: 'TuiCurrency',
|
55
|
-
from: 'HongKong_dollar',
|
56
|
-
to: 'HongKongDollar',
|
57
|
-
});
|
58
|
-
replaceEnumProperty({
|
59
|
-
enumName: 'TuiCurrencyCode',
|
60
|
-
from: 'HongKong_dollar',
|
61
|
-
to: 'HongKongDollar',
|
62
|
-
});
|
63
|
-
replaceEnumProperty({
|
64
|
-
enumName: 'TuiCreditCardAutofillName',
|
65
|
-
/**
|
66
|
-
* Do not mark `mounth` as incorrect.
|
67
|
-
* cspell:ignore mounth
|
68
|
-
*/
|
69
|
-
from: 'CcExp_mounth',
|
70
|
-
to: 'CcExpMonth',
|
71
|
-
});
|
72
|
-
replaceEnumProperty({
|
73
|
-
enumName: 'TuiCreditCardAutofillName',
|
74
|
-
from: 'CcExp_year',
|
75
|
-
to: 'CcExpYear',
|
76
|
-
});
|
77
|
-
addWarningToMethod('TuiDirectiveStylesService', 'addStyle', 'addStyle method has been removed. Use components approach');
|
78
|
-
!options['skip-logs'] &&
|
79
|
-
(0, colored_log_1.successLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} miscellaneous migrated \n`);
|
80
|
-
}
|
81
|
-
exports.miscellaneousMigrations = miscellaneousMigrations;
|
@@ -1,138 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.replaceFunctions = void 0;
|
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");
|
7
|
-
const import_manipulations_1 = require("../../../utils/import-manipulations");
|
8
|
-
const deprecated_functions_1 = require("../constants/deprecated-functions");
|
9
|
-
function replaceDeprecatedFunction() {
|
10
|
-
deprecated_functions_1.DEPRECATED_FUNCTIONS.forEach(({ from, to, moduleSpecifier }) => {
|
11
|
-
(0, get_named_import_references_1.getNamedImportReferences)(from, moduleSpecifier).forEach((ref) => {
|
12
|
-
if (ref.wasForgotten()) {
|
13
|
-
return;
|
14
|
-
}
|
15
|
-
const parent = ref.getParent();
|
16
|
-
if (ng_morph_1.Node.isImportSpecifier(parent) || ng_morph_1.Node.isCallExpression(parent)) {
|
17
|
-
parent === null || parent === void 0 ? void 0 : parent.replaceWithText(parent === null || parent === void 0 ? void 0 : parent.getText({ includeJsDocComments: false }).trim().replace(from, to !== null && to !== void 0 ? to : from));
|
18
|
-
}
|
19
|
-
});
|
20
|
-
});
|
21
|
-
}
|
22
|
-
function replacePadStart(references) {
|
23
|
-
references.forEach((ref) => {
|
24
|
-
var _a;
|
25
|
-
const parent = ref.getParent();
|
26
|
-
if (ng_morph_1.Node.isImportSpecifier(parent)) {
|
27
|
-
(0, import_manipulations_1.removeImport)(parent);
|
28
|
-
}
|
29
|
-
else if (ng_morph_1.Node.isCallExpression(parent)) {
|
30
|
-
const [targetString, length, pad] = parent.getArguments();
|
31
|
-
parent.replaceWithText(`${targetString.getText()}.padStart(${length.getText()}, ${(_a = pad === null || pad === void 0 ? void 0 : pad.getText()) !== null && _a !== void 0 ? _a : '" "'})`);
|
32
|
-
}
|
33
|
-
});
|
34
|
-
}
|
35
|
-
function replaceNativeFocused(references) {
|
36
|
-
references.forEach((ref) => {
|
37
|
-
const parent = ref.getParent();
|
38
|
-
if (ng_morph_1.Node.isImportSpecifier(parent)) {
|
39
|
-
(0, import_manipulations_1.removeImport)(parent);
|
40
|
-
}
|
41
|
-
else if (ng_morph_1.Node.isCallExpression(parent)) {
|
42
|
-
const [targetString, focusedArg, preventScroll] = parent.getArguments();
|
43
|
-
const setFocused = !focusedArg || focusedArg.getText() === 'true';
|
44
|
-
const focus = `${targetString.getText()}.focus(${(preventScroll === null || preventScroll === void 0 ? void 0 : preventScroll.getText()) ? '{preventScroll: true}' : ''})`;
|
45
|
-
const blur = `${targetString.getText()}.blur()`;
|
46
|
-
parent.replaceWithText(setFocused ? focus : blur);
|
47
|
-
}
|
48
|
-
});
|
49
|
-
}
|
50
|
-
function replaceClosestElement(references) {
|
51
|
-
references.forEach((ref) => {
|
52
|
-
const parent = ref.getParent();
|
53
|
-
if (ng_morph_1.Node.isImportSpecifier(parent)) {
|
54
|
-
(0, import_manipulations_1.removeImport)(parent);
|
55
|
-
}
|
56
|
-
else if (ng_morph_1.Node.isCallExpression(parent)) {
|
57
|
-
const [firstArg, secondArg] = parent.getArguments();
|
58
|
-
const firstArgText = firstArg.getText();
|
59
|
-
const element = firstArgText.includes(' as ') // e.g, `getClosestElement(el as Element, ...)`
|
60
|
-
? `(${firstArgText})`
|
61
|
-
: firstArgText;
|
62
|
-
parent.replaceWithText(`${element}.closest(${secondArg.getText()})`);
|
63
|
-
}
|
64
|
-
});
|
65
|
-
}
|
66
|
-
function replaceCustomEvent(references) {
|
67
|
-
references.forEach((ref) => {
|
68
|
-
const parent = ref.getParent();
|
69
|
-
if (ng_morph_1.Node.isImportSpecifier(parent)) {
|
70
|
-
(0, import_manipulations_1.removeImport)(parent);
|
71
|
-
}
|
72
|
-
else if (ng_morph_1.Node.isCallExpression(parent)) {
|
73
|
-
const [firstArg, secondArg] = parent.getArguments();
|
74
|
-
parent.replaceWithText(`new CustomEvent(${firstArg.getText()}, ${secondArg.getText()})`);
|
75
|
-
}
|
76
|
-
});
|
77
|
-
}
|
78
|
-
function replaceFallbackValue(references) {
|
79
|
-
references.forEach((ref) => {
|
80
|
-
const parent = ref.getParent();
|
81
|
-
if (ng_morph_1.Node.isImportSpecifier(parent)) {
|
82
|
-
(0, import_manipulations_1.removeImport)(parent);
|
83
|
-
}
|
84
|
-
else if (ng_morph_1.Node.isCallExpression(parent)) {
|
85
|
-
const [firstArg, secondArg] = parent.getArguments();
|
86
|
-
parent.replaceWithText(`${firstArg.getText()} ?? ${secondArg.getText()}`);
|
87
|
-
}
|
88
|
-
});
|
89
|
-
}
|
90
|
-
function modifyFormatNumberArgs() {
|
91
|
-
[
|
92
|
-
...(0, get_named_import_references_1.getNamedImportReferences)('formatNumber', '@taiga-ui/core'),
|
93
|
-
...(0, get_named_import_references_1.getNamedImportReferences)('tuiFormatNumber', '@taiga-ui/core'),
|
94
|
-
]
|
95
|
-
.map((ref) => ref.getParent())
|
96
|
-
.filter(ng_morph_1.Node.isCallExpression)
|
97
|
-
.forEach((fn) => {
|
98
|
-
const args = fn.getArguments();
|
99
|
-
if (args.length > 1) {
|
100
|
-
const [value, decimalLimit = 'Infinity', decimalSeparator = "','", thousandSeparator = "'\u00A0'", zeroPadding = true,] = args.map((arg) => arg.getText());
|
101
|
-
const notNullDecimalLimit = decimalLimit === 'null' ? 'Infinity' : decimalLimit;
|
102
|
-
const conditionalDecimalLimit = !Number.isNaN(Number(notNullDecimalLimit))
|
103
|
-
? notNullDecimalLimit
|
104
|
-
: `${decimalLimit} === null ? Infinity : ${decimalLimit}`;
|
105
|
-
fn.replaceWithText(`tuiFormatNumber(${value}, {decimalLimit: ${conditionalDecimalLimit}, decimalSeparator: ${decimalSeparator}, thousandSeparator: ${thousandSeparator}, zeroPadding: ${zeroPadding}})`);
|
106
|
-
}
|
107
|
-
});
|
108
|
-
}
|
109
|
-
function modifyClosestFocusable() {
|
110
|
-
(0, get_named_import_references_1.getNamedImportReferences)('tuiGetClosestFocusable', '@taiga-ui/cdk')
|
111
|
-
.map((ref) => ref.getParent())
|
112
|
-
.filter(ng_morph_1.Node.isCallExpression)
|
113
|
-
.forEach((fn) => {
|
114
|
-
const args = fn.getArguments();
|
115
|
-
if (args.length > 1) {
|
116
|
-
const [initial, prev = false, root, keyboard = true] = args.map((arg) => arg.getText());
|
117
|
-
fn.replaceWithText(`tuiGetClosestFocusable({initial: ${initial}, root: ${root}, previous: ${prev}, keyboard: ${keyboard}})`);
|
118
|
-
}
|
119
|
-
});
|
120
|
-
}
|
121
|
-
function replaceFunctions(options) {
|
122
|
-
!options['skip-logs'] &&
|
123
|
-
(0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} functions replacing...`);
|
124
|
-
replacePadStart((0, get_named_import_references_1.getNamedImportReferences)('padStart', '@taiga-ui/cdk'));
|
125
|
-
replaceFallbackValue((0, get_named_import_references_1.getNamedImportReferences)('fallbackValue', '@taiga-ui/cdk'));
|
126
|
-
replaceCustomEvent((0, get_named_import_references_1.getNamedImportReferences)('tuiCustomEvent', '@taiga-ui/cdk'));
|
127
|
-
replaceClosestElement((0, get_named_import_references_1.getNamedImportReferences)('getClosestElement', '@taiga-ui/cdk'));
|
128
|
-
replaceNativeFocused([
|
129
|
-
...(0, get_named_import_references_1.getNamedImportReferences)('tuiSetNativeFocused', '@taiga-ui/cdk'),
|
130
|
-
...(0, get_named_import_references_1.getNamedImportReferences)('setNativeFocused', '@taiga-ui/cdk'),
|
131
|
-
]);
|
132
|
-
replaceDeprecatedFunction();
|
133
|
-
modifyFormatNumberArgs();
|
134
|
-
modifyClosestFocusable();
|
135
|
-
!options['skip-logs'] &&
|
136
|
-
(0, colored_log_1.successLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} functions replaced \n`);
|
137
|
-
}
|
138
|
-
exports.replaceFunctions = replaceFunctions;
|
@@ -1,3 +0,0 @@
|
|
1
|
-
export declare const TUI_WARNING_NORMALIZE = "\n// [WARNING]: In version 3.0 we drop to support normalize(v7) out-of-the-box\n// You need to manually download css file from https://necolas.github.io/normalize.css/\n// If you're looking to use reset styles or you can write your own reset.css";
|
2
|
-
export declare const TUI_WARNING_WRAPPER_MIXINS = "// TODO: (Taiga UI migration): use mixins to customize tuiWrapper. See https://taiga-ui.dev/wrapper";
|
3
|
-
export declare function replaceStyles(): void;
|
@@ -1,33 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.replaceStyles = exports.TUI_WARNING_WRAPPER_MIXINS = exports.TUI_WARNING_NORMALIZE = void 0;
|
4
|
-
const ng_morph_1 = require("ng-morph");
|
5
|
-
const breakpoints_1 = require("../constants/breakpoints");
|
6
|
-
exports.TUI_WARNING_NORMALIZE = `
|
7
|
-
// [WARNING]: In version 3.0 we drop to support normalize(v7) out-of-the-box
|
8
|
-
// You need to manually download css file from https://necolas.github.io/normalize.css/
|
9
|
-
// If you're looking to use reset styles or you can write your own reset.css`;
|
10
|
-
exports.TUI_WARNING_WRAPPER_MIXINS = '// TODO: (Taiga UI migration): use mixins to customize tuiWrapper. See https://taiga-ui.dev/wrapper';
|
11
|
-
function replaceStyles() {
|
12
|
-
var _a;
|
13
|
-
(_a = (0, ng_morph_1.getActiveProject)()) === null || _a === void 0 ? void 0 : _a.getSourceFiles('**/**.less').forEach((sourceFile) => {
|
14
|
-
let fullText = sourceFile.getFullText();
|
15
|
-
if (fullText.includes('taiga-ui')) {
|
16
|
-
breakpoints_1.DEPRECATED_BREAKPOINTS.forEach(({ from, to }) => {
|
17
|
-
fullText = fullText.replaceAll(new RegExp(`(?<=@media.*)(${from})(?=[\\s,{])`, 'g'), to);
|
18
|
-
});
|
19
|
-
}
|
20
|
-
fullText = fullText
|
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')
|
26
|
-
.replace('--tui-color-link', '--tui-link')
|
27
|
-
.replaceAll("@import '~@taiga-ui", "@import '@taiga-ui")
|
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'));
|
30
|
-
sourceFile.replaceWithText(fullText);
|
31
|
-
});
|
32
|
-
}
|
33
|
-
exports.replaceStyles = replaceStyles;
|
@@ -1,8 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ICONS_TS = void 0;
|
4
|
-
const icons_1 = require("./icons");
|
5
|
-
exports.ICONS_TS = icons_1.ICONS.map(({ from, to }) => ({
|
6
|
-
from: { name: from, moduleSpecifier: '@taiga-ui/proprietary-icons' },
|
7
|
-
to: { name: to, moduleSpecifier: '@taiga-ui/proprietary-tds-icons' },
|
8
|
-
}));
|