taiga-ui 2.75.0 → 2.76.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taiga-ui",
3
- "version": "2.75.0",
3
+ "version": "2.76.0",
4
4
  "description": "Taiga UI package that provides ng add command for Taiga library",
5
5
  "keywords": [
6
6
  "angular",
@@ -2,7 +2,7 @@ export interface ImportingModule {
2
2
  name: string;
3
3
  packageName: string;
4
4
  }
5
- export declare const MAIN_MODULES: ReadonlyArray<ImportingModule>;
6
- export declare const DIALOG_MODULES: ReadonlyArray<ImportingModule>;
7
- export declare const ALERT_MODULES: ReadonlyArray<ImportingModule>;
8
- export declare const SANITIZER_MODULES: ReadonlyArray<ImportingModule>;
5
+ export declare const MAIN_MODULES: readonly ImportingModule[];
6
+ export declare const DIALOG_MODULES: readonly ImportingModule[];
7
+ export declare const ALERT_MODULES: readonly ImportingModule[];
8
+ export declare const SANITIZER_MODULES: readonly ImportingModule[];
@@ -2,33 +2,33 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MAIN_MODULES = [
4
4
  {
5
- name: 'BrowserAnimationsModule',
6
- packageName: '@angular/platform-browser/animations',
5
+ name: `BrowserAnimationsModule`,
6
+ packageName: `@angular/platform-browser/animations`,
7
7
  },
8
8
  {
9
- name: 'TuiRootModule',
10
- packageName: '@taiga-ui/core',
9
+ name: `TuiRootModule`,
10
+ packageName: `@taiga-ui/core`,
11
11
  },
12
12
  ];
13
13
  exports.DIALOG_MODULES = [
14
14
  {
15
- name: 'TuiDialogModule',
16
- packageName: '@taiga-ui/core',
15
+ name: `TuiDialogModule`,
16
+ packageName: `@taiga-ui/core`,
17
17
  },
18
18
  ];
19
19
  exports.ALERT_MODULES = [
20
20
  {
21
- name: 'TuiAlertModule',
22
- packageName: '@taiga-ui/core',
21
+ name: `TuiAlertModule`,
22
+ packageName: `@taiga-ui/core`,
23
23
  },
24
24
  ];
25
25
  exports.SANITIZER_MODULES = [
26
26
  {
27
- name: 'TUI_SANITIZER',
28
- packageName: '@taiga-ui/core',
27
+ name: `TUI_SANITIZER`,
28
+ packageName: `@taiga-ui/core`,
29
29
  },
30
30
  {
31
- name: 'NgDompurifySanitizer',
32
- packageName: '@tinkoff/ng-dompurify',
31
+ name: `NgDompurifySanitizer`,
32
+ packageName: `@tinkoff/ng-dompurify`,
33
33
  },
34
34
  ];
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const package_json_1 = require("../../../package.json");
4
4
  exports.TAIGA_VERSION = `^${package_json_1.version}`;
5
- exports.NG_DOMPURIFY_VERSION = '3.0.0';
6
- exports.DOMPURIFY_VERSION = '2.2.9';
7
- exports.DOMPURIFY_TYPES_VERSION = '2.2.3';
5
+ exports.NG_DOMPURIFY_VERSION = `3.0.0`;
6
+ exports.DOMPURIFY_VERSION = `2.2.9`;
7
+ exports.DOMPURIFY_TYPES_VERSION = `2.2.3`;
@@ -4,13 +4,13 @@ const tslib_1 = require("tslib");
4
4
  const tasks_1 = require("@angular-devkit/schematics/tasks");
5
5
  const ng_morph_1 = require("ng-morph");
6
6
  const versions_1 = require("./constants/versions");
7
- const MAIN_PACKAGES = ['core', 'cdk', 'kit', 'icons'];
7
+ const MAIN_PACKAGES = [`core`, `cdk`, `kit`, `icons`];
8
8
  function ngAdd(options) {
9
9
  return (tree, context) => tslib_1.__awaiter(this, void 0, void 0, function* () {
10
10
  context.logger.info(`The main packages will be installed - ${MAIN_PACKAGES}`);
11
11
  addDependencies(tree, options);
12
12
  context.addTask(new tasks_1.NodePackageInstallTask(), [
13
- context.addTask(new tasks_1.RunSchematicTask('ng-add-setup-project', options)),
13
+ context.addTask(new tasks_1.RunSchematicTask(`ng-add-setup-project`, options)),
14
14
  ]);
15
15
  });
16
16
  }
@@ -23,36 +23,36 @@ function addDependencies(tree, options) {
23
23
  version: versions_1.TAIGA_VERSION,
24
24
  });
