@taiga-ui/cdk 2.40.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 (120) hide show
  1. package/abstract/dialog.service.d.ts +2 -2
  2. package/bundles/taiga-ui-cdk-abstract.umd.js.map +1 -1
  3. package/bundles/taiga-ui-cdk-abstract.umd.min.js.map +1 -1
  4. package/bundles/taiga-ui-cdk-components-alert-host.umd.js +281 -0
  5. package/bundles/taiga-ui-cdk-components-alert-host.umd.js.map +1 -0
  6. package/bundles/taiga-ui-cdk-components-alert-host.umd.min.js +16 -0
  7. package/bundles/taiga-ui-cdk-components-alert-host.umd.min.js.map +1 -0
  8. package/bundles/taiga-ui-cdk-components-dialog-host.umd.js +1 -1
  9. package/bundles/taiga-ui-cdk-components-dialog-host.umd.js.map +1 -1
  10. package/bundles/taiga-ui-cdk-components-dialog-host.umd.min.js +1 -1
  11. package/bundles/taiga-ui-cdk-components-dialog-host.umd.min.js.map +1 -1
  12. package/bundles/taiga-ui-cdk-components-dropdown-host.umd.js +1 -1
  13. package/bundles/taiga-ui-cdk-components-dropdown-host.umd.js.map +1 -1
  14. package/bundles/taiga-ui-cdk-components-dropdown-host.umd.min.js +1 -1
  15. package/bundles/taiga-ui-cdk-components-dropdown-host.umd.min.js.map +1 -1
  16. package/bundles/taiga-ui-cdk-components.umd.js +12 -4
  17. package/bundles/taiga-ui-cdk-components.umd.js.map +1 -1
  18. package/bundles/taiga-ui-cdk-components.umd.min.js +1 -1
  19. package/bundles/taiga-ui-cdk-constants.umd.js +1 -5
  20. package/bundles/taiga-ui-cdk-constants.umd.js.map +1 -1
  21. package/bundles/taiga-ui-cdk-constants.umd.min.js +1 -1
  22. package/bundles/taiga-ui-cdk-constants.umd.min.js.map +1 -1
  23. package/bundles/taiga-ui-cdk-tokens.umd.js +8 -1
  24. package/bundles/taiga-ui-cdk-tokens.umd.js.map +1 -1
  25. package/bundles/taiga-ui-cdk-tokens.umd.min.js +1 -1
  26. package/bundles/taiga-ui-cdk-tokens.umd.min.js.map +1 -1
  27. package/components/alert-host/alert-host.component.d.ts +9 -0
  28. package/components/alert-host/alert-host.module.d.ts +2 -0
  29. package/components/alert-host/index.d.ts +2 -0
  30. package/components/alert-host/package.json +13 -0
  31. package/components/alert-host/taiga-ui-cdk-components-alert-host.d.ts +4 -0
  32. package/components/alert-host/taiga-ui-cdk-components-alert-host.metadata.json +1 -0
  33. package/components/dialog-host/taiga-ui-cdk-components-dialog-host.metadata.json +1 -1
  34. package/components/dropdown-host/taiga-ui-cdk-components-dropdown-host.metadata.json +1 -1
  35. package/components/index.d.ts +1 -0
  36. package/components/taiga-ui-cdk-components.metadata.json +1 -1
  37. package/constants/taiga-ui-cdk-constants.metadata.json +1 -1
  38. package/esm2015/abstract/dialog.service.js +1 -1
  39. package/esm2015/components/alert-host/alert-host.component.js +38 -0
  40. package/esm2015/components/alert-host/alert-host.module.js +16 -0
  41. package/esm2015/components/alert-host/index.js +3 -0
  42. package/esm2015/components/alert-host/taiga-ui-cdk-components-alert-host.js +5 -0
  43. package/esm2015/components/dialog-host/dialog-host.component.js +2 -2
  44. package/esm2015/components/dropdown-host/dropdown-host.component.js +2 -2
  45. package/esm2015/components/index.js +2 -1
  46. package/esm2015/constants/parent-animation.js +2 -6
  47. package/esm2015/interfaces/aria-dialog-context.js +1 -1
  48. package/esm2015/tokens/alerts.js +5 -0
  49. package/esm2015/tokens/dialogs.js +4 -2
  50. package/esm2015/tokens/index.js +2 -1
  51. package/esm5/abstract/dialog.service.js +1 -1
  52. package/esm5/components/alert-host/alert-host.component.js +42 -0
  53. package/esm5/components/alert-host/alert-host.module.js +19 -0
  54. package/esm5/components/alert-host/index.js +3 -0
  55. package/esm5/components/alert-host/taiga-ui-cdk-components-alert-host.js +5 -0
  56. package/esm5/components/dialog-host/dialog-host.component.js +2 -2
  57. package/esm5/components/dropdown-host/dropdown-host.component.js +2 -2
  58. package/esm5/components/index.js +2 -1
  59. package/esm5/constants/parent-animation.js +2 -6
  60. package/esm5/interfaces/aria-dialog-context.js +1 -1
  61. package/esm5/tokens/alerts.js +5 -0
  62. package/esm5/tokens/dialogs.js +4 -2
  63. package/esm5/tokens/index.js +2 -1
  64. package/fesm2015/taiga-ui-cdk-abstract.js.map +1 -1
  65. package/fesm2015/taiga-ui-cdk-components-alert-host.js +56 -0
  66. package/fesm2015/taiga-ui-cdk-components-alert-host.js.map +1 -0
  67. package/fesm2015/taiga-ui-cdk-components-dialog-host.js +1 -1
  68. package/fesm2015/taiga-ui-cdk-components-dialog-host.js.map +1 -1
  69. package/fesm2015/taiga-ui-cdk-components-dropdown-host.js +1 -1
  70. package/fesm2015/taiga-ui-cdk-components-dropdown-host.js.map +1 -1
  71. package/fesm2015/taiga-ui-cdk-components.js +1 -0
  72. package/fesm2015/taiga-ui-cdk-components.js.map +1 -1
  73. package/fesm2015/taiga-ui-cdk-constants.js +1 -5
  74. package/fesm2015/taiga-ui-cdk-constants.js.map +1 -1
  75. package/fesm2015/taiga-ui-cdk-tokens.js +8 -2
  76. package/fesm2015/taiga-ui-cdk-tokens.js.map +1 -1
  77. package/fesm5/taiga-ui-cdk-abstract.js.map +1 -1
  78. package/fesm5/taiga-ui-cdk-components-alert-host.js +63 -0
  79. package/fesm5/taiga-ui-cdk-components-alert-host.js.map +1 -0
  80. package/fesm5/taiga-ui-cdk-components-dialog-host.js +1 -1
  81. package/fesm5/taiga-ui-cdk-components-dialog-host.js.map +1 -1
  82. package/fesm5/taiga-ui-cdk-components-dropdown-host.js +1 -1
  83. package/fesm5/taiga-ui-cdk-components-dropdown-host.js.map +1 -1
  84. package/fesm5/taiga-ui-cdk-components.js +1 -0
  85. package/fesm5/taiga-ui-cdk-components.js.map +1 -1
  86. package/fesm5/taiga-ui-cdk-constants.js +1 -5
  87. package/fesm5/taiga-ui-cdk-constants.js.map +1 -1
  88. package/fesm5/taiga-ui-cdk-tokens.js +8 -2
  89. package/fesm5/taiga-ui-cdk-tokens.js.map +1 -1
  90. package/interfaces/aria-dialog-context.d.ts +2 -2
  91. package/package.json +1 -1
  92. package/schematics/migration.json +1 -1
  93. package/schematics/ng-add/constants/packages.d.ts +0 -1
  94. package/schematics/ng-add/constants/packages.js +0 -10
  95. package/schematics/ng-add/steps/add-taiga-modules.js +3 -27
  96. package/schematics/ng-update/constants/consts.d.ts +12 -0
  97. package/schematics/ng-update/constants/consts.js +45 -0
  98. package/schematics/ng-update/constants/enums.d.ts +7 -0
  99. package/schematics/ng-update/constants/enums.js +174 -0
  100. package/schematics/ng-update/constants/types.d.ts +7 -0
  101. package/schematics/ng-update/constants/types.js +14 -0
  102. package/schematics/ng-update/index.d.ts +2 -2
  103. package/schematics/ng-update/index.js +12 -1
  104. package/schematics/ng-update/steps/rename-types.d.ts +1 -0
  105. package/schematics/ng-update/steps/rename-types.js +27 -0
  106. package/schematics/ng-update/steps/replace-const.d.ts +3 -0
  107. package/schematics/ng-update/steps/replace-const.js +25 -0
  108. package/schematics/ng-update/steps/replace-deep-import.d.ts +1 -0
  109. package/schematics/ng-update/steps/replace-deep-import.js +12 -0
  110. package/schematics/ng-update/steps/replace-enums.d.ts +1 -0
  111. package/schematics/ng-update/steps/replace-enums.js +40 -0
  112. package/schematics/utils/add-unique-import.d.ts +1 -0
  113. package/schematics/utils/add-unique-import.js +29 -0
  114. package/schematics/utils/get-named-import-references.d.ts +2 -0
  115. package/schematics/utils/get-named-import-references.js +14 -0
  116. package/schematics/utils/remove-import.d.ts +2 -0
  117. package/schematics/utils/remove-import.js +11 -0
  118. package/tokens/alerts.d.ts +4 -0
  119. package/tokens/index.d.ts +1 -0
  120. package/tokens/taiga-ui-cdk-tokens.metadata.json +1 -1
