@taiga-ui/cdk 4.0.0-alpha.0 → 4.0.0-rc.10

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 (199) hide show
  1. package/classes/index.d.ts +0 -1
  2. package/constants/used-icons.d.ts +1 -1
  3. package/constants/version.d.ts +1 -1
  4. package/constants/version.js +1 -1
  5. package/esm2022/classes/index.mjs +1 -2
  6. package/esm2022/constants/used-icons.mjs +9 -1
  7. package/esm2022/constants/version.mjs +2 -2
  8. package/esm2022/directives/auto-focus/autofocus.options.mjs +3 -3
  9. package/esm2022/directives/copy-processor/copy-processor.directive.mjs +3 -3
  10. package/esm2022/directives/high-dpi/high-dpi.directive.mjs +3 -3
  11. package/esm2022/directives/obscured/obscured.service.mjs +3 -3
  12. package/esm2022/services/index.mjs +2 -2
  13. package/esm2022/services/scroll.service.mjs +4 -4
  14. package/esm2022/services/theme-color.service.mjs +30 -0
  15. package/esm2022/tokens/active-element.mjs +3 -3
  16. package/esm2022/tokens/environment.mjs +15 -7
  17. package/esm2022/tokens/removed-element.mjs +3 -3
  18. package/esm2022/tokens/window-size.mjs +3 -3
  19. package/esm2022/utils/focus/focused-in.mjs +7 -0
  20. package/esm2022/utils/focus/index.mjs +2 -1
  21. package/fesm2022/taiga-ui-cdk-classes.mjs +1 -15
  22. package/fesm2022/taiga-ui-cdk-classes.mjs.map +1 -1
  23. package/fesm2022/taiga-ui-cdk-constants.mjs +9 -1
  24. package/fesm2022/taiga-ui-cdk-constants.mjs.map +1 -1
  25. package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs +2 -2
  26. package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs.map +1 -1
  27. package/fesm2022/taiga-ui-cdk-directives-copy-processor.mjs +2 -2
  28. package/fesm2022/taiga-ui-cdk-directives-copy-processor.mjs.map +1 -1
  29. package/fesm2022/taiga-ui-cdk-directives-high-dpi.mjs +2 -2
  30. package/fesm2022/taiga-ui-cdk-directives-high-dpi.mjs.map +1 -1
  31. package/fesm2022/taiga-ui-cdk-directives-obscured.mjs +2 -2
  32. package/fesm2022/taiga-ui-cdk-directives-obscured.mjs.map +1 -1
  33. package/fesm2022/taiga-ui-cdk-services.mjs +22 -25
  34. package/fesm2022/taiga-ui-cdk-services.mjs.map +1 -1
  35. package/fesm2022/taiga-ui-cdk-tokens.mjs +19 -12
  36. package/fesm2022/taiga-ui-cdk-tokens.mjs.map +1 -1
  37. package/fesm2022/taiga-ui-cdk-utils-focus.mjs +8 -2
  38. package/fesm2022/taiga-ui-cdk-utils-focus.mjs.map +1 -1
  39. package/package.json +356 -67
  40. package/schematics/ng-update/interfaces/html-comment.d.ts +3 -2
  41. package/schematics/ng-update/interfaces/replacement-attribute-value.d.ts +6 -2
  42. package/schematics/ng-update/interfaces/replacement-identifier.d.ts +4 -10
  43. package/schematics/ng-update/interfaces/replacement-type.d.ts +4 -0
  44. package/schematics/ng-update/steps/rename-types.js +6 -2
  45. package/schematics/ng-update/steps/replace-identifier.js +30 -8
  46. package/schematics/ng-update/steps/replace-package-name.js +4 -5
  47. package/schematics/ng-update/utils/templates/replace-attr-values.js +39 -10
  48. package/schematics/ng-update/utils/templates/template-comments.js +7 -1
  49. package/schematics/ng-update/v4/index.js +9 -1
  50. package/schematics/ng-update/v4/migrate-icons/index.js +2 -2
  51. package/schematics/ng-update/v4/migrate-icons/rename-icons.js +13 -5
  52. package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.d.ts +2 -1
  53. package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.js +19 -6
  54. package/schematics/ng-update/v4/steps/constants/attr-to-directive-replace.js +3 -2
  55. package/schematics/ng-update/v4/steps/constants/attr-with-values-to-replace.js +44 -3
  56. package/schematics/ng-update/v4/steps/constants/attrs-to-replace.js +107 -21
  57. package/schematics/ng-update/v4/steps/constants/html-comments.js +9 -0
  58. package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.js +552 -213
  59. package/schematics/ng-update/v4/steps/constants/index.d.ts +1 -0
  60. package/schematics/ng-update/v4/steps/constants/index.js +1 -0
  61. package/schematics/ng-update/v4/steps/constants/inputs-to-remove.js +1 -0
  62. package/schematics/ng-update/v4/steps/constants/migration-warnings.js +20 -0
  63. package/schematics/ng-update/v4/steps/constants/modules-to-remove.js +20 -0
  64. package/schematics/ng-update/v4/steps/constants/modules-to-replace.d.ts +7 -6
  65. package/schematics/ng-update/v4/steps/constants/modules-to-replace.js +1 -0
  66. package/schematics/ng-update/v4/steps/constants/services.d.ts +2 -0
  67. package/schematics/ng-update/v4/steps/constants/services.js +15 -0
  68. package/schematics/ng-update/v4/steps/constants/tags-to-replace.js +14 -2
  69. package/schematics/ng-update/v4/steps/constants/types.js +33 -1
  70. package/schematics/ng-update/v4/steps/index.d.ts +4 -1
  71. package/schematics/ng-update/v4/steps/index.js +4 -1
  72. package/schematics/ng-update/v4/steps/migrate-alert-service.d.ts +2 -0
  73. package/schematics/ng-update/v4/steps/migrate-alert-service.js +110 -0
  74. package/schematics/ng-update/v4/steps/migrate-month-context.d.ts +2 -0
  75. package/schematics/ng-update/v4/steps/migrate-month-context.js +39 -0
  76. package/schematics/ng-update/v4/steps/migrate-number-format-settings.d.ts +2 -0
  77. package/schematics/ng-update/v4/steps/migrate-number-format-settings.js +64 -0
  78. package/schematics/ng-update/v4/steps/migrate-root.d.ts +3 -0
  79. package/schematics/ng-update/v4/steps/migrate-root.js +61 -0
  80. package/schematics/ng-update/v4/steps/migrate-templates.js +10 -2
  81. package/schematics/ng-update/v4/steps/styles/index.js +38 -0
  82. package/schematics/ng-update/v4/steps/styles/migrate-less-scss-constants.d.ts +1 -0
  83. package/schematics/ng-update/v4/steps/styles/migrate-less-scss-constants.js +13 -0
  84. package/schematics/ng-update/v4/steps/styles/migrate-scrollbar-behavior.d.ts +1 -0
  85. package/schematics/ng-update/v4/steps/styles/migrate-scrollbar-behavior.js +10 -0
  86. package/schematics/ng-update/v4/steps/styles/migrate-shadow-mixins.d.ts +1 -0
  87. package/schematics/ng-update/v4/steps/styles/migrate-shadow-mixins.js +23 -0
  88. package/schematics/ng-update/v4/steps/styles/migrate-space-mixins.d.ts +1 -0
  89. package/schematics/ng-update/v4/steps/styles/migrate-space-mixins.js +20 -0
  90. package/schematics/ng-update/v4/steps/styles/migrate-text-mixins.d.ts +1 -0
  91. package/schematics/ng-update/v4/steps/styles/migrate-text-mixins.js +54 -0
  92. package/schematics/ng-update/v4/steps/templates/index.d.ts +6 -0
  93. package/schematics/ng-update/v4/steps/templates/index.js +6 -0
  94. package/schematics/ng-update/v4/steps/templates/migrate-avatar.js +10 -5
  95. package/schematics/ng-update/{v3/steps/migrate-polymorpheus.d.ts → v4/steps/templates/migrate-axes.d.ts} +2 -2
  96. package/schematics/ng-update/v4/steps/templates/migrate-axes.js +26 -0
  97. package/schematics/ng-update/v4/steps/templates/migrate-badge.js +15 -6
  98. package/schematics/ng-update/v4/steps/templates/migrate-badged-content.js +1 -1
  99. package/schematics/ng-update/{v3/steps/migrate-textfield-controller.d.ts → v4/steps/templates/migrate-blocked.d.ts} +2 -2
  100. package/schematics/ng-update/v4/steps/templates/migrate-blocked.js +35 -0
  101. package/schematics/ng-update/v4/steps/templates/migrate-button-appearance.d.ts +8 -0
  102. package/schematics/ng-update/v4/steps/templates/migrate-button-appearance.js +41 -0
  103. package/schematics/ng-update/v4/steps/templates/migrate-expandable.js +3 -2
  104. package/schematics/ng-update/v4/steps/templates/migrate-focusable.js +7 -4
  105. package/schematics/ng-update/v4/steps/templates/migrate-label.d.ts +8 -0
  106. package/schematics/ng-update/v4/steps/templates/migrate-label.js +39 -0
  107. package/schematics/ng-update/v4/steps/templates/migrate-labeled.js +5 -7
  108. package/schematics/ng-update/v4/steps/templates/migrate-mobile-tabs.d.ts +8 -0
  109. package/schematics/ng-update/v4/steps/templates/migrate-mobile-tabs.js +45 -0
  110. package/schematics/ng-update/v4/steps/templates/migrate-notification.d.ts +8 -0
  111. package/schematics/ng-update/v4/steps/templates/migrate-notification.js +64 -0
  112. package/schematics/ng-update/v4/steps/templates/migrate-number-precision.d.ts +8 -0
  113. package/schematics/ng-update/v4/steps/templates/migrate-number-precision.js +36 -0
  114. package/schematics/ng-update/v4/steps/templates/migrate-overscroll.js +4 -6
  115. package/schematics/ng-update/v4/steps/templates/migrate-thumbnail-card.js +2 -1
  116. package/schematics/ng-update/v4/steps/templates/toggles/common.js +3 -2
  117. package/schematics/ng-update/v4/steps/templates/toggles/migrate-checkbox.js +36 -0
  118. package/schematics/ng-update/v4/steps/update-packages.js +21 -8
  119. package/schematics/ng-update/v4/steps/utils/replace-modules-with-providers.d.ts +1 -11
  120. package/schematics/ng-update/v4/steps/utils/replace-modules-with-providers.js +8 -4
  121. package/schematics/utils/get-named-import-references.js +4 -2
  122. package/schematics/utils/templates/elements.js +2 -1
  123. package/schematics/utils/templates/inputs.js +2 -1
  124. package/services/index.d.ts +1 -1
  125. package/services/theme-color.service.d.ts +16 -0
  126. package/tokens/environment.d.ts +1 -0
  127. package/utils/focus/focused-in.d.ts +2 -0
  128. package/utils/focus/index.d.ts +1 -0
  129. package/classes/controller.d.ts +0 -9
  130. package/esm2022/classes/controller.mjs +0 -18
  131. package/esm2022/services/static-request.service.mjs +0 -33
  132. package/schematics/ng-update/v3/constants/breakpoints.d.ts +0 -82
  133. package/schematics/ng-update/v3/constants/breakpoints.js +0 -34
  134. package/schematics/ng-update/v3/constants/constants.d.ts +0 -2
  135. package/schematics/ng-update/v3/constants/constants.js +0 -466
  136. package/schematics/ng-update/v3/constants/deprecated-functions.d.ts +0 -2
  137. package/schematics/ng-update/v3/constants/deprecated-functions.js +0 -680
  138. package/schematics/ng-update/v3/constants/enums.d.ts +0 -2
  139. package/schematics/ng-update/v3/constants/enums.js +0 -284
  140. package/schematics/ng-update/v3/constants/modules.d.ts +0 -2
  141. package/schematics/ng-update/v3/constants/modules.js +0 -9
  142. package/schematics/ng-update/v3/constants/services.d.ts +0 -2
  143. package/schematics/ng-update/v3/constants/services.js +0 -53
  144. package/schematics/ng-update/v3/constants/templates.d.ts +0 -57
  145. package/schematics/ng-update/v3/constants/templates.js +0 -744
  146. package/schematics/ng-update/v3/constants/tui-interactive-selectors.d.ts +0 -1
  147. package/schematics/ng-update/v3/constants/tui-interactive-selectors.js +0 -55
  148. package/schematics/ng-update/v3/constants/types.d.ts +0 -2
  149. package/schematics/ng-update/v3/constants/types.js +0 -156
  150. package/schematics/ng-update/v3/constants/warnings.d.ts +0 -2
  151. package/schematics/ng-update/v3/constants/warnings.js +0 -111
  152. package/schematics/ng-update/v3/index.d.ts +0 -3
  153. package/schematics/ng-update/v3/index.js +0 -105
  154. package/schematics/ng-update/v3/schema.json +0 -13
  155. package/schematics/ng-update/v3/steps/migrate-date-time.d.ts +0 -2
  156. package/schematics/ng-update/v3/steps/migrate-date-time.js +0 -207
  157. package/schematics/ng-update/v3/steps/migrate-polymorpheus.js +0 -78
  158. package/schematics/ng-update/v3/steps/migrate-progress.d.ts +0 -8
  159. package/schematics/ng-update/v3/steps/migrate-progress.js +0 -49
  160. package/schematics/ng-update/v3/steps/migrate-sliders/index.d.ts +0 -3
  161. package/schematics/ng-update/v3/steps/migrate-sliders/index.js +0 -19
  162. package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-range.d.ts +0 -3
  163. package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-range.js +0 -103
  164. package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-slider.d.ts +0 -3
  165. package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-slider.js +0 -90
  166. package/schematics/ng-update/v3/steps/migrate-taiga-proprietary-icons.d.ts +0 -3
  167. package/schematics/ng-update/v3/steps/migrate-taiga-proprietary-icons.js +0 -70
  168. package/schematics/ng-update/v3/steps/migrate-templates.d.ts +0 -4
  169. package/schematics/ng-update/v3/steps/migrate-templates.js +0 -216
  170. package/schematics/ng-update/v3/steps/migrate-textfield-controller.js +0 -98
  171. package/schematics/ng-update/v3/steps/miscellaneous.d.ts +0 -2
  172. package/schematics/ng-update/v3/steps/miscellaneous.js +0 -81
  173. package/schematics/ng-update/v3/steps/replace-functions.d.ts +0 -2
  174. package/schematics/ng-update/v3/steps/replace-functions.js +0 -138
  175. package/schematics/ng-update/v3/steps/replace-styles.d.ts +0 -3
  176. package/schematics/ng-update/v3/steps/replace-styles.js +0 -33
  177. package/schematics/ng-update/v3-30/constants/constants.d.ts +0 -2
  178. package/schematics/ng-update/v3-30/constants/constants.js +0 -8
  179. package/schematics/ng-update/v3-30/constants/icons.d.ts +0 -4
  180. package/schematics/ng-update/v3-30/constants/icons.js +0 -993
  181. package/schematics/ng-update/v3-30/index.d.ts +0 -3
  182. package/schematics/ng-update/v3-30/index.js +0 -33
  183. package/schematics/ng-update/v3-35/constants/constants.d.ts +0 -2
  184. package/schematics/ng-update/v3-35/constants/constants.js +0 -8
  185. package/schematics/ng-update/v3-35/constants/icons.d.ts +0 -4
  186. package/schematics/ng-update/v3-35/constants/icons.js +0 -2537
  187. package/schematics/ng-update/v3-35/index.d.ts +0 -3
  188. package/schematics/ng-update/v3-35/index.js +0 -33
  189. package/schematics/ng-update/v3-36/index.d.ts +0 -3
  190. package/schematics/ng-update/v3-36/index.js +0 -23
  191. package/schematics/ng-update/v3-40/index.d.ts +0 -3
  192. package/schematics/ng-update/v3-40/index.js +0 -62
  193. package/schematics/ng-update/v3-5/index.d.ts +0 -3
  194. package/schematics/ng-update/v3-5/index.js +0 -20
  195. package/schematics/ng-update/v3-5/steps/migrate-expand-templates.d.ts +0 -3
  196. package/schematics/ng-update/v3-5/steps/migrate-expand-templates.js +0 -44
  197. package/schematics/ng-update/v4/steps/migrate-styles.js +0 -20
  198. package/services/static-request.service.d.ts +0 -8
  199. /package/schematics/ng-update/v4/steps/{migrate-styles.d.ts → styles/index.d.ts} +0 -0
