@taiga-ui/cdk 4.5.0 → 4.6.0-canary.d8f9586

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 (66) hide show
  1. package/constants/version.d.ts +1 -1
  2. package/constants/version.js +1 -1
  3. package/directives/native-validator/native-validator.directive.d.ts +1 -2
  4. package/esm2022/constants/version.mjs +2 -2
  5. package/esm2022/date-time/day.mjs +9 -9
  6. package/esm2022/date-time/month.mjs +4 -4
  7. package/esm2022/directives/native-validator/native-validator.directive.mjs +4 -7
  8. package/esm2022/directives/obscured/obscured.service.mjs +3 -3
  9. package/esm2022/utils/color/parse-gradient.mjs +9 -9
  10. package/esm2022/utils/color/rgba-to-hex.mjs +4 -4
  11. package/esm2022/utils/di/create-options.mjs +6 -0
  12. package/esm2022/utils/di/index.mjs +3 -0
  13. package/esm2022/utils/di/taiga-ui-cdk-utils-di.mjs +5 -0
  14. package/esm2022/utils/index.mjs +2 -1
  15. package/esm2022/utils/math/round-with.mjs +3 -3
  16. package/esm2022/utils/miscellaneous/is-valid-url.mjs +7 -7
  17. package/fesm2022/taiga-ui-cdk-constants.mjs +1 -1
  18. package/fesm2022/taiga-ui-cdk-constants.mjs.map +1 -1
  19. package/fesm2022/taiga-ui-cdk-date-time.mjs +11 -11
  20. package/fesm2022/taiga-ui-cdk-date-time.mjs.map +1 -1
  21. package/fesm2022/taiga-ui-cdk-directives-native-validator.mjs +3 -6
  22. package/fesm2022/taiga-ui-cdk-directives-native-validator.mjs.map +1 -1
  23. package/fesm2022/taiga-ui-cdk-directives-obscured.mjs +2 -2
  24. package/fesm2022/taiga-ui-cdk-directives-obscured.mjs.map +1 -1
  25. package/fesm2022/taiga-ui-cdk-utils-color.mjs +11 -11
  26. package/fesm2022/taiga-ui-cdk-utils-color.mjs.map +1 -1
  27. package/fesm2022/taiga-ui-cdk-utils-di.mjs +15 -0
  28. package/fesm2022/taiga-ui-cdk-utils-di.mjs.map +1 -0
  29. package/fesm2022/taiga-ui-cdk-utils-math.mjs +2 -2
  30. package/fesm2022/taiga-ui-cdk-utils-math.mjs.map +1 -1
  31. package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs +6 -6
  32. package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs.map +1 -1
  33. package/fesm2022/taiga-ui-cdk-utils.mjs +1 -0
  34. package/fesm2022/taiga-ui-cdk-utils.mjs.map +1 -1
  35. package/package.json +362 -356
  36. package/schematics/constants/taiga-styles.d.ts +0 -2
  37. package/schematics/constants/taiga-styles.js +1 -3
  38. package/schematics/ng-add/index.js +5 -8
  39. package/schematics/ng-add/schema.d.ts +0 -1
  40. package/schematics/ng-add/schema.json +0 -9
  41. package/schematics/ng-add/steps/add-taiga-modules.js +2 -0
  42. package/schematics/ng-add/steps/add-taiga-styles.js +1 -4
  43. package/schematics/ng-update/v4/index.js +4 -0
  44. package/schematics/ng-update/v4/migrate-icons/rename-icons.js +5 -0
  45. package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.js +1 -1
  46. package/schematics/ng-update/v4/steps/constants/attr-with-values-to-replace.js +5 -0
  47. package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.js +8 -41
  48. package/schematics/ng-update/v4/steps/drop-universal-mock.d.ts +2 -0
  49. package/schematics/ng-update/v4/steps/drop-universal-mock.js +20 -0
  50. package/schematics/ng-update/v4/steps/migrate-alert-service.js +2 -2
  51. package/schematics/ng-update/v4/steps/migrate-editor.d.ts +5 -0
  52. package/schematics/ng-update/v4/steps/migrate-editor.js +77 -0
  53. package/schematics/ng-update/v4/steps/migrate-month-context.js +1 -3
  54. package/schematics/ng-update/v4/steps/migrate-templates.js +1 -0
  55. package/schematics/ng-update/v4/steps/styles/migrate-text-mixins.js +1 -1
  56. package/schematics/ng-update/v4/steps/templates/index.d.ts +1 -0
  57. package/schematics/ng-update/v4/steps/templates/index.js +1 -0
  58. package/schematics/ng-update/v4/steps/templates/migrate-active-zone.d.ts +8 -0
  59. package/schematics/ng-update/v4/steps/templates/migrate-active-zone.js +32 -0
  60. package/schematics/ng-update/v4/steps/update-packages.d.ts +0 -1
  61. package/schematics/ng-update/v4/steps/update-packages.js +1 -6
  62. package/schematics/ng-update/v4/steps/utils/clean-object.js +1 -1
  63. package/schematics/utils/angular-json-manipulations.js +5 -3
  64. package/utils/di/create-options.d.ts +3 -0
  65. package/utils/di/index.d.ts +1 -0
  66. package/utils/index.d.ts +1 -0
