@taiga-ui/cdk 4.4.1 → 4.5.0-canary.538706d

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 (72) 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/directives/auto-focus/handlers/default.handler.d.ts +3 -2
  5. package/esm2022/constants/used-icons.mjs +3 -1
  6. package/esm2022/constants/version.mjs +2 -2
  7. package/esm2022/directives/auto-focus/autofocus.options.mjs +2 -2
  8. package/esm2022/directives/auto-focus/handlers/default.handler.mjs +5 -3
  9. package/esm2022/directives/obscured/obscured.service.mjs +4 -4
  10. package/esm2022/directives/pan/pan.service.mjs +3 -3
  11. package/esm2022/directives/swipe/swipe.service.mjs +7 -7
  12. package/esm2022/directives/zoom/zoom.service.mjs +5 -5
  13. package/esm2022/observables/zone.mjs +24 -4
  14. package/esm2022/services/id.service.mjs +6 -7
  15. package/esm2022/utils/color/hex-to-rgba.mjs +2 -2
  16. package/esm2022/utils/color/parse-gradient.mjs +3 -3
  17. package/esm2022/utils/color/rgba-to-hex.mjs +6 -8
  18. package/esm2022/utils/focus/move-focus.mjs +2 -2
  19. package/esm2022/utils/miscellaneous/distance-between-touches.mjs +2 -2
  20. package/fesm2022/taiga-ui-cdk-constants.mjs +3 -1
  21. package/fesm2022/taiga-ui-cdk-constants.mjs.map +1 -1
  22. package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs +5 -3
  23. package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs.map +1 -1
  24. package/fesm2022/taiga-ui-cdk-directives-obscured.mjs +3 -3
  25. package/fesm2022/taiga-ui-cdk-directives-obscured.mjs.map +1 -1
  26. package/fesm2022/taiga-ui-cdk-directives-pan.mjs +2 -2
  27. package/fesm2022/taiga-ui-cdk-directives-pan.mjs.map +1 -1
  28. package/fesm2022/taiga-ui-cdk-directives-swipe.mjs +6 -6
  29. package/fesm2022/taiga-ui-cdk-directives-swipe.mjs.map +1 -1
  30. package/fesm2022/taiga-ui-cdk-directives-zoom.mjs +4 -4
  31. package/fesm2022/taiga-ui-cdk-directives-zoom.mjs.map +1 -1
  32. package/fesm2022/taiga-ui-cdk-observables.mjs +24 -5
  33. package/fesm2022/taiga-ui-cdk-observables.mjs.map +1 -1
  34. package/fesm2022/taiga-ui-cdk-services.mjs +5 -6
  35. package/fesm2022/taiga-ui-cdk-services.mjs.map +1 -1
  36. package/fesm2022/taiga-ui-cdk-utils-color.mjs +8 -10
  37. package/fesm2022/taiga-ui-cdk-utils-color.mjs.map +1 -1
  38. package/fesm2022/taiga-ui-cdk-utils-focus.mjs +1 -1
  39. package/fesm2022/taiga-ui-cdk-utils-focus.mjs.map +1 -1
  40. package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs +1 -1
  41. package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs.map +1 -1
  42. package/observables/zone.d.ts +7 -5
  43. package/package.json +356 -356
  44. package/schematics/constants/taiga-styles.d.ts +0 -2
  45. package/schematics/constants/taiga-styles.js +1 -3
  46. package/schematics/ng-add/index.js +4 -7
  47. package/schematics/ng-add/schema.d.ts +0 -1
  48. package/schematics/ng-add/schema.json +0 -9
  49. package/schematics/ng-add/steps/add-taiga-modules.js +10 -1
  50. package/schematics/ng-add/steps/add-taiga-styles.js +1 -4
  51. package/schematics/ng-add/steps/wrap-with-tui-root.js +7 -2
  52. package/schematics/ng-update/v4/index.js +2 -0
  53. package/schematics/ng-update/v4/migrate-addon-doc/replace-symbols.js +4 -0
  54. package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.js +0 -41
  55. package/schematics/ng-update/v4/steps/migrate-editor.d.ts +5 -0
  56. package/schematics/ng-update/v4/steps/migrate-editor.js +77 -0
  57. package/schematics/ng-update/v4/steps/migrate-legacy-mask.js +2 -2
  58. package/schematics/ng-update/v4/steps/migrate-number-format-settings.js +1 -1
  59. package/schematics/ng-update/v4/steps/migrate-root.js +28 -8
  60. package/schematics/ng-update/v4/steps/restore-tui-mapper.js +1 -1
  61. package/schematics/ng-update/v4/steps/restore-tui-matcher.js +1 -1
  62. package/schematics/ng-update/v4/steps/templates/migrate-avatar.js +4 -1
  63. package/schematics/ng-update/v4/steps/templates/migrate-overscroll.js +5 -1
  64. package/schematics/ng-update/v4/steps/templates/migrate-prevent-default.js +3 -3
  65. package/schematics/ng-update/v4/steps/templates/migrate-progress-segmented.js +2 -2
  66. package/schematics/ng-update/v4/steps/update-packages.d.ts +0 -1
  67. package/schematics/ng-update/v4/steps/update-packages.js +1 -6
  68. package/schematics/utils/add-unique-import.js +4 -3
  69. package/schematics/utils/get-component-from-identifier.js +1 -1
  70. package/schematics/utils/templates/get-component-templates.js +2 -2
  71. package/schematics/utils/templates/ng-component-input-manipulations.js +3 -3
  72. package/services/id.service.d.ts +1 -3