@@ -1,78 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.migratePolymorpheus = void 0;
4
- const elements_1 = require("../../../utils/templates/elements");
5
- const ng_component_input_manipulations_1 = require("../../../utils/templates/ng-component-input-manipulations");
6
- const template_resource_1 = require("../../../utils/templates/template-resource");
7
- const replace_tag_1 = require("../../utils/templates/replace-tag");
8
- function insertPolymorpheus({ element, contentVal, contextVal, recorder, templateOffset, }) {
9
- var _a, _b;
10
- const content = `
11
- <ng-container *polymorpheusOutlet="${contentVal} as text${contextVal ? `; context: ${contextVal}` : ''}">
12
- {{ text }}
13
- </ng-container>`;
14
- const insertTo = (_b = (_a = element.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.startTag) === null || _b === void 0 ? void 0 : _b.endOffset;
15
- if (insertTo) {
16
- recorder.insertRight(insertTo + templateOffset, content);
17
- }
18
- }
19
- function removeOldInputs(recorder, template, templateOffset) {
20
- const offsets = [
21
- ...(0, ng_component_input_manipulations_1.getInputPropertyOffsets)(template, '[content]', ['*'], (el) => (0, elements_1.hasElementAttribute)(el, 'polymorpheus-outlet')),
22
- ...(0, ng_component_input_manipulations_1.getInputPropertyOffsets)(template, '[context]', ['*'], (el) => (0, elements_1.hasElementAttribute)(el, 'polymorpheus-outlet')),
23
- ...(0, ng_component_input_manipulations_1.getInputPropertyOffsets)(template, 'polymorpheus-outlet', ['*'], (el) => (0, elements_1.hasElementAttribute)(el, 'polymorpheus-outlet')),
24
- ];
25
- offsets.forEach(([start, end]) => {
26
- recorder.remove(start + templateOffset, end - start);
27
- });
28
- }
29
- function insertPolymorpheusWithDefault({ template, defaultTemplateEl, recorder, templateOffset, contentVal, contextVal, }) {
30
- var _a, _b;
31
- const templateVar = defaultTemplateEl.attrs.find((attr) => attr.name.startsWith('let-'));
32
- let templateVarName = templateVar === null || templateVar === void 0 ? void 0 : templateVar.name;
33
- if (templateVarName === null || templateVarName === void 0 ? void 0 : templateVarName.startsWith('let-')) {
34
- templateVarName = (_a = template.match(new RegExp(templateVarName, 'i'))) === null || _a === void 0 ? void 0 : _a[0];
35
- }
36
- const varName = templateVarName === null || templateVarName === void 0 ? void 0 : templateVarName.replace('let-', '');
37
- const attr = `*polymorpheusOutlet="${contentVal} as ${varName}${contextVal ? `; context: ${contextVal}` : ''}"`;
38
- (0, replace_tag_1.replaceTag)(recorder, defaultTemplateEl.sourceCodeLocation, 'ng-template', 'ng-container', templateOffset, [attr]);
39
- if (((_b = defaultTemplateEl.sourceCodeLocation) === null || _b === void 0 ? void 0 : _b.attrs) && (templateVar === null || templateVar === void 0 ? void 0 : templateVar.name)) {
40
- recorder.remove(defaultTemplateEl.sourceCodeLocation.attrs[templateVar.name].startOffset +
41
- templateOffset, templateVar.name.length);
42
- }
43
- }
44
- function migratePolymorpheus({ resource, fileSystem, recorder, }) {
45
- const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
46
- const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
47
- const elements = (0, elements_1.findElementsWithAttribute)(template, 'polymorpheus-outlet');
48
- elements.forEach((element) => {
49
- var _a, _b;
50
- const contentVal = (_a = element.attrs.find((attr) => attr.name === '[content]')) === null || _a === void 0 ? void 0 : _a.value;
51
- const contextVal = (_b = element.attrs.find((attr) => attr.name === '[context]')) === null || _b === void 0 ? void 0 : _b.value;
52
- const defaultTemplateEl = (0, elements_1.findElementsByFn)(element.childNodes, (el) => el.tagName === 'ng-template')[0];
53
- if (!contentVal) {
54
- return;
55
- }
56
- if (defaultTemplateEl) {
57
- insertPolymorpheusWithDefault({
58
- template,
59
- defaultTemplateEl,
60
- recorder,
61
- templateOffset,
62
- contentVal,
63
- contextVal,
64
- });
65
- }
66
- else {
67
- insertPolymorpheus({
68
- element,
69
- contentVal,
70
- contextVal,
71
- recorder,
72
- templateOffset,
73
- });
74
- }
75
- });
76
- removeOldInputs(recorder, template, templateOffset);
77
- }
78
- exports.migratePolymorpheus = migratePolymorpheus;
@@ -1,8 +0,0 @@
1
- import type { DevkitFileSystem } from 'ng-morph';
2
- import type { Element } from 'parse5/dist/tree-adapters/default';
3
- import type { TuiSchema } from '../../../ng-add/schema';
4
- import type { TemplateResource } from '../../interfaces/template-resource';
5
- export declare const DEPRECATED_PROGRESS_PIPES_REG: RegExp;
6
- export declare function replaceProgressColorSegmentsPipe(templateResource: TemplateResource, fileSystem: DevkitFileSystem): void;
7
- export declare function isProgressWithDeprecatedPipe(element: Element): boolean;
8
- export declare function migrateProgress(fileSystem: DevkitFileSystem, options: TuiSchema): void;
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.migrateProgress = exports.isProgressWithDeprecatedPipe = exports.replaceProgressColorSegmentsPipe = exports.DEPRECATED_PROGRESS_PIPES_REG = void 0;
4
- const ng_morph_1 = require("ng-morph");
5
- const constants_1 = require("../../../constants");
6
- const colored_log_1 = require("../../../utils/colored-log");
7
- const project_root_1 = require("../../../utils/project-root");
8
- const elements_1 = require("../../../utils/templates/elements");
9
- const get_component_templates_1 = require("../../../utils/templates/get-component-templates");
10
- const template_resource_1 = require("../../../utils/templates/template-resource");
11
- const PROPERTY_FOR_DEPRECATED_PIPES = '[color]';
12
- exports.DEPRECATED_PROGRESS_PIPES_REG = /\s*\|\s*tuiProgressColorSegments(Async\s*\|\s*async)?/gi;
13
- function replaceProgressColorSegmentsPipe(templateResource, fileSystem) {
14
- const template = (0, template_resource_1.getTemplateFromTemplateResource)(templateResource, fileSystem);
15
- const templateOffset = (0, template_resource_1.getTemplateOffset)(templateResource);
16
- const path = fileSystem.resolve((0, template_resource_1.getPathFromTemplateResource)(templateResource));
17
- const recorder = fileSystem.edit(path);
18
- (0, elements_1.findElementsWithAttribute)(template, PROPERTY_FOR_DEPRECATED_PIPES)
19
- .filter(isProgressWithDeprecatedPipe)
20
- .forEach((progressEl) => {
21
- var _a, _b;
22
- const oldValue = ((_a = progressEl.attrs.find((attr) => attr.name === PROPERTY_FOR_DEPRECATED_PIPES)) === null || _a === void 0 ? void 0 : _a.value) || '';
23
- const newValue = oldValue.replaceAll(exports.DEPRECATED_PROGRESS_PIPES_REG, '');
24
- const attrLocations = (_b = progressEl.sourceCodeLocation) === null || _b === void 0 ? void 0 : _b.attrs;
25
- if (attrLocations) {
26
- const { startOffset, endOffset } = attrLocations[PROPERTY_FOR_DEPRECATED_PIPES];
27
- recorder.remove(templateOffset + startOffset, endOffset - startOffset);
28
- recorder.insertRight(templateOffset + startOffset, `[tuiProgressColorSegments]="${newValue}"`);
29
- }
30
- });
31
- }
32
- exports.replaceProgressColorSegmentsPipe = replaceProgressColorSegmentsPipe;
33
- function isProgressWithDeprecatedPipe(element) {
34
- return (element.tagName === 'progress' &&
35
- element.attrs.some((attr) => attr.name === PROPERTY_FOR_DEPRECATED_PIPES &&
36
- attr.value.match(exports.DEPRECATED_PROGRESS_PIPES_REG)));
37
- }
38
- exports.isProgressWithDeprecatedPipe = isProgressWithDeprecatedPipe;
39
- function migrateProgress(fileSystem, options) {
40
- !options['skip-logs'] &&
41
- (0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating progress bars...`);
42
- (0, get_component_templates_1.getComponentTemplates)(constants_1.ALL_TS_FILES).forEach((templateResource) => replaceProgressColorSegmentsPipe(templateResource, fileSystem));
43
- fileSystem.commitEdits();
44
- (0, ng_morph_1.saveActiveProject)();
45
- (0, ng_morph_1.setActiveProject)((0, ng_morph_1.createProject)(fileSystem.tree, (0, project_root_1.projectRoot)(), constants_1.ALL_FILES));
46
- !options['skip-logs'] &&
47
- (0, colored_log_1.successLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} progress bars migrated \n`);
48
- }
49
- exports.migrateProgress = migrateProgress;
@@ -1,3 +0,0 @@
1
- import type { DevkitFileSystem } from 'ng-morph';
2
- import type { TuiSchema } from '../../../../ng-add/schema';
3
- export declare function migrateSliders(fileSystem: DevkitFileSystem, options: TuiSchema): void;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.migrateSliders = void 0;
4
- const colored_log_1 = require("../../../../utils/colored-log");
5
- const migrate_input_range_1 = require("./migrate-input-range");
6
- const migrate_input_slider_1 = require("./migrate-input-slider");
7
- function migrateSliders(fileSystem, options) {
8
- !options['skip-logs'] &&
9
- (0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} migrating sliders...`);
10
- !options['skip-logs'] &&
11
- (0, colored_log_1.processLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.PROCESSING_SYMBOL}InputSlider...`);
12
- (0, migrate_input_slider_1.migrateInputSlider)(fileSystem, options);
13
- !options['skip-logs'] &&
14
- (0, colored_log_1.processLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.PROCESSING_SYMBOL}InputRange...`);
15
- (0, migrate_input_range_1.migrateInputRange)(fileSystem, options);
16
- !options['skip-logs'] &&
17
- (0, colored_log_1.successLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} sliders migrated \n`);
18
- }
19
- exports.migrateSliders = migrateSliders;
@@ -1,3 +0,0 @@
1
- import type { DevkitFileSystem } from 'ng-morph';
2
- import type { TuiSchema } from '../../../../ng-add/schema';
3
- export declare function migrateInputRange(fileSystem: DevkitFileSystem, options: TuiSchema): void;
@@ -1,103 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.migrateInputRange = void 0;
4
- const ng_morph_1 = require("ng-morph");
5
- const constants_1 = require("../../../../constants");
6
- const add_unique_import_1 = require("../../../../utils/add-unique-import");
7
- const progress_1 = require("../../../../utils/progress");
8
- const project_root_1 = require("../../../../utils/project-root");
9
- const get_component_templates_1 = require("../../../../utils/templates/get-component-templates");
10
- const ng_component_input_manipulations_1 = require("../../../../utils/templates/ng-component-input-manipulations");
11
- const MIN_LABELS_MIGRATION_METHOD_NAME = 'tuiMigrationInputRangeMinLabel';
12
- const MAX_LABELS_MIGRATION_METHOD_NAME = 'tuiMigrationInputRangeMaxLabel';
13
- function replaceMinLabel(templateResource, fileSystem, modifiedComponentStorage) {
14
- const wasModified = (0, ng_component_input_manipulations_1.replaceInputProperty)({
15
- templateResource,
16
- fileSystem,
17
- componentSelector: 'tui-input-range',
18
- from: 'minLabel',
19
- to: '[leftValueContent]',
20
- newValue: MIN_LABELS_MIGRATION_METHOD_NAME,
21
- });
22
- if (wasModified) {
23
- modifiedComponentStorage.add(templateResource.componentPath);
24
- }
25
- }
26
- function replaceMaxLabel(templateResource, fileSystem, modifiedComponentStorage) {
27
- const wasModified = (0, ng_component_input_manipulations_1.replaceInputProperty)({
28
- templateResource,
29
- fileSystem,
30
- componentSelector: 'tui-input-range',
31
- from: 'maxLabel',
32
- to: '[rightValueContent]',
33
- newValue: MAX_LABELS_MIGRATION_METHOD_NAME,
34
- });
35
- if (wasModified) {
36
- modifiedComponentStorage.add(templateResource.componentPath);
37
- }
38
- }
39
- function addMinMaxLabelMethod(componentPath, methodName, methodCode) {
40
- const [ngComponent] = (0, ng_morph_1.getNgComponents)(componentPath);
41
- if (ngComponent) {
42
- (0, add_unique_import_1.addUniqueImport)(ngComponent.getSourceFile().getFilePath(), 'TuiContextWithImplicit', '@taiga-ui/cdk');
43
- (0, ng_morph_1.addMethods)(ngComponent, {
44
- name: methodName,
45
- returnType: 'string',
46
- parameters: [{ name: 'context', type: 'TuiContextWithImplicit<number>' }],
47
- statements: methodCode,
48
- });
49
- }
50
- }
51
- /**
52
- * We should update virtual file tree after template manipulations
53
- * otherwise all following ng-morph commands will overwrite all previous template manipulations
54
- * */
55
- function save(fileSystem) {
56
- fileSystem.commitEdits();
57
- (0, ng_morph_1.saveActiveProject)();
58
- (0, ng_morph_1.setActiveProject)((0, ng_morph_1.createProject)(fileSystem.tree, (0, project_root_1.projectRoot)(), constants_1.ALL_FILES));
59
- }
60
- function migrateInputRange(fileSystem, options) {
61
- const templateResources = (0, get_component_templates_1.getComponentTemplates)(constants_1.ALL_TS_FILES);
62
- const COMPONENTS_WITH_MIN_LABELS = new Set();
63
- const COMPONENTS_WITH_MAX_LABELS = new Set();
64
- let progressLog = (0, progress_1.setupProgressLogger)({
65
- total: templateResources.length,
66
- prefix: '[replaceMinMaxLabel]',
67
- });
68
- templateResources.forEach((templateResource) => {
69
- !options['skip-logs'] && progressLog(templateResource.componentPath);
70
- replaceMinLabel(templateResource, fileSystem, COMPONENTS_WITH_MIN_LABELS);
71
- replaceMaxLabel(templateResource, fileSystem, COMPONENTS_WITH_MAX_LABELS);
72
- });
73
- save(fileSystem);
74
- progressLog = (0, progress_1.setupProgressLogger)({
75
- total: COMPONENTS_WITH_MIN_LABELS.size,
76
- prefix: '[COMPONENTS_WITH_MIN_LABELS]',
77
- });
78
- Array.from(COMPONENTS_WITH_MIN_LABELS).forEach((componentPath) => {
79
- !options['skip-logs'] && progressLog(componentPath);
80
- addMinMaxLabelMethod(componentPath, MIN_LABELS_MIGRATION_METHOD_NAME, [
81
- 'const currentValue = context.$implicit;',
82
- 'const minValue = 0; // TODO: (Taiga UI migration) replace with the MIN value of the input-range',
83
- 'const minLabelText = "Min"; // TODO: (Taiga UI migration) replace with the required label',
84
- 'if (currentValue === minValue) return minLabelText;',
85
- 'return String(currentValue);',
86
- ]);
87
- });
88
- progressLog = (0, progress_1.setupProgressLogger)({
89
- total: COMPONENTS_WITH_MAX_LABELS.size,
90
- prefix: '[COMPONENTS_WITH_MAX_LABELS]',
91
- });
92
- Array.from(COMPONENTS_WITH_MAX_LABELS).forEach((componentPath) => {
93
- !options['skip-logs'] && progressLog(componentPath);
94
- addMinMaxLabelMethod(componentPath, MAX_LABELS_MIGRATION_METHOD_NAME, [
95
- 'const currentValue = context.$implicit;',
96
- 'const maxValue = 100; // TODO: (Taiga UI migration) replace with the MAX value of the input',
97
- 'const maxLabelText = "Max"; // TODO: (Taiga UI migration) replace with the required label',
98
- 'if (currentValue === maxValue) return maxLabelText;',
99
- 'return String(currentValue);',
100
- ]);
101
- });
102
- }
103
- exports.migrateInputRange = migrateInputRange;
@@ -1,3 +0,0 @@
1
- import type { DevkitFileSystem } from 'ng-morph';
2
- import type { TuiSchema } from '../../../../ng-add/schema';
3
- export declare function migrateInputSlider(fileSystem: DevkitFileSystem, options: TuiSchema): void;
@@ -1,90 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.migrateInputSlider = void 0;
4
- const ng_morph_1 = require("ng-morph");
5
- const constants_1 = require("../../../../constants");
6
- const add_unique_import_1 = require("../../../../utils/add-unique-import");
7
- const progress_1 = require("../../../../utils/progress");
8
- const project_root_1 = require("../../../../utils/project-root");
9
- const elements_1 = require("../../../../utils/templates/elements");
10
- const get_component_templates_1 = require("../../../../utils/templates/get-component-templates");
11
- const ng_component_input_manipulations_1 = require("../../../../utils/templates/ng-component-input-manipulations");
12
- const MIN_MAX_LABELS_MIGRATION_METHOD_NAME = 'tuiMigrationMinMaxLabel';
13
- function replaceMinMaxLabels(templateResource, fileSystem, modifiedComponentStorage) {
14
- const wasMaxLabelModified = (0, ng_component_input_manipulations_1.replaceInputProperty)({
15
- templateResource,
16
- fileSystem,
17
- componentSelector: 'tui-input-slider',
18
- from: 'maxLabel',
19
- to: '[valueContent]',
20
- newValue: MIN_MAX_LABELS_MIGRATION_METHOD_NAME,
21
- });
22
- const wasMinLabelModified = (0, ng_component_input_manipulations_1.replaceInputProperty)({
23
- templateResource,
24
- fileSystem,
25
- componentSelector: 'tui-input-slider',
26
- from: 'minLabel',
27
- to: '[valueContent]',
28
- newValue: MIN_MAX_LABELS_MIGRATION_METHOD_NAME,
29
- filterFn: (element) => !(0, elements_1.hasElementAttribute)(element, 'maxLabel'),
30
- });
31
- (0, ng_component_input_manipulations_1.removeInputProperty)({
32
- templateResource,
33
- fileSystem,
34
- componentSelector: 'tui-input-slider',
35
- inputProperty: 'minLabel',
36
- filterFn: (element) => (0, elements_1.hasElementAttribute)(element, 'maxLabel'),
37
- });
38
- if (wasMaxLabelModified || wasMinLabelModified) {
39
- modifiedComponentStorage.add(templateResource.componentPath);
40
- }
41
- }
42
- function addMinMaxLabelMethod(componentPath) {
43
- const [ngComponent] = (0, ng_morph_1.getNgComponents)(componentPath);
44
- if (ngComponent) {
45
- (0, add_unique_import_1.addUniqueImport)(componentPath, 'TuiContextWithImplicit', '@taiga-ui/cdk');
46
- (0, ng_morph_1.addMethods)(ngComponent, {
47
- name: MIN_MAX_LABELS_MIGRATION_METHOD_NAME,
48
- returnType: 'string',
49
- parameters: [{ name: 'context', type: 'TuiContextWithImplicit<number>' }],
50
- statements: [
51
- 'const currentValue = context.$implicit;',
52
- 'const maxValue = 100; // TODO: (Taiga UI migration) replace with the MAX value of the input',
53
- 'const maxLabelText = "Max"; // TODO: (Taiga UI migration) replace with the required label',
54
- 'const minValue = 0; // TODO: (Taiga UI migration) replace with the MIN value of the input',
55
- 'const minLabelText = "Min"; // TODO: (Taiga UI migration) replace with the required label',
56
- 'if (currentValue === maxValue) return maxLabelText;',
57
- 'if (currentValue === minValue) return minLabelText;',
58
- 'return String(currentValue);',
59
- ],
60
- });
61
- }
62
- }
63
- function migrateInputSlider(fileSystem, options) {
64
- const templateResources = (0, get_component_templates_1.getComponentTemplates)(constants_1.ALL_TS_FILES);
65
- const COMPONENTS_WITH_MIN_MAX_LABELS = new Set();
66
- let progressLog = (0, progress_1.setupProgressLogger)({
67
- total: templateResources.length,
68
- prefix: '[replaceMinMaxLabels]',
69
- });
70
- templateResources.forEach((templateResource) => {
71
- !options['skip-logs'] && progressLog(templateResource.componentPath);
72
- replaceMinMaxLabels(templateResource, fileSystem, COMPONENTS_WITH_MIN_MAX_LABELS);
73
- });
74
- /**
75
- * We should update virtual file tree
76
- * otherwise all following ng-morph commands will overwrite all previous template manipulations
77
- * */
78
- fileSystem.commitEdits();
79
- (0, ng_morph_1.saveActiveProject)();
80
- (0, ng_morph_1.setActiveProject)((0, ng_morph_1.createProject)(fileSystem.tree, (0, project_root_1.projectRoot)(), constants_1.ALL_FILES));
81
- progressLog = (0, progress_1.setupProgressLogger)({
82
- total: COMPONENTS_WITH_MIN_MAX_LABELS.size,
83
- prefix: '[addMinMaxLabelMethod]',
84
- });
85
- Array.from(COMPONENTS_WITH_MIN_MAX_LABELS).forEach((componentPath) => {
86
- !options['skip-logs'] && progressLog(componentPath);
87
- addMinMaxLabelMethod(componentPath);
88
- });
89
- }
90
- exports.migrateInputSlider = migrateInputSlider;
@@ -1,3 +0,0 @@
1
- import type { Rule } from '@angular-devkit/schematics';
2
- import type { TuiSchema } from '../../../ng-add/schema';
3
- export declare function migrateTaigaProprietaryIcons(options: TuiSchema): Rule;
@@ -1,70 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.migrateTaigaProprietaryIcons = void 0;
4
- const tslib_1 = require("tslib");
5
- const workspace_1 = require("@schematics/angular/utility/workspace");
6
- const ng_morph_1 = require("ng-morph");
7
- const is_string_1 = require("../../../../utils/miscellaneous/is-string");
8
- const angular_json_manipulations_1 = require("../../../utils/angular-json-manipulations");
9
- const get_project_target_options_1 = require("../../../utils/get-project-target-options");
10
- const get_projects_1 = require("../../../utils/get-projects");
11
- const PROPRIETARY_TDS_ICON_ASSETS = {
12
- glob: '**/*',
13
- input: 'node_modules/@taiga-ui/proprietary-tds-icons/src',
14
- output: 'assets/taiga-ui/icons',
15
- };
16
- const MANUAL_MIGRATION_TIPS = `Add ${JSON.stringify(PROPRIETARY_TDS_ICON_ASSETS, null, 4)} to angular.json manually`;
17
- function migrateTaigaProprietaryIcons(options) {
18
- return (tree, context) => tslib_1.__awaiter(this, void 0, void 0, function* () {
19
- var _a;
20
- let proprietaryIcons = null;
21
- try {
22
- proprietaryIcons =
23
- ((_a = (0, ng_morph_1.getPackageJsonDependency)(tree, '@taiga-ui/proprietary-icons')) === null || _a === void 0 ? void 0 : _a.version) ||
24
- null;
25
- }
26
- catch (_b) {
27
- // noop
28
- }
29
- if (yield (0, angular_json_manipulations_1.isInvalidAngularJson)(tree)) {
30
- context.logger.warn(`[WARNING]: Schematics don't support this version of angular.json. ${MANUAL_MIGRATION_TIPS}`);
31
- return;
32
- }
33
- return (0, ng_morph_1.getSourceFiles)('**/angular.json').length > 0
34
- ? (0, workspace_1.updateWorkspace)((workspace) => {
35
- if (proprietaryIcons === null) {
36
- return;
37
- }
38
- const projects = (0, get_projects_1.getProjects)(options, workspace);
39
- if (!projects.length) {
40
- context.logger.warn(`[WARNING]: Target project not found. ${MANUAL_MIGRATION_TIPS}`);
41
- return;
42
- }
43
- for (const project of projects) {
44
- let targetOptions;
45
- try {
46
- targetOptions = (0, get_project_target_options_1.getProjectTargetOptions)(project, 'build');
47
- }
48
- catch (_a) {
49
- context.logger.warn(`[WARNING]: No buildable project was found. ${MANUAL_MIGRATION_TIPS}`);
50
- return;
51
- }
52
- if (Array.isArray(targetOptions === null || targetOptions === void 0 ? void 0 : targetOptions.assets)) {
53
- const tdsSrc = '@taiga-ui/proprietary-tds-icons/src';
54
- const hasIcons = targetOptions.assets.find((asset) => {
55
- var _a;
56
- return (0, is_string_1.tuiIsString)(asset)
57
- ? asset.includes(tdsSrc)
58
- : (_a = asset === null || asset === void 0 ? void 0 : asset.input) === null || _a === void 0 ? void 0 : _a.includes(tdsSrc);
59
- });
60
- if (hasIcons) {
61
- return;
62
- }
63
- targetOptions.assets.push(PROPRIETARY_TDS_ICON_ASSETS);
64
- }
65
- }
66
- })
67
- : () => { };
68
- });
69
- }
70
- exports.migrateTaigaProprietaryIcons = migrateTaigaProprietaryIcons;
@@ -1,4 +0,0 @@
1
- /// <reference lib="es2021" />
2
- import type { DevkitFileSystem } from 'ng-morph';
3
- import type { TuiSchema } from '../../../ng-add/schema';
4
- export declare function migrateTemplates(fileSystem: DevkitFileSystem, options: TuiSchema): void;