@taiga-ui/cdk 4.4.1-canary.90b9797 → 4.4.1
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/esm2022/directives/pan/pan.service.mjs +3 -3
- package/esm2022/directives/swipe/swipe.service.mjs +7 -7
- package/esm2022/directives/zoom/zoom.service.mjs +5 -5
- package/esm2022/utils/color/hex-to-rgba.mjs +2 -2
- package/esm2022/utils/color/parse-gradient.mjs +3 -3
- package/esm2022/utils/color/rgba-to-hex.mjs +8 -6
- package/esm2022/utils/focus/move-focus.mjs +2 -2
- package/esm2022/utils/miscellaneous/distance-between-touches.mjs +2 -2
- package/fesm2022/taiga-ui-cdk-directives-pan.mjs +2 -2
- package/fesm2022/taiga-ui-cdk-directives-pan.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-swipe.mjs +6 -6
- package/fesm2022/taiga-ui-cdk-directives-swipe.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-zoom.mjs +4 -4
- package/fesm2022/taiga-ui-cdk-directives-zoom.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-utils-color.mjs +10 -8
- package/fesm2022/taiga-ui-cdk-utils-color.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-utils-focus.mjs +1 -1
- package/fesm2022/taiga-ui-cdk-utils-focus.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs +1 -1
- package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs.map +1 -1
- package/package.json +356 -356
- package/schematics/ng-add/steps/add-taiga-modules.js +1 -8
- package/schematics/ng-add/steps/wrap-with-tui-root.js +2 -7
- package/schematics/ng-update/v4/steps/migrate-legacy-mask.js +2 -2
- package/schematics/ng-update/v4/steps/migrate-number-format-settings.js +1 -1
- package/schematics/ng-update/v4/steps/restore-tui-mapper.js +1 -1
- package/schematics/ng-update/v4/steps/restore-tui-matcher.js +1 -1
- package/schematics/ng-update/v4/steps/templates/migrate-overscroll.js +1 -5
- package/schematics/ng-update/v4/steps/templates/migrate-prevent-default.js +3 -3
- package/schematics/ng-update/v4/steps/templates/migrate-progress-segmented.js +2 -2
- package/schematics/utils/add-unique-import.js +3 -4
- package/schematics/utils/get-component-from-identifier.js +1 -1
- package/schematics/utils/templates/get-component-templates.js +2 -2
- package/schematics/utils/templates/ng-component-input-manipulations.js +3 -3
@@ -23,14 +23,8 @@ function addTuiModules({ mainClass, context, }) {
|
|
23
23
|
}
|
24
24
|
function addTuiEntitiesToStandalone({ bootstrapFunction, options, context, }) {
|
25
25
|
const [rootComponentIdentifier, bootstrapOptions = bootstrapFunction.addArgument('{providers}: []'),] = bootstrapFunction.getArguments();
|
26
|
-
if (!rootComponentIdentifier) {
|
27
|
-
return;
|
28
|
-
}
|
29
26
|
const mainClass = (0, get_component_from_identifier_1.getComponentFromIdentifier)(rootComponentIdentifier);
|
30
27
|
const optionsObject = getOptionsObject(bootstrapOptions);
|
31
|
-
if (!optionsObject) {
|
32
|
-
return;
|
33
|
-
}
|
34
28
|
if (mainClass) {
|
35
29
|
addMainModuleToRootComponent({ mainClass, options, context });
|
36
30
|
addRootTuiProvidersToBootstrapFn(optionsObject);
|
@@ -72,12 +66,11 @@ function getModules(extraModules) {
|
|
72
66
|
return [...(extraModules || []), modules_1.MAIN_MODULE];
|
73
67
|
}
|
74
68
|
function getOptionsObject(options) {
|
75
|
-
var _a;
|
76
69
|
if (ng_morph_1.Node.isObjectLiteralExpression(options)) {
|
77
70
|
return options;
|
78
71
|
}
|
79
72
|
const definition = options.getDefinitionNodes()[0];
|
80
|
-
return
|
73
|
+
return definition.getChildrenOfKind(ng_morph_1.SyntaxKind.ObjectLiteralExpression)[0];
|
81
74
|
}
|
82
75
|
function addTaigaModules(options) {
|
83
76
|
return (tree, context) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
@@ -32,13 +32,8 @@ function getAppTemplatePath(mainPath) {
|
|
32
32
|
const standaloneBootstrapFunction = (0, get_standalone_bootstrap_function_1.getStandaloneBootstrapFunction)(mainPath);
|
33
33
|
if (standaloneBootstrapFunction) {
|
34
34
|
const [componentIdentifier] = standaloneBootstrapFunction.getArguments();
|
35
|
-
|
36
|
-
|
37
|
-
if (component) {
|
38
|
-
return getTemplatePathFromComponent(component);
|
39
|
-
}
|
40
|
-
}
|
41
|
-
return '';
|
35
|
+
const component = (0, get_component_from_identifier_1.getComponentFromIdentifier)(componentIdentifier);
|
36
|
+
return (component && getTemplatePathFromComponent(component)) || '';
|
42
37
|
}
|
43
38
|
const mainModule = (0, ng_morph_1.getMainModule)(mainPath);
|
44
39
|
if (!mainModule) {
|
@@ -29,7 +29,7 @@ function migrateTuiMaskedMoneyValueIsEmpty(options) {
|
|
29
29
|
}
|
30
30
|
else if (ng_morph_1.Node.isCallExpression(parent)) {
|
31
31
|
const [value] = parent.getArguments();
|
32
|
-
parent.replaceWithText(`Number.isNaN(maskitoParseNumber(${value
|
32
|
+
parent.replaceWithText(`Number.isNaN(maskitoParseNumber(${value.getText()}, ','))`);
|
33
33
|
}
|
34
34
|
});
|
35
35
|
}
|
@@ -48,7 +48,7 @@ function migrateTuiMaskedNumberStringToNumber(options) {
|
|
48
48
|
}
|
49
49
|
else if (ng_morph_1.Node.isCallExpression(parent)) {
|
50
50
|
const [value, decimalSeparator] = parent.getArguments();
|
51
|
-
parent.replaceWithText(`maskitoParseNumber(${value
|
51
|
+
parent.replaceWithText(`maskitoParseNumber(${value.getText()}, ${decimalSeparator.getText()})`);
|
52
52
|
}
|
53
53
|
});
|
54
54
|
}
|
@@ -8,7 +8,7 @@ const OPTIONS_MIGRATIONS = {
|
|
8
8
|
decimalLimit: (property) => property.replaceWithText(property.getText().replace('decimalLimit', 'precision')),
|
9
9
|
decimal: (property) => {
|
10
10
|
const [, propertyValue] = property.getText().split(/\s?:\s?/);
|
11
|
-
property.replaceWithText(
|
11
|
+
property.replaceWithText(propertyValue.match(/^['"`]never['"`]$/)
|
12
12
|
? 'precision: 0'
|
13
13
|
: property.getText().replace('decimal', 'decimalMode'));
|
14
14
|
},
|
@@ -20,7 +20,7 @@ function updateTuiMapper(options) {
|
|
20
20
|
return;
|
21
21
|
}
|
22
22
|
const [inputType] = typeArguments;
|
23
|
-
inputType
|
23
|
+
inputType.replaceWithText(`[${inputType.getText()}, ...any]`);
|
24
24
|
}
|
25
25
|
}
|
26
26
|
}
|
@@ -20,7 +20,7 @@ function updateTuiMatcher(options) {
|
|
20
20
|
return;
|
21
21
|
}
|
22
22
|
const [inputType] = typeArguments;
|
23
|
-
inputType
|
23
|
+
inputType.replaceWithText(`[${inputType.getText()}, ...any]`);
|
24
24
|
}
|
25
25
|
}
|
26
26
|
}
|
@@ -7,7 +7,6 @@ const template_resource_1 = require("../../../../utils/templates/template-resour
|
|
7
7
|
const remove_attrs_1 = require("../utils/remove-attrs");
|
8
8
|
const overscrollAttrName = 'tuiOverscroll';
|
9
9
|
function migrateOverscroll({ resource, recorder, fileSystem, }) {
|
10
|
-
var _a;
|
11
10
|
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
12
11
|
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
13
12
|
const elements = (0, elements_1.findElementsWithDirective)(template, overscrollAttrName).filter(({ sourceCodeLocation }) => !!sourceCodeLocation);
|
@@ -19,10 +18,7 @@ function migrateOverscroll({ resource, recorder, fileSystem, }) {
|
|
19
18
|
attrToRemove &&
|
20
19
|
(0, remove_attrs_1.removeAttrs)([attrToRemove], sourceCodeLocation, recorder, templateOffset);
|
21
20
|
});
|
22
|
-
|
23
|
-
if (element) {
|
24
|
-
addTodo(recorder, element, templateOffset);
|
25
|
-
}
|
21
|
+
addTodo(recorder, elements[0].sourceCodeLocation, templateOffset);
|
26
22
|
}
|
27
23
|
exports.migrateOverscroll = migrateOverscroll;
|
28
24
|
function addTodo(recorder, sourceCodeLocation, templateOffset) {
|
@@ -9,7 +9,7 @@ function migratePreventDefault({ resource, recorder, fileSystem, }) {
|
|
9
9
|
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
10
10
|
const elements = (0, elements_1.findElementsWithAttribute)(template, 'tuiPreventDefault');
|
11
11
|
elements.forEach(({ attrs, sourceCodeLocation }) => {
|
12
|
-
var _a, _b
|
12
|
+
var _a, _b;
|
13
13
|
if (!sourceCodeLocation) {
|
14
14
|
return;
|
15
15
|
}
|
@@ -18,8 +18,8 @@ function migratePreventDefault({ resource, recorder, fileSystem, }) {
|
|
18
18
|
return;
|
19
19
|
}
|
20
20
|
const event = preventDefaultAttr.value;
|
21
|
-
const preventDefaultStart = ((
|
22
|
-
const preventDefaultEnd = ((
|
21
|
+
const preventDefaultStart = ((_a = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[preventDefaultAttr.name].startOffset) || 0;
|
22
|
+
const preventDefaultEnd = ((_b = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.attrs) === null || _b === void 0 ? void 0 : _b[preventDefaultAttr.name].endOffset) || 0;
|
23
23
|
recorder.insertLeft(templateOffset + preventDefaultStart, `(${event}.prevent.silent)="0"`);
|
24
24
|
recorder.remove(templateOffset + preventDefaultStart, preventDefaultEnd - preventDefaultStart);
|
25
25
|
});
|
@@ -9,7 +9,7 @@ function migrateProgressSegmented({ resource, recorder, fileSystem, }) {
|
|
9
9
|
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
10
10
|
const elements = (0, elements_1.findElementsByTagName)(template, 'tui-progress-segmented');
|
11
11
|
elements.forEach(({ attrs, sourceCodeLocation }) => {
|
12
|
-
var _a
|
12
|
+
var _a;
|
13
13
|
if (!sourceCodeLocation) {
|
14
14
|
return;
|
15
15
|
}
|
@@ -18,7 +18,7 @@ function migrateProgressSegmented({ resource, recorder, fileSystem, }) {
|
|
18
18
|
return;
|
19
19
|
}
|
20
20
|
const max = maxAttr.value;
|
21
|
-
const insertTo = ((
|
21
|
+
const insertTo = ((_a = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[maxAttr.name].endOffset) || 0;
|
22
22
|
recorder.insertRight(insertTo + templateOffset, ` [segments]="${max}"`);
|
23
23
|
});
|
24
24
|
}
|
@@ -13,12 +13,11 @@ function addUniqueImport(filePath, namedImport, moduleSpecifier) {
|
|
13
13
|
const existingDeclaration = (0, ng_morph_1.getImports)(filePath, {
|
14
14
|
moduleSpecifier,
|
15
15
|
});
|
16
|
-
|
17
|
-
|
18
|
-
const modules = imports
|
16
|
+
if (existingDeclaration.length) {
|
17
|
+
const modules = existingDeclaration[0]
|
19
18
|
.getNamedImports()
|
20
19
|
.map((namedImport) => namedImport.getText());
|
21
|
-
(0, ng_morph_1.editImports)(
|
20
|
+
(0, ng_morph_1.editImports)(existingDeclaration[0], () => ({
|
22
21
|
namedImports: [...modules, namedImport],
|
23
22
|
isTypeOnly: false,
|
24
23
|
}));
|
@@ -7,7 +7,7 @@ function getComponentFromIdentifier(identifier) {
|
|
7
7
|
const rootImportDeclaration = (0, ng_morph_1.getImports)(identifier.getSourceFile().getFilePath(), {
|
8
8
|
namedImports: [identifier.getText()],
|
9
9
|
})[0];
|
10
|
-
const rootComponentPath = ((_a = rootImportDeclaration
|
10
|
+
const rootComponentPath = ((_a = rootImportDeclaration.getModuleSpecifierSourceFile()) === null || _a === void 0 ? void 0 : _a.getFilePath()) || '';
|
11
11
|
return (0, ng_morph_1.getNgComponents)(rootComponentPath, { name: identifier.getText() })[0];
|
12
12
|
}
|
13
13
|
exports.getComponentFromIdentifier = getComponentFromIdentifier;
|
@@ -7,8 +7,8 @@ const ng_morph_1 = require("ng-morph");
|
|
7
7
|
function decoratorToTemplateResource(decorator) {
|
8
8
|
var _a, _b, _c;
|
9
9
|
const [metadata] = decorator.getArguments();
|
10
|
-
const templateUrl = metadata
|
11
|
-
const template = metadata
|
10
|
+
const templateUrl = metadata.getProperty('templateUrl');
|
11
|
+
const template = metadata.getProperty('template');
|
12
12
|
const componentPath = decorator.getSourceFile().getFilePath();
|
13
13
|
if (templateUrl) {
|
14
14
|
const templatePath = path.parse(((_a = templateUrl === null || templateUrl === void 0 ? void 0 : templateUrl.getInitializer()) === null || _a === void 0 ? void 0 : _a.getText().replaceAll(/['"`]/g, '')) || '');
|
@@ -62,8 +62,8 @@ function replaceInputProperty({ templateResource, fileSystem, componentSelector,
|
|
62
62
|
recorder.insertRight(offset, to.startsWith('[') ? to : `[${to}]`);
|
63
63
|
});
|
64
64
|
propertyValues.forEach(([startOffset, endOffset]) => {
|
65
|
-
recorder.remove(startOffset
|
66
|
-
recorder.insertRight(startOffset
|
65
|
+
recorder.remove(startOffset, endOffset - startOffset);
|
66
|
+
recorder.insertRight(startOffset, newValue);
|
67
67
|
});
|
68
68
|
return true;
|
69
69
|
}
|
@@ -130,7 +130,7 @@ function removeInputProperty({ templateResource, fileSystem, componentSelector,
|
|
130
130
|
...getInputPropertyOffsets(template, `[${inputProperty}]`, [componentSelector], filterFn),
|
131
131
|
].map(([start, end]) => [templateOffset + start, templateOffset + end]);
|
132
132
|
propertyOffsets.forEach(([start, end]) => {
|
133
|
-
recorder.remove(start
|
133
|
+
recorder.remove(start, end - start);
|
134
134
|
});
|
135
135
|
}
|
136
136
|
exports.removeInputProperty = removeInputProperty;
|