@@ -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 {};
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ENUMS_TO_REPLACE = [
4
+ {
5
+ name: 'TuiTextAlign',
6
+ replaceValues: {
7
+ Left: 'left',
8
+ Right: 'right',
9
+ Center: 'center',
10
+ },
11
+ keepAsType: false,
12
+ },
13
+ {
14
+ name: 'TuiLineType',
15
+ replaceValues: {
16
+ Solid: 'solid',
17
+ Dashed: 'dashed',
18
+ Dotted: 'dotted',
19
+ None: 'none',
20
+ Hidden: 'hidden',
21
+ },
22
+ },
23
+ {
24
+ name: 'TuiMoneySign',
25
+ replaceValues: {
26
+ NegativeOnly: 'negative-only',
27
+ Always: 'always',
28
+ Never: 'never',
29
+ ForceNegative: 'force-negative',
30
+ ForcePositive: 'force-positive',
31
+ },
32
+ },
33
+ {
34
+ name: 'TuiDecimal',
35
+ replaceValues: {
36
+ NotZero: 'not-zero',
37
+ Always: 'always',
38
+ Never: 'never',
39
+ },
40
+ },
41
+ {
42
+ name: 'TuiInputType',
43
+ replaceValues: {
44
+ Text: 'text',
45
+ Tel: 'tel',
46
+ Email: 'email',
47
+ Url: 'url',
48
+ Password: 'password',
49
+ },
50
+ },
51
+ {
52
+ name: 'TuiOverscrollMode',
53
+ replaceValues: {
54
+ All: 'all',
55
+ Scroll: 'scroll',
56
+ None: 'none',
57
+ },
58
+ },
59
+ {
60
+ name: 'TuiStepState',
61
+ replaceValues: {
62
+ Normal: 'normal',
63
+ Error: 'error',
64
+ Pass: 'pass',
65
+ },
66
+ keepAsType: false,
67
+ },
68
+ {
69
+ name: 'TuiStatus',
70
+ replaceValues: {
71
+ Default: 'default',
72
+ Primary: 'primary',
73
+ Custom: 'custom',
74
+ Success: 'success',
75
+ Error: 'error',
76
+ Warning: 'warning',
77
+ },
78
+ },
79
+ {
80
+ name: 'TuiMarkerIconMode',
81
+ replaceValues: {
82
+ Link: 'link',
83
+ Primary: 'primary',
84
+ Warning: 'warning',
85
+ White: 'white',
86
+ Secondary: 'secondary',
87
+ Success: 'success',
88
+ Error: 'error',
89
+ OnDark: 'onDark',
90
+ },
91
+ },
92
+ {
93
+ name: 'TuiDropdownPosition',
94
+ replaceValues: {
95
+ Selection: 'selection',
96
+ Word: 'word',
97
+ Tag: 'tag',
98
+ },
99
+ keepAsType: false,
100
+ },
101
+ {
102
+ name: 'TuiBorders',
103
+ replaceValues: {
104
+ All: 'all',
105
+ TopBottom: 'top-bottom',
106
+ },
107
+ keepAsType: false,
108
+ },
109
+ {
110
+ name: 'TuiButtonShape',
111
+ replaceValues: {
112
+ Square: 'square',
113
+ Rounded: 'rounded',
114
+ },
115
+ },
116
+ {
117
+ name: 'TuiDropdownWidth',
118
+ replaceValues: {
119
+ Fixed: 'fixed',
120
+ Min: 'min',
121
+ Auto: 'auto',
122
+ },
123
+ },
124
+ {
125
+ name: 'TuiHintMode',
126
+ replaceValues: {
127
+ Error: 'error',
128
+ OnDark: 'onDark',
129
+ Overflow: 'overflow',
130
+ },
131
+ },
132
+ {
133
+ name: 'TuiLinkMode',
134
+ replaceValues: {
135
+ Positive: 'positive',
136
+ Negative: 'negative',
137
+ },
138
+ keepAsType: false,
139
+ },
140
+ {
141
+ name: 'TuiOrientation',
142
+ replaceValues: {
143
+ Vertical: 'vertical',
144
+ Horizontal: 'horizontal',
145
+ },
146
+ },
147
+ {
148
+ name: 'TuiSupportColor',
149
+ replaceValues: {
150
+ Mustard: 'support-01',
151
+ Texas: 'support-02',
152
+ Tan: 'support-03',
153
+ Salmon: 'support-04',
154
+ Sienna: 'support-05',
155
+ Bittersweet: 'support-06',
156
+ Pinkie: 'support-07',
157
+ Charm: 'support-08',
158
+ Amethist: 'support-09',
159
+ Helio: 'support-10',
160
+ Lilac: 'support-11',
161
+ Malibu: 'support-12',
162
+ Havelock: 'support-13',
163
+ Picton: 'support-14',
164
+ Mint: 'support-15',
165
+ Fountain: 'support-16',
166
+ Puertorico: 'support-17',
167
+ Bay: 'support-18',
168
+ Forest: 'support-19',
169
+ York: 'support-20',
170
+ Feijoa: 'support-21',
171
+ },
172
+ keepAsType: false,
173
+ },
174
+ ];
@@ -0,0 +1,7 @@
1
+ interface TypeToRename {
2
+ from: string;
3
+ to: string;
4
+ moduleSpecifier?: string | string[];
5
+ }
6
+ export declare const TYPES_TO_RENAME: readonly TypeToRename[];
7
+ export {};
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TYPES_TO_RENAME = [
4
+ {
5
+ from: 'ButtonOptions',
6
+ to: 'TuiButtonOptions',
7
+ moduleSpecifier: ['@taiga-ui/core'],
8
+ },
9
+ {
10
+ from: 'RadioOptions',
11
+ to: 'TuiRadioOptions',
12
+ moduleSpecifier: ['@taiga-ui/kit'],
13
+ },
14
+ ];
@@ -1,3 +1,3 @@
1
- import { SchematicContext } from '@angular-devkit/schematics';
1
+ import { Rule } from '@angular-devkit/schematics';
2
2
  import { Schema } from '../ng-add/schema';
