@taiga-ui/cdk 2.38.0 → 2.41.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.
Files changed (204) hide show
  1. package/abstract/dialog.service.d.ts +3 -3
  2. package/abstract/multiple-control.d.ts +2 -2
  3. package/abstract/taiga-ui-cdk-abstract.metadata.json +1 -1
  4. package/bundles/taiga-ui-cdk-abstract.umd.js.map +1 -1
  5. package/bundles/taiga-ui-cdk-abstract.umd.min.js.map +1 -1
  6. package/bundles/taiga-ui-cdk-components-alert-host.umd.js +281 -0
  7. package/bundles/taiga-ui-cdk-components-alert-host.umd.js.map +1 -0
  8. package/bundles/taiga-ui-cdk-components-alert-host.umd.min.js +16 -0
  9. package/bundles/taiga-ui-cdk-components-alert-host.umd.min.js.map +1 -0
  10. package/bundles/taiga-ui-cdk-components-dialog-host.umd.js +6 -10
  11. package/bundles/taiga-ui-cdk-components-dialog-host.umd.js.map +1 -1
  12. package/bundles/taiga-ui-cdk-components-dialog-host.umd.min.js +2 -2
  13. package/bundles/taiga-ui-cdk-components-dialog-host.umd.min.js.map +1 -1
  14. package/bundles/taiga-ui-cdk-components-dropdown-host.umd.js +1 -1
  15. package/bundles/taiga-ui-cdk-components-dropdown-host.umd.js.map +1 -1
  16. package/bundles/taiga-ui-cdk-components-dropdown-host.umd.min.js +1 -1
  17. package/bundles/taiga-ui-cdk-components-dropdown-host.umd.min.js.map +1 -1
  18. package/bundles/taiga-ui-cdk-components.umd.js +12 -4
  19. package/bundles/taiga-ui-cdk-components.umd.js.map +1 -1
  20. package/bundles/taiga-ui-cdk-components.umd.min.js +1 -1
  21. package/bundles/taiga-ui-cdk-constants.umd.js +1 -5
  22. package/bundles/taiga-ui-cdk-constants.umd.js.map +1 -1
  23. package/bundles/taiga-ui-cdk-constants.umd.min.js +1 -1
  24. package/bundles/taiga-ui-cdk-constants.umd.min.js.map +1 -1
  25. package/bundles/taiga-ui-cdk-directives-active-zone.umd.js.map +1 -1
  26. package/bundles/taiga-ui-cdk-directives-active-zone.umd.min.js.map +1 -1
  27. package/bundles/taiga-ui-cdk-directives-resize.umd.js.map +1 -1
  28. package/bundles/taiga-ui-cdk-directives-resize.umd.min.js.map +1 -1
  29. package/bundles/taiga-ui-cdk-observables.umd.js.map +1 -1
  30. package/bundles/taiga-ui-cdk-observables.umd.min.js.map +1 -1
  31. package/bundles/taiga-ui-cdk-services.umd.js.map +1 -1
  32. package/bundles/taiga-ui-cdk-services.umd.min.js.map +1 -1
  33. package/bundles/taiga-ui-cdk-tokens.umd.js +8 -1
  34. package/bundles/taiga-ui-cdk-tokens.umd.js.map +1 -1
  35. package/bundles/taiga-ui-cdk-tokens.umd.min.js +1 -1
  36. package/bundles/taiga-ui-cdk-tokens.umd.min.js.map +1 -1
  37. package/bundles/taiga-ui-cdk-utils-dom.umd.js.map +1 -1
  38. package/bundles/taiga-ui-cdk-utils-dom.umd.min.js.map +1 -1
  39. package/bundles/taiga-ui-cdk-utils-focus.umd.js.map +1 -1
  40. package/bundles/taiga-ui-cdk-utils-focus.umd.min.js.map +1 -1
  41. package/bundles/taiga-ui-cdk-utils-miscellaneous.umd.js.map +1 -1
  42. package/bundles/taiga-ui-cdk-utils-miscellaneous.umd.min.js.map +1 -1
  43. package/components/alert-host/alert-host.component.d.ts +9 -0
  44. package/components/alert-host/alert-host.module.d.ts +2 -0
  45. package/components/alert-host/index.d.ts +2 -0
  46. package/components/alert-host/package.json +13 -0
  47. package/components/alert-host/taiga-ui-cdk-components-alert-host.d.ts +4 -0
  48. package/components/alert-host/taiga-ui-cdk-components-alert-host.metadata.json +1 -0
  49. package/components/dialog-host/taiga-ui-cdk-components-dialog-host.metadata.json +1 -1
  50. package/components/dropdown-host/taiga-ui-cdk-components-dropdown-host.metadata.json +1 -1
  51. package/components/index.d.ts +1 -0
  52. package/components/taiga-ui-cdk-components.metadata.json +1 -1
  53. package/constants/taiga-ui-cdk-constants.metadata.json +1 -1
  54. package/directives/resize/resize.directive.d.ts +2 -2
  55. package/directives/resize/taiga-ui-cdk-directives-resize.metadata.json +1 -1
  56. package/esm2015/abstract/dialog.service.js +1 -1
  57. package/esm2015/abstract/multiple-control.js +1 -1
  58. package/esm2015/components/alert-host/alert-host.component.js +38 -0
  59. package/esm2015/components/alert-host/alert-host.module.js +16 -0
  60. package/esm2015/components/alert-host/index.js +3 -0
  61. package/esm2015/components/alert-host/taiga-ui-cdk-components-alert-host.js +5 -0
  62. package/esm2015/components/dialog-host/dialog-host.component.js +5 -10
  63. package/esm2015/components/dropdown-host/dropdown-host.component.js +2 -2
  64. package/esm2015/components/index.js +2 -1
  65. package/esm2015/constants/parent-animation.js +2 -6
  66. package/esm2015/directives/active-zone/active-zone.directive.js +1 -1
  67. package/esm2015/directives/resize/resize.directive.js +1 -1
  68. package/esm2015/interfaces/aria-dialog-context.js +1 -1
  69. package/esm2015/observables/items-query-list-observable.js +1 -1
  70. package/esm2015/services/obscured.service.js +1 -1
  71. package/esm2015/services/parents-scroll.service.js +1 -1
  72. package/esm2015/tokens/alerts.js +5 -0
  73. package/esm2015/tokens/dialogs.js +4 -2
  74. package/esm2015/tokens/index.js +2 -1
  75. package/esm2015/utils/dom/get-element-obscurers.js +1 -1
  76. package/esm2015/utils/focus/move-focus.js +1 -1
  77. package/esm2015/utils/miscellaneous/flat-length.js +1 -1
  78. package/esm2015/utils/miscellaneous/get-original-array-from-query-list.js +1 -1
  79. package/esm2015/utils/miscellaneous/uniq-by.js +1 -1
  80. package/esm5/abstract/dialog.service.js +1 -1
  81. package/esm5/abstract/multiple-control.js +1 -1
  82. package/esm5/components/alert-host/alert-host.component.js +42 -0
  83. package/esm5/components/alert-host/alert-host.module.js +19 -0
  84. package/esm5/components/alert-host/index.js +3 -0
  85. package/esm5/components/alert-host/taiga-ui-cdk-components-alert-host.js +5 -0
  86. package/esm5/components/dialog-host/dialog-host.component.js +5 -10
  87. package/esm5/components/dropdown-host/dropdown-host.component.js +2 -2
  88. package/esm5/components/index.js +2 -1
  89. package/esm5/constants/parent-animation.js +2 -6
  90. package/esm5/directives/active-zone/active-zone.directive.js +1 -1
  91. package/esm5/directives/resize/resize.directive.js +1 -1
  92. package/esm5/interfaces/aria-dialog-context.js +1 -1
  93. package/esm5/observables/items-query-list-observable.js +1 -1
  94. package/esm5/services/obscured.service.js +1 -1
  95. package/esm5/services/parents-scroll.service.js +1 -1
  96. package/esm5/tokens/alerts.js +5 -0
  97. package/esm5/tokens/dialogs.js +4 -2
  98. package/esm5/tokens/index.js +2 -1
  99. package/esm5/utils/dom/get-element-obscurers.js +1 -1
  100. package/esm5/utils/focus/move-focus.js +1 -1
  101. package/esm5/utils/miscellaneous/flat-length.js +1 -1
  102. package/esm5/utils/miscellaneous/get-original-array-from-query-list.js +1 -1
  103. package/esm5/utils/miscellaneous/uniq-by.js +1 -1
  104. package/fesm2015/taiga-ui-cdk-abstract.js.map +1 -1
  105. package/fesm2015/taiga-ui-cdk-components-alert-host.js +56 -0
  106. package/fesm2015/taiga-ui-cdk-components-alert-host.js.map +1 -0
  107. package/fesm2015/taiga-ui-cdk-components-dialog-host.js +4 -9
  108. package/fesm2015/taiga-ui-cdk-components-dialog-host.js.map +1 -1
  109. package/fesm2015/taiga-ui-cdk-components-dropdown-host.js +1 -1
  110. package/fesm2015/taiga-ui-cdk-components-dropdown-host.js.map +1 -1
  111. package/fesm2015/taiga-ui-cdk-components.js +1 -0
  112. package/fesm2015/taiga-ui-cdk-components.js.map +1 -1
  113. package/fesm2015/taiga-ui-cdk-constants.js +1 -5
  114. package/fesm2015/taiga-ui-cdk-constants.js.map +1 -1
  115. package/fesm2015/taiga-ui-cdk-directives-active-zone.js.map +1 -1
  116. package/fesm2015/taiga-ui-cdk-directives-resize.js.map +1 -1
  117. package/fesm2015/taiga-ui-cdk-observables.js.map +1 -1
  118. package/fesm2015/taiga-ui-cdk-services.js.map +1 -1
  119. package/fesm2015/taiga-ui-cdk-tokens.js +8 -2
  120. package/fesm2015/taiga-ui-cdk-tokens.js.map +1 -1
  121. package/fesm2015/taiga-ui-cdk-utils-dom.js.map +1 -1
  122. package/fesm2015/taiga-ui-cdk-utils-focus.js.map +1 -1
  123. package/fesm2015/taiga-ui-cdk-utils-miscellaneous.js.map +1 -1
  124. package/fesm5/taiga-ui-cdk-abstract.js.map +1 -1
  125. package/fesm5/taiga-ui-cdk-components-alert-host.js +63 -0
  126. package/fesm5/taiga-ui-cdk-components-alert-host.js.map +1 -0
  127. package/fesm5/taiga-ui-cdk-components-dialog-host.js +4 -9
  128. package/fesm5/taiga-ui-cdk-components-dialog-host.js.map +1 -1
  129. package/fesm5/taiga-ui-cdk-components-dropdown-host.js +1 -1
  130. package/fesm5/taiga-ui-cdk-components-dropdown-host.js.map +1 -1
  131. package/fesm5/taiga-ui-cdk-components.js +1 -0
  132. package/fesm5/taiga-ui-cdk-components.js.map +1 -1
  133. package/fesm5/taiga-ui-cdk-constants.js +1 -5
  134. package/fesm5/taiga-ui-cdk-constants.js.map +1 -1
  135. package/fesm5/taiga-ui-cdk-directives-active-zone.js.map +1 -1
  136. package/fesm5/taiga-ui-cdk-directives-resize.js.map +1 -1
  137. package/fesm5/taiga-ui-cdk-observables.js.map +1 -1
  138. package/fesm5/taiga-ui-cdk-services.js.map +1 -1
  139. package/fesm5/taiga-ui-cdk-tokens.js +8 -2
  140. package/fesm5/taiga-ui-cdk-tokens.js.map +1 -1
  141. package/fesm5/taiga-ui-cdk-utils-dom.js.map +1 -1
  142. package/fesm5/taiga-ui-cdk-utils-focus.js.map +1 -1
  143. package/fesm5/taiga-ui-cdk-utils-miscellaneous.js.map +1 -1
  144. package/interfaces/aria-dialog-context.d.ts +2 -2
  145. package/observables/items-query-list-observable.d.ts +1 -1
  146. package/package.json +20 -1
  147. package/schematics/collection.json +16 -0
  148. package/schematics/migration.json +10 -0
  149. package/schematics/ng-add/constants/modules.d.ts +8 -0
  150. package/schematics/ng-add/constants/modules.js +34 -0
  151. package/schematics/ng-add/constants/packages.d.ts +1 -0
  152. package/schematics/ng-add/constants/packages.js +3 -0
  153. package/schematics/ng-add/constants/versions.d.ts +4 -0
  154. package/schematics/ng-add/constants/versions.js +7 -0
  155. package/schematics/ng-add/index.d.ts +3 -0
  156. package/schematics/ng-add/index.js +66 -0
  157. package/schematics/ng-add/schema.d.ts +7 -0
  158. package/schematics/ng-add/schema.js +2 -0
  159. package/schematics/ng-add/schema.json +86 -0
  160. package/schematics/ng-add/setup-project.d.ts +3 -0
  161. package/schematics/ng-add/setup-project.js +16 -0
  162. package/schematics/ng-add/steps/add-taiga-icons.d.ts +5 -0
  163. package/schematics/ng-add/steps/add-taiga-icons.js +40 -0
  164. package/schematics/ng-add/steps/add-taiga-modules.d.ts +3 -0
  165. package/schematics/ng-add/steps/add-taiga-modules.js +52 -0
  166. package/schematics/ng-add/steps/add-taiga-styles.d.ts +5 -0
  167. package/schematics/ng-add/steps/add-taiga-styles.js +38 -0
  168. package/schematics/ng-add/steps/wrap-with-tui-root.d.ts +3 -0
  169. package/schematics/ng-add/steps/wrap-with-tui-root.js +82 -0
  170. package/schematics/ng-update/constants/consts.d.ts +12 -0
  171. package/schematics/ng-update/constants/consts.js +45 -0
  172. package/schematics/ng-update/constants/enums.d.ts +7 -0
  173. package/schematics/ng-update/constants/enums.js +174 -0
  174. package/schematics/ng-update/constants/types.d.ts +7 -0
  175. package/schematics/ng-update/constants/types.js +14 -0
  176. package/schematics/ng-update/index.d.ts +3 -0
  177. package/schematics/ng-update/index.js +29 -0
  178. package/schematics/ng-update/steps/rename-types.d.ts +1 -0
  179. package/schematics/ng-update/steps/rename-types.js +27 -0
  180. package/schematics/ng-update/steps/replace-const.d.ts +3 -0
  181. package/schematics/ng-update/steps/replace-const.js +25 -0
  182. package/schematics/ng-update/steps/replace-deep-import.d.ts +1 -0
  183. package/schematics/ng-update/steps/replace-deep-import.js +12 -0
  184. package/schematics/ng-update/steps/replace-enums.d.ts +1 -0
  185. package/schematics/ng-update/steps/replace-enums.js +40 -0
  186. package/schematics/utils/add-unique-import.d.ts +1 -0
  187. package/schematics/utils/add-unique-import.js +29 -0
  188. package/schematics/utils/get-named-import-references.d.ts +2 -0
  189. package/schematics/utils/get-named-import-references.js +14 -0
  190. package/schematics/utils/get-project-target-options.d.ts +2 -0
  191. package/schematics/utils/get-project-target-options.js +12 -0
  192. package/schematics/utils/get-project.d.ts +3 -0
  193. package/schematics/utils/get-project.js +12 -0
  194. package/schematics/utils/remove-import.d.ts +2 -0
  195. package/schematics/utils/remove-import.js +11 -0
  196. package/services/obscured.service.d.ts +1 -1
  197. package/tokens/alerts.d.ts +4 -0
  198. package/tokens/index.d.ts +1 -0
  199. package/tokens/taiga-ui-cdk-tokens.metadata.json +1 -1
  200. package/utils/dom/get-element-obscurers.d.ts +1 -1
  201. package/utils/focus/move-focus.d.ts +1 -1
  202. package/utils/miscellaneous/flat-length.d.ts +1 -1
  203. package/utils/miscellaneous/get-original-array-from-query-list.d.ts +1 -1
  204. package/utils/miscellaneous/uniq-by.d.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taiga-ui/cdk",
