@taiga-ui/cdk 4.0.0-rc.7 → 4.0.0-rc.9
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/constants/used-icons.d.ts +1 -1
- package/constants/version.d.ts +1 -1
- package/constants/version.js +1 -1
- package/esm2022/constants/used-icons.mjs +9 -1
- package/esm2022/constants/version.mjs +2 -2
- package/esm2022/services/index.mjs +2 -2
- package/esm2022/services/theme-color.service.mjs +30 -0
- package/fesm2022/taiga-ui-cdk-constants.mjs +9 -1
- package/fesm2022/taiga-ui-cdk-constants.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-services.mjs +19 -22
- package/fesm2022/taiga-ui-cdk-services.mjs.map +1 -1
- package/package.json +5 -6
- 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 -11
- package/schematics/ng-update/steps/replace-identifier.js +16 -12
- 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 +3 -0
- package/schematics/ng-update/v4/migrate-icons/index.js +2 -2
- 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-with-values-to-replace.js +42 -2
- package/schematics/ng-update/v4/steps/constants/attrs-to-replace.js +34 -3
- package/schematics/ng-update/v4/steps/constants/html-comments.js +9 -0
- package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.js +243 -220
- 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 +8 -0
- package/schematics/ng-update/v4/steps/constants/tags-to-replace.js +3 -2
- package/schematics/ng-update/v4/steps/constants/types.js +29 -0
- 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-templates.js +5 -0
- package/schematics/ng-update/v4/steps/{migrate-styles.js → styles/index.js} +13 -1
- 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 +3 -0
- package/schematics/ng-update/v4/steps/templates/index.js +3 -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 +7 -6
- package/schematics/ng-update/v4/steps/templates/migrate-badged-content.js +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-blocked.js +2 -1
- 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-labeled.js +1 -1
- package/schematics/ng-update/{v3/steps/migrate-textfield-controller.d.ts → v4/steps/templates/migrate-mobile-tabs.d.ts} +2 -2
- 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 +2 -1
- package/schematics/ng-update/v4/steps/update-packages.js +13 -4
- 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/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/services/static-request.service.d.ts +0 -8
- /package/schematics/ng-update/v4/steps/{migrate-styles.d.ts → styles/index.d.ts} +0 -0
@@ -22,9 +22,6 @@ function addModules(componentPath, modules) {
|
|
22
22
|
});
|
23
23
|
}
|
24
24
|
function getFallbackValue(textValue, fallbackValue) {
|
25
|
-
if (textValue) {
|
26
|
-
return `(${textValue} | tuiInitials)`;
|
27
|
-
}
|
28
25
|
return textValue ? `(${textValue} | tuiInitials)` : fallbackValue || '';
|
29
26
|
}
|
30
27
|
function normalizeAttrValue(attrName, attrValue) {
|
@@ -47,6 +44,7 @@ function migrateAvatar({ resource, recorder, fileSystem, }) {
|
|
47
44
|
const fallbackAttr = (0, inputs_1.findAttr)(attrs, 'fallback');
|
48
45
|
const textAttr = (0, inputs_1.findAttr)(attrs, 'text');
|
49
46
|
const roundedAttr = (0, inputs_1.findAttr)(attrs, 'rounded');
|
47
|
+
const autoColorAttr = (0, inputs_1.findAttr)(attrs, 'autoColor');
|
50
48
|
if ((!avatarUrlAttr && !textAttr) || !sourceCodeLocation) {
|
51
49
|
return;
|
52
50
|
}
|
@@ -55,6 +53,8 @@ function migrateAvatar({ resource, recorder, fileSystem, }) {
|
|
55
53
|
const textAttrValue = (textAttr === null || textAttr === void 0 ? void 0 : textAttr.value) && normalizeAttrValue(textAttr.name, textAttr.value);
|
56
54
|
const fallbackAttrValue = (fallbackAttr === null || fallbackAttr === void 0 ? void 0 : fallbackAttr.value) &&
|
57
55
|
normalizeAttrValue(fallbackAttr.name, fallbackAttr.value);
|
56
|
+
const autoColorValue = (autoColorAttr === null || autoColorAttr === void 0 ? void 0 : autoColorAttr.value) &&
|
57
|
+
normalizeAttrValue(autoColorAttr.name, autoColorAttr.value);
|
58
58
|
const insertTo = ((_b = (_a = sourceCodeLocation.startTag) === null || _a === void 0 ? void 0 : _a.startOffset) !== null && _b !== void 0 ? _b : 0) + '<tui-avatar'.length;
|
59
59
|
if (!insertTo) {
|
60
60
|
return;
|
@@ -66,8 +66,13 @@ function migrateAvatar({ resource, recorder, fileSystem, }) {
|
|
66
66
|
const fallbackSrc = urlAttrValue && fallbackValue
|
67
67
|
? `| tuiFallbackSrc : ${fallbackValue} | async`
|
68
68
|
: '';
|
69
|
-
recorder.insertRight(insertTo + templateOffset, ` [src]="${mainSrc}${fallbackSrc ? ` ${fallbackSrc}` : ''}"${!roundedAttr ? ' [round]="false"' : ''}`);
|
70
|
-
const attrsToRemove = [
|
69
|
+
recorder.insertRight(insertTo + templateOffset, ` [src]="${mainSrc}${fallbackSrc ? ` ${fallbackSrc}` : ''}"${!roundedAttr ? ' [round]="false"' : ''}${autoColorValue === 'true' ? ` [style.background]="${textAttrValue} | tuiAutoColor"` : ''}`);
|
70
|
+
const attrsToRemove = [
|
71
|
+
avatarUrlAttr,
|
72
|
+
textAttr,
|
73
|
+
fallbackAttr,
|
74
|
+
autoColorAttr,
|
75
|
+
].filter((attr) => attr !== undefined);
|
71
76
|
const fallbackModule = !!((avatarUrlAttr && textAttrValue) || fallbackAttr);
|
72
77
|
const initialsModule = !!textAttrValue;
|
73
78
|
const modules = [
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { UpdateRecorder } from '@angular-devkit/schematics';
|
2
2
|
import type { DevkitFileSystem } from 'ng-morph';
|
3
|
-
import type { TemplateResource } from '
|
4
|
-
export declare function
|
3
|
+
import type { TemplateResource } from '../../../interfaces';
|
4
|
+
export declare function migrateAxes({ resource, recorder, fileSystem, }: {
|
5
5
|
fileSystem: DevkitFileSystem;
|
6
6
|
recorder: UpdateRecorder;
|
7
7
|
resource: TemplateResource;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.migrateAxes = void 0;
|
4
|
+
const elements_1 = require("../../../../utils/templates/elements");
|
5
|
+
const template_resource_1 = require("../../../../utils/templates/template-resource");
|
6
|
+
const remove_attrs_1 = require("../utils/remove-attrs");
|
7
|
+
const AXES_TAG_NAME = 'tui-axes';
|
8
|
+
const AXES_NEW_ATTRIBUTE = 'new';
|
9
|
+
function migrateAxes({ resource, recorder, fileSystem, }) {
|
10
|
+
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
11
|
+
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
12
|
+
const elements = (0, elements_1.findElementsByTagName)(template, AXES_TAG_NAME);
|
13
|
+
elements.forEach(({ attrs, sourceCodeLocation }) => {
|
14
|
+
const axesNewAttr = attrs.find((attr) => attr.name === AXES_NEW_ATTRIBUTE);
|
15
|
+
if (!sourceCodeLocation) {
|
16
|
+
return;
|
17
|
+
}
|
18
|
+
if (axesNewAttr) {
|
19
|
+
(0, remove_attrs_1.removeAttrs)([axesNewAttr], sourceCodeLocation, recorder, templateOffset);
|
20
|
+
}
|
21
|
+
else {
|
22
|
+
recorder.insertLeft(sourceCodeLocation.startOffset + templateOffset, '<!-- TODO: (Taiga UI migration) labels positioning on x axes were updated. Add empty string to axisXLabels array. See https://taiga-ui.dev/charts/axes -->\n');
|
23
|
+
}
|
24
|
+
});
|
25
|
+
}
|
26
|
+
exports.migrateAxes = migrateAxes;
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.migrateBadge = void 0;
|
4
4
|
const elements_1 = require("../../../../utils/templates/elements");
|
5
|
+
const inputs_1 = require("../../../../utils/templates/inputs");
|
5
6
|
const template_resource_1 = require("../../../../utils/templates/template-resource");
|
6
7
|
const common_1 = require("./toggles/common");
|
7
8
|
const badgeSizeMap = {
|
@@ -19,7 +20,7 @@ function migrateBadge({ resource, recorder, fileSystem, }) {
|
|
19
20
|
return;
|
20
21
|
}
|
21
22
|
(0, common_1.replaceSizeAttr)(attrs, sourceCodeLocation, recorder, templateOffset, badgeSizeMap);
|
22
|
-
const valueAttr =
|
23
|
+
const valueAttr = (0, inputs_1.findAttr)(attrs, 'value');
|
23
24
|
// migration for icon-only badges
|
24
25
|
if (!valueAttr) {
|
25
26
|
addTodo(recorder, sourceCodeLocation, templateOffset);
|
@@ -39,16 +40,16 @@ function migrateBadge({ resource, recorder, fileSystem, }) {
|
|
39
40
|
}
|
40
41
|
exports.migrateBadge = migrateBadge;
|
41
42
|
function migrateIcon({ svg, sourceCodeLocation, recorder, templateOffset, }) {
|
42
|
-
var _a, _b, _c, _d
|
43
|
-
const src = (
|
43
|
+
var _a, _b, _c, _d;
|
44
|
+
const src = (0, inputs_1.findAttr)(svg.attrs, 'src');
|
44
45
|
const srcValue = src === null || src === void 0 ? void 0 : src.value;
|
45
46
|
if (!srcValue) {
|
46
47
|
return;
|
47
48
|
}
|
48
|
-
const insertTo = templateOffset + (((
|
49
|
+
const insertTo = templateOffset + (((_a = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.startTag) === null || _a === void 0 ? void 0 : _a.endOffset) || 0) - 1;
|
49
50
|
recorder.insertRight(insertTo, `${(src === null || src === void 0 ? void 0 : src.name) === 'src' ? 'iconStart' : '[iconStart]'}="${srcValue}"`);
|
50
|
-
recorder.remove(((
|
51
|
-
(((
|
51
|
+
recorder.remove(((_b = svg.sourceCodeLocation) === null || _b === void 0 ? void 0 : _b.startOffset) || 0, (((_c = svg.sourceCodeLocation) === null || _c === void 0 ? void 0 : _c.endOffset) || 0) -
|
52
|
+
(((_d = svg.sourceCodeLocation) === null || _d === void 0 ? void 0 : _d.startOffset) || 0));
|
52
53
|
}
|
53
54
|
function migrateBadgeValue({ valueAttr, sourceCodeLocation, recorder, templateOffset, }) {
|
54
55
|
var _a, _b, _c, _d, _e;
|
@@ -59,7 +59,7 @@ function migrateBadgedContent({ resource, recorder, fileSystem, }) {
|
|
59
59
|
});
|
60
60
|
if (!rounded || rounded.value === 'true') {
|
61
61
|
const insertTo = (_b = (_a = sourceCodeLocation.startTag) === null || _a === void 0 ? void 0 : _a.endOffset) !== null && _b !== void 0 ? _b : 0;
|
62
|
-
recorder.insertRight(insertTo + templateOffset - 1, '[style.--tui-radius.%]="50"');
|
62
|
+
recorder.insertRight(insertTo + templateOffset - 1, ' [style.--tui-radius.%]="50"');
|
63
63
|
}
|
64
64
|
const attrsToRemove = [
|
65
65
|
colorBottomAttr,
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.migrateBlocked = void 0;
|
4
4
|
const elements_1 = require("../../../../utils/templates/elements");
|
5
|
+
const inputs_1 = require("../../../../utils/templates/inputs");
|
5
6
|
const template_resource_1 = require("../../../../utils/templates/template-resource");
|
6
7
|
function migrateBlocked({ resource, recorder, fileSystem, }) {
|
7
8
|
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
@@ -18,7 +19,7 @@ function migrateBlocked({ resource, recorder, fileSystem, }) {
|
|
18
19
|
const [, hideIconAttrLocation] = Object.entries(sourceCodeLocation.attrs || {}).find(([name]) => name.includes('hideCheckbox'.toLowerCase()) ||
|
19
20
|
name.includes('hideRadio'.toLowerCase())) || [];
|
20
21
|
const [, sizeAttrLocation] = Object.entries(sourceCodeLocation.attrs || {}).find(([name]) => name.includes('size')) || [];
|
21
|
-
const sizeAttr =
|
22
|
+
const sizeAttr = (0, inputs_1.findAttr)(attrs, 'size');
|
22
23
|
const newBlockAttr = `tuiBlock${sizeAttr ? `="${sizeAttr.value === 'xs' ? 's' : sizeAttr.value}"` : ''}`;
|
23
24
|
recorder.insertRight(templateOffset + (((_a = sourceCodeLocation.startTag) === null || _a === void 0 ? void 0 : _a.startOffset) || 1) - 1, `<label ${newBlockAttr}${hideIconAttrLocation ? ' appearance=""' : ''}>`);
|
24
25
|
recorder.remove(templateOffset + ((_c = (_b = sourceCodeLocation.endTag) === null || _b === void 0 ? void 0 : _b.startOffset) !== null && _c !== void 0 ? _c : 0), `<${tagName}/>`.length);
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.migrateExpandable = void 0;
|
4
4
|
const elements_1 = require("../../../../utils/templates/elements");
|
5
|
+
const inputs_1 = require("../../../../utils/templates/inputs");
|
5
6
|
const template_resource_1 = require("../../../../utils/templates/template-resource");
|
6
7
|
function migrateExpandable({ resource, recorder, fileSystem, }) {
|
7
8
|
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
@@ -9,7 +10,7 @@ function migrateExpandable({ resource, recorder, fileSystem, }) {
|
|
9
10
|
const elements = (0, elements_1.findElementsWithAttributeOnTag)(template, ['[expandable]'], ['tui-input-tag', 'tui-multi-select', 'tui-input-date']);
|
10
11
|
elements.forEach(({ attrs, sourceCodeLocation }) => {
|
11
12
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
12
|
-
const expandableAttr =
|
13
|
+
const expandableAttr = (0, inputs_1.findAttr)(attrs, 'expandable');
|
13
14
|
if (!expandableAttr) {
|
14
15
|
return;
|
15
16
|
}
|
@@ -17,7 +18,7 @@ function migrateExpandable({ resource, recorder, fileSystem, }) {
|
|
17
18
|
const expandableStart = (_c = (_b = (_a = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[expandableAttr.name]) === null || _b === void 0 ? void 0 : _b.startOffset) !== null && _c !== void 0 ? _c : 0;
|
18
19
|
const expandableEnd = (_f = (_e = (_d = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.attrs) === null || _d === void 0 ? void 0 : _d[expandableAttr.name]) === null || _e === void 0 ? void 0 : _e.endOffset) !== null && _f !== void 0 ? _f : 0;
|
19
20
|
if (expandableValue === 'false') {
|
20
|
-
const rowsAttr =
|
21
|
+
const rowsAttr = (0, inputs_1.findAttr)(attrs, 'rows');
|
21
22
|
const insertTo = ((_h = (_g = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.startTag) === null || _g === void 0 ? void 0 : _g.endOffset) !== null && _h !== void 0 ? _h : 0) - 1;
|
22
23
|
recorder.insertRight(templateOffset + insertTo, rowsAttr ? '' : '[rows]="1"');
|
23
24
|
}
|
@@ -2,19 +2,22 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.migrateFocusable = void 0;
|
4
4
|
const elements_1 = require("../../../../utils/templates/elements");
|
5
|
+
const inputs_1 = require("../../../../utils/templates/inputs");
|
5
6
|
const template_resource_1 = require("../../../../utils/templates/template-resource");
|
6
|
-
const LEGACY_ATTRIBUTE_NAME = '
|
7
|
+
const LEGACY_ATTRIBUTE_NAME = 'tuiFocusable';
|
7
8
|
function migrateFocusable({ resource, recorder, fileSystem, }) {
|
8
9
|
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
9
10
|
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
10
|
-
const elements = (0, elements_1.findElementsWithAttributeOnTag)(template, [
|
11
|
+
const elements = (0, elements_1.findElementsWithAttributeOnTag)(template, [
|
12
|
+
`[${LEGACY_ATTRIBUTE_NAME}]`,
|
13
|
+
]);
|
11
14
|
elements.forEach(({ attrs, sourceCodeLocation }) => {
|
12
15
|
var _a;
|
13
16
|
if (!sourceCodeLocation) {
|
14
17
|
return;
|
15
18
|
}
|
16
|
-
const focusableAttr =
|
17
|
-
const attributeLocation = (_a = sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[
|
19
|
+
const focusableAttr = (0, inputs_1.findAttr)(attrs, LEGACY_ATTRIBUTE_NAME);
|
20
|
+
const attributeLocation = (_a = sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[focusableAttr.name];
|
18
21
|
if (!focusableAttr || !attributeLocation) {
|
19
22
|
return;
|
20
23
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { UpdateRecorder } from '@angular-devkit/schematics';
|
2
2
|
import type { DevkitFileSystem } from 'ng-morph';
|
3
|
-
import type { TemplateResource } from '
|
4
|
-
export declare function
|
3
|
+
import type { TemplateResource } from '../../../interfaces';
|
4
|
+
export declare function migrateMobileTabs({ resource, recorder, fileSystem, }: {
|
5
5
|
fileSystem: DevkitFileSystem;
|
6
6
|
recorder: UpdateRecorder;
|
7
7
|
resource: TemplateResource;
|
@@ -0,0 +1,45 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.migrateMobileTabs = void 0;
|
4
|
+
const add_import_to_closest_module_1 = require("../../../../utils/add-import-to-closest-module");
|
5
|
+
const elements_1 = require("../../../../utils/templates/elements");
|
6
|
+
const template_resource_1 = require("../../../../utils/templates/template-resource");
|
7
|
+
const templates_1 = require("../../../utils/templates");
|
8
|
+
const remove_attrs_1 = require("../utils/remove-attrs");
|
9
|
+
const TABS_TAG_NAME = 'tui-tabs';
|
10
|
+
const SEGMENTED_TAG_NAME = 'tui-segmented';
|
11
|
+
const TAB_ATTRIBUTE_NAME = 'tuiTab'.toLowerCase();
|
12
|
+
const MOBILE_TABS_ATTRIBUTE_NAME = 'tuiMobileTabs'.toLowerCase();
|
13
|
+
function migrateMobileTabs({ resource, recorder, fileSystem, }) {
|
14
|
+
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
15
|
+
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
16
|
+
const elements = (0, elements_1.findElementsWithAttributeOnTag)(template, [MOBILE_TABS_ATTRIBUTE_NAME], [TABS_TAG_NAME]);
|
17
|
+
if (elements.length > 0) {
|
18
|
+
(0, add_import_to_closest_module_1.addImportToClosestModule)(resource.componentPath, 'TuiSegmented', '@taiga-ui/kit');
|
19
|
+
}
|
20
|
+
elements.forEach((element) => {
|
21
|
+
(0, templates_1.replaceTag)(recorder, element.sourceCodeLocation, TABS_TAG_NAME, SEGMENTED_TAG_NAME, templateOffset);
|
22
|
+
removeMobileTabsAttribute(element, recorder, templateOffset);
|
23
|
+
element.childNodes
|
24
|
+
.filter(isElement)
|
25
|
+
.forEach((element) => removeTabAttribute(element, recorder, templateOffset));
|
26
|
+
});
|
27
|
+
}
|
28
|
+
exports.migrateMobileTabs = migrateMobileTabs;
|
29
|
+
function removeTabAttribute({ attrs, sourceCodeLocation }, recorder, templateOffset) {
|
30
|
+
const tabAttr = attrs.find((attr) => attr.name === TAB_ATTRIBUTE_NAME);
|
31
|
+
if (!tabAttr || !sourceCodeLocation) {
|
32
|
+
return;
|
33
|
+
}
|
34
|
+
(0, remove_attrs_1.removeAttrs)([tabAttr], sourceCodeLocation, recorder, templateOffset);
|
35
|
+
}
|
36
|
+
function removeMobileTabsAttribute({ attrs, sourceCodeLocation }, recorder, templateOffset) {
|
37
|
+
const mobileTabsAttr = attrs.find((attr) => attr.name === MOBILE_TABS_ATTRIBUTE_NAME);
|
38
|
+
if (!mobileTabsAttr || !sourceCodeLocation) {
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
(0, remove_attrs_1.removeAttrs)([mobileTabsAttr], sourceCodeLocation, recorder, templateOffset);
|
42
|
+
}
|
43
|
+
function isElement(node) {
|
44
|
+
return Boolean(node.attrs);
|
45
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { UpdateRecorder } from '@angular-devkit/schematics';
|
2
|
+
import type { DevkitFileSystem } from 'ng-morph';
|
3
|
+
import type { TemplateResource } from '../../../interfaces';
|
4
|
+
export declare function migrateNotification({ resource, recorder, fileSystem, }: {
|
5
|
+
fileSystem: DevkitFileSystem;
|
6
|
+
recorder: UpdateRecorder;
|
7
|
+
resource: TemplateResource;
|
8
|
+
}): void;
|
@@ -0,0 +1,64 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.migrateNotification = void 0;
|
4
|
+
const ng_morph_1 = require("ng-morph");
|
5
|
+
const add_import_to_closest_module_1 = require("../../../../utils/add-import-to-closest-module");
|
6
|
+
const elements_1 = require("../../../../utils/templates/elements");
|
7
|
+
const inputs_1 = require("../../../../utils/templates/inputs");
|
8
|
+
const template_resource_1 = require("../../../../utils/templates/template-resource");
|
9
|
+
function migrateNotification({ resource, recorder, fileSystem, }) {
|
10
|
+
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
11
|
+
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
12
|
+
const elements = [
|
13
|
+
...(0, elements_1.findElementsByTagNames)(template, ['tui-notification']),
|
14
|
+
...(0, elements_1.findElementsWithAttributeOnTag)(template, ['tuiNotification'], ['button', 'a']),
|
15
|
+
];
|
16
|
+
elements.forEach(({ attrs, sourceCodeLocation, tagName, childNodes }) => {
|
17
|
+
var _a, _b, _c, _d;
|
18
|
+
const sizeAttr = (0, inputs_1.findAttr)(attrs, 'size');
|
19
|
+
const hasIconAttr = (0, inputs_1.findAttr)(attrs, 'hasIcon');
|
20
|
+
const hideCloseAttr = (0, inputs_1.findAttr)(attrs, 'hideClose');
|
21
|
+
const closeListener = (0, inputs_1.findAttr)(attrs, '(close)');
|
22
|
+
const { startTag, endTag } = sourceCodeLocation || {};
|
23
|
+
const hideCloseAttrLocation = (_a = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[(hideCloseAttr === null || hideCloseAttr === void 0 ? void 0 : hideCloseAttr.name) || ''];
|
24
|
+
const hasIconAttrLocation = (_b = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.attrs) === null || _b === void 0 ? void 0 : _b[(hasIconAttr === null || hasIconAttr === void 0 ? void 0 : hasIconAttr.name) || ''];
|
25
|
+
if (!sizeAttr) {
|
26
|
+
recorder.insertRight(templateOffset + ((_c = startTag === null || startTag === void 0 ? void 0 : startTag.startOffset) !== null && _c !== void 0 ? _c : 0) + `<${tagName}`.length, ' size="m"');
|
27
|
+
}
|
28
|
+
if (closeListener) {
|
29
|
+
const hasProprietaryPackages = !!(0, ng_morph_1.getPackageJsonDependency)(fileSystem.tree, '@taiga-ui/proprietary-core');
|
30
|
+
(0, add_import_to_closest_module_1.addImportToClosestModule)(resource.componentPath, 'NgIf', '@angular/common');
|
31
|
+
const ifCondition = hideCloseAttr ? ` *ngIf="!${hideCloseAttr.value}"` : '';
|
32
|
+
const closeIconName = hasProprietaryPackages
|
33
|
+
? '@tui.pragmatic.small.cross'
|
34
|
+
: '@tui.x';
|
35
|
+
const closeButtonTemplate = ` <button${ifCondition} tuiIconButton iconStart="${closeIconName}"></button>`;
|
36
|
+
recorder.insertRight(templateOffset + ((_d = endTag === null || endTag === void 0 ? void 0 : endTag.startOffset) !== null && _d !== void 0 ? _d : 0), closeButtonTemplate);
|
37
|
+
if (hideCloseAttrLocation) {
|
38
|
+
const { startOffset, endOffset } = hideCloseAttrLocation;
|
39
|
+
recorder.remove(templateOffset + startOffset, endOffset - startOffset);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
if (hasIconAttr && hasIconAttrLocation) {
|
43
|
+
const { startOffset, endOffset } = hasIconAttrLocation;
|
44
|
+
const attrOffset = templateOffset + startOffset;
|
45
|
+
const attrLength = endOffset - startOffset;
|
46
|
+
switch (hasIconAttr.value) {
|
47
|
+
case 'false':
|
48
|
+
recorder.remove(attrOffset, attrLength);
|
49
|
+
recorder.insertRight(attrOffset, 'icon=""');
|
50
|
+
break;
|
51
|
+
case 'true':
|
52
|
+
recorder.remove(attrOffset, attrLength);
|
53
|
+
break;
|
54
|
+
default:
|
55
|
+
recorder.insertLeft(templateOffset + ((startTag === null || startTag === void 0 ? void 0 : startTag.startOffset) || 0), '<!-- TODO: (Taiga UI migration) "hasIcon" is deleted. Use icon="" to hide icon. Or pass TUI_NOTIFICATION_DEFAULT_OPTIONS["icon"] to show it again. Learn more: https://taiga-ui.dev/components/notification -->\n');
|
56
|
+
}
|
57
|
+
}
|
58
|
+
if (childNodes.length > 1 && startTag && endTag) {
|
59
|
+
recorder.insertRight(templateOffset + startTag.endOffset, '<div>');
|
60
|
+
recorder.insertLeft(templateOffset + endTag.startOffset, '</div>');
|
61
|
+
}
|
62
|
+
});
|
63
|
+
}
|
64
|
+
exports.migrateNotification = migrateNotification;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { UpdateRecorder } from '@angular-devkit/schematics';
|
2
|
+
import type { DevkitFileSystem } from 'ng-morph';
|
3
|
+
import type { TemplateResource } from '../../../../ng-update/interfaces';
|
4
|
+
export declare function migrateNumberPrecision({ resource, recorder, fileSystem, }: {
|
5
|
+
fileSystem: DevkitFileSystem;
|
6
|
+
recorder: UpdateRecorder;
|
7
|
+
resource: TemplateResource;
|
8
|
+
}): void;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.migrateNumberPrecision = void 0;
|
4
|
+
const remove_attrs_1 = require("../../../../ng-update/v4/steps/utils/remove-attrs");
|
5
|
+
const add_import_to_closest_module_1 = require("../../../../utils/add-import-to-closest-module");
|
6
|
+
const elements_1 = require("../../../../utils/templates/elements");
|
7
|
+
const inputs_1 = require("../../../../utils/templates/inputs");
|
8
|
+
const template_resource_1 = require("../../../../utils/templates/template-resource");
|
9
|
+
const clean_object_1 = require("../utils/clean-object");
|
10
|
+
function migrateNumberPrecision({ resource, recorder, fileSystem, }) {
|
11
|
+
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
12
|
+
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
13
|
+
const elements = (0, elements_1.findElementsByTagName)(template, 'tui-input-number');
|
14
|
+
elements.forEach(({ attrs, sourceCodeLocation }) => {
|
15
|
+
var _a;
|
16
|
+
if (!sourceCodeLocation) {
|
17
|
+
return;
|
18
|
+
}
|
19
|
+
const decimalAttr = (0, inputs_1.findAttr)(attrs, 'decimal');
|
20
|
+
const precisionAttr = (0, inputs_1.findAttr)(attrs, 'precision');
|
21
|
+
if (decimalAttr || precisionAttr) {
|
22
|
+
(0, add_import_to_closest_module_1.addImportToClosestModule)(resource.componentPath, 'TuiNumberFormat', '@taiga-ui/core');
|
23
|
+
const format = JSON.stringify((0, clean_object_1.cleanObject)({
|
24
|
+
decimalMode: decimalAttr === null || decimalAttr === void 0 ? void 0 : decimalAttr.value,
|
25
|
+
precision: precisionAttr === null || precisionAttr === void 0 ? void 0 : precisionAttr.value,
|
26
|
+
}));
|
27
|
+
const formatPart = `[tuiNumberFormat]='${format}'`;
|
28
|
+
const insertTo = (((_a = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.startTag) === null || _a === void 0 ? void 0 : _a.startOffset) || 0) +
|
29
|
+
'<tui-input-number '.length;
|
30
|
+
recorder.insertRight(templateOffset + insertTo, formatPart);
|
31
|
+
}
|
32
|
+
const attrsToRemove = [decimalAttr, precisionAttr].filter((attr) => attr !== undefined);
|
33
|
+
(0, remove_attrs_1.removeAttrs)(attrsToRemove, sourceCodeLocation, recorder, templateOffset);
|
34
|
+
});
|
35
|
+
}
|
36
|
+
exports.migrateNumberPrecision = migrateNumberPrecision;
|
@@ -2,13 +2,10 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.migrateOverscroll = void 0;
|
4
4
|
const elements_1 = require("../../../../utils/templates/elements");
|
5
|
+
const inputs_1 = require("../../../../utils/templates/inputs");
|
5
6
|
const template_resource_1 = require("../../../../utils/templates/template-resource");
|
6
7
|
const remove_attrs_1 = require("../utils/remove-attrs");
|
7
8
|
const overscrollAttrName = 'tuiOverscroll';
|
8
|
-
const overscrollAttrNameDict = {
|
9
|
-
[overscrollAttrName.toLowerCase()]: true,
|
10
|
-
[`[${overscrollAttrName.toLowerCase()}]`]: true,
|
11
|
-
};
|
12
9
|
function migrateOverscroll({ resource, recorder, fileSystem, }) {
|
13
10
|
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
14
11
|
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
@@ -17,8 +14,9 @@ function migrateOverscroll({ resource, recorder, fileSystem, }) {
|
|
17
14
|
return;
|
18
15
|
}
|
19
16
|
elements.forEach(({ attrs, sourceCodeLocation }) => {
|
20
|
-
const
|
21
|
-
|
17
|
+
const attrToRemove = (0, inputs_1.findAttr)(attrs, overscrollAttrName);
|
18
|
+
attrToRemove &&
|
19
|
+
(0, remove_attrs_1.removeAttrs)([attrToRemove], sourceCodeLocation, recorder, templateOffset);
|
22
20
|
});
|
23
21
|
addTodo(recorder, elements[0].sourceCodeLocation, templateOffset);
|
24
22
|
}
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.migrateThumbnailCard = void 0;
|
4
4
|
const elements_1 = require("../../../../utils/templates/elements");
|
5
|
+
const inputs_1 = require("../../../../utils/templates/inputs");
|
5
6
|
const template_resource_1 = require("../../../../utils/templates/template-resource");
|
6
7
|
function migrateThumbnailCard({ resource, recorder, fileSystem, }) {
|
7
8
|
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
@@ -11,7 +12,7 @@ function migrateThumbnailCard({ resource, recorder, fileSystem, }) {
|
|
11
12
|
if (!sourceCodeLocation) {
|
12
13
|
return;
|
13
14
|
}
|
14
|
-
const valueAttr =
|
15
|
+
const valueAttr = (0, inputs_1.findAttr)(attrs, 'cardNumber');
|
15
16
|
if (!valueAttr) {
|
16
17
|
return;
|
17
18
|
}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.closeStartTag = exports.removeClosingTag = exports.replaceSizeAttr = exports.replaceOpenTag = void 0;
|
4
|
+
const inputs_1 = require("../../../../../utils/templates/inputs");
|
4
5
|
const sizeMap = {
|
5
6
|
l: 'm',
|
6
7
|
m: 's',
|
@@ -17,14 +18,14 @@ function replaceOpenTag(sourceCodeLocation, recorder, templateOffset, { tag, dir
|
|
17
18
|
exports.replaceOpenTag = replaceOpenTag;
|
18
19
|
function replaceSizeAttr(attrs, sourceCodeLocation, recorder, templateOffset, map = sizeMap) {
|
19
20
|
var _a;
|
20
|
-
const sizeAttr =
|
21
|
+
const sizeAttr = (0, inputs_1.findAttr)(attrs, 'size');
|
21
22
|
if (sizeAttr) {
|
22
23
|
const { startOffset, endOffset } = ((_a = sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[sizeAttr.name]) || {
|
23
24
|
startOffset: 0,
|
24
25
|
endOffset: 0,
|
25
26
|
};
|
26
27
|
recorder.remove(templateOffset + startOffset, endOffset - startOffset);
|
27
|
-
recorder.insertRight(templateOffset + startOffset,
|
28
|
+
recorder.insertRight(templateOffset + startOffset, `${sizeAttr.name}="${map[sizeAttr.value] || sizeAttr.value}"`);
|
28
29
|
}
|
29
30
|
}
|
30
31
|
exports.replaceSizeAttr = replaceSizeAttr;
|
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.migrateCheckbox = void 0;
|
4
4
|
const elements_1 = require("../../../../../utils/templates/elements");
|
5
|
+
const inputs_1 = require("../../../../../utils/templates/inputs");
|
5
6
|
const template_resource_1 = require("../../../../../utils/templates/template-resource");
|
6
7
|
const common_1 = require("./common");
|
7
8
|
function migrateCheckbox({ resource, recorder, fileSystem, }) {
|
@@ -39,7 +40,7 @@ function migrateCheckbox({ resource, recorder, fileSystem, }) {
|
|
39
40
|
exports.migrateCheckbox = migrateCheckbox;
|
40
41
|
function replaceValueAttr(attrs, sourceCodeLocation, recorder, templateOffset) {
|
41
42
|
var _a;
|
42
|
-
const valueAttr =
|
43
|
+
const valueAttr = (0, inputs_1.findAttr)(attrs, 'value');
|
43
44
|
if (valueAttr) {
|
44
45
|
const { startOffset, endOffset } = ((_a = sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[valueAttr.name]) || {
|
45
46
|
startOffset: 0,
|
@@ -3,16 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updatePackages = void 0;
|
4
4
|
const ng_morph_1 = require("ng-morph");
|
5
5
|
const version_1 = require("../../../../constants/version");
|
6
|
+
const constants_1 = require("../../../constants");
|
6
7
|
const steps_1 = require("../../steps");
|
7
8
|
function updatePackages({ tree }, _) {
|
8
9
|
const packagesToRemove = ['@taiga-ui/addon-tablebars', '@taiga-ui/addon-preview'];
|
9
10
|
packagesToRemove.forEach((pkg) => {
|
10
11
|
(0, ng_morph_1.removePackageJsonDependency)(tree, pkg);
|
11
12
|
});
|
12
|
-
(0, ng_morph_1.addPackageJsonDependency)(tree, {
|
13
|
-
name: '@taiga-ui/legacy',
|
14
|
-
version: version_1.TUI_VERSION,
|
15
|
-
});
|
16
13
|
(0, steps_1.replacePackageName)('@tinkoff/ng-polymorpheus', {
|
17
14
|
name: '@taiga-ui/polymorpheus',
|
18
15
|
version: '^4.6.4',
|
@@ -31,5 +28,17 @@ function updatePackages({ tree }, _) {
|
|
31
28
|
version: '^4.0.1',
|
32
29
|
});
|
33
30
|
}
|
31
|
+
if ((0, ng_morph_1.getImports)(constants_1.ALL_TS_FILES, { moduleSpecifier: '@taiga-ui/layout' }).length) {
|
32
|
+
(0, ng_morph_1.addPackageJsonDependency)(tree, {
|
33
|
+
name: '@taiga-ui/layout',
|
34
|
+
version: version_1.TUI_VERSION,
|
35
|
+
});
|
36
|
+
}
|
37
|
+
if ((0, ng_morph_1.getImports)(constants_1.ALL_TS_FILES, { moduleSpecifier: '@taiga-ui/legacy' }).length) {
|
38
|
+
(0, ng_morph_1.addPackageJsonDependency)(tree, {
|
39
|
+
name: '@taiga-ui/legacy',
|
40
|
+
version: version_1.TUI_VERSION,
|
41
|
+
});
|
42
|
+
}
|
34
43
|
}
|
35
44
|
exports.updatePackages = updatePackages;
|
@@ -104,7 +104,8 @@ exports.findAttributeOnElementWithAttrs = findAttributeOnElementWithAttrs;
|
|
104
104
|
/** Shorthand function that checks if the specified element contains the given attribute. */
|
105
105
|
function hasElementAttribute(element, attributeName) {
|
106
106
|
var _a;
|
107
|
-
|
107
|
+
const lowercasedAttrName = attributeName.toLowerCase();
|
108
|
+
return (_a = element.attrs) === null || _a === void 0 ? void 0 : _a.some((attr) => attr.name === lowercasedAttrName || attr.name === `[${lowercasedAttrName}]`);
|
108
109
|
}
|
109
110
|
exports.hasElementAttribute = hasElementAttribute;
|
110
111
|
/** Gets the start offset of the given attribute from a Parse5 element. */
|
@@ -2,7 +2,8 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.isBinding = exports.findAttr = void 0;
|
4
4
|
function findAttr(attrs, name) {
|
5
|
-
|
5
|
+
const lowercasedName = name.toLowerCase();
|
6
|
+
return attrs.find((attr) => attr.name === lowercasedName || attr.name === `[${lowercasedName}]`);
|
6
7
|
}
|
7
8
|
exports.findAttr = findAttr;
|
8
9
|
function isBinding(attr) {
|
package/services/index.d.ts
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
import * as i0 from "@angular/core";
|
2
|
+
export declare const TUI_THEME_COLOR: import("@angular/core").InjectionToken<string>;
|
3
|
+
interface TuiThemeColor {
|
4
|
+
get color(): string;
|
5
|
+
set color(value: string);
|
6
|
+
}
|
7
|
+
export declare class TuiThemeColorService implements TuiThemeColor {
|
8
|
+
private readonly current;
|
9
|
+
private readonly doc;
|
10
|
+
private readonly meta;
|
11
|
+
get color(): string;
|
12
|
+
set color(content: string);
|
13
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TuiThemeColorService, never>;
|
14
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<TuiThemeColorService>;
|
15
|
+
}
|
16
|
+
export {};
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import { Injectable } from '@angular/core';
|
2
|
-
import { shareReplay, switchMap } from 'rxjs';
|
3
|
-
import { fromFetch } from 'rxjs/fetch';
|
4
|
-
import * as i0 from "@angular/core";
|
5
|
-
class TuiStaticRequestService {
|
6
|
-
constructor() {
|
7
|
-
this.cache = new Map();
|
8
|
-
}
|
9
|
-
request(url) {
|
10
|
-
const cache = this.cache.get(url);
|
11
|
-
if (cache) {
|
12
|
-
return cache;
|
13
|
-
}
|
14
|
-
const piped = fromFetch(url).pipe(switchMap(async (response) => {
|
15
|
-
if (response.ok) {
|
16
|
-
return response.text();
|
17
|
-
}
|
18
|
-
throw new Error(`Failed to load ${url} (${response.statusText})`);
|
19
|
-
}), shareReplay({ bufferSize: 1, refCount: false }));
|
20
|
-
this.cache.set(url, piped);
|
21
|
-
return piped;
|
22
|
-
}
|
23
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiStaticRequestService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
24
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiStaticRequestService, providedIn: 'root' }); }
|
25
|
-
}
|
26
|
-
export { TuiStaticRequestService };
|
27
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TuiStaticRequestService, decorators: [{
|
28
|
-
type: Injectable,
|
29
|
-
args: [{
|
30
|
-
providedIn: 'root',
|
31
|
-
}]
|
32
|
-
}] });
|
33
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RhdGljLXJlcXVlc3Quc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3Byb2plY3RzL2Nkay9zZXJ2aWNlcy9zdGF0aWMtcmVxdWVzdC5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBQyxVQUFVLEVBQUMsTUFBTSxlQUFlLENBQUM7QUFFekMsT0FBTyxFQUFDLFdBQVcsRUFBRSxTQUFTLEVBQUMsTUFBTSxNQUFNLENBQUM7QUFDNUMsT0FBTyxFQUFDLFNBQVMsRUFBQyxNQUFNLFlBQVksQ0FBQzs7QUFFckMsTUFHYSx1QkFBdUI7SUFIcEM7UUFJcUIsVUFBSyxHQUFHLElBQUksR0FBRyxFQUE4QixDQUFDO0tBd0JsRTtJQXRCVSxPQUFPLENBQUMsR0FBVztRQUN0QixNQUFNLEtBQUssR0FBRyxJQUFJLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsQ0FBQztRQUVsQyxJQUFJLEtBQUssRUFBRTtZQUNQLE9BQU8sS0FBSyxDQUFDO1NBQ2hCO1FBRUQsTUFBTSxLQUFLLEdBQUcsU0FBUyxDQUFDLEdBQUcsQ0FBQyxDQUFDLElBQUksQ0FDN0IsU0FBUyxDQUFDLEtBQUssRUFBRSxRQUFRLEVBQUUsRUFBRTtZQUN6QixJQUFJLFFBQVEsQ0FBQyxFQUFFLEVBQUU7Z0JBQ2IsT0FBTyxRQUFRLENBQUMsSUFBSSxFQUFFLENBQUM7YUFDMUI7WUFFRCxNQUFNLElBQUksS0FBSyxDQUFDLGtCQUFrQixHQUFHLEtBQUssUUFBUSxDQUFDLFVBQVUsR0FBRyxDQUFDLENBQUM7UUFDdEUsQ0FBQyxDQUFDLEVBQ0YsV0FBVyxDQUFDLEVBQUMsVUFBVSxFQUFFLENBQUMsRUFBRSxRQUFRLEVBQUUsS0FBSyxFQUFDLENBQUMsQ0FDaEQsQ0FBQztRQUVGLElBQUksQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLEdBQUcsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUUzQixPQUFPLEtBQUssQ0FBQztJQUNqQixDQUFDOytHQXhCUSx1QkFBdUI7bUhBQXZCLHVCQUF1QixjQUZwQixNQUFNOztTQUVULHVCQUF1Qjs0RkFBdkIsdUJBQXVCO2tCQUhuQyxVQUFVO21CQUFDO29CQUNSLFVBQVUsRUFBRSxNQUFNO2lCQUNyQiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7SW5qZWN0YWJsZX0gZnJvbSAnQGFuZ3VsYXIvY29yZSc7XG5pbXBvcnQgdHlwZSB7T2JzZXJ2YWJsZX0gZnJvbSAncnhqcyc7XG5pbXBvcnQge3NoYXJlUmVwbGF5LCBzd2l0Y2hNYXB9IGZyb20gJ3J4anMnO1xuaW1wb3J0IHtmcm9tRmV0Y2h9IGZyb20gJ3J4anMvZmV0Y2gnO1xuXG5ASW5qZWN0YWJsZSh7XG4gICAgcHJvdmlkZWRJbjogJ3Jvb3QnLFxufSlcbmV4cG9ydCBjbGFzcyBUdWlTdGF0aWNSZXF1ZXN0U2VydmljZSB7XG4gICAgcHJpdmF0ZSByZWFkb25seSBjYWNoZSA9IG5ldyBNYXA8c3RyaW5nLCBPYnNlcnZhYmxlPHN0cmluZz4+KCk7XG5cbiAgICBwdWJsaWMgcmVxdWVzdCh1cmw6IHN0cmluZyk6IE9ic2VydmFibGU8c3RyaW5nPiB7XG4gICAgICAgIGNvbnN0IGNhY2hlID0gdGhpcy5jYWNoZS5nZXQodXJsKTtcblxuICAgICAgICBpZiAoY2FjaGUpIHtcbiAgICAgICAgICAgIHJldHVybiBjYWNoZTtcbiAgICAgICAgfVxuXG4gICAgICAgIGNvbnN0IHBpcGVkID0gZnJvbUZldGNoKHVybCkucGlwZShcbiAgICAgICAgICAgIHN3aXRjaE1hcChhc3luYyAocmVzcG9uc2UpID0+IHtcbiAgICAgICAgICAgICAgICBpZiAocmVzcG9uc2Uub2spIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHJlc3BvbnNlLnRleHQoKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoYEZhaWxlZCB0byBsb2FkICR7dXJsfSAoJHtyZXNwb25zZS5zdGF0dXNUZXh0fSlgKTtcbiAgICAgICAgICAgIH0pLFxuICAgICAgICAgICAgc2hhcmVSZXBsYXkoe2J1ZmZlclNpemU6IDEsIHJlZkNvdW50OiBmYWxzZX0pLFxuICAgICAgICApO1xuXG4gICAgICAgIHRoaXMuY2FjaGUuc2V0KHVybCwgcGlwZWQpO1xuXG4gICAgICAgIHJldHVybiBwaXBlZDtcbiAgICB9XG59XG4iXX0=
|