@@ -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
  }
@@ -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,12 +19,20 @@ 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, }) {
25
27
  const [rootComponentIdentifier, bootstrapOptions = bootstrapFunction.addArgument('{providers}: []'),] = bootstrapFunction.getArguments();
28
+ if (!rootComponentIdentifier) {
29
+ return;
30
+ }
26
31
  const mainClass = (0, get_component_from_identifier_1.getComponentFromIdentifier)(rootComponentIdentifier);
27
32
  const optionsObject = getOptionsObject(bootstrapOptions);
33
+ if (!optionsObject) {
34
+ return;
35
+ }
28
36
  if (mainClass) {
29
37
  addMainModuleToRootComponent({ mainClass, options, context });
30
38
  addRootTuiProvidersToBootstrapFn(optionsObject);
@@ -66,11 +74,12 @@ function getModules(extraModules) {
66
74
  return [...(extraModules || []), modules_1.MAIN_MODULE];
67
75
  }
68
76
  function getOptionsObject(options) {
77
+ var _a;
69
78
  if (ng_morph_1.Node.isObjectLiteralExpression(options)) {
70
79
  return options;
71
80
  }
72
81
  const definition = options.getDefinitionNodes()[0];
73
- return definition.getChildrenOfKind(ng_morph_1.SyntaxKind.ObjectLiteralExpression)[0];
82
+ return (_a = definition === null || definition === void 0 ? void 0 : definition.getChildrenOfKind(ng_morph_1.SyntaxKind.ObjectLiteralExpression)[0]) !== null && _a !== void 0 ? _a : null;
74
83
  }
75
84
  function addTaigaModules(options) {
76
85
  return (tree, context) => tslib_1.__awaiter(this, void 0, void 0, function* () {
@@ -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;
@@ -32,8 +32,13 @@ 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
- const component = (0, get_component_from_identifier_1.getComponentFromIdentifier)(componentIdentifier);
36
- return (component && getTemplatePathFromComponent(component)) || '';
35
+ if (componentIdentifier) {
36
+ const component = (0, get_component_from_identifier_1.getComponentFromIdentifier)(componentIdentifier);
37
+ if (component) {
38
+ return getTemplatePathFromComponent(component);
39
+ }
40
+ }
41
+ return '';
37
42
  }
38
43
  const mainModule = (0, ng_morph_1.getMainModule)(mainPath);
39
44
  if (!mainModule) {
@@ -16,11 +16,13 @@ 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 migrate_editor_1 = require("./steps/migrate-editor");
19
20
  const migrate_root_1 = require("./steps/migrate-root");
20
21
  const replace_modules_with_providers_1 = require("./steps/utils/replace-modules-with-providers");
21
22
  function main(options) {
22
23
  return (tree, context) => {
23
24
  const fileSystem = (0, get_file_system_1.getFileSystem)(tree);
25
+ (0, migrate_editor_1.migrateEditor)(fileSystem, options);
24
26
  (0, steps_1.replaceEnums)(options, enums_1.ENUMS_TO_REPLACE);
25
27
  (0, migrate_root_1.migrateRoot)(fileSystem, options);
26
28
  (0, replace_services_1.replaceServices)(options, constants_1.SERVICES_TO_REPLACE);
@@ -99,6 +99,10 @@ exports.DOC_SYMBOLS_TO_REPLACE = [
99
99
  name: 'TuiAddonDocModule',
100
100
  moduleSpecifier: '@taiga-ui/addon-doc',
101
101
  },
102
+ {
103
+ name: 'TuiDocExampleModule',
104
+ moduleSpecifier: '@taiga-ui/addon-doc',
105
+ },
102
106
  ],
103
107
  to: {
104
108
  name: 'TuiAddonDoc',
@@ -587,47 +587,6 @@ exports.IDENTIFIERS_TO_REPLACE = [
587
587
  moduleSpecifier: '@taiga-ui/kit',
588
588
  },
589
589
  },
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
590
  {
632
591
  from: { name: 'TuiFadeModule', moduleSpecifier: '@taiga-ui/experimental' },
633
592
  to: {
@@ -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;
@@ -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.getText()}, ','))`);
32
+ parent.replaceWithText(`Number.isNaN(maskitoParseNumber(${value === null || value === void 0 ? void 0 : 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.getText()}, ${decimalSeparator.getText()})`);
51
+ parent.replaceWithText(`maskitoParseNumber(${value === null || value === void 0 ? void 0 : value.getText()}, ${decimalSeparator === null || decimalSeparator === void 0 ? void 0 : 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(propertyValue.match(/^['"`]never['"`]$/)
11
+ property.replaceWithText((propertyValue === null || propertyValue === void 0 ? void 0 : propertyValue.match(/^['"`]never['"`]$/))
12
12
  ? 'precision: 0'
13
13
  : property.getText().replace('decimal', 'decimalMode'));
14
14
  },
@@ -38,25 +38,45 @@ function replaceRootIdentifier(ref, fileSystem) {
38
38
  .find((arg) => arg.getText() === ref.getText());
39
39
  if (node) {
40
40
  callExpression.removeArgument(node);
41
- addProviders(callExpression, fileSystem);
41
+ addProviders({ callExpression, fileSystem });
42
42
  }
43
43
  }
44
44
  else {
45
45
  ref.replaceWithText('TuiRoot');
46
+ addProviders({ fileSystem, modulePath: ref.getSourceFile().getFilePath() });
46
47
  }
47
48
  }
48
- function addProviders(callExpression, fileSystem) {
49
- const array = callExpression.getParentWhile(ng_morph_1.Node.isArrayLiteralExpression);
50
- if (!array) {
49
+ function addProviders({ callExpression, fileSystem, modulePath, }) {
50
+ var _a;
51
+ const providersArray = callExpression === null || callExpression === void 0 ? void 0 : callExpression.getParentWhile(ng_morph_1.Node.isArrayLiteralExpression);
52
+ const module = modulePath && ((_a = (0, ng_morph_1.getNgModules)(modulePath)) === null || _a === void 0 ? void 0 : _a[0]);
53
+ if (!providersArray && !modulePath) {
51
54
  return;
52
55
  }
53
- array.addElement('NG_EVENT_PLUGINS');
54
- (0, add_unique_import_1.addUniqueImport)(array.getSourceFile().getFilePath(), 'NG_EVENT_PLUGINS', '@taiga-ui/event-plugins');
56
+ const path = providersArray
57
+ ? providersArray.getSourceFile().getFilePath()
58
+ : modulePath || '';
59
+ if (providersArray) {
60
+ providersArray.addElement('NG_EVENT_PLUGINS');
61
+ }
62
+ else if (module) {
63
+ (0, ng_morph_1.addProviderToNgModule)(module, 'NG_EVENT_PLUGINS', { unique: true });
64
+ }
65
+ if (providersArray || module) {
66
+ (0, add_unique_import_1.addUniqueImport)(path, 'NG_EVENT_PLUGINS', '@taiga-ui/event-plugins');
67
+ }
55
68
  (0, ng_morph_1.getActiveProject)();
56
69
  const proprietary = (0, ng_morph_1.getPackageJsonDependency)(fileSystem.tree, '@taiga-ui/proprietary-core') ||
57
70
  (0, ng_morph_1.getPackageJsonDependency)(fileSystem.tree, '@taiga-ui/proprietary');
58
71
  if (proprietary) {
59
- array.addElement('TBANK_PROVIDERS');
60
- (0, add_unique_import_1.addUniqueImport)(array.getSourceFile().getFilePath(), 'TBANK_PROVIDERS', '@taiga-ui/proprietary');
72
+ if (providersArray) {
73
+ providersArray.addElement('TBANK_PROVIDERS');
74
+ }
75
+ else if (module) {
76
+ (0, ng_morph_1.addProviderToNgModule)(module, 'TBANK_PROVIDERS', { unique: true });
77
+ }
78
+ if (providersArray || module) {
79
+ (0, add_unique_import_1.addUniqueImport)(path, 'TBANK_PROVIDERS', '@taiga-ui/proprietary');
80
+ }
61
81
  }
62
82
  }
@@ -20,7 +20,7 @@ function updateTuiMapper(options) {
20
20
  return;
21
21
  }
22
22
  const [inputType] = typeArguments;
23
- inputType.replaceWithText(`[${inputType.getText()}, ...any]`);
23
+ inputType === null || inputType === void 0 ? void 0 : 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.replaceWithText(`[${inputType.getText()}, ...any]`);
23
+ inputType === null || inputType === void 0 ? void 0 : inputType.replaceWithText(`[${inputType.getText()}, ...any]`);
24
24
  }
25
25
  }
26
26
  }
@@ -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
- [...avatarElements, ...markerIconElements].forEach(({ attrs, sourceCodeLocation }) => {
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
- addTodo(recorder, elements[0].sourceCodeLocation, templateOffset);
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 = ((_b = sourceCodeLocation === null || sourceCodeLocation === void 0 ? void 0 : sourceCodeLocation.attrs) === null || _b === void 0 ? void 0 : _b[preventDefaultAttr.name].endOffset) || 0;
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
  }
@@ -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, {
@@ -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
- if (existingDeclaration.length) {
17
- const modules = existingDeclaration[0]
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)(existingDeclaration[0], () => ({
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;
@@ -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;