@taiga-ui/cdk 4.5.0-canary.d55e3ee → 4.6.0-canary.0a513eb

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 (61) hide show
  1. package/constants/used-icons.d.ts +1 -1
  2. package/constants/version.d.ts +1 -1
  3. package/constants/version.js +1 -1
  4. package/esm2022/constants/used-icons.mjs +3 -2
  5. package/esm2022/constants/version.mjs +2 -2
  6. package/esm2022/date-time/day.mjs +9 -9
  7. package/esm2022/date-time/month.mjs +4 -4
  8. package/esm2022/services/scroll.service.mjs +5 -3
  9. package/esm2022/tokens/active-element.mjs +5 -4
  10. package/esm2022/tokens/environment.mjs +7 -3
  11. package/esm2022/utils/browser/is-safari.mjs +2 -2
  12. package/esm2022/utils/color/hex-to-rgba.mjs +2 -2
  13. package/esm2022/utils/color/parse-gradient.mjs +2 -2
  14. package/esm2022/utils/color/rgba-to-hex.mjs +2 -2
  15. package/esm2022/utils/di/create-options.mjs +6 -0
  16. package/esm2022/utils/di/index.mjs +3 -0
  17. package/esm2022/utils/di/taiga-ui-cdk-utils-di.mjs +5 -0
  18. package/esm2022/utils/index.mjs +2 -1
  19. package/esm2022/utils/math/round-with.mjs +3 -3
  20. package/fesm2022/taiga-ui-cdk-constants.mjs +3 -2
  21. package/fesm2022/taiga-ui-cdk-constants.mjs.map +1 -1
  22. package/fesm2022/taiga-ui-cdk-date-time.mjs +11 -11
  23. package/fesm2022/taiga-ui-cdk-date-time.mjs.map +1 -1
  24. package/fesm2022/taiga-ui-cdk-services.mjs +4 -2
  25. package/fesm2022/taiga-ui-cdk-services.mjs.map +1 -1
  26. package/fesm2022/taiga-ui-cdk-tokens.mjs +10 -5
  27. package/fesm2022/taiga-ui-cdk-tokens.mjs.map +1 -1
  28. package/fesm2022/taiga-ui-cdk-utils-browser.mjs +1 -1
  29. package/fesm2022/taiga-ui-cdk-utils-browser.mjs.map +1 -1
  30. package/fesm2022/taiga-ui-cdk-utils-color.mjs +3 -3
  31. package/fesm2022/taiga-ui-cdk-utils-color.mjs.map +1 -1
  32. package/fesm2022/taiga-ui-cdk-utils-di.mjs +15 -0
  33. package/fesm2022/taiga-ui-cdk-utils-di.mjs.map +1 -0
  34. package/fesm2022/taiga-ui-cdk-utils-math.mjs +2 -2
  35. package/fesm2022/taiga-ui-cdk-utils-math.mjs.map +1 -1
  36. package/fesm2022/taiga-ui-cdk-utils.mjs +1 -0
  37. package/fesm2022/taiga-ui-cdk-utils.mjs.map +1 -1
  38. package/package.json +13 -7
  39. package/schematics/ng-add/index.js +1 -1
  40. package/schematics/ng-update/v4/index.js +2 -0
  41. package/schematics/ng-update/v4/migrate-icons/rename-icons.js +5 -0
  42. package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.js +1 -1
  43. package/schematics/ng-update/v4/steps/constants/attr-with-values-to-replace.js +5 -0
  44. package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.js +28 -20
  45. package/schematics/ng-update/v4/steps/constants/modules-to-remove.js +8 -0
  46. package/schematics/ng-update/v4/steps/migrate-alert-service.js +2 -2
  47. package/schematics/ng-update/v4/steps/migrate-month-context.js +1 -3
  48. package/schematics/ng-update/v4/steps/migrate-providers-from.d.ts +2 -0
  49. package/schematics/ng-update/v4/steps/migrate-providers-from.js +32 -0
  50. package/schematics/ng-update/v4/steps/migrate-templates.js +1 -0
  51. package/schematics/ng-update/v4/steps/styles/migrate-text-mixins.js +1 -1
  52. package/schematics/ng-update/v4/steps/templates/index.d.ts +1 -0
  53. package/schematics/ng-update/v4/steps/templates/index.js +1 -0
  54. package/schematics/ng-update/v4/steps/templates/migrate-active-zone.d.ts +8 -0
  55. package/schematics/ng-update/v4/steps/templates/migrate-active-zone.js +32 -0
  56. package/schematics/ng-update/v4/steps/utils/clean-object.js +1 -1
  57. package/schematics/utils/angular-json-manipulations.js +5 -3
  58. package/services/scroll.service.d.ts +1 -0
  59. package/utils/di/create-options.d.ts +3 -0
  60. package/utils/di/index.d.ts +1 -0
  61. package/utils/index.d.ts +1 -0