3
- "version": "2.38.0",
3
+ "version": "2.41.0",
4
4
  "description": "Base library for creating Angular components and applications using Taiga UI principles regarding of actual visual appearance",
5
5
  "keywords": [
6
6
  "angular",
@@ -30,6 +30,25 @@
30
30
  "@angular/forms": ">=9.0.0",
31
31
  "rxjs": ">=6.0.0"
32
32
  },
33
+ "schematics": "./schematics/collection.json",
34
+ "ng-update": {
35
+ "migrations": "./schematics/migration.json",
36
+ "packageGroup": [
37
+ "@taiga-ui/i18n",
38
+ "@taiga-ui/cdk",
39
+ "@taiga-ui/core",
40
+ "@taiga-ui/kit",
41
+ "@taiga-ui/addon-doc",
42
+ "@taiga-ui/addon-charts",
43
+ "@taiga-ui/addon-commerce",
44
+ "@taiga-ui/icons",
45
+ "@taiga-ui/addon-preview",
46
+ "@taiga-ui/addon-tablebars",
47
+ "@taiga-ui/addon-table",
48
+ "@taiga-ui/addon-editor",
49
+ "@taiga-ui/addon-mobile"
50
+ ]
51
+ },
33
52
  "main": "bundles/taiga-ui-cdk.umd.js",
