@taiga-ui/cdk 3.53.0-canary.0ae603c → 3.53.0-canary.f51807c

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.
Files changed (47) hide show
  1. package/bundles/taiga-ui-cdk-components-alert-host.umd.js +1 -1
  2. package/bundles/taiga-ui-cdk-components-alert-host.umd.js.map +1 -1
  3. package/bundles/taiga-ui-cdk-directives-autofilled.umd.js +1 -1
  4. package/bundles/taiga-ui-cdk-directives-autofilled.umd.js.map +1 -1
  5. package/bundles/taiga-ui-cdk-pipes-filter.umd.js +1 -1
  6. package/bundles/taiga-ui-cdk-pipes-filter.umd.js.map +1 -1
  7. package/bundles/taiga-ui-cdk-pipes-keys.umd.js +1 -1
  8. package/bundles/taiga-ui-cdk-pipes-keys.umd.js.map +1 -1
  9. package/bundles/taiga-ui-cdk-pipes-mapper.umd.js +1 -1
  10. package/bundles/taiga-ui-cdk-pipes-mapper.umd.js.map +1 -1
  11. package/bundles/taiga-ui-cdk-pipes-replace.umd.js +1 -1
  12. package/bundles/taiga-ui-cdk-pipes-replace.umd.js.map +1 -1
  13. package/bundles/taiga-ui-cdk-utils-focus.umd.js +6 -2
  14. package/bundles/taiga-ui-cdk-utils-focus.umd.js.map +1 -1
  15. package/esm2015/components/alert-host/alert-host.component.js +2 -2
  16. package/esm2015/directives/autofilled/autofilled.module.js +2 -2
  17. package/esm2015/pipes/filter/filter.module.js +2 -2
  18. package/esm2015/pipes/keys/keys.module.js +2 -2
  19. package/esm2015/pipes/mapper/mapper.module.js +2 -2
  20. package/esm2015/pipes/replace/replace.module.js +2 -2
  21. package/esm2015/utils/focus/is-native-focused-in.js +4 -2
  22. package/esm2015/utils/focus/is-native-focused.js +4 -2
  23. package/fesm2015/taiga-ui-cdk-components-alert-host.js +2 -2
  24. package/fesm2015/taiga-ui-cdk-components-alert-host.js.map +1 -1
  25. package/fesm2015/taiga-ui-cdk-directives-autofilled.js +1 -1
  26. package/fesm2015/taiga-ui-cdk-directives-autofilled.js.map +1 -1
  27. package/fesm2015/taiga-ui-cdk-pipes-filter.js +1 -1
  28. package/fesm2015/taiga-ui-cdk-pipes-filter.js.map +1 -1
  29. package/fesm2015/taiga-ui-cdk-pipes-keys.js +1 -1
  30. package/fesm2015/taiga-ui-cdk-pipes-keys.js.map +1 -1
  31. package/fesm2015/taiga-ui-cdk-pipes-mapper.js +1 -1
  32. package/fesm2015/taiga-ui-cdk-pipes-mapper.js.map +1 -1
  33. package/fesm2015/taiga-ui-cdk-pipes-replace.js +1 -1
  34. package/fesm2015/taiga-ui-cdk-pipes-replace.js.map +1 -1
  35. package/fesm2015/taiga-ui-cdk-utils-focus.js +6 -2
  36. package/fesm2015/taiga-ui-cdk-utils-focus.js.map +1 -1
  37. package/package.json +68 -68
  38. package/schematics/ng-add/steps/add-taiga-modules.js +1 -1
  39. package/schematics/ng-update/v4/steps/constants/attrs-to-replace.js +7 -0
  40. package/schematics/ng-update/v4/steps/constants/html-comments.js +10 -0
  41. package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.js +4 -0
  42. package/schematics/ng-update/v4/steps/constants/inputs-to-remove.js +1 -0
  43. package/schematics/ng-update/v4/steps/migrate-templates.js +1 -0
  44. package/schematics/ng-update/v4/steps/templates/index.d.ts +1 -0
  45. package/schematics/ng-update/v4/steps/templates/index.js +1 -0
  46. package/schematics/ng-update/v4/steps/templates/migrate-avatar.d.ts +8 -0
  47. package/schematics/ng-update/v4/steps/templates/migrate-avatar.js +75 -0