@@ -1,4 +1,2 @@
1
- export declare const TAIGA_GLOBAL_OLD_STYLE = "node_modules/@taiga-ui/core/styles/taiga-ui-global.less";
2
- export declare const TAIGA_GLOBAL_NEW_STYLE = "node_modules/@taiga-ui/styles/taiga-ui-global.less";
3
1
  export declare const TAIGA_THEME_STYLE = "node_modules/@taiga-ui/core/styles/taiga-ui-theme.less";
4
2
  export declare const TAIGA_THEME_FONTS = "node_modules/@taiga-ui/core/styles/taiga-ui-fonts.less";
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TAIGA_THEME_FONTS = exports.TAIGA_THEME_STYLE = exports.TAIGA_GLOBAL_NEW_STYLE = exports.TAIGA_GLOBAL_OLD_STYLE = void 0;
4
- exports.TAIGA_GLOBAL_OLD_STYLE = 'node_modules/@taiga-ui/core/styles/taiga-ui-global.less';
5
- exports.TAIGA_GLOBAL_NEW_STYLE = 'node_modules/@taiga-ui/styles/taiga-ui-global.less';
3
+ exports.TAIGA_THEME_FONTS = exports.TAIGA_THEME_STYLE = void 0;
6
4
  exports.TAIGA_THEME_STYLE = 'node_modules/@taiga-ui/core/styles/taiga-ui-theme.less';
7
5
  exports.TAIGA_THEME_FONTS = 'node_modules/@taiga-ui/core/styles/taiga-ui-fonts.less';
@@ -14,14 +14,11 @@ function addDependencies(tree, options) {
14
14
  type: ng_morph_1.NodeDependencyType.Default,
15
15
  });
16
16
  });
17
+ (0, ng_morph_1.addPackageJsonDependency)(tree, {
18
+ name: '@taiga-ui/event-plugins',
19
+ version: '^4.0.2',
20
+ });
17
21
  removeTaigaSchematicsPackage(tree);
18
- if (options.addGlobalStyles) {
19
- (0, ng_morph_1.addPackageJsonDependency)(tree, {
20
- name: '@taiga-ui/styles',
21
- version: versions_1.TAIGA_VERSION,
22
- type: ng_morph_1.NodeDependencyType.Default,
23
- });
24
- }
25
22
  if (packages.includes('addon-table') || packages.includes('addon-mobile')) {
26
23
  addAngularCdkDep(tree);
27
24
  }