@@ -362,6 +362,14 @@ exports.IDENTIFIERS_TO_REPLACE = [
362
362
  from: { name: 'TuiPrimitiveTextfieldModule', moduleSpecifier: '@taiga-ui/core' },
363
363
  to: { name: 'TuiPrimitiveTextfieldModule', moduleSpecifier: '@taiga-ui/legacy' },
364
364
  },
365
+ {
366
+ from: { name: 'TuiPrimitiveTextfieldComponent', moduleSpecifier: '@taiga-ui/core' },
367
+ to: { name: 'TuiPrimitiveTextfieldComponent', moduleSpecifier: '@taiga-ui/legacy' },
368
+ },
369
+ {
370
+ from: { name: 'TuiOptionComponent', moduleSpecifier: '@taiga-ui/core' },
371
+ to: { name: 'TuiOption', moduleSpecifier: '@taiga-ui/core' },
372
+ },
365
373
  {
366
374
  from: { name: 'TuiTextfieldControllerModule', moduleSpecifier: '@taiga-ui/core' },
367
375
  to: { name: 'TuiTextfieldControllerModule', moduleSpecifier: '@taiga-ui/legacy' },
@@ -1303,6 +1311,26 @@ exports.IDENTIFIERS_TO_REPLACE = [
1303
1311
  spreadInModule: true,
1304
1312
  },
1305
1313
  },