@@ -44,4 +44,11 @@ exports.ATTRS_TO_REPLACE = [
44
44
  },
45
45
  to: { attrName: `[value]` },
46
46
  },
47
+ {
48
+ from: {
49
+ attrName: `[rounded]`,
50
+ withTagNames: [`tui-avatar`],
51
+ },
52
+ to: { attrName: `[round]` },
53
+ },
47
54
  ];
@@ -7,4 +7,14 @@ exports.HTML_COMMENTS = [
7
7
  withAttrs: [`singleColor`, `showLoader`],
8
8
  comment: `toggle [singleColor] and [showLoader] inputs have been removed due to design changes`,
9
9
  },
10
+ {
11
+ tag: `tui-table-pagination`,
12
+ withAttrs: [`[(page)]`, `[(size)]`, `(pageChange)`, `(sizeChange)`],
13
+ comment: `(pageChange) and (sizeChange) outputs have been removed. Use (paginationChange) instead`,
14
+ },
15
+ {
16
+ tag: `tui-radio`,
17
+ withAttrs: [`identityMatcher`, `showLoader`],
18
+ comment: `radio [identityMatcher] and [pseudoDisabled] inputs have been removed. If you need a workaround, please start a discussion on GitHub to think together`,
19
+ },
10
20
  ];
@@ -25,6 +25,10 @@ exports.IDENTIFIERS_TO_REPLACE = [
25
25
  from: { name: `TuiRadioModule`, moduleSpecifier: `@taiga-ui/experimental` },
26
26
  to: { name: `TuiRadioModule`, moduleSpecifier: `@taiga-ui/kit` },
27
27
  },