@@ -32,7 +29,7 @@ function addAngularCdkDep(tree) {
32
29
  if (!angularCore) {
33
30
  return;
34
31
  }
35
- const majorVersionArr = angularCore.match(/[0-9]+/);
32
+ const majorVersionArr = /[0-9]+/.exec(angularCore);
36
33
  if (majorVersionArr) {
37
34
  (0, ng_morph_1.addPackageJsonDependency)(tree, {
38
35
  name: '@angular/cdk',
@@ -1,5 +1,4 @@
1
1
  export interface TuiSchema {
2
- readonly addGlobalStyles: boolean;
3
2
  readonly addons: readonly string[];
4
3
  readonly project: string;
5
4
  /**
@@ -11,15 +11,6 @@
11
11
  "$source": "projectName"
12
12
  }
13
13
  },
14
- "addGlobalStyles": {
15
- "description": "Setting up global styles",
16
- "type": "boolean",
17
- "default": false,
18
- "x-prompt": {
19
- "message": "Do you want to use global Taiga UI classes, such as 'tui-space', 'tui-skeleton', etc?",
20
- "type": "confirmation"
21
- }
22
- },
23
14
  "addons": {
24
15
  "description": "Setting up additional packages",
25
16
  "type": "array",
@@ -19,6 +19,8 @@ function addTuiModules({ mainClass, context, }) {
19
19
  (0, ng_morph_1.addImportToNgModule)(mainClass, module.name, { unique: true });
20
20
  (0, add_unique_import_1.addUniqueImport)(mainModulePath, module.name, module.packageName);
21
21
  });
22
+ (0, ng_morph_1.addProviderToNgModule)(mainClass, 'NG_EVENT_PLUGINS', { unique: true });
23
+ (0, add_unique_import_1.addUniqueImport)(mainModulePath, 'NG_EVENT_PLUGINS', '@taiga-ui/event-plugins');
22
24
  context.logger.info(`${modules.map((module) => module.name)} was added to ${mainModulePath}`);
23
25
  }
24
26
  function addTuiEntitiesToStandalone({ bootstrapFunction, options, context, }) {
@@ -6,10 +6,7 @@ const angular_json_manipulations_1 = require("../../utils/angular-json-manipulat
6
6
  function addTaigaStyles(options) {
7
7
  return (_, context) => {
8
8
  const taigaLocalStyles = [taiga_styles_1.TAIGA_THEME_STYLE, taiga_styles_1.TAIGA_THEME_FONTS];
9
- const taigaStyles = options.addGlobalStyles
10
- ? [...taigaLocalStyles, taiga_styles_1.TAIGA_GLOBAL_NEW_STYLE]
11
- : taigaLocalStyles;
12
- return (0, angular_json_manipulations_1.addStylesToAngularJson)(options, context, taigaStyles);
9
+ return (0, angular_json_manipulations_1.addStylesToAngularJson)(options, context, taigaLocalStyles);
13
10
  };
14
11
  }
15
12
  exports.addTaigaStyles = addTaigaStyles;
@@ -16,11 +16,14 @@ const steps_2 = require("./steps");
16
16
  const constants_1 = require("./steps/constants");
17
17
  const modules_to_replace_1 = require("./steps/constants/modules-to-replace");
18
18
  const types_1 = require("./steps/constants/types");
19
+ const drop_universal_mock_1 = require("./steps/drop-universal-mock");
20
+ const migrate_editor_1 = require("./steps/migrate-editor");
19
21
  const migrate_root_1 = require("./steps/migrate-root");
20
22
  const replace_modules_with_providers_1 = require("./steps/utils/replace-modules-with-providers");
21
23
  function main(options) {
22
24
  return (tree, context) => {
23
25
  const fileSystem = (0, get_file_system_1.getFileSystem)(tree);
26
+ (0, migrate_editor_1.migrateEditor)(fileSystem, options);
24
27
  (0, steps_1.replaceEnums)(options, enums_1.ENUMS_TO_REPLACE);
25
28
  (0, migrate_root_1.migrateRoot)(fileSystem, options);
26
29
  (0, replace_services_1.replaceServices)(options, constants_1.SERVICES_TO_REPLACE);
@@ -37,6 +40,7 @@ function main(options) {
37
40
  (0, steps_2.migrateAlertService)(options);
38
41
  (0, steps_2.migrateNumberFormatSettings)(options);
39
42
  (0, steps_2.migrateMonthContext)(options);
43
+ (0, drop_universal_mock_1.dropUniversalMock)(options);
40
44
  (0, ng_morph_1.saveActiveProject)();
41
45
  (0, steps_2.migrateTemplates)(fileSystem, options);
42
46
  (0, steps_1.showWarnings)(context, constants_1.MIGRATION_WARNINGS);
@@ -7,8 +7,13 @@ const constants_1 = require("../../../constants");
7
7
  const CHANGED_ICONS = [
8
8
  { from: 'tuiIconClose', to: '@tui.x' },
9
9
  { from: 'tuiIconCloseLarge', to: '@tui.x' },
10
+ { from: 'tuiIconUploadCloud', to: '@tui.cloud-upload' },
11
+ { from: 'tuiIconUploadCloudLarge', to: '@tui.cloud-upload' },
12
+ { from: 'tuiIconEdit', to: '@tui.pencil' },
10
13
  { from: 'tuiIconEdit2', to: '@tui.pencil' },
11
14
  { from: 'tuiIconEdit2Large', to: '@tui.pencil' },
15
+ { from: 'tuiIconGitCommit', to: '@tui.git-commit-horizontal' },
16
+ { from: 'tuiIconGitCommitLarge', to: '@tui.git-commit-horizontal' },
12
17
  { from: 'tuiIconMoreHorizontal', to: '@tui.ellipsis' },
13
18
  { from: 'tuiIconMoreHorizontalLarge', to: '@tui.ellipsis' },
14
19
  { from: 'tuiIconMoreVertical', to: '@tui.ellipsis-vertical' },
@@ -10,7 +10,7 @@ function renameProprietaryIcons({ logger }, pattern = constants_1.ALL_FILES) {
10
10
  const regex = /['"`]tuiIcon(?!Button\b)[A-Z][a-zA-Z0-9]*\b/g;
11
11
  const invalidIcons = new Set();
12
12
  text = text.replaceAll(regex, (icon) => {
13
- if (icon.match(/['"`]tuiIcon(?!Tds)\w*/)) {
13
+ if (/['"`]tuiIcon(?!Tds)\w*/.exec(icon)) {
14
14
  logger.warn(`[WARNING] in ${file.getSourceFile().getFilePath()}: Invalid icon name ${icon}. Please select an icon from the proprietary pack.`);
15
15
  invalidIcons.add(icon.slice(1));
16
16
  return icon;
@@ -29,6 +29,11 @@ exports.ATTR_WITH_VALUES_TO_REPLACE = [
29
29
  { from: 'onLight', to: 'light' },
30
30
  ],
31
31
  },
32
+ {
33
+ attrNames: ['tuiHintAppearance'],
34
+ newAttrName: 'tuiHintAppearance',
35
+ valueReplacer: [{ from: 'onDark', to: 'dark' }],
36
+ },
32
37
  {
33
38
  attrNames: ['[pseudoActive]'],
34
39
  newAttrName: '[tuiAppearanceState]',
@@ -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' },
@@ -587,47 +595,6 @@ exports.IDENTIFIERS_TO_REPLACE = [
587
595
  moduleSpecifier: '@taiga-ui/kit',
588
596
  },
589
597
  },
590
- {
591
- from: { name: 'TuiEditorModule', moduleSpecifier: '@tinkoff/tui-editor' },
592
- to: [
593
- { name: 'TuiEditor', moduleSpecifier: '@taiga-ui/editor' },
594
- { name: 'TuiEditorSocket', moduleSpecifier: '@taiga-ui/editor' },
595
- ],
596
- },
597
- {
598
- from: { name: 'TuiEditorSocketModule', moduleSpecifier: '@tinkoff/tui-editor' },
599
- to: { name: 'TuiEditorSocket', moduleSpecifier: '@taiga-ui/editor' },
600
- },
601
- {
602
- from: { name: 'TuiToolbarModule', moduleSpecifier: '@tinkoff/tui-editor' },
603
- to: { name: 'TuiToolbar', moduleSpecifier: '@taiga-ui/editor' },
604
- },
605
- {
606
- from: { name: 'defaultEditorExtensions', moduleSpecifier: '@tinkoff/tui-editor' },
607
- to: { name: 'TUI_EDITOR_DEFAULT_EXTENSIONS', moduleSpecifier: '@taiga-ui/editor' },
608
- },
609
- {
610
- from: {
611
- name: 'TUI_EDITOR_DEFAULT_EXTENSIONS',
612
- moduleSpecifier: '@tinkoff/tui-editor',
613
- },
614
- to: { name: 'TUI_EDITOR_DEFAULT_EXTENSIONS', moduleSpecifier: '@taiga-ui/editor' },
615
- },
616
- {
617
- from: [
618
- { name: 'defaultEditorTools', moduleSpecifier: '@tinkoff/tui-editor' },
619
- { name: 'TUI_EDITOR_DEFAULT_TOOLS', moduleSpecifier: '@tinkoff/tui-editor' },
620
- ],
621
- to: { name: 'TUI_EDITOR_DEFAULT_TOOLS', moduleSpecifier: '@taiga-ui/editor' },
622
- },
623
- {
624
- from: { name: 'TuiColorPickerModule', moduleSpecifier: '@tinkoff/tui-editor' },
625
- to: { name: 'TuiColorPickerModule', moduleSpecifier: '@taiga-ui/legacy' },
626
- },
627
- {
628
- from: { name: 'TuiInputColorModule', moduleSpecifier: '@tinkoff/tui-editor' },
629
- to: { name: 'TuiInputColorModule', moduleSpecifier: '@taiga-ui/legacy' },
630
- },
631
598
  {
632
599
  from: { name: 'TuiFadeModule', moduleSpecifier: '@taiga-ui/experimental' },
633
600
  to: {
@@ -0,0 +1,2 @@
1
+ import type { TuiSchema } from '../../../ng-add/schema';
2
+ export declare function dropUniversalMock(options: TuiSchema): void;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dropUniversalMock = void 0;
4
+ const ng_morph_1 = require("ng-morph");
5
+ const file_globs_1 = require("../../../constants/file-globs");
6
+ const colored_log_1 = require("../../../utils/colored-log");
7
+ function dropUniversalMock(options) {
8
+ const moduleSpecifier = '@ng-web-apis/universal/mocks';
9
+ const imports = (0, ng_morph_1.getImports)(file_globs_1.ALL_TS_FILES, { moduleSpecifier });
10
+ if (imports.length) {
11
+ !options['skip-logs'] &&
12
+ (0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} drop "${moduleSpecifier}" import`);
13
+ const match = new RegExp(`import\\s+[\\'\\"\`]${moduleSpecifier}[\\'\\"\`];`, 'g');
14
+ imports.forEach((declaration) => declaration
15
+ .getSourceFile()
16
+ .replaceWithText(declaration.getSourceFile().getFullText().replaceAll(match, '')));
17
+ !options['skip-logs'] && (0, colored_log_1.titleLog)(`${colored_log_1.FINISH_SYMBOL} successfully migrated \n`);
18
+ }
19
+ }
20
+ exports.dropUniversalMock = dropUniversalMock;
@@ -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
  }
@@ -0,0 +1,5 @@
1
+ /// <reference lib="es2021" />
2
+ import { type DevkitFileSystem } from 'ng-morph';
3
+ import type { TuiSchema } from '../../../ng-add/schema';
4
+ export declare const TUI_EDITOR_VERSION = "^4.0.0";
5
+ export declare function migrateEditor(fileSystem: DevkitFileSystem, options: TuiSchema): void;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrateEditor = exports.TUI_EDITOR_VERSION = void 0;
4
+ /// <reference lib="es2021" />
5
+ const ng_morph_1 = require("ng-morph");
6
+ const ng_morph_2 = require("ng-morph");
7
+ const file_globs_1 = require("../../../constants/file-globs");
8
+ const colored_log_1 = require("../../../utils/colored-log");
9
+ const replace_identifier_1 = require("../../steps/replace-identifier");
10
+ const replace_package_name_1 = require("../../steps/replace-package-name");
11
+ exports.TUI_EDITOR_VERSION = '^4.0.0';
12
+ function migrateEditor(fileSystem, options) {
13
+ const moduleSpecifier = ['@tinkoff/tui-editor', '@taiga-ui/addon-editor'];
14
+ const hasEditor = moduleSpecifier.every((pkg) => !(0, ng_morph_1.getPackageJsonDependency)(fileSystem.tree, pkg));
15
+ if (hasEditor) {
16
+ return;
17
+ }
18
+ !options['skip-logs'] &&
19
+ (0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating editor...`);
20
+ (0, replace_identifier_1.replaceIdentifiers)(options, [
21
+ {
22
+ from: { name: 'TuiEditorModule', moduleSpecifier },
23
+ to: [
24
+ { name: 'TuiEditor', moduleSpecifier: '@taiga-ui/editor' },
25
+ { name: 'TuiEditorSocket', moduleSpecifier: '@taiga-ui/editor' },
26
+ ],
27
+ },
28
+ {
29
+ from: { name: 'TuiEditorSocketModule', moduleSpecifier },
30
+ to: { name: 'TuiEditorSocket', moduleSpecifier: '@taiga-ui/editor' },
31
+ },
32
+ {
33
+ from: { name: 'TuiToolbarModule', moduleSpecifier },
34
+ to: { name: 'TuiToolbar', moduleSpecifier: '@taiga-ui/editor' },
35
+ },
36
+ {
37
+ from: { name: 'defaultEditorExtensions', moduleSpecifier },
38
+ to: {
39
+ name: 'TUI_EDITOR_DEFAULT_EXTENSIONS',
40
+ moduleSpecifier: '@taiga-ui/editor',
41
+ },
42
+ },
43
+ {
44
+ from: { name: 'TUI_EDITOR_DEFAULT_EXTENSIONS', moduleSpecifier },
45
+ to: {
46
+ name: 'TUI_EDITOR_DEFAULT_EXTENSIONS',
47
+ moduleSpecifier: '@taiga-ui/editor',
48
+ },
49
+ },
50
+ {
51
+ from: [
52
+ { name: 'defaultEditorTools', moduleSpecifier },
53
+ {
54
+ name: 'TUI_EDITOR_DEFAULT_TOOLS',
55
+ moduleSpecifier: '@tinkoff/tui-editor',
56
+ },
57
+ ],
58
+ to: { name: 'TUI_EDITOR_DEFAULT_TOOLS', moduleSpecifier: '@taiga-ui/editor' },
59
+ },
60
+ {
61
+ from: { name: 'TuiColorPickerModule', moduleSpecifier },
62
+ to: { name: 'TuiColorPickerModule', moduleSpecifier: '@taiga-ui/legacy' },
63
+ },
64
+ {
65
+ from: { name: 'TuiInputColorModule', moduleSpecifier },
66
+ to: { name: 'TuiInputColorModule', moduleSpecifier: '@taiga-ui/legacy' },
67
+ },
68
+ ]);
69
+ (0, ng_morph_2.getSourceFiles)(file_globs_1.ALL_TS_FILES).forEach((sourceFile) => sourceFile.replaceWithText(sourceFile
70
+ .getFullText()
71
+ .replaceAll(/import\(['"`](@tinkoff|@taiga-ui)\/(tui-editor|addon-editor)\/(.*)['"`]\)/g, "import('@taiga-ui/editor')")));
72
+ (0, ng_morph_2.saveActiveProject)();
73
+ moduleSpecifier.forEach((pkg) => (0, replace_package_name_1.replacePackageName)(pkg, { name: '@taiga-ui/editor', version: exports.TUI_EDITOR_VERSION }, fileSystem.tree));
74
+ (0, ng_morph_2.saveActiveProject)();
75
+ !options['skip-logs'] && (0, colored_log_1.titleLog)(`${colored_log_1.FINISH_SYMBOL} successfully migrated \n`);
76
+ }
77
+ exports.migrateEditor = migrateEditor;
@@ -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
  }
@@ -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,5 +4,4 @@ import type { TuiSchema } from '../../../ng-add/schema';
4
4
  export declare const TUI_POLYMORPHEUS_VERSION = "^4.6.4";
5
5
  export declare const TUI_DOMPURIFY_VERSION = "^4.1.2";
6
6
  export declare const TUI_EVENT_PLUGINS_VERSION = "^4.0.1";
7
- export declare const TUI_EDITOR_VERSION = "^2.5.0";
8
7
  export declare function updatePackages({ tree }: DevkitFileSystem, _: TuiSchema): void;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updatePackages = exports.TUI_EDITOR_VERSION = exports.TUI_EVENT_PLUGINS_VERSION = exports.TUI_DOMPURIFY_VERSION = exports.TUI_POLYMORPHEUS_VERSION = void 0;
3
+ exports.updatePackages = exports.TUI_EVENT_PLUGINS_VERSION = exports.TUI_DOMPURIFY_VERSION = exports.TUI_POLYMORPHEUS_VERSION = void 0;
4
4
  const ng_morph_1 = require("ng-morph");
5
5
  const version_1 = require("../../../../constants/version");
6
6
  const constants_1 = require("../../../constants");
@@ -8,7 +8,6 @@ const steps_1 = require("../../steps");
8
8
  exports.TUI_POLYMORPHEUS_VERSION = '^4.6.4';
9
9
  exports.TUI_DOMPURIFY_VERSION = '^4.1.2';
10
10
  exports.TUI_EVENT_PLUGINS_VERSION = '^4.0.1';
11
- exports.TUI_EDITOR_VERSION = '^2.5.0';
12
11
  function updatePackages({ tree }, _) {
13
12
  const packagesToRemove = ['@taiga-ui/addon-tablebars', '@taiga-ui/addon-preview'];
14
13
  packagesToRemove.forEach((pkg) => {
@@ -26,10 +25,6 @@ function updatePackages({ tree }, _) {
26
25
  name: '@taiga-ui/event-plugins',
27
26
  version: exports.TUI_EVENT_PLUGINS_VERSION,
28
27
  }, tree);
29
- (0, steps_1.replacePackageName)('@tinkoff/tui-editor', {
30
- name: '@taiga-ui/editor',
31
- version: exports.TUI_EDITOR_VERSION,
32
- }, tree);
33
28
  const cdk = (0, ng_morph_1.getPackageJsonDependency)(tree, '@taiga-ui/cdk');
34
29
  if (!(0, ng_morph_1.getPackageJsonDependency)(tree, '@taiga-ui/event-plugins')) {
35
30
  (0, ng_morph_1.addPackageJsonDependency)(tree, {
@@ -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, {
@@ -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';