25
25
  });
26
- ng_morph_1.removePackageJsonDependency(tree, 'taiga-ui');
26
+ ng_morph_1.removePackageJsonDependency(tree, `taiga-ui`);
27
27
  if (options.addSanitizer) {
28
28
  ng_morph_1.addPackageJsonDependency(tree, {
29
- name: '@tinkoff/ng-dompurify',
29
+ name: `@tinkoff/ng-dompurify`,
30
30
  version: versions_1.NG_DOMPURIFY_VERSION,
31
31
  });
32
32
  ng_morph_1.addPackageJsonDependency(tree, {
33
- name: 'dompurify',
33
+ name: `dompurify`,
34
34
  version: versions_1.DOMPURIFY_VERSION,
35
35
  });
36
36
  ng_morph_1.addPackageJsonDependency(tree, {
37
- name: '@types/dompurify',
37
+ name: `@types/dompurify`,
38
38
  version: versions_1.DOMPURIFY_TYPES_VERSION,
39
39
  type: ng_morph_1.NodeDependencyType.Dev,
40
40
  });
41
41
  }
42
- if (packages.includes('addon-table') || packages.includes('addon-mobile')) {
42
+ if (packages.includes(`addon-table`) || packages.includes(`addon-mobile`)) {
43
43
  addAngularCdkDep(tree);
44
44
  }
45
45
  }