3
- export declare function updateToV3(_: Schema): (_: any, context: SchematicContext) => Promise<void>;
3
+ export declare function updateToV3(_: Schema): Rule;
@@ -9,10 +9,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
+ const ng_morph_1 = require("ng-morph");
12
13
  const versions_1 = require("../ng-add/constants/versions");
14
+ const replace_enums_1 = require("./steps/replace-enums");
15
+ const rename_types_1 = require("./steps/rename-types");
16
+ const replace_const_1 = require("./steps/replace-const");
17
+ const replace_deep_import_1 = require("./steps/replace-deep-import");
13
18
  function updateToV3(_) {
14
- return (_, context) => __awaiter(this, void 0, void 0, function* () {
19
+ return (tree, context) => __awaiter(this, void 0, void 0, function* () {
15
20
  context.logger.info(`taiga packages will be updated to ${versions_1.TAIGA_VERSION}`);
21
+ ng_morph_1.setActiveProject(ng_morph_1.createProject(tree, '/', '**/**'));
22
+ replace_deep_import_1.replaceDeepImports();
23
+ replace_enums_1.replaceEnums();
24
+ rename_types_1.renameTypes();
25
+ replace_const_1.replaceConsts();
26
+ ng_morph_1.saveActiveProject();
16
27
  });
17
28
  }
18
29
  exports.updateToV3 = updateToV3;
@@ -0,0 +1 @@
1
+ export declare function renameTypes(): void;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const get_named_import_references_1 = require("../../utils/get-named-import-references");
4
+ const ng_morph_1 = require("ng-morph");
5
+ const types_1 = require("../constants/types");
6
+ function renameTypes() {
7
+ types_1.TYPES_TO_RENAME.forEach(({ from, to, moduleSpecifier }) => {
8
+ renameType(from, to, moduleSpecifier);
9
+ });
10
+ }
11
+ exports.renameTypes = renameTypes;
12
+ function renameType(from, to, moduleSpecifier) {
13
+ const references = get_named_import_references_1.getNamedImportReferences(from, moduleSpecifier);
14
+ for (let ref of references) {
15
+ const parent = ref.getParent();
16
+ if (ng_morph_1.Node.isImportSpecifier(parent)) {
17
+ const namedImport = parent
18
+ .getImportDeclaration()
19
+ .getNamedImports()
20
+ .find(specifier => specifier.getName() === from);
21
+ namedImport === null || namedImport === void 0 ? void 0 : namedImport.replaceWithText(to);
22
+ }
23
+ else if (ng_morph_1.Node.isTypeReferenceNode(parent)) {
24
+ parent.replaceWithText(to);
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,3 @@
1
+ import { ReplacementConst } from '../constants/consts';
2
+ export declare function replaceConsts(): void;
3
+ export declare function replaceConst({ from, to }: ReplacementConst): void;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const get_named_import_references_1 = require("../../utils/get-named-import-references");
4
+ const ng_morph_1 = require("ng-morph");
5
+ const remove_import_1 = require("../../utils/remove-import");
6
+ const add_unique_import_1 = require("../../utils/add-unique-import");
7
+ const consts_1 = require("../constants/consts");
8
+ function replaceConsts() {
9
+ consts_1.CONSTS_TO_REPLACE.forEach(constToReplace => replaceConst(constToReplace));
10
+ }
11
+ exports.replaceConsts = replaceConsts;
12
+ function replaceConst({ from, to }) {
13
+ const references = get_named_import_references_1.getNamedImportReferences(from.name, from.moduleSpecifier);
14
+ for (let ref of references) {
15
+ const parent = ref.getParent();
16
+ if (ng_morph_1.Node.isImportSpecifier(parent)) {
17
+ remove_import_1.removeImport(parent);
18
+ add_unique_import_1.addUniqueImport(parent.getSourceFile().getFilePath(), to.namedImport || to.name, to.moduleSpecifier);
19
+ }
20
+ else {
21
+ ref === null || ref === void 0 ? void 0 : ref.replaceWithText(to.name);
22
+ }
23
+ }
24
+ }
25
+ exports.replaceConst = replaceConst;
@@ -0,0 +1 @@
1
+ export declare function replaceDeepImports(): void;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ng_morph_1 = require("ng-morph");
4
+ const DEEP_REGEX = /(@taiga-ui\/\w+)\/.*/;
5
+ function replaceDeepImports() {
6
+ const deepImports = ng_morph_1.getImports('**/**').filter(imp => DEEP_REGEX.test(imp.getModuleSpecifier().getLiteralValue()));
7
+ ng_morph_1.editImports(deepImports, deepImport => {
8
+ const specifier = deepImport.moduleSpecifier.replace(DEEP_REGEX, '$1');
9
+ return { moduleSpecifier: specifier };
10
+ });
11
+ }
12
+ exports.replaceDeepImports = replaceDeepImports;
@@ -0,0 +1 @@
1
+ export declare function replaceEnums(): void;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ng_morph_1 = require("ng-morph");
4
+ const get_named_import_references_1 = require("../../utils/get-named-import-references");
5
+ const enums_1 = require("../constants/enums");
6
+ const remove_import_1 = require("../../utils/remove-import");
7
+ function replaceEnums() {
8
+ enums_1.ENUMS_TO_REPLACE.forEach(({ name, replaceValues, keepAsType }) => {
9
+ replaceEnumWithString(name, replaceValues, keepAsType);
10
+ });
11
+ }
12
+ exports.replaceEnums = replaceEnums;
13
+ function replaceEnumWithString(enumName, replaceValues, keepAsType = true) {
14
+ const references = get_named_import_references_1.getNamedImportReferences(enumName);
15
+ for (let ref of references) {
16
+ const parent = ref.getParent();
17
+ if (ng_morph_1.Node.isImportSpecifier(parent) && !(keepAsType && containTypeRef(parent))) {
18
+ remove_import_1.removeImport(parent);
19
+ continue;
20
+ }
21
+ if (ng_morph_1.Node.isTypeReferenceNode(parent) && !keepAsType) {
22
+ const declaration = parent.getParent();
23
+ declaration.removeType();
24
+ continue;
25
+ }
26
+ if (!ng_morph_1.Node.isPropertyAccessExpression(parent)) {
27
+ continue;
28
+ }
29
+ const key = Object.keys(replaceValues).find(key => parent.getName() === key);
30
+ if (key) {
31
+ parent.replaceWithText(`'${replaceValues[key]}'`);
32
+ }
33
+ }
34
+ }
35
+ function containTypeRef(node) {
36
+ return node
37
+ .getNameNode()
38
+ .findReferencesAsNodes()
39
+ .some(ref => ng_morph_1.Node.isTypeReferenceNode(ref.getParent()));
40
+ }
@@ -0,0 +1 @@
1
+ export declare function addUniqueImport(filePath: string, namedImport: string, moduleSpecifier: string): void;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ng_morph_1 = require("ng-morph");
4
+ function addUniqueImport(filePath, namedImport, moduleSpecifier) {
5
+ const existingNamedImport = ng_morph_1.getImports(filePath, {
6
+ namedImports: namedImport,
7
+ moduleSpecifier,
8
+ });
9
+ if (existingNamedImport.length) {
10
+ return;
11
+ }
12
+ const existingDeclaration = ng_morph_1.getImports(filePath, {
13
+ moduleSpecifier,
14
+ });
15
+ if (existingDeclaration.length) {
16
+ const modules = existingDeclaration[0]
17
+ .getNamedImports()
18
+ .map(namedImport => namedImport.getText());
19
+ ng_morph_1.editImports(existingDeclaration, () => ({
20
+ namedImports: [...modules, namedImport],
21
+ }));
22
+ return;
23
+ }
24
+ ng_morph_1.addImports(filePath, {
25
+ moduleSpecifier: moduleSpecifier,
26
+ namedImports: [namedImport],
27
+ });
28
+ }
29
+ exports.addUniqueImport = addUniqueImport;
@@ -0,0 +1,2 @@
1
+ import { Node } from 'ng-morph';
2
+ export declare function getNamedImportReferences(namedImport: string, moduleSpecifier?: string | string[]): Node[];
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const ng_morph_1 = require("ng-morph");
4
+ function getNamedImportReferences(namedImport, moduleSpecifier = '**/**') {
5
+ const importDeclarations = ng_morph_1.getImports('**/**', {
6
+ namedImports: [namedImport],
7
+ moduleSpecifier: moduleSpecifier,
8
+ });
9
+ const namedImports = importDeclarations.map(declaration => { var _a; return (_a = declaration
10
+ .getNamedImports()
11
+ .find(specifier => specifier.getName() === namedImport)) === null || _a === void 0 ? void 0 : _a.getNameNode(); });
12
+ return ng_morph_1.arrayFlat(namedImports.map(specifier => (specifier === null || specifier === void 0 ? void 0 : specifier.findReferencesAsNodes()) || []));
13
+ }
14
+ exports.getNamedImportReferences = getNamedImportReferences;
@@ -0,0 +1,2 @@
1
+ import { ImportSpecifier } from 'ng-morph';
2
+ export declare function removeImport(specifier: ImportSpecifier): void;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ function removeImport(specifier) {
4
+ if (specifier.getImportDeclaration().getNamedImports().length === 1) {
5
+ specifier.getImportDeclaration().remove();
6
+ }
7
+ else {
8
+ specifier.remove();
9
+ }
10
+ }
11
+ exports.removeImport = removeImport;
@@ -0,0 +1,4 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { TuiAriaDialogContext } from '@taiga-ui/cdk/interfaces';
3
+ import { Observable } from 'rxjs';
4
+ export declare const TUI_ALERTS: InjectionToken<readonly Observable<readonly TuiAriaDialogContext[]>[]>;
package/tokens/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './active-element';
2
+ export * from './alerts';
2
3
  export * from './default-renderer';
3
4
  export * from './dialogs';
4
5
  export * from './focusable-item-accessor';
@@ -1 +1 @@
1
- {"__symbolic":"module","version":4,"metadata":{"TUI_ACTIVE_ELEMENT":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":22,"character":38},"arguments":["Active element on the document for ActiveZone",{"__symbolic":"error","message":"Lambda not supported","line":25,"character":17,"module":"./active-element"}]},"TUI_DEFAULT_RENDERER":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":3,"character":40},"arguments":["A Renderer2 for global services",{"__symbolic":"error","message":"Lambda not supported","line":7,"character":17,"module":"./default-renderer"}]},"TUI_DIALOGS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":4,"character":31},"arguments":["A stream of dialogs"]},"TUI_FOCUSABLE_ITEM_ACCESSOR":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":4,"character":8},"arguments":["A component that can be focused"]},"TUI_IS_ANDROID":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":5,"character":34},"arguments":["Mobile browser that is not iOS (technically includes Windows Phone, Blackberry etc.)",{"__symbolic":"error","message":"Lambda not supported","line":8,"character":17,"module":"./is-android"}]},"WindowWithCypress":{"__symbolic":"interface"},"TUI_IS_CYPRESS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":10,"character":34},"arguments":["Detect if app is running under Cypress",{"__symbolic":"error","message":"Lambda not supported","line":13,"character":17,"module":"./is-cypress"}]},"TUI_IS_IOS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":5,"character":30},"arguments":["iOS browser detection",{"__symbolic":"error","message":"Lambda not supported","line":6,"character":13,"module":"./is-ios"}]},"TUI_IS_MOBILE":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":9,"character":33},"arguments":["Mobile browser detection",{"__symbolic":"error","message":"Lambda not supported","line":10,"character":13,"module":"./is-mobile"}]},"TUI_REMOVED_ELEMENT":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":5,"character":39},"arguments":["Element currently being removed by AnimationEngine",{"__symbolic":"error","message":"Lambda not supported","line":8,"character":17,"module":"./removed-element"}]},"TUI_SANITIZER":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":3,"character":33},"arguments":["A custom Sanitizer to sanitize source before inlining"]},"TUI_SWIPE_OPTIONS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":3,"character":37},"arguments":["Swipe options",{"__symbolic":"error","message":"Lambda not supported","line":4,"character":13,"module":"./swipe-options"}]},"TUI_TAKE_ONLY_TRUSTED_EVENTS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":9,"character":8},"arguments":["This token need for override behavior the `pressedObservable` function",{"__symbolic":"error","message":"Lambda not supported","line":12,"character":21,"module":"./take-only-trusted-events"}]},"TUI_TOUCH_SUPPORTED":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":3,"character":39},"arguments":["Touch support detection",{"__symbolic":"error","message":"Lambda not supported","line":4,"character":13,"module":"./touch-supported"}]},"TUI_WINDOW_HEIGHT":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":6,"character":37},"arguments":["Window height accounting for disappearing address bar",{"__symbolic":"error","message":"Lambda not supported","line":9,"character":17,"module":"./window-height"}]},"TUI_ZOOM_OPTIONS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":3,"character":36},"arguments":["Zoom options",{"__symbolic":"error","message":"Lambda not supported","line":4,"character":13,"module":"./zoom-options"}]}},"origins":{"TUI_ACTIVE_ELEMENT":"./active-element","TUI_DEFAULT_RENDERER":"./default-renderer","TUI_DIALOGS":"./dialogs","TUI_FOCUSABLE_ITEM_ACCESSOR":"./focusable-item-accessor","TUI_IS_ANDROID":"./is-android","WindowWithCypress":"./is-cypress","TUI_IS_CYPRESS":"./is-cypress","TUI_IS_IOS":"./is-ios","TUI_IS_MOBILE":"./is-mobile","TUI_REMOVED_ELEMENT":"./removed-element","TUI_SANITIZER":"./sanitizer","TUI_SWIPE_OPTIONS":"./swipe-options","TUI_TAKE_ONLY_TRUSTED_EVENTS":"./take-only-trusted-events","TUI_TOUCH_SUPPORTED":"./touch-supported","TUI_WINDOW_HEIGHT":"./window-height","TUI_ZOOM_OPTIONS":"./zoom-options"},"importAs":"@taiga-ui/cdk/tokens"}
1
+ {"__symbolic":"module","version":4,"metadata":{"TUI_ACTIVE_ELEMENT":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":22,"character":38},"arguments":["Active element on the document for ActiveZone",{"__symbolic":"error","message":"Lambda not supported","line":25,"character":17,"module":"./active-element"}]},"TUI_ALERTS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":4,"character":30},"arguments":["A stream of alerts",{"__symbolic":"error","message":"Lambda not supported","line":7,"character":13,"module":"./alerts"}]},"TUI_DEFAULT_RENDERER":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":3,"character":40},"arguments":["A Renderer2 for global services",{"__symbolic":"error","message":"Lambda not supported","line":7,"character":17,"module":"./default-renderer"}]},"TUI_DIALOGS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":4,"character":31},"arguments":["A stream of dialogs",{"__symbolic":"error","message":"Lambda not supported","line":7,"character":13,"module":"./dialogs"}]},"TUI_FOCUSABLE_ITEM_ACCESSOR":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":4,"character":8},"arguments":["A component that can be focused"]},"TUI_IS_ANDROID":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":5,"character":34},"arguments":["Mobile browser that is not iOS (technically includes Windows Phone, Blackberry etc.)",{"__symbolic":"error","message":"Lambda not supported","line":8,"character":17,"module":"./is-android"}]},"WindowWithCypress":{"__symbolic":"interface"},"TUI_IS_CYPRESS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":10,"character":34},"arguments":["Detect if app is running under Cypress",{"__symbolic":"error","message":"Lambda not supported","line":13,"character":17,"module":"./is-cypress"}]},"TUI_IS_IOS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":5,"character":30},"arguments":["iOS browser detection",{"__symbolic":"error","message":"Lambda not supported","line":6,"character":13,"module":"./is-ios"}]},"TUI_IS_MOBILE":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":9,"character":33},"arguments":["Mobile browser detection",{"__symbolic":"error","message":"Lambda not supported","line":10,"character":13,"module":"./is-mobile"}]},"TUI_REMOVED_ELEMENT":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":5,"character":39},"arguments":["Element currently being removed by AnimationEngine",{"__symbolic":"error","message":"Lambda not supported","line":8,"character":17,"module":"./removed-element"}]},"TUI_SANITIZER":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":3,"character":33},"arguments":["A custom Sanitizer to sanitize source before inlining"]},"TUI_SWIPE_OPTIONS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":3,"character":37},"arguments":["Swipe options",{"__symbolic":"error","message":"Lambda not supported","line":4,"character":13,"module":"./swipe-options"}]},"TUI_TAKE_ONLY_TRUSTED_EVENTS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":9,"character":8},"arguments":["This token need for override behavior the `pressedObservable` function",{"__symbolic":"error","message":"Lambda not supported","line":12,"character":21,"module":"./take-only-trusted-events"}]},"TUI_TOUCH_SUPPORTED":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":3,"character":39},"arguments":["Touch support detection",{"__symbolic":"error","message":"Lambda not supported","line":4,"character":13,"module":"./touch-supported"}]},"TUI_WINDOW_HEIGHT":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":6,"character":37},"arguments":["Window height accounting for disappearing address bar",{"__symbolic":"error","message":"Lambda not supported","line":9,"character":17,"module":"./window-height"}]},"TUI_ZOOM_OPTIONS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":3,"character":36},"arguments":["Zoom options",{"__symbolic":"error","message":"Lambda not supported","line":4,"character":13,"module":"./zoom-options"}]}},"origins":{"TUI_ACTIVE_ELEMENT":"./active-element","TUI_ALERTS":"./alerts","TUI_DEFAULT_RENDERER":"./default-renderer","TUI_DIALOGS":"./dialogs","TUI_FOCUSABLE_ITEM_ACCESSOR":"./focusable-item-accessor","TUI_IS_ANDROID":"./is-android","WindowWithCypress":"./is-cypress","TUI_IS_CYPRESS":"./is-cypress","TUI_IS_IOS":"./is-ios","TUI_IS_MOBILE":"./is-mobile","TUI_REMOVED_ELEMENT":"./removed-element","TUI_SANITIZER":"./sanitizer","TUI_SWIPE_OPTIONS":"./swipe-options","TUI_TAKE_ONLY_TRUSTED_EVENTS":"./take-only-trusted-events","TUI_TOUCH_SUPPORTED":"./touch-supported","TUI_WINDOW_HEIGHT":"./window-height","TUI_ZOOM_OPTIONS":"./zoom-options"},"importAs":"@taiga-ui/cdk/tokens"}