@taiga-ui/cdk 4.4.1 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/constants/used-icons.d.ts +1 -1
- package/constants/version.d.ts +1 -1
- package/constants/version.js +1 -1
- package/directives/auto-focus/handlers/default.handler.d.ts +3 -2
- package/esm2022/constants/used-icons.mjs +3 -1
- package/esm2022/constants/version.mjs +2 -2
- package/esm2022/directives/auto-focus/autofocus.options.mjs +2 -2
- package/esm2022/directives/auto-focus/handlers/default.handler.mjs +5 -3
- package/esm2022/directives/obscured/obscured.service.mjs +3 -3
- 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/observables/zone.mjs +24 -4
- package/esm2022/services/id.service.mjs +6 -7
- 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 +6 -8
- package/esm2022/utils/focus/move-focus.mjs +2 -2
- package/esm2022/utils/miscellaneous/distance-between-touches.mjs +2 -2
- package/fesm2022/taiga-ui-cdk-constants.mjs +3 -1
- package/fesm2022/taiga-ui-cdk-constants.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs +5 -3
- package/fesm2022/taiga-ui-cdk-directives-auto-focus.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-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-observables.mjs +24 -5
- package/fesm2022/taiga-ui-cdk-observables.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-services.mjs +5 -6
- package/fesm2022/taiga-ui-cdk-services.mjs.map +1 -1
- package/fesm2022/taiga-ui-cdk-utils-color.mjs +8 -10
- 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/observables/zone.d.ts +7 -5
- package/package.json +2 -2
- package/schematics/ng-add/steps/add-taiga-modules.js +8 -1
- package/schematics/ng-add/steps/wrap-with-tui-root.js +7 -2
- package/schematics/ng-update/v4/migrate-addon-doc/replace-symbols.js +4 -0
- 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/migrate-root.js +28 -8
- 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-avatar.js +4 -1
- package/schematics/ng-update/v4/steps/templates/migrate-overscroll.js +5 -1
- 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 +4 -3
- 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
- package/services/id.service.d.ts +1 -3
@@ -30,7 +30,10 @@ function migrateAvatar({ resource, recorder, fileSystem, }) {
|
|
30
30
|
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
31
31
|
const avatarElements = (0, elements_1.findElementsByTagName)(template, 'tui-avatar');
|
32
32
|
const markerIconElements = (0, elements_1.findElementsByTagName)(template, 'tui-marker-icon');
|
33
|
-
[
|
33
|
+
[
|
34
|
+
...avatarElements.filter(({ attrs }) => (0, inputs_1.findAttr)(attrs, 'avatarurl') || (0, inputs_1.findAttr)(attrs, 'text')),
|
35
|
+
...markerIconElements,
|
36
|
+
].forEach(({ attrs, sourceCodeLocation }) => {
|
34
37
|
if (!sourceCodeLocation) {
|
35
38
|
return;
|
36
39
|
}
|
@@ -7,6 +7,7 @@ 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;
|
10
11
|
const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
|
11
12
|
const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
|
12
13
|
const elements = (0, elements_1.findElementsWithDirective)(template, overscrollAttrName).filter(({ sourceCodeLocation }) => !!sourceCodeLocation);
|
@@ -18,7 +19,10 @@ function migrateOverscroll({ resource, recorder, fileSystem, }) {
|
|
18
19
|
attrToRemove &&
|
19
20
|
(0, remove_attrs_1.removeAttrs)([attrToRemove], sourceCodeLocation, recorder, templateOffset);
|
20
21
|
});
|
21
|
-
|
22
|
+
const element = (_a = elements[0]) === null || _a === void 0 ? void 0 : _a.sourceCodeLocation;
|
23
|
+
if (element) {
|
24
|
+
addTodo(recorder, element, templateOffset);
|
25
|
+
}
|
22
26
|
}
|
23
27
|
exports.migrateOverscroll = migrateOverscroll;
|
24
28
|
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, _c, _d;
|
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 = ((_a = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[preventDefaultAttr.name].startOffset) || 0;
|
22
|
-
const preventDefaultEnd = ((
|
21
|
+
const preventDefaultStart = ((_b = (_a = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[preventDefaultAttr.name]) === null || _b === void 0 ? void 0 : _b.startOffset) || 0;
|
22
|
+
const preventDefaultEnd = ((_d = (_c = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.attrs) === null || _c === void 0 ? void 0 : _c[preventDefaultAttr.name]) === null || _d === void 0 ? void 0 : _d.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, _b;
|
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 = ((_a = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[maxAttr.name].endOffset) || 0;
|
21
|
+
const insertTo = ((_b = (_a = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[maxAttr.name]) === null || _b === void 0 ? void 0 : _b.endOffset) || 0;
|
22
22
|
recorder.insertRight(insertTo + templateOffset, ` [segments]="${max}"`);
|
23
23
|
});
|
24
24
|
}
|
@@ -13,11 +13,12 @@ function addUniqueImport(filePath, namedImport, moduleSpecifier) {
|
|
13
13
|
const existingDeclaration = (0, ng_morph_1.getImports)(filePath, {
|
14
14
|
moduleSpecifier,
|
15
15
|
});
|
16
|
-
|
17
|
-
|
16
|
+
const imports = existingDeclaration === null || existingDeclaration === void 0 ? void 0 : existingDeclaration[0];
|
17
|
+
if (imports) {
|
18
|
+
const modules = imports
|
18
19
|
.getNamedImports()
|
19
20
|
.map((namedImport) => namedImport.getText());
|
20
|
-
(0, ng_morph_1.editImports)(
|
21
|
+
(0, ng_morph_1.editImports)(imports, () => ({
|
21
22
|
namedImports: [...modules, namedImport],
|
22
23
|
isTypeOnly: false,
|
23
24
|
}));
|
@@ -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.getModuleSpecifierSourceFile()) === null || _a === void 0 ? void 0 : _a.getFilePath()) || '';
|
10
|
+
const rootComponentPath = ((_a = rootImportDeclaration === null || rootImportDeclaration === void 0 ? void 0 : 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.getProperty('templateUrl');
|
11
|
-
const template = metadata.getProperty('template');
|
10
|
+
const templateUrl = metadata === null || metadata === void 0 ? void 0 : metadata.getProperty('templateUrl');
|
11
|
+
const template = metadata === null || metadata === void 0 ? void 0 : 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, endOffset - startOffset);
|
66
|
-
recorder.insertRight(startOffset, newValue);
|
65
|
+
recorder.remove(startOffset !== null && startOffset !== void 0 ? startOffset : 0, (endOffset !== null && endOffset !== void 0 ? endOffset : 0) - (startOffset !== null && startOffset !== void 0 ? startOffset : 0));
|
66
|
+
recorder.insertRight(startOffset !== null && startOffset !== void 0 ? startOffset : 0, 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, end - start);
|
133
|
+
recorder.remove(start !== null && start !== void 0 ? start : 0, (end !== null && end !== void 0 ? end : 0) - (start !== null && start !== void 0 ? start : 0));
|
134
134
|
});
|
135
135
|
}
|
136
136
|
exports.removeInputProperty = removeInputProperty;
|
package/services/id.service.d.ts
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
import * as i0 from "@angular/core";
|
2
|
-
/**
|
3
|
-
* Generates unique ids
|
4
|
-
*/
|
5
2
|
export declare class TuiIdService {
|
6
3
|
private static autoId;
|
7
4
|
generate(): string;
|
8
5
|
static ɵfac: i0.ɵɵFactoryDeclaration<TuiIdService, never>;
|
9
6
|
static ɵprov: i0.ɵɵInjectableDeclaration<TuiIdService>;
|
10
7
|
}
|
8
|
+
export declare function tuiInjectId(): string;
|