1314
+ {
1315
+ from: {
1316
+ name: 'TuiPreviewDialogModule',
1317
+ moduleSpecifier: '@taiga-ui/addon-preview',
1318
+ },
1319
+ to: {
1320
+ name: 'TuiPreviewDialog',
1321
+ moduleSpecifier: '@taiga-ui/kit',
1322
+ },
1323
+ },
1324
+ {
1325
+ from: {
1326
+ name: 'TuiPreviewDialogService',
1327
+ moduleSpecifier: '@taiga-ui/addon-preview',
1328
+ },
1329
+ to: {
1330
+ name: 'TuiPreviewDialogService',
1331
+ moduleSpecifier: '@taiga-ui/kit',
1332
+ },
1333
+ },
1306
1334
  {
1307
1335
  from: {
1308
1336
  name: 'TuiBlockStatusModule',
@@ -1368,26 +1396,6 @@ exports.IDENTIFIERS_TO_REPLACE = [
1368
1396
  spreadInModule: true,
1369
1397
  },
1370
1398
  },
1371
- {
1372
- from: {
1373
- name: 'TuiPreviewDialogModule',
1374
- moduleSpecifier: '@taiga-ui/addon-preview',
1375
- },
1376
- to: {
1377
- name: 'TuiPreviewDialog',
1378
- moduleSpecifier: '@taiga-ui/kit',
1379
- },
1380
- },
1381
- {
1382
- from: {
1383
- name: 'TuiPreviewDialogService',
1384
- moduleSpecifier: '@taiga-ui/addon-preview',
1385
- },
1386
- to: {
1387
- name: 'TuiPreviewDialogService',
1388
- moduleSpecifier: '@taiga-ui/kit',
1389
- },
1390
- },
1391
1399
  {
1392
1400
  from: {
1393
1401
  name: 'PolymorpheusModule',
@@ -22,6 +22,10 @@ exports.MODULES_TO_REMOVE = [
22
22
  name: 'TuiPromptModule',
23
23
  moduleSpecifier: '@taiga-ui/kit',
24
24
  },
25
+ {
26
+ name: 'TuiPdfViewerModule',
27
+ moduleSpecifier: '@taiga-ui/kit',
28
+ },
25
29
  {
26
30
  name: 'TuiThemeTinkoff2023NightModule',
27
31
  moduleSpecifier: '@taiga-ui/proprietary-core',
@@ -46,4 +50,8 @@ exports.MODULES_TO_REMOVE = [
46
50
  name: 'TuiMobileTabsModule',
47
51
  moduleSpecifier: '@taiga-ui/addon-mobile',
48
52
  },
53
+ {
54
+ name: 'TuiPreviewActionModule',
55
+ moduleSpecifier: '@taiga-ui/addon-preview',
56
+ },
49
57
  ];
@@ -8,10 +8,10 @@ const OPTIONS_MIGRATIONS = {
8
8
  autoClose: (property) => {
9
9
  const [propertyKey, propertyValue] = property.getText().split(/\s?:\s?/);
10
10
  switch (propertyValue) {
11
- case 'true':
12
- return property.replaceWithText(`${propertyKey}: 3_000`);
13
11
  case 'false':
14
12
  return property.replaceWithText(`${propertyKey}: 0`);
13
+ case 'true':
14
+ return property.replaceWithText(`${propertyKey}: 3_000`);
15
15
  default:
16
16
  return null;
17
17
  }
@@ -17,9 +17,7 @@ function migrateMonthContext(options) {
17
17
  return;
18
18
  }
19
19
  const booleanHandlerWithContext = ref.getFirstAncestor((node) => node.isKind(ng_morph_1.SyntaxKind.TypeReference) &&
20
- !!node
21
- .getText()
22
- .match(/TuiBooleanHandlerWithContext<\s*TuiMonth\s*,\s*TuiMonthContext\s*>/));
20
+ !!/TuiBooleanHandlerWithContext<\s*TuiMonth\s*,\s*TuiMonthContext\s*>/.exec(node.getText()));
23
21
  if (!booleanHandlerWithContext) {
24
22
  return;
25
23
  }
@@ -0,0 +1,2 @@
1
+ import type { TuiSchema } from '../../../ng-add/schema';
2
+ export declare function migrateImportProvidersFrom(options: TuiSchema): void;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrateImportProvidersFrom = 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
+ function migrateImportProvidersFrom(options) {
8
+ !options['skip-logs'] &&
9
+ (0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} updating importProvidersFrom`);
10
+ const refs = [
11
+ ...(0, get_named_import_references_1.getNamedImportReferences)('TuiDialogModule', '@taiga-ui/core'),
12
+ ...(0, get_named_import_references_1.getNamedImportReferences)('TuiAlertModule', '@taiga-ui/core'),
13
+ ...(0, get_named_import_references_1.getNamedImportReferences)('TuiPushModule', '@taiga-ui/kit'),
14
+ ...(0, get_named_import_references_1.getNamedImportReferences)('TuiPdfViewerModule', '@taiga-ui/kit'),
15
+ ...(0, get_named_import_references_1.getNamedImportReferences)('TuiPreviewModule', '@taiga-ui/addon-preview'),
16
+ ];
17
+ for (const ref of refs) {
18
+ if (ref.wasForgotten()) {
19
+ return;
20
+ }
21
+ const callExpression = ref.getParentWhile(ng_morph_1.Node.isCallExpression);
22
+ if ((callExpression === null || callExpression === void 0 ? void 0 : callExpression.getExpression().getText()) === 'importProvidersFrom') {
23
+ const node = callExpression
24
+ .getArguments()
25
+ .find((arg) => arg.getText() === ref.getText());
26
+ if (node) {
27
+ callExpression.removeArgument(node);
28
+ }
29
+ }
30
+ }
31
+ }
32
+ exports.migrateImportProvidersFrom = migrateImportProvidersFrom;
@@ -52,6 +52,7 @@ function migrateTemplates(fileSystem, options) {
52
52
  migrate_number_precision_1.migrateNumberPrecision,
53
53
  templates_2.migrateNotification,
54
54
  templates_2.migrateFilterPipe,
55
+ templates_2.migrateActiveZoneParent,
55
56
  ];
56
57
  const progressLog = (0, progress_1.setupProgressLogger)({
57
58
  total: componentWithTemplatesPaths.length,
@@ -42,7 +42,7 @@ const MAPPING = {
42
42
  };
43
43
  // .tui-text-h1();
44
44
  // @include tui-text-h1();
45
- const MIXIN_RE = /(?:@include\s|\.)(text-[\w-]+)\(([\w-,\s]+)?\)(\s?!important)?;/g;
45
+ const MIXIN_RE = /(?:@include\s|\.)(?!text-overflow\b)(text-[\w-]+)\(([\w-,\s]+)?\)(\s?!important)?;/g;
46
46
  function migrateTextMixins(fileContent) {
47
47
  if (!fileContent.includes('@taiga-ui/core/styles/taiga-ui-local')) {
48
48
  return fileContent;
@@ -1,3 +1,4 @@
1
+ export * from './migrate-active-zone';
1
2
  export * from './migrate-avatar';
2
3
  export * from './migrate-axes';
3
4
  export * from './migrate-badge';
@@ -1,6 +1,7 @@
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-active-zone"), exports);
4
5
  tslib_1.__exportStar(require("./migrate-avatar"), exports);
5
6
  tslib_1.__exportStar(require("./migrate-axes"), exports);
6
7
  tslib_1.__exportStar(require("./migrate-badge"), exports);
@@ -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 migrateActiveZoneParent({ resource, recorder, fileSystem, }: {
5
+ fileSystem: DevkitFileSystem;
6
+ recorder: UpdateRecorder;
7
+ resource: TemplateResource;
8
+ }): void;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrateActiveZoneParent = void 0;
4
+ const elements_1 = require("../../../../utils/templates/elements");
5
+ const inputs_1 = require("../../../../utils/templates/inputs");
6
+ const template_resource_1 = require("../../../../utils/templates/template-resource");
7
+ const remove_attrs_1 = require("../utils/remove-attrs");
8
+ function migrateActiveZoneParent({ resource, recorder, fileSystem, }) {
9
+ const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
10
+ const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
11
+ const elements = (0, elements_1.findElementsByTagName)(template, 'ng-template');
12
+ elements.forEach(({ attrs, sourceCodeLocation, childNodes }) => {
13
+ const zoneAttr = (0, inputs_1.findAttr)(attrs, 'let-activeZone');
14
+ if (!sourceCodeLocation) {
15
+ return;
16
+ }
17
+ if (zoneAttr) {
18
+ (0, remove_attrs_1.removeAttrs)([zoneAttr], sourceCodeLocation, recorder, templateOffset);
19
+ }
20
+ const children = (0, elements_1.findElementsByFn)(childNodes, (el) => (0, elements_1.hasElementAttribute)(el, 'tuiActiveZoneParent'));
21
+ children.forEach(({ attrs, sourceCodeLocation }) => {
22
+ const parentAttr = (0, inputs_1.findAttr)(attrs, 'tuiActiveZoneParent');
23
+ if (!parentAttr || !sourceCodeLocation) {
24
+ return;
25
+ }
26
+ if (parentAttr) {
27
+ (0, remove_attrs_1.removeAttrs)([parentAttr], sourceCodeLocation, recorder, templateOffset);
28
+ }
29
+ });
30
+ });
31
+ }
32
+ exports.migrateActiveZoneParent = migrateActiveZoneParent;
@@ -4,7 +4,7 @@ exports.cleanObject = void 0;
4
4
  function checkValueIsEmpty(value) {
5
5
  // eslint-disable-next-line
6
6
  const nextValue = typeof value === 'string' ? value.trim() : value;
7
- return [undefined, null, NaN, ''].includes(nextValue);
7
+ return ['', NaN, null, undefined].includes(nextValue);
8
8
  }
9
9
  function cleanObject(object) {
10
10
  return JSON.parse(JSON.stringify(object, (_key, value) => checkValueIsEmpty(value) ? undefined : value));
@@ -60,14 +60,16 @@ function addStylesToAngularJson(options, context, taigaStyles, filter, stylesToR
60
60
  }
61
61
  if (stylesToReplace &&
62
62
  (styles === null || styles === void 0 ? void 0 : styles.filter((style) => style !== stylesToReplace.from))) {
63
- targetOptions.styles = Array.from(new Set([
63
+ const orderList = [
64
64
  ...taigaStyles,
65
65
  ...stylesToReplace.to,
66
66
  ...styles.filter((style) => style !== stylesToReplace.from),
67
- ]));
67
+ ];
68
+ targetOptions.styles = Array.from(new Set(orderList));
68
69
  }
69
70
  else {
70
- targetOptions.styles = Array.from(new Set([...taigaStyles, ...(styles || [])]));
71
+ const orderList = [...taigaStyles, ...(styles || [])];
72
+ targetOptions.styles = Array.from(new Set(orderList));
71
73
  }
72
74
  if (tree && stylesToReplace) {
73
75
  (0, ng_morph_1.addPackageJsonDependency)(tree, {
@@ -3,6 +3,7 @@ import * as i0 from "@angular/core";
3
3
  export declare class TuiScrollService {
4
4
  private readonly performanceRef;
5
5
  private readonly animationFrame$;
6
+ private readonly zone;
6
7
  scroll$(elementOrWindow: Element | Window, scrollTop: number, scrollLeft?: number, duration?: number): Observable<[number, number]>;
7
8
  static ɵfac: i0.ɵɵFactoryDeclaration<TuiScrollService, never>;
8
9
  static ɵprov: i0.ɵɵInjectableDeclaration<TuiScrollService>;
@@ -0,0 +1,3 @@
1
+ import type { InjectionToken, Provider } from '@angular/core';
2
+ import type { TuiHandler } from '@taiga-ui/cdk/types';
3
+ export declare function tuiCreateOptions<T>(defaults: T): [token: InjectionToken<T>, provider: TuiHandler<Partial<T>, Provider>];
@@ -0,0 +1 @@
1
+ export * from './create-options';
package/utils/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from '@taiga-ui/cdk/utils/browser';
2
2
  export * from '@taiga-ui/cdk/utils/color';
3
+ export * from '@taiga-ui/cdk/utils/di';
3
4
  export * from '@taiga-ui/cdk/utils/dom';
4
5
  export * from '@taiga-ui/cdk/utils/focus';
5
6
  export * from '@taiga-ui/cdk/utils/math';