34
53
  "module": "fesm5/taiga-ui-cdk.js",
35
54
  "es2015": "fesm2015/taiga-ui-cdk.js",
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
3
+ "schematics": {
4
+ "ng-add": {
5
+ "description": "Add Taiga UI to the project.",
6
+ "factory": "./ng-add/index#ngAdd",
7
+ "schema": "./ng-add/schema.json"
8
+ },
9
+ "ng-add-setup-project": {
10
+ "private": true,
11
+ "description": "Sets up the project after dependencies have been installed",
12
+ "factory": "./ng-add/setup-project",
13
+ "schema": "./ng-add/schema.json"
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "../../../node_modules/@angular-devkit/schematics/collection-schema.json",
3
+ "schematics": {
4
+ "updateToV3": {
5
+ "description": "Updates Taiga UI packages to v3",
6
+ "version": "3.0.0",
7
+ "factory": "./ng-update/index#updateToV3"
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,8 @@
1
+ export interface ImportingModule {
2
+ name: string;
3
+ packageName: string;
4
+ }
5
+ export declare const MAIN_MODULES: ReadonlyArray<ImportingModule>;
6
+ export declare const DIALOG_MODULES: ReadonlyArray<ImportingModule>;
7
+ export declare const NOTIFICATION_MODULES: ReadonlyArray<ImportingModule>;
8
+ export declare const SANITIZER_MODULES: ReadonlyArray<ImportingModule>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MAIN_MODULES = [
4
+ {
5
+ name: 'TuiRootModule',
6
+ packageName: '@taiga-ui/core',
7
+ },
8
+ {
9
+ name: 'BrowserAnimationsModule',
10
+ packageName: '@angular/platform-browser/animations',
11
+ },
12
+ ];
13
+ exports.DIALOG_MODULES = [
14
+ {
15
+ name: 'TuiDialogModule',
16
+ packageName: '@taiga-ui/core',
17
+ },
18
+ ];
19
+ exports.NOTIFICATION_MODULES = [
20
+ {
21
+ name: 'TuiNotificationsModule',
22
+ packageName: '@taiga-ui/core',
23
+ },
24
+ ];
25
+ exports.SANITIZER_MODULES = [
26
+ {
27
+ name: 'TUI_SANITIZER',
28
+ packageName: '@taiga-ui/core',
29
+ },
30
+ {
31
+ name: 'NgDompurifySanitizer',
32
+ packageName: '@tinkoff/ng-dompurify',
33
+ },
34
+ ];
@@ -0,0 +1 @@
1
+ export declare const MAIN_PACKAGES: string[];
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MAIN_PACKAGES = ['core', 'cdk', 'kit', 'icons'];
@@ -0,0 +1,4 @@
1
+ export declare const TAIGA_VERSION: string;
2
+ export declare const NG_DOMPURIFY_VERSION = "3.0.0";
3
+ export declare const DOMPURIFY_VERSION = "2.2.9";
4
+ export declare const DOMPURIFY_TYPES_VERSION = "2.2.3";
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const { version } = require('../../../package.json');
4
+ exports.TAIGA_VERSION = `^${version}`;
5
+ exports.NG_DOMPURIFY_VERSION = '3.0.0';
6
+ exports.DOMPURIFY_VERSION = '2.2.9';
7
+ exports.DOMPURIFY_TYPES_VERSION = '2.2.3';
@@ -0,0 +1,3 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import { Schema } from './schema';
3
+ export declare function ngAdd(options: Schema): Rule;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const tasks_1 = require("@angular-devkit/schematics/tasks");
13
+ const ng_morph_1 = require("ng-morph");
14
+ const packages_1 = require("./constants/packages");
15
+ const versions_1 = require("./constants/versions");
16
+ function ngAdd(options) {
17
+ return (tree, context) => __awaiter(this, void 0, void 0, function* () {
18
+ context.logger.info(`The main packages will be installed - ${packages_1.MAIN_PACKAGES}`);
19
+ addDependencies(tree, options);
20
+ context.addTask(new tasks_1.NodePackageInstallTask(), [
21
+ context.addTask(new tasks_1.RunSchematicTask('ng-add-setup-project', options)),
22
+ ]);
23
+ });
24
+ }
25
+ exports.ngAdd = ngAdd;
26
+ function addDependencies(tree, options) {
27
+ const packages = [...packages_1.MAIN_PACKAGES, ...options.addons];
28
+ packages.forEach(pack => {
29
+ ng_morph_1.addPackageJsonDependency(tree, {
30
+ name: `@taiga-ui/${pack}`,
31
+ version: versions_1.TAIGA_VERSION,
32
+ });
33
+ });
34
+ if (options.addSanitizer) {
35
+ ng_morph_1.addPackageJsonDependency(tree, {
36
+ name: '@tinkoff/ng-dompurify',
37
+ version: versions_1.NG_DOMPURIFY_VERSION,
38
+ });
39
+ ng_morph_1.addPackageJsonDependency(tree, {
40
+ name: 'dompurify',
41
+ version: versions_1.DOMPURIFY_VERSION,
42
+ });
43
+ ng_morph_1.addPackageJsonDependency(tree, {
44
+ name: '@types/dompurify',
45
+ version: versions_1.DOMPURIFY_TYPES_VERSION,
46
+ type: ng_morph_1.NodeDependencyType.Dev,
47
+ });
48
+ }
49
+ if (packages.includes('addon-table') || packages.includes('addon-mobile')) {
50
+ addAngularCdkDep(tree);
51
+ }
52
+ }
53
+ function addAngularCdkDep(tree) {
54
+ var _a;
55
+ const angularCore = (_a = ng_morph_1.getPackageJsonDependency(tree, '@angular/core')) === null || _a === void 0 ? void 0 : _a.version;
56
+ if (!angularCore) {
57
+ return;
58
+ }
59
+ const majorVersionArr = angularCore.match(/[0-9]+/);
60
+ if (majorVersionArr) {
61
+ ng_morph_1.addPackageJsonDependency(tree, {
62
+ name: '@angular/cdk',
63
+ version: `^${majorVersionArr[0]}.0.0`,
64
+ });
65
+ }
66
+ }
@@ -0,0 +1,7 @@
1
+ export interface Schema {
2
+ readonly project: string;
3
+ readonly addons: ReadonlyArray<string>;
4
+ readonly addNotificationsModule: boolean;
5
+ readonly addDialogsModule: boolean;
6
+ readonly addSanitizer: boolean;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,86 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "taiga-ui-ng-add",
4
+ "title": "Taiga UI ng-add",
5
+ "type": "object",
6
+ "properties": {
7
+ "project": {
8
+ "type": "string",
9
+ "description": "The name of the project.",
10
+ "$default": {
11
+ "$source": "projectName"
12
+ }
13
+ },
14
+ "addDialogsModule": {
15
+ "description": "Setting up dialog module",
16
+ "type": "boolean",
17
+ "default": true,
18
+ "x-prompt": {
19
+ "message": "Do you want to use Taiga UI dialogs?",
20
+ "type": "confirmation"
21
+ }
22
+ },
23
+ "addSanitizer": {
24
+ "description": "Setting up TUI_SANITIZER",
25
+ "type": "boolean",
26
+ "default": true,
27
+ "x-prompt": {
28
+ "message": "Do you plan on using custom SVGs/icons or addon-editor? If `Yes` we will include ng-dompurify as sanitizer, read more: https://taiga-ui.dev/icon-set#sanitizer",
29
+ "type": "confirmation"
30
+ }
31
+ },
32
+ "addNotificationsModule": {
33
+ "description": "Setting up notifications module",
34
+ "type": "boolean",
35
+ "default": true,
36
+ "x-prompt": {
37
+ "message": "Do you want to use Taiga UI notifications?",
38
+ "type": "confirmation"
39
+ }
40
+ },
41
+ "addons": {
42
+ "description": "Setting up additional packages",
43
+ "type": "array",
44
+ "x-prompt": {
45
+ "message": "Choose additional packages to install",
46
+ "type": "list",
47
+ "multiselect": true,
48
+ "items": [
49
+ {
50
+ "value": "addon-doc",
51
+ "label": "addon-doc Taiga UI based library for developing documentation portals for Angular libraries"
52
+ },
53
+ {
54
+ "value": "addon-charts",
55
+ "label": "addon-charts Components for various charts, graphs and visualizations"
56
+ },
57
+ {
58
+ "value": "addon-commerce",
59
+ "label": "addon-commerce Money-related extension with currencies, credit card inputs and validators"
60
+ },
61
+ {
62
+ "value": "addon-mobile",
63
+ "label": "addon-mobile Components and tools specific to mobile version of the app"
64
+ },
65
+ {
66
+ "value": "addon-table",
67
+ "label": "addon-table Interactive table component and related utilities"
68
+ },
69
+ {
70
+ "value": "addon-tablebars",
71
+ "label": "addon-tablebars Group action sliding toolbar"
72
+ },
73
+ {
74
+ "value": "addon-editor",
75
+ "label": "addon-editor Rich text editor extension with related components"
76
+ },
77
+ {
78
+ "value": "addon-preview",
79
+ "label": "addon preview Custom fullscreen dialog to preview various content such as documents, images etc."
80
+ }
81
+ ]
82
+ }
83
+ }
84
+ },
85
+ "required": []
86
+ }
@@ -0,0 +1,3 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import { Schema } from './schema';
3
+ export default function ngAddSetupProject(options: Schema): Rule;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const schematics_1 = require("@angular-devkit/schematics");
4
+ const add_taiga_icons_1 = require("./steps/add-taiga-icons");
5
+ const add_taiga_modules_1 = require("./steps/add-taiga-modules");
6
+ const add_taiga_styles_1 = require("./steps/add-taiga-styles");
7
+ const wrap_with_tui_root_1 = require("./steps/wrap-with-tui-root");
8
+ function ngAddSetupProject(options) {
9
+ return schematics_1.chain([
10
+ add_taiga_styles_1.addTaigaStyles(options),
11
+ add_taiga_modules_1.addTaigaModules(options),
12
+ add_taiga_icons_1.addTaigaIcons(options),
13
+ wrap_with_tui_root_1.wrapWithTuiRootComponent(options),
14
+ ]);
15
+ }
16
+ exports.default = ngAddSetupProject;
@@ -0,0 +1,5 @@
1
+ import { workspaces } from '@angular-devkit/core';
2
+ import { Rule } from '@angular-devkit/schematics';
3
+ import { Schema } from '../schema';
4
+ export declare function addTaigaIcons(options: Schema): Rule;
5
+ export declare function addTaigaStylesToAngularJson(workspace: workspaces.WorkspaceDefinition, project: workspaces.ProjectDefinition): Rule;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const workspace_1 = require("@schematics/angular/utility/workspace");
13
+ const workspace_2 = require("@schematics/angular/utility/workspace");
14
+ const get_project_1 = require("../../utils/get-project");
15
+ const get_project_target_options_1 = require("../../utils/get-project-target-options");
16
+ const ICON_ASSETS = {
17
+ glob: '**/*',
18
+ input: 'node_modules/@taiga-ui/icons/src',
19
+ output: 'assets/taiga-ui/icons',
20
+ };
21
+ function addTaigaIcons(options) {
22
+ return (tree) => __awaiter(this, void 0, void 0, function* () {
23
+ const workspace = yield workspace_2.getWorkspace(tree);
24
+ const project = get_project_1.getProject(options, workspace);
25
+ return addTaigaStylesToAngularJson(workspace, project);
26
+ });
27
+ }
28
+ exports.addTaigaIcons = addTaigaIcons;
29
+ function addTaigaStylesToAngularJson(workspace, project) {
30
+ const targetOptions = get_project_target_options_1.getProjectTargetOptions(project, 'build');
31
+ const assets = targetOptions.assets;
32
+ if (!assets) {
33
+ targetOptions.assets = [ICON_ASSETS];
34
+ }
35
+ else {
36
+ targetOptions.assets = [...assets, ICON_ASSETS];
37
+ }
38
+ return workspace_1.updateWorkspace(workspace);
39
+ }
40
+ exports.addTaigaStylesToAngularJson = addTaigaStylesToAngularJson;
@@ -0,0 +1,3 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import { Schema } from '../schema';
3
+ export declare function addTaigaModules(options: Schema): Rule;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const workspace_1 = require("@schematics/angular/utility/workspace");
13
+ const ng_morph_1 = require("ng-morph");
14
+ const get_project_1 = require("../../utils/get-project");
15
+ const get_project_target_options_1 = require("../../utils/get-project-target-options");
16
+ const modules_1 = require("../constants/modules");
17
+ const add_unique_import_1 = require("../../utils/add-unique-import");
18
+ function addTaigaModules(options) {
19
+ return (tree, context) => __awaiter(this, void 0, void 0, function* () {
20
+ const workspace = yield workspace_1.getWorkspace(tree);
21
+ const project = get_project_1.getProject(options, workspace);
22
+ const buildOptions = get_project_target_options_1.getProjectTargetOptions(project, 'build');
23
+ ng_morph_1.setActiveProject(ng_morph_1.createProject(tree, '/', ['**/*.ts', '**/*.json']));
24
+ const mainModule = ng_morph_1.getMainModule(buildOptions.main);
25
+ addTuiModules(mainModule, options, context);
26
+ addTuiProviders(mainModule, options);
27
+ ng_morph_1.saveActiveProject();
28
+ });
29
+ }
30
+ exports.addTaigaModules = addTaigaModules;
31
+ function addTuiModules(mainModule, options, context) {
32
+ const modules = [
33
+ ...modules_1.MAIN_MODULES,
34
+ ...(options.addDialogsModule ? modules_1.DIALOG_MODULES : []),
35
+ ...(options.addNotificationsModule ? modules_1.NOTIFICATION_MODULES : []),
36
+ ];
37
+ const mainModulePath = mainModule.getSourceFile().getFilePath();
38
+ modules.forEach(module => {
39
+ ng_morph_1.addImportToNgModule(mainModule, module.name, { unique: true });
40
+ add_unique_import_1.addUniqueImport(mainModulePath, module.name, module.packageName);
41
+ });
42
+ context.logger.info(`${modules.map(module => module.name)} was added to ${mainModulePath}`);
43
+ }
44
+ function addTuiProviders(mainModule, options) {
45
+ if (!options.addSanitizer) {
46
+ return;
47
+ }
48
+ ng_morph_1.addProviderToNgModule(mainModule, '{provide: TUI_SANITIZER, useClass: NgDompurifySanitizer}', { unique: true });
49
+ modules_1.SANITIZER_MODULES.forEach(module => {
50
+ add_unique_import_1.addUniqueImport(mainModule.getSourceFile().getFilePath(), module.name, module.packageName);
51
+ });
52
+ }
@@ -0,0 +1,5 @@
1
+ import { workspaces } from '@angular-devkit/core';
2
+ import { Rule } from '@angular-devkit/schematics';
3
+ import { Schema } from '../schema';
4
+ export declare function addTaigaStyles(options: Schema): Rule;
5
+ export declare function addTaigaStylesToAngularJson(workspace: workspaces.WorkspaceDefinition, project: workspaces.ProjectDefinition): Rule;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const workspace_1 = require("@schematics/angular/utility/workspace");
13
+ const workspace_2 = require("@schematics/angular/utility/workspace");
14
+ const get_project_1 = require("../../utils/get-project");
15
+ const get_project_target_options_1 = require("../../utils/get-project-target-options");
16
+ const TAIGA_GLOBAL_STYLE = 'node_modules/@taiga-ui/core/styles/taiga-ui-global.less';
17
+ const TAIGA_THEME_STYLE = 'node_modules/@taiga-ui/core/styles/taiga-ui-theme.less';
18
+ function addTaigaStyles(options) {
19
+ return (tree) => __awaiter(this, void 0, void 0, function* () {
20
+ const workspace = yield workspace_2.getWorkspace(tree);
21
+ const project = get_project_1.getProject(options, workspace);
22
+ return addTaigaStylesToAngularJson(workspace, project);
23
+ });
24
+ }
25
+ exports.addTaigaStyles = addTaigaStyles;
26
+ function addTaigaStylesToAngularJson(workspace, project) {
27
+ const targetOptions = get_project_target_options_1.getProjectTargetOptions(project, 'build');
28
+ const styles = targetOptions.styles;
29
+ const taigaStyles = [TAIGA_GLOBAL_STYLE, TAIGA_THEME_STYLE];
30
+ if (!styles) {
31
+ targetOptions.styles = taigaStyles;
32
+ }
33
+ else {
34
+ targetOptions.styles = Array.from(new Set([...taigaStyles, ...styles]));
35
+ }
36
+ return workspace_1.updateWorkspace(workspace);
37
+ }
38
+ exports.addTaigaStylesToAngularJson = addTaigaStylesToAngularJson;
@@ -0,0 +1,3 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ import { Schema } from '../schema';
3
+ export declare function wrapWithTuiRootComponent(options: Schema): Rule;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const workspace_1 = require("@schematics/angular/utility/workspace");
13
+ const ng_morph_1 = require("ng-morph");
14
+ const get_project_1 = require("../../utils/get-project");
15
+ const get_project_target_options_1 = require("../../utils/get-project-target-options");
16
+ function wrapWithTuiRootComponent(options) {
17
+ return (tree, context) => __awaiter(this, void 0, void 0, function* () {
18
+ const workspace = yield workspace_1.getWorkspace(tree);
19
+ const project = get_project_1.getProject(options, workspace);
20
+ const buildOptions = get_project_target_options_1.getProjectTargetOptions(project, 'build');
21
+ const appTemplatePath = getAppTemplatePath(tree, buildOptions.main);
22
+ if (!appTemplatePath) {
23
+ context.logger.error('Could not find the default main template file for this project.');
24
+ context.logger.info('Consider manually wrapping content of your app with tui-root');
25
+ context.logger.info('More information at https://taiga-ui.dev/getting-started');
26
+ return;
27
+ }
28
+ addTuiRootComponent(appTemplatePath, context, tree);
29
+ });
30
+ }
31
+ exports.wrapWithTuiRootComponent = wrapWithTuiRootComponent;
32
+ function addTuiRootComponent(filePath, context, tree) {
33
+ const buffer = tree.read(filePath);
34
+ if (!buffer) {
35
+ context.logger.error(`Could not read the default template file within the project ${filePath}`);
36
+ context.logger.info('Consider manually wrapping content of your app with tui-root');
37
+ return;
38
+ }
39
+ const htmlContent = buffer.toString();
40
+ const openTag = '<tui-root>' + '\n';
41
+ const closeTag = '\n' + '</tui-root>';
42
+ if (htmlContent.includes(openTag)) {
43
+ return;
44
+ }
45
+ const recorder = tree.beginUpdate(filePath);
46
+ recorder.insertLeft(0, openTag);
47
+ recorder.insertLeft(htmlContent.length, closeTag);
48
+ tree.commitUpdate(recorder);
49
+ context.logger.info(`Content of the app was wrapped with tui-root component in ${filePath}`);
50
+ }
51
+ function getAppTemplatePath(tree, mainPath) {
52
+ ng_morph_1.setActiveProject(ng_morph_1.createProject(tree, '/', ['**/*.ts', '**/*.json']));
53
+ const mainModule = ng_morph_1.getMainModule(mainPath);
54
+ const mainInitializer = getInitializer(mainModule, 'NgModule', 'declarations');
55
+ if (!ng_morph_1.Node.isArrayLiteralExpression(mainInitializer)) {
56
+ return;
57
+ }
58
+ const appIdentifier = mainInitializer.getElements()[0];
59
+ const appComponent = appIdentifier.getDefinitionNodes()[0];
60
+ const templateInitializer = getInitializer(appComponent, 'Component', 'templateUrl');
61
+ const appComponentPath = appComponent.getSourceFile().getFilePath().split('/');
62
+ const templateUrlPath = `${appComponentPath
63
+ .splice(0, appComponentPath.length - 1)
64
+ .join('/')}/${templateInitializer === null || templateInitializer === void 0 ? void 0 : templateInitializer.getText().replace(/['"]/g, '')}`;
65
+ ng_morph_1.saveActiveProject();
66
+ return templateUrlPath;
67
+ }
68
+ function getInitializer(classDeclaration, decoratorName, propertyName) {
69
+ const decorator = classDeclaration.getDecorator(decoratorName);
70
+ if (!decorator) {
71
+ return;
72
+ }
73
+ const [metadata] = decorator.getArguments();
74
+ if (!ng_morph_1.Node.isObjectLiteralExpression(metadata)) {
75
+ return;
76
+ }
77
+ const property = metadata.getProperty(propertyName);
78
+ if (!ng_morph_1.Node.isPropertyAssignment(property)) {
79
+ return;
80
+ }
81
+ return property.getInitializer();
82
+ }
@@ -0,0 +1,12 @@
1
+ export interface ReplacementConst {
2
+ from: {
3
+ name: string;
4
+ moduleSpecifier?: string;
5
+ };
6
+ to: {
7
+ name: string;
8
+ namedImport?: string;
9
+ moduleSpecifier: string;
10
+ };
11
+ }
12
+ export declare const CONSTS_TO_REPLACE: ReplacementConst[];
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CONSTS_TO_REPLACE = [
4
+ {
5
+ from: {
6
+ name: 'EMPTY_VALIDATOR',
7
+ moduleSpecifier: '@taiga-ui/cdk',
8
+ },
9
+ to: {
10
+ name: 'Validators.nullValidator',
11
+ namedImport: 'Validators',
12
+ moduleSpecifier: '@angular/forms',
13
+ },
14
+ },
15
+ {
16
+ from: {
17
+ name: 'TUI_DATE_MASK',
18
+ },
19
+ to: {
20
+ name: `tuiCreateDateMask('DMY', '.')`,
21
+ moduleSpecifier: '@taiga-ui/kit',
22
+ namedImport: 'tuiCreateDateMask',
23
+ },
24
+ },
25
+ {
26
+ from: {
27
+ name: 'TUI_DATE_RANGE_MASK',
28
+ },
29
+ to: {
30
+ name: `tuiCreateDateRangeMask('DMY', '.')`,
31
+ moduleSpecifier: '@taiga-ui/kit',
32
+ namedImport: 'tuiCreateDateRangeMask',
33
+ },
34
+ },
35
+ {
36
+ from: {
37
+ name: 'getClosestKeyboardFocusable',
38
+ moduleSpecifier: '@taiga-ui/cdk',
39
+ },
40
+ to: {
41
+ name: 'getClosestFocusable',
42
+ moduleSpecifier: '@taiga-ui/cdk',
43
+ },
44
+ },
45
+ ];
@@ -0,0 +1,7 @@
1
+ interface ReplacementEnum {
2
+ name: string;
3
+ replaceValues: Record<string, string>;
4
+ keepAsType?: boolean;
5
+ }
6
+ export declare const ENUMS_TO_REPLACE: ReplacementEnum[];
7
+ export {};