46
46
  function addAngularCdkDep(tree) {
47
47
  var _a;
48
- const angularCore = (_a = ng_morph_1.getPackageJsonDependency(tree, '@angular/core')) === null || _a === void 0 ? void 0 : _a.version;
48
+ const angularCore = (_a = ng_morph_1.getPackageJsonDependency(tree, `@angular/core`)) === null || _a === void 0 ? void 0 : _a.version;
49
49
  if (!angularCore) {
50
50
  return;
51
51
  }
52
52
  const majorVersionArr = angularCore.match(/[0-9]+/);
53
53
  if (majorVersionArr) {
54
54
  ng_morph_1.addPackageJsonDependency(tree, {
55
- name: '@angular/cdk',
55
+ name: `@angular/cdk`,
56
56
  version: `^${majorVersionArr[0]}.0.0`,
57
57
  });
58
58
  }
@@ -1,6 +1,6 @@
1
1
  export interface Schema {
2
2
  readonly project: string;
3
- readonly addons: ReadonlyArray<string>;
3
+ readonly addons: readonly string[];
4
4
  readonly addAlertModule: boolean;
5
5
  readonly addDialogsModule: boolean;
6
6
  readonly addSanitizer: boolean;
@@ -5,9 +5,9 @@ const workspace_1 = require("@schematics/angular/utility/workspace");
5
5
  const get_project_1 = require("../../utils/get-project");
6
6
  const get_project_target_options_1 = require("../../utils/get-project-target-options");
7
7
  const ICON_ASSETS = {
8
- glob: '**/*',
9
- input: 'node_modules/@taiga-ui/icons/src',
10
- output: 'assets/taiga-ui/icons',
8
+ glob: `**/*`,
9
+ input: `node_modules/@taiga-ui/icons/src`,
10
+ output: `assets/taiga-ui/icons`,
11
11
  };
12
12
  function addTaigaIcons(options) {
13
13
  return (_) => tslib_1.__awaiter(this, void 0, void 0, function* () {
@@ -18,7 +18,7 @@ exports.addTaigaIcons = addTaigaIcons;
18
18
  function addTaigaStylesToAngularJson(options) {
19
19
  return workspace_1.updateWorkspace(workspace => {
20
20
  const project = get_project_1.getProject(options, workspace);
21
- const targetOptions = get_project_target_options_1.getProjectTargetOptions(project, 'build');
21
+ const targetOptions = get_project_target_options_1.getProjectTargetOptions(project, `build`);
22
22
  const assets = targetOptions.assets;
23
23
  targetOptions.assets = assets ? [...assets, ICON_ASSETS] : [ICON_ASSETS];
24
24
  });
@@ -10,8 +10,8 @@ function addTaigaModules(options) {
10
10
  return (tree, context) => tslib_1.__awaiter(this, void 0, void 0, function* () {
11
11
  const workspace = yield workspace_1.getWorkspace(tree);
12
12
  const project = get_project_1.getProject(options, workspace);
13
- const buildOptions = get_project_target_options_1.getProjectTargetOptions(project, 'build');
14
- ng_morph_1.setActiveProject(ng_morph_1.createProject(tree, '/', ['**/*.ts', '**/*.json']));
13
+ const buildOptions = get_project_target_options_1.getProjectTargetOptions(project, `build`);
14
+ ng_morph_1.setActiveProject(ng_morph_1.createProject(tree, `/`, [`**/*.ts`, `**/*.json`]));
15
15
  const mainModule = ng_morph_1.getMainModule(buildOptions.main);
16
16
  addTuiModules(mainModule, options, context);
17
17
  addTuiProviders(mainModule, options);
@@ -36,7 +36,7 @@ function addTuiProviders(mainModule, options) {
36
36
  if (!options.addSanitizer) {
37
37
  return;
38
38
  }
39
- ng_morph_1.addProviderToNgModule(mainModule, '{provide: TUI_SANITIZER, useClass: NgDompurifySanitizer}', { unique: true });
39
+ ng_morph_1.addProviderToNgModule(mainModule, `{provide: TUI_SANITIZER, useClass: NgDompurifySanitizer}`, { unique: true });
40
40
  modules_1.SANITIZER_MODULES.forEach(module => {
41
41
  addUniqueImport(mainModule.getSourceFile().getFilePath(), module.name, module.packageName);
42
42
  });
@@ -4,8 +4,8 @@ const tslib_1 = require("tslib");
4
4
  const workspace_1 = require("@schematics/angular/utility/workspace");
5
5
  const get_project_1 = require("../../utils/get-project");
6
6
  const get_project_target_options_1 = require("../../utils/get-project-target-options");
7
- const TAIGA_GLOBAL_STYLE = 'node_modules/@taiga-ui/core/styles/taiga-ui-global.less';
8
- const TAIGA_THEME_STYLE = 'node_modules/@taiga-ui/core/styles/taiga-ui-theme.less';
7
+ const TAIGA_GLOBAL_STYLE = `node_modules/@taiga-ui/core/styles/taiga-ui-global.less`;
8
+ const TAIGA_THEME_STYLE = `node_modules/@taiga-ui/core/styles/taiga-ui-theme.less`;
9
9
  function addTaigaStyles(options) {
10
10
  return (_) => tslib_1.__awaiter(this, void 0, void 0, function* () {
11
11
  return addTaigaStylesToAngularJson(options);
@@ -15,7 +15,7 @@ exports.addTaigaStyles = addTaigaStyles;
15
15
  function addTaigaStylesToAngularJson(options) {
16
16
  return workspace_1.updateWorkspace(workspace => {
17
17
  const project = get_project_1.getProject(options, workspace);
18
- const targetOptions = get_project_target_options_1.getProjectTargetOptions(project, 'build');
18
+ const targetOptions = get_project_target_options_1.getProjectTargetOptions(project, `build`);
19
19
  const styles = targetOptions.styles;
20
20
  const taigaStyles = [TAIGA_GLOBAL_STYLE, TAIGA_THEME_STYLE];
21
21
  targetOptions.styles = styles
@@ -9,12 +9,12 @@ function wrapWithTuiRootComponent(options) {
9
9
  return (tree, context) => tslib_1.__awaiter(this, void 0, void 0, function* () {
10
10
  const workspace = yield workspace_1.getWorkspace(tree);
11
11
  const project = get_project_1.getProject(options, workspace);
12
- const buildOptions = get_project_target_options_1.getProjectTargetOptions(project, 'build');
12
+ const buildOptions = get_project_target_options_1.getProjectTargetOptions(project, `build`);
13
13
  const appTemplatePath = getAppTemplatePath(tree, buildOptions.main);
14
14
  if (!appTemplatePath) {
15
- context.logger.error('Could not find the default main template file for this project.');
16
- context.logger.info('Consider manually wrapping content of your app with tui-root');
17
- context.logger.info('More information at https://taiga-ui.dev/getting-started');
15
+ context.logger.error(`Could not find the default main template file for this project.`);
16
+ context.logger.info(`Consider manually wrapping content of your app with tui-root`);
17
+ context.logger.info(`More information at https://taiga-ui.dev/getting-started`);
18
18
  return;
19
19
  }
20
20
  addTuiRootComponent(appTemplatePath, context, tree);
@@ -25,12 +25,12 @@ function addTuiRootComponent(filePath, context, tree) {
25
25
  const buffer = tree.read(filePath);
26
26
  if (!buffer) {
27
27
  context.logger.error(`Could not read the default template file within the project ${filePath}`);
28
- context.logger.info('Consider manually wrapping content of your app with tui-root');
28
+ context.logger.info(`Consider manually wrapping content of your app with tui-root`);
29
29
  return;
30
30
  }
31
31
  const htmlContent = buffer.toString();
32
- const openTag = '<tui-root>' + '\n';
33
- const closeTag = '\n' + '</tui-root>';
32
+ const openTag = `<tui-root>` + `\n`;
33
+ const closeTag = `\n` + `</tui-root>`;
34
34
  if (htmlContent.includes(openTag)) {
35
35
  return;
36
36
  }
@@ -41,19 +41,19 @@ function addTuiRootComponent(filePath, context, tree) {
41
41
  context.logger.info(`Content of the app was wrapped with tui-root component in ${filePath}`);
42
42
  }
43
43
  function getAppTemplatePath(tree, mainPath) {
44
- ng_morph_1.setActiveProject(ng_morph_1.createProject(tree, '/', ['**/*.ts', '**/*.json']));
44
+ ng_morph_1.setActiveProject(ng_morph_1.createProject(tree, `/`, [`**/*.ts`, `**/*.json`]));
45
45
  const mainModule = ng_morph_1.getMainModule(mainPath);
46
- const mainInitializer = getInitializer(mainModule, 'NgModule', 'declarations');
46
+ const mainInitializer = getInitializer(mainModule, `NgModule`, `declarations`);
47
47
  if (!ng_morph_1.Node.isArrayLiteralExpression(mainInitializer)) {
48
48
  return;
49
49
  }
50
50
  const appIdentifier = mainInitializer.getElements()[0];
51
51
  const appComponent = appIdentifier.getDefinitionNodes()[0];
52
- const templateInitializer = getInitializer(appComponent, 'Component', 'templateUrl');
53
- const appComponentPath = appComponent.getSourceFile().getFilePath().split('/');
52
+ const templateInitializer = getInitializer(appComponent, `Component`, `templateUrl`);
53
+ const appComponentPath = appComponent.getSourceFile().getFilePath().split(`/`);
54
54
  const templateUrlPath = `${appComponentPath
55
55
  .splice(0, appComponentPath.length - 1)
56
- .join('/')}/${templateInitializer === null || templateInitializer === void 0 ? void 0 : templateInitializer.getText().replace(/['"]/g, '')}`;
56
+ .join(`/`)}/${templateInitializer === null || templateInitializer === void 0 ? void 0 : templateInitializer.getText().replace(/['"]/g, ``)}`;
57
57
  ng_morph_1.saveActiveProject();
58
58
  return templateUrlPath;
59
59
  }
@@ -1,2 +1,2 @@
1
1
  import { JsonArray, JsonObject, workspaces } from '@angular-devkit/core';
2
- export declare function getProjectTargetOptions(project: workspaces.ProjectDefinition, buildTarget: string): Record<string, string | number | boolean | JsonArray | JsonObject | undefined | null>;
2
+ export declare function getProjectTargetOptions(project: workspaces.ProjectDefinition, buildTarget: string): Record<string, JsonArray | JsonObject | boolean | number | string | null | undefined>;
@@ -4,7 +4,7 @@ const schematics_1 = require("@angular-devkit/schematics");
4
4
  function getProjectTargetOptions(project, buildTarget) {
5
5
  var _a;
6
6
  const buildTargetObject = (_a = project.targets) === null || _a === void 0 ? void 0 : _a.get(buildTarget);
7
- if (buildTargetObject && buildTargetObject.options) {
7
+ if (buildTargetObject === null || buildTargetObject === void 0 ? void 0 : buildTargetObject.options) {
8
8
  return buildTargetObject.options;
9
9
  }
10
10
  throw new schematics_1.SchematicsException(`Cannot determine project target configuration for: ${buildTarget}.`);
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const schematics_1 = require("@angular-devkit/schematics");
4
4
  function getProject(options, workspace) {
5
5
  var _a;
6
- const projectName = options.project || ((_a = workspace.extensions.defaultProject) === null || _a === void 0 ? void 0 : _a.toString()) || '';
6
+ const projectName = options.project || ((_a = workspace.extensions.defaultProject) === null || _a === void 0 ? void 0 : _a.toString()) || ``;
7
7
  const project = workspace.projects.get(projectName);
8
8
  if (!project) {
9
9
  throw new schematics_1.SchematicsException(`Unable to find project '${projectName}' in the workspace`);