28
+ {
29
+ from: { name: `TuiAvatarModule`, moduleSpecifier: `@taiga-ui/experimental` },
30
+ to: { name: `TuiAvatarModule`, moduleSpecifier: `@taiga-ui/kit` },
31
+ },
28
32
  {
29
33
  from: { name: `TuiToggleModule`, moduleSpecifier: `@taiga-ui/experimental` },
30
34
  to: { name: `TuiToggleModule`, moduleSpecifier: `@taiga-ui/kit` },
@@ -5,4 +5,5 @@ exports.INPUTS_TO_REMOVE = [
5
5
  { inputName: `active`, tags: [`tui-card`, `tui-thumbnail-card`] },
6
6
  { inputName: `showLoader`, tags: [`tui-toggle`] },
7
7
  { inputName: `singleColor`, tags: [`tui-toggle`] },
8
+ { inputName: `hoverable`, tags: [`tui-badge`] },
8
9
  ];
@@ -27,6 +27,7 @@ function migrateTemplates(fileSystem, options) {
27
27
  templates_2.migrateCheckbox,
28
28
  templates_2.migrateRadio,
29
29
  templates_2.migrateToggle,
30
+ templates_2.migrateAvatar,
30
31
  ];
31
32
  const progressLog = progress_1.setupProgressLogger({
32
33
  total: componentWithTemplatesPaths.length,
@@ -1,2 +1,3 @@
1
+ export * from './migrate-avatar';
1
2
  export * from './migrate-badge';
2
3
  export * from './toggles';
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./migrate-avatar"), exports);
4
5
  tslib_1.__exportStar(require("./migrate-badge"), exports);
5
6
  tslib_1.__exportStar(require("./toggles"), exports);
@@ -0,0 +1,8 @@
1
+ import { UpdateRecorder } from '@angular-devkit/schematics';
2
+ import { DevkitFileSystem } from 'ng-morph';
3
+ import { TemplateResource } from '../../../interfaces';
4
+ export declare function migrateAvatar({ resource, recorder, fileSystem, }: {
5
+ fileSystem: DevkitFileSystem;
6
+ recorder: UpdateRecorder;
7
+ resource: TemplateResource;
8
+ }): void;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrateAvatar = 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
+ function migrateAvatar({ resource, recorder, fileSystem, }) {
8
+ const template = template_resource_1.getTemplateFromTemplateResource(resource, fileSystem);
9
+ const templateOffset = template_resource_1.getTemplateOffset(resource);
10
+ const elements = elements_1.findElementsByTagName(template, `tui-avatar`);
11
+ elements.forEach(({ attrs, sourceCodeLocation }) => {
12
+ const avatarUrlAttr = attrs.find(attr => attr.name === `[avatarurl]` || attr.name === `avatarurl`);
13
+ const fallbackAttr = attrs.find(attr => attr.name === `[fallback]` || attr.name === `fallback`);
14
+ const textAttr = attrs.find(attr => attr.name === `[text]` || attr.name === `text`);
15
+ const roundedAttr = attrs.find(attr => attr.name === `[rounded]` || attr.name === `rounded`);
16
+ if ((!avatarUrlAttr && !textAttr) || !sourceCodeLocation) {
17
+ return;
18
+ }
19
+ const urlAttrValue = (avatarUrlAttr === null || avatarUrlAttr === void 0 ? void 0 : avatarUrlAttr.value) &&
20
+ normalizeAttrValue(avatarUrlAttr.name, avatarUrlAttr.value);
21
+ const textAttrValue = (textAttr === null || textAttr === void 0 ? void 0 : textAttr.value) && normalizeAttrValue(textAttr.name, textAttr.value);
22
+ const fallbackAttrValue = (fallbackAttr === null || fallbackAttr === void 0 ? void 0 : fallbackAttr.value) &&
23
+ normalizeAttrValue(fallbackAttr.name, fallbackAttr.value);
24
+ const insertTo = sourceCodeLocation.startTag.startOffset + `<tui-avatar`.length;
25
+ if (!insertTo) {
26
+ return;
27
+ }
28
+ const mainSrc = urlAttrValue || (textAttrValue ? `${textAttrValue} | tuiInitials` : ``);
29
+ const fallbackValue = urlAttrValue
30
+ ? getFallbackValue(textAttrValue, fallbackAttrValue)
31
+ : ``;
32
+ const fallbackSrc = urlAttrValue && fallbackValue
33
+ ? `| tuiFallbackSrc : ${fallbackValue} | async`
34
+ : ``;
35
+ recorder.insertRight(insertTo + templateOffset, ` [src]="${mainSrc}${fallbackSrc ? ` ${fallbackSrc}` : ``}"${!roundedAttr ? ` [round]="false"` : ``}`);
36
+ const attrsToRemove = [avatarUrlAttr, textAttr, fallbackAttr].filter((attr) => attr !== undefined);
37
+ const fallbackModule = !!((avatarUrlAttr && textAttrValue) || fallbackAttr);
38
+ const initialsModule = !!textAttrValue;
39
+ const modules = [
40
+ ...(fallbackModule
41
+ ? [{ moduleName: `TuiFallbackModule`, moduleSpecifier: `@taiga-ui/cdk` }]
42
+ : []),
43
+ ...(initialsModule
44
+ ? [{ moduleName: `TuiInitialsModule`, moduleSpecifier: `@taiga-ui/cdk` }]
45
+ : []),
46
+ ];
47
+ addModules(resource.componentPath, modules);
48
+ removeAttrs(attrsToRemove, sourceCodeLocation, recorder, templateOffset);
49
+ });
50
+ }
51
+ exports.migrateAvatar = migrateAvatar;
52
+ function addModules(componentPath, modules) {
53
+ modules.forEach(({ moduleName, moduleSpecifier }) => {
54
+ add_import_to_closest_module_1.addImportToClosestModule(componentPath, moduleName, moduleSpecifier);
55
+ });
56
+ }
57
+ function removeAttrs(attrs, sourceCodeLocation, recorder, templateOffset) {
58
+ attrs.forEach(attr => {
59
+ var _a;
60
+ const attrOffset = (_a = sourceCodeLocation.attrs) === null || _a === void 0 ? void 0 : _a[attr.name];
61
+ if (attrOffset) {
62
+ const { startOffset, endOffset } = attrOffset;
63
+ recorder.remove(templateOffset + startOffset - 1, endOffset - startOffset + 1);
64
+ }
65
+ });
66
+ }
67
+ function getFallbackValue(textValue, fallbackValue) {
68
+ if (textValue) {
69
+ return `(${textValue} | tuiInitials)`;
70
+ }
71
+ return textValue ? `(${textValue} | tuiInitials)` : fallbackValue || ``;
72
+ }
73
+ function normalizeAttrValue(attrName, attrValue) {
74
+ return attrName.startsWith(`[`) ? attrValue : `'${attrValue}'`;
75
+ }