@taiga-ui/cdk 4.0.0-rc.2 → 4.0.0-rc.3

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 (186) hide show
  1. package/classes/control.d.ts +1 -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/directives/auto-focus/autofocus.options.d.ts +1 -1
  6. package/directives/for/for.directive.d.ts +3 -3
  7. package/directives/platform/platform.directive.d.ts +1 -1
  8. package/directives/value-changes/value-changes.directive.d.ts +3 -3
  9. package/esm2022/classes/control.mjs +2 -2
  10. package/esm2022/constants/used-icons.mjs +5 -5
  11. package/esm2022/constants/version.mjs +2 -2
  12. package/esm2022/directives/active-zone/active-zone.directive.mjs +2 -2
  13. package/esm2022/directives/auto-focus/handlers/ios.handler.mjs +3 -3
  14. package/esm2022/directives/click-outside/click-outside.directive.mjs +2 -2
  15. package/esm2022/directives/droppable/droppable.directive.mjs +3 -3
  16. package/esm2022/directives/for/for.directive.mjs +6 -6
  17. package/esm2022/directives/hovered/hovered.service.mjs +2 -2
  18. package/esm2022/directives/obscured/obscured.directive.mjs +2 -2
  19. package/esm2022/directives/obscured/obscured.service.mjs +2 -2
  20. package/esm2022/directives/pan/pan.service.mjs +2 -2
  21. package/esm2022/directives/platform/platform.directive.mjs +6 -6
  22. package/esm2022/directives/swipe/swipe.service.mjs +2 -2
  23. package/esm2022/directives/value-changes/value-changes.directive.mjs +6 -6
  24. package/esm2022/directives/zoom/zoom.service.mjs +4 -4
  25. package/esm2022/observables/control-value.mjs +2 -2
  26. package/esm2022/observables/drag-and-drop-from.mjs +2 -2
  27. package/esm2022/observables/events.mjs +3 -3
  28. package/esm2022/observables/if-map.mjs +2 -2
  29. package/esm2022/observables/must-be-present.mjs +2 -2
  30. package/esm2022/observables/zone.mjs +4 -4
  31. package/esm2022/pipes/filter/filter.pipe.mjs +2 -2
  32. package/esm2022/services/popover.service.mjs +3 -3
  33. package/esm2022/services/scroll.service.mjs +2 -2
  34. package/esm2022/services/static-request.service.mjs +1 -1
  35. package/esm2022/tokens/active-element.mjs +3 -3
  36. package/esm2022/tokens/removed-element.mjs +2 -2
  37. package/esm2022/utils/color/get-gradient-data.mjs +6 -0
  38. package/esm2022/utils/color/hex-to-rgb.mjs +2 -2
  39. package/esm2022/utils/color/index.mjs +3 -1
  40. package/esm2022/utils/color/parse-color.mjs +3 -3
  41. package/esm2022/utils/color/parse-gradient.mjs +70 -0
  42. package/esm2022/utils/color/rgb-to-hex.mjs +2 -2
  43. package/esm2022/utils/dom/get-element-obscurers.mjs +2 -2
  44. package/esm2022/utils/dom/get-element-point.mjs +6 -0
  45. package/esm2022/utils/dom/index.mjs +2 -1
  46. package/esm2022/utils/miscellaneous/mark-control-as-touched-and-validate.mjs +3 -3
  47. package/esm2022/utils/miscellaneous/with-styles.mjs +2 -2
  48. package/fesm2022/taiga-ui-cdk-classes.mjs +1 -1
  49. package/fesm2022/taiga-ui-cdk-classes.mjs.map +1 -1
  50. package/fesm2022/taiga-ui-cdk-constants.mjs +5 -5
  51. package/fesm2022/taiga-ui-cdk-constants.mjs.map +1 -1
  52. package/fesm2022/taiga-ui-cdk-directives-active-zone.mjs +1 -1
  53. package/fesm2022/taiga-ui-cdk-directives-active-zone.mjs.map +1 -1
  54. package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs +2 -2
  55. package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs.map +1 -1
  56. package/fesm2022/taiga-ui-cdk-directives-click-outside.mjs +1 -1
  57. package/fesm2022/taiga-ui-cdk-directives-click-outside.mjs.map +1 -1
  58. package/fesm2022/taiga-ui-cdk-directives-droppable.mjs +2 -2
  59. package/fesm2022/taiga-ui-cdk-directives-droppable.mjs.map +1 -1
  60. package/fesm2022/taiga-ui-cdk-directives-for.mjs +5 -5
  61. package/fesm2022/taiga-ui-cdk-directives-for.mjs.map +1 -1
  62. package/fesm2022/taiga-ui-cdk-directives-hovered.mjs +1 -1
  63. package/fesm2022/taiga-ui-cdk-directives-hovered.mjs.map +1 -1
  64. package/fesm2022/taiga-ui-cdk-directives-obscured.mjs +2 -2
  65. package/fesm2022/taiga-ui-cdk-directives-obscured.mjs.map +1 -1
  66. package/fesm2022/taiga-ui-cdk-directives-pan.mjs +1 -1
  67. package/fesm2022/taiga-ui-cdk-directives-pan.mjs.map +1 -1
  68. package/fesm2022/taiga-ui-cdk-directives-platform.mjs +5 -5
  69. package/fesm2022/taiga-ui-cdk-directives-platform.mjs.map +1 -1
  70. package/fesm2022/taiga-ui-cdk-directives-swipe.mjs +1 -1
  71. package/fesm2022/taiga-ui-cdk-directives-swipe.mjs.map +1 -1
  72. package/fesm2022/taiga-ui-cdk-directives-value-changes.mjs +5 -5
  73. package/fesm2022/taiga-ui-cdk-directives-value-changes.mjs.map +1 -1
  74. package/fesm2022/taiga-ui-cdk-directives-zoom.mjs +3 -3
  75. package/fesm2022/taiga-ui-cdk-directives-zoom.mjs.map +1 -1
  76. package/fesm2022/taiga-ui-cdk-observables.mjs +9 -9
  77. package/fesm2022/taiga-ui-cdk-observables.mjs.map +1 -1
  78. package/fesm2022/taiga-ui-cdk-pipes-filter.mjs +1 -1
  79. package/fesm2022/taiga-ui-cdk-pipes-filter.mjs.map +1 -1
  80. package/fesm2022/taiga-ui-cdk-services.mjs +3 -3
  81. package/fesm2022/taiga-ui-cdk-services.mjs.map +1 -1
  82. package/fesm2022/taiga-ui-cdk-tokens.mjs +3 -3
  83. package/fesm2022/taiga-ui-cdk-tokens.mjs.map +1 -1
  84. package/fesm2022/taiga-ui-cdk-utils-color.mjs +80 -5
  85. package/fesm2022/taiga-ui-cdk-utils-color.mjs.map +1 -1
  86. package/fesm2022/taiga-ui-cdk-utils-dom.mjs +7 -2
  87. package/fesm2022/taiga-ui-cdk-utils-dom.mjs.map +1 -1
  88. package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs +3 -3
  89. package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs.map +1 -1
  90. package/package.json +67 -357
  91. package/schematics/ng-add/index.js +1 -1
  92. package/schematics/ng-add/steps/add-taiga-icons.js +1 -1
  93. package/schematics/ng-add/steps/add-taiga-modules.js +3 -3
  94. package/schematics/ng-update/steps/icons/replace-imports.js +5 -5
  95. package/schematics/ng-update/steps/index.d.ts +1 -0
  96. package/schematics/ng-update/steps/index.js +1 -0
  97. package/schematics/ng-update/steps/remove-module.js +2 -2
  98. package/schematics/ng-update/steps/rename-types.js +2 -2
  99. package/schematics/ng-update/steps/replace-deep-import.js +2 -2
  100. package/schematics/ng-update/steps/replace-enums.js +2 -2
  101. package/schematics/ng-update/steps/replace-identifier.js +1 -1
  102. package/schematics/ng-update/steps/replace-package-name.d.ts +5 -0
  103. package/schematics/ng-update/steps/replace-package-name.js +19 -0
  104. package/schematics/ng-update/steps/replace-services.js +5 -5
  105. package/schematics/ng-update/steps/show-warnings.js +4 -4
  106. package/schematics/ng-update/utils/replace-text.js +1 -1
  107. package/schematics/ng-update/utils/templates/replace-attr-values.js +3 -3
  108. package/schematics/ng-update/utils/templates/replace-attrs.js +1 -1
  109. package/schematics/ng-update/utils/templates/template-comments.js +4 -2
  110. package/schematics/ng-update/v3/constants/templates.js +9 -9
  111. package/schematics/ng-update/v3/index.js +1 -1
  112. package/schematics/ng-update/v3/steps/migrate-date-time.js +10 -10
  113. package/schematics/ng-update/v3/steps/migrate-polymorpheus.js +8 -8
  114. package/schematics/ng-update/v3/steps/migrate-progress.js +4 -4
  115. package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-range.js +3 -3
  116. package/schematics/ng-update/v3/steps/migrate-sliders/migrate-input-slider.js +4 -4
  117. package/schematics/ng-update/v3/steps/migrate-taiga-proprietary-icons.js +2 -2
  118. package/schematics/ng-update/v3/steps/migrate-templates.js +16 -16
  119. package/schematics/ng-update/v3/steps/migrate-textfield-controller.js +8 -8
  120. package/schematics/ng-update/v3/steps/miscellaneous.js +5 -5
  121. package/schematics/ng-update/v3/steps/replace-functions.js +12 -12
  122. package/schematics/ng-update/v3/steps/replace-styles.js +2 -2
  123. package/schematics/ng-update/v3-36/index.js +7 -17
  124. package/schematics/ng-update/v3-40/index.js +1 -1
  125. package/schematics/ng-update/v3-5/steps/migrate-expand-templates.js +4 -4
  126. package/schematics/ng-update/v4/index.js +9 -6
  127. package/schematics/ng-update/v4/migrate-css-vars/palette.d.ts +11 -2
  128. package/schematics/ng-update/v4/migrate-css-vars/palette.js +18 -8
  129. package/schematics/ng-update/v4/migrate-css-vars/rename-css-vars.js +10 -2
  130. package/schematics/ng-update/v4/migrate-icons/index.js +8 -6
  131. package/schematics/ng-update/v4/migrate-icons/rename-icons.js +2 -2
  132. package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.d.ts +2 -0
  133. package/schematics/ng-update/v4/migrate-icons/rename-proprietary-icons.js +66 -0
  134. package/schematics/ng-update/v4/steps/constants/attr-to-directive-replace.js +2 -2
  135. package/schematics/ng-update/v4/steps/constants/attr-with-values-to-replace.js +9 -1
  136. package/schematics/ng-update/v4/steps/constants/attrs-to-replace.js +10 -9
  137. package/schematics/ng-update/v4/steps/constants/enums.js +31 -0
  138. package/schematics/ng-update/v4/steps/constants/html-comments.js +10 -0
  139. package/schematics/ng-update/v4/steps/constants/identifiers-to-replace.js +180 -118
  140. package/schematics/ng-update/v4/steps/constants/inputs-to-remove.js +1 -1
  141. package/schematics/ng-update/v4/steps/constants/migration-warnings.js +5 -0
  142. package/schematics/ng-update/v4/steps/constants/modules-to-remove.js +8 -0
  143. package/schematics/ng-update/v4/steps/constants/modules-to-replace.d.ts +12 -0
  144. package/schematics/ng-update/v4/steps/constants/modules-to-replace.js +15 -0
  145. package/schematics/ng-update/v4/steps/constants/tags-to-replace.js +5 -4
  146. package/schematics/ng-update/v4/steps/constants/types.js +6 -0
  147. package/schematics/ng-update/v4/steps/index.d.ts +4 -0
  148. package/schematics/ng-update/v4/steps/index.js +4 -0
  149. package/schematics/ng-update/v4/steps/migrate-all-country-iso-codes.js +1 -1
  150. package/schematics/ng-update/v4/steps/migrate-destroy-service.js +7 -4
  151. package/schematics/ng-update/v4/steps/migrate-legacy-mask.js +2 -2
  152. package/schematics/ng-update/v4/steps/migrate-option-providers.js +2 -2
  153. package/schematics/ng-update/v4/steps/migrate-proprietary.js +3 -3
  154. package/schematics/ng-update/v4/steps/migrate-styles.js +1 -1
  155. package/schematics/ng-update/v4/steps/migrate-templates.js +1 -1
  156. package/schematics/ng-update/v4/steps/templates/migrate-avatar.js +24 -6
  157. package/schematics/ng-update/v4/steps/templates/migrate-badge.js +4 -4
  158. package/schematics/ng-update/v4/steps/templates/migrate-expandable.js +2 -2
  159. package/schematics/ng-update/v4/steps/templates/migrate-focusable.js +1 -1
  160. package/schematics/ng-update/v4/steps/templates/migrate-labeled.js +1 -3
  161. package/schematics/ng-update/v4/steps/templates/migrate-money.js +1 -1
  162. package/schematics/ng-update/v4/steps/templates/migrate-thumbnail-card.js +1 -1
  163. package/schematics/ng-update/v4/steps/templates/toggles/common.d.ts +1 -1
  164. package/schematics/ng-update/v4/steps/templates/toggles/common.js +3 -3
  165. package/schematics/ng-update/v4/steps/update-packages.d.ts +4 -0
  166. package/schematics/ng-update/v4/steps/update-packages.js +31 -0
  167. package/schematics/ng-update/v4/steps/utils/remove-attrs.js +1 -1
  168. package/schematics/ng-update/v4/steps/utils/replace-modules-with-providers.d.ts +13 -0
  169. package/schematics/ng-update/v4/steps/utils/replace-modules-with-providers.js +47 -0
  170. package/schematics/ng-update/v4/steps/utils/replace-substrings.js +1 -1
  171. package/schematics/ng-update/v4/tests/migrate-destroy-service/utils.js +1 -0
  172. package/schematics/utils/add-unique-import.js +1 -1
  173. package/schematics/utils/angular-json-manipulations.js +4 -4
  174. package/schematics/utils/get-named-import-references.js +4 -4
  175. package/schematics/utils/get-standalone-bootstrap-function.js +2 -2
  176. package/schematics/utils/import-manipulations.js +1 -1
  177. package/schematics/utils/push-to-array-property.js +1 -1
  178. package/schematics/utils/templates/elements.js +16 -13
  179. package/schematics/utils/templates/get-component-templates.js +1 -1
  180. package/schematics/utils/templates/inputs.js +1 -1
  181. package/schematics/utils/templates/ng-component-input-manipulations.js +5 -5
  182. package/utils/color/get-gradient-data.d.ts +1 -0
  183. package/utils/color/index.d.ts +2 -0
  184. package/utils/color/parse-gradient.d.ts +10 -0
  185. package/utils/dom/get-element-point.d.ts +2 -0
  186. package/utils/dom/index.d.ts +1 -0
@@ -52,9 +52,9 @@ function addHTMLCommentTags({ resource, recorder, fileSystem, }) {
52
52
  ...(0, elements_1.findElementsWithAttribute)(template, withAttr),
53
53
  ...(0, elements_1.findElementsWithAttribute)(template, `[${withAttr}]`),
54
54
  ]
55
- .filter(el => el.tagName === tag)
56
- .map(el => { var _a; return (((_a = el.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.startOffset) || 0) + templateOffset; });
57
- elementStartOffsets.forEach(offset => {
55
+ .filter((el) => el.tagName === tag)
56
+ .map((el) => { var _a; return (((_a = el.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.startOffset) || 0) + templateOffset; });
57
+ elementStartOffsets.forEach((offset) => {
58
58
  recorder.insertRight(offset, `<!-- ${insert_todo_1.TODO_MARK} ${comment} -->\n`);
59
59
  });
60
60
  });
@@ -63,9 +63,9 @@ function replaceBreadcrumbs({ resource, recorder, fileSystem, }) {
63
63
  const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
64
64
  const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
65
65
  const elements = (0, elements_1.findElementsByTagName)(template, 'tui-breadcrumbs');
66
- elements.forEach(element => {
66
+ elements.forEach((element) => {
67
67
  var _a, _b, _c, _d, _e;
68
- const itemsAttr = element.attrs.find(attr => attr.name === '[items]');
68
+ const itemsAttr = element.attrs.find((attr) => attr.name === '[items]');
69
69
  const itemsValue = itemsAttr === null || itemsAttr === void 0 ? void 0 : itemsAttr.value;
70
70
  const insertTo = (_c = (_b = (_a = element === null || element === void 0 ? void 0 : element.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.startTag) === null || _b === void 0 ? void 0 : _b.endOffset) !== null && _c !== void 0 ? _c : 0;
71
71
  if (!itemsValue || !insertTo) {
@@ -90,9 +90,9 @@ function replaceFieldError({ resource, recorder, fileSystem, }) {
90
90
  const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
91
91
  const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
92
92
  const elements = (0, elements_1.findElementsByTagName)(template, 'tui-field-error');
93
- elements.forEach(element => {
93
+ elements.forEach((element) => {
94
94
  var _a, _b;
95
- const orderAttr = element.attrs.find(attr => attr.name === '[order]');
95
+ const orderAttr = element.attrs.find((attr) => attr.name === '[order]');
96
96
  const orderVal = orderAttr === null || orderAttr === void 0 ? void 0 : orderAttr.value;
97
97
  if (orderAttr) {
98
98
  const { startOffset = 0, endOffset = 0 } = ((_b = (_a = element.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.attrs) === null || _b === void 0 ? void 0 : _b['[order]']) || {};
@@ -107,7 +107,7 @@ function replaceFieldError({ resource, recorder, fileSystem, }) {
107
107
  }
108
108
  function addEditorProviders({ resource, fileSystem, }) {
109
109
  const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
110
- const elements = (0, elements_1.findElementsByTagName)(template, 'tui-editor').filter(element => !(0, elements_1.hasElementAttribute)(element, 'new'));
110
+ const elements = (0, elements_1.findElementsByTagName)(template, 'tui-editor').filter((element) => !(0, elements_1.hasElementAttribute)(element, 'new'));
111
111
  if (elements.length) {
112
112
  const componentPath = resource.componentPath;
113
113
  const componentClass = (0, ng_morph_1.getNgComponents)(componentPath);
@@ -123,10 +123,10 @@ const HIDE_SELECTED_PIPE_WITH_ARGS_REG = /\|\s*tuiHideSelected(\s*:\s*[^|'"]*)?/
123
123
  function migrateTuiHideSelectedPipe({ resource, fileSystem, recorder, }) {
124
124
  const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
125
125
  const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
126
- const elementsWithPipe = (0, elements_1.findElementsInTemplateByFn)(template, el => { var _a; return (_a = el.attrs) === null || _a === void 0 ? void 0 : _a.some(attr => attr.value.match(HIDE_SELECTED_PIPE_WITH_ARGS_REG)); });
127
- elementsWithPipe.forEach(el => {
126
+ const elementsWithPipe = (0, elements_1.findElementsInTemplateByFn)(template, (el) => { var _a; return (_a = el.attrs) === null || _a === void 0 ? void 0 : _a.some((attr) => attr.value.match(HIDE_SELECTED_PIPE_WITH_ARGS_REG)); });
127
+ elementsWithPipe.forEach((el) => {
128
128
  var _a;
129
- const { name, value: oldValue } = el.attrs.find(attr => attr.value.match(HIDE_SELECTED_PIPE_WITH_ARGS_REG)) ||
129
+ const { name, value: oldValue } = el.attrs.find((attr) => attr.value.match(HIDE_SELECTED_PIPE_WITH_ARGS_REG)) ||
130
130
  {};
131
131
  const attrLocations = (_a = el.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.attrs;
132
132
  if (!name || !oldValue || !attrLocations) {
@@ -142,12 +142,12 @@ function migrateTuiHideSelectedPipe({ resource, fileSystem, recorder, }) {
142
142
  function migrateBinaryAttributes({ resource, fileSystem, recorder, }) {
143
143
  const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
144
144
  const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
145
- templates_1.TRUTHY_BOOLEAN_INPUT_TO_HTML_BINARY_ATTRIBUTE.forEach(attrName => {
146
- const elements = (0, elements_1.findElementsInTemplateByFn)(template, el => {
145
+ templates_1.TRUTHY_BOOLEAN_INPUT_TO_HTML_BINARY_ATTRIBUTE.forEach((attrName) => {
146
+ const elements = (0, elements_1.findElementsInTemplateByFn)(template, (el) => {
147
147
  var _a;
148
- return (_a = el.attrs) === null || _a === void 0 ? void 0 : _a.some(attr => attr.value === 'true' && attr.name.includes(attrName.toLowerCase()));
148
+ return (_a = el.attrs) === null || _a === void 0 ? void 0 : _a.some((attr) => attr.value === 'true' && attr.name.includes(attrName.toLowerCase()));
149
149
  });
150
- elements.forEach(el => {
150
+ elements.forEach((el) => {
151
151
  var _a;
152
152
  const attrLocations = (_a = el.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.attrs;
153
153
  if (!attrLocations) {
@@ -201,7 +201,7 @@ function migrateTemplates(fileSystem, options) {
201
201
  const progressLog = (0, progress_1.setupProgressLogger)({
202
202
  total: componentWithTemplatesPaths.length,
203
203
  });
204
- componentWithTemplatesPaths.forEach(resource => {
204
+ componentWithTemplatesPaths.forEach((resource) => {
205
205
  const path = fileSystem.resolve((0, template_resource_1.getPathFromTemplateResource)(resource));
206
206
  const recorder = fileSystem.edit(path);
207
207
  actions.forEach((action, actionIndex) => {
@@ -34,11 +34,11 @@ const ATTRS_MAP = {
34
34
  '[tuitextfieldtype]': '[attr.type]',
35
35
  '[tuitextfieldexampletext]': '[attr.placeholder]',
36
36
  };
37
- const CONTROLLER_ITEMS = Object.keys(ATTRS_MAP).map(attr => attr.toLowerCase());
37
+ const CONTROLLER_ITEMS = Object.keys(ATTRS_MAP).map((attr) => attr.toLowerCase());
38
38
  function insertTuiTextfieldInput({ element, attrs, recorder, templateOffset, }) {
39
39
  var _a, _b;
40
40
  const newAttrs = attrs
41
- .map(attr => `${ATTRS_MAP[attr.name]}="${attr.value}"`)
41
+ .map((attr) => `${ATTRS_MAP[attr.name]}="${attr.value}"`)
42
42
  .join('\n');
43
43
  const content = element.tagName === 'tui-text-area'
44
44
  ? `<textarea tuiTextfield ${newAttrs}></textarea> `
@@ -49,7 +49,7 @@ function insertTuiTextfieldInput({ element, attrs, recorder, templateOffset, })
49
49
  }
50
50
  }
51
51
  function addAttrToExistingInput({ existingInput, attrs, recorder, templateOffset, }) {
52
- attrs.forEach(attr => {
52
+ attrs.forEach((attr) => {
53
53
  var _a, _b, _c;
54
54
  const insertTo = (_c = (_b = (_a = existingInput.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.attrs) === null || _b === void 0 ? void 0 : _b.tuitextfield) === null || _c === void 0 ? void 0 : _c.endOffset;
55
55
  if (insertTo) {
@@ -58,14 +58,14 @@ function addAttrToExistingInput({ existingInput, attrs, recorder, templateOffset
58
58
  });
59
59
  }
60
60
  function removeOldInputs(recorder, template, templateOffset) {
61
- const offsets = (0, ng_morph_1.arrayFlat)(CONTROLLER_ITEMS.map(item => (0, ng_component_input_manipulations_1.getInputPropertyOffsets)(template, item, getTagsToRemove(item))));
61
+ const offsets = (0, ng_morph_1.arrayFlat)(CONTROLLER_ITEMS.map((item) => (0, ng_component_input_manipulations_1.getInputPropertyOffsets)(template, item, getTagsToRemove(item))));
62
62
  offsets.forEach(([start, end]) => {
63
63
  recorder.remove(start + templateOffset, end - start);
64
64
  });
65
65
  }
66
66
  function getTagsToRemove(attrName) {
67
67
  return ['[tuitextfieldmaxlength]', 'tuitextfieldmaxlength'].includes(attrName)
68
- ? TEXTFIELDS.filter(tag => tag !== 'tui-text-area')
68
+ ? TEXTFIELDS.filter((tag) => tag !== 'tui-text-area')
69
69
  : TEXTFIELDS;
70
70
  }
71
71
  const excludedAttrs = {
@@ -79,12 +79,12 @@ function migrateTextfieldController({ resource, fileSystem, recorder, }) {
79
79
  const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
80
80
  const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
81
81
  const elements = (0, elements_1.findElementsByTagNames)(template, TEXTFIELDS);
82
- elements.forEach(element => {
83
- const attrs = element.attrs.filter(attr => CONTROLLER_ITEMS.includes(attr.name) && !exclusion(element, attr.name));
82
+ elements.forEach((element) => {
83
+ const attrs = element.attrs.filter((attr) => CONTROLLER_ITEMS.includes(attr.name) && !exclusion(element, attr.name));
84
84
  if (!attrs.length) {
85
85
  return;
86
86
  }
87
- const existingInput = (0, elements_1.findElementsByFn)(element.childNodes, el => (el.tagName === 'input' || el.tagName === 'textarea') &&
87
+ const existingInput = (0, elements_1.findElementsByFn)(element.childNodes, (el) => (el.tagName === 'input' || el.tagName === 'textarea') &&
88
88
  (0, elements_1.hasElementAttribute)(el, 'tuiTextfield'))[0];
89
89
  if (existingInput) {
90
90
  addAttrToExistingInput({ existingInput, attrs, recorder, templateOffset });
@@ -7,7 +7,7 @@ const get_named_import_references_1 = require("../../../utils/get-named-import-r
7
7
  const insert_todo_1 = require("../../../utils/insert-todo");
8
8
  function addWarningToMethod(className, method, message) {
9
9
  const references = (0, get_named_import_references_1.getNamedImportReferences)(className);
10
- references.forEach(ref => {
10
+ references.forEach((ref) => {
11
11
  const parent = ref.getParent();
12
12
  if (ng_morph_1.Node.isTypeReference(parent)) {
13
13
  checkMethod(parent, method, message);
@@ -16,12 +16,12 @@ function addWarningToMethod(className, method, message) {
16
16
  }
17
17
  function replaceEnumProperty({ enumName, from, to, }) {
18
18
  const references = (0, get_named_import_references_1.getNamedImportReferences)(enumName);
19
- references.forEach(ref => {
19
+ references.forEach((ref) => {
20
20
  const parent = ref.getParent();
21
21
  if (!ng_morph_1.Node.isPropertyAccessExpression(parent)) {
22
22
  return;
23
23
  }
24
- parent.getChildren().forEach(node => {
24
+ parent.getChildren().forEach((node) => {
25
25
  if (node.getText() === from) {
26
26
  node.replaceWithText(to);
27
27
  }
@@ -31,7 +31,7 @@ function replaceEnumProperty({ enumName, from, to, }) {
31
31
  function checkMethod(node, method, message) {
32
32
  const statement = node.getParent();
33
33
  const identifier = statement.getChildrenOfKind(ng_morph_1.SyntaxKind.Identifier)[0];
34
- identifier.findReferencesAsNodes().forEach(ref => {
34
+ identifier.findReferencesAsNodes().forEach((ref) => {
35
35
  let parent = ref.getParent();
36
36
  if ((ng_morph_1.Node.isPropertyAccessExpression(parent) &&
37
37
  parent.getText().startsWith('this.')) ||
@@ -39,7 +39,7 @@ function checkMethod(node, method, message) {
39
39
  parent = parent.getParentIfKind(ng_morph_1.SyntaxKind.PropertyAccessExpression);
40
40
  }
41
41
  if (ng_morph_1.Node.isPropertyAccessExpression(parent)) {
42
- parent.getChildrenOfKind(ng_morph_1.SyntaxKind.Identifier).forEach(identifier => {
42
+ parent.getChildrenOfKind(ng_morph_1.SyntaxKind.Identifier).forEach((identifier) => {
43
43
  if (identifier.getText() === method) {
44
44
  (0, insert_todo_1.insertTodo)(identifier, message);
45
45
  }
@@ -8,7 +8,7 @@ const import_manipulations_1 = require("../../../utils/import-manipulations");
8
8
  const deprecated_functions_1 = require("../constants/deprecated-functions");
9
9
  function replaceDeprecatedFunction() {
10
10
  deprecated_functions_1.DEPRECATED_FUNCTIONS.forEach(({ from, to, moduleSpecifier }) => {
11
- (0, get_named_import_references_1.getNamedImportReferences)(from, moduleSpecifier).forEach(ref => {
11
+ (0, get_named_import_references_1.getNamedImportReferences)(from, moduleSpecifier).forEach((ref) => {
12
12
  if (ref.wasForgotten()) {
13
13
  return;
14
14
  }
@@ -20,7 +20,7 @@ function replaceDeprecatedFunction() {
20
20
  });
21
21
  }
22
22
  function replacePadStart(references) {
23
- references.forEach(ref => {
23
+ references.forEach((ref) => {
24
24
  var _a;
25
25
  const parent = ref.getParent();
26
26
  if (ng_morph_1.Node.isImportSpecifier(parent)) {
@@ -33,7 +33,7 @@ function replacePadStart(references) {
33
33
  });
34
34
  }
35
35
  function replaceNativeFocused(references) {
36
- references.forEach(ref => {
36
+ references.forEach((ref) => {
37
37
  const parent = ref.getParent();
38
38
  if (ng_morph_1.Node.isImportSpecifier(parent)) {
39
39
  (0, import_manipulations_1.removeImport)(parent);
@@ -48,7 +48,7 @@ function replaceNativeFocused(references) {
48
48
  });
49
49
  }
50
50
  function replaceClosestElement(references) {
51
- references.forEach(ref => {
51
+ references.forEach((ref) => {
52
52
  const parent = ref.getParent();
53
53
  if (ng_morph_1.Node.isImportSpecifier(parent)) {
54
54
  (0, import_manipulations_1.removeImport)(parent);
@@ -64,7 +64,7 @@ function replaceClosestElement(references) {
64
64
  });
65
65
  }
66
66
  function replaceCustomEvent(references) {
67
- references.forEach(ref => {
67
+ references.forEach((ref) => {
68
68
  const parent = ref.getParent();
69
69
  if (ng_morph_1.Node.isImportSpecifier(parent)) {
70
70
  (0, import_manipulations_1.removeImport)(parent);
@@ -76,7 +76,7 @@ function replaceCustomEvent(references) {
76
76
  });
77
77
  }
78
78
  function replaceFallbackValue(references) {
79
- references.forEach(ref => {
79
+ references.forEach((ref) => {
80
80
  const parent = ref.getParent();
81
81
  if (ng_morph_1.Node.isImportSpecifier(parent)) {
82
82
  (0, import_manipulations_1.removeImport)(parent);
@@ -92,12 +92,12 @@ function modifyFormatNumberArgs() {
92
92
  ...(0, get_named_import_references_1.getNamedImportReferences)('formatNumber', '@taiga-ui/core'),
93
93
  ...(0, get_named_import_references_1.getNamedImportReferences)('tuiFormatNumber', '@taiga-ui/core'),
94
94
  ]
95
- .map(ref => ref.getParent())
95
+ .map((ref) => ref.getParent())
96
96
  .filter(ng_morph_1.Node.isCallExpression)
97
- .forEach(fn => {
97
+ .forEach((fn) => {
98
98
  const args = fn.getArguments();
99
99
  if (args.length > 1) {
100
- const [value, decimalLimit = 'Infinity', decimalSeparator = "','", thousandSeparator = "'\u00A0'", zeroPadding = true,] = args.map(arg => arg.getText());
100
+ const [value, decimalLimit = 'Infinity', decimalSeparator = "','", thousandSeparator = "'\u00A0'", zeroPadding = true,] = args.map((arg) => arg.getText());
101
101
  const notNullDecimalLimit = decimalLimit === 'null' ? 'Infinity' : decimalLimit;
102
102
  const conditionalDecimalLimit = !Number.isNaN(Number(notNullDecimalLimit))
103
103
  ? notNullDecimalLimit
@@ -108,12 +108,12 @@ function modifyFormatNumberArgs() {
108
108
  }
109
109
  function modifyClosestFocusable() {
110
110
  (0, get_named_import_references_1.getNamedImportReferences)('tuiGetClosestFocusable', '@taiga-ui/cdk')
111
- .map(ref => ref.getParent())
111
+ .map((ref) => ref.getParent())
112
112
  .filter(ng_morph_1.Node.isCallExpression)
113
- .forEach(fn => {
113
+ .forEach((fn) => {
114
114
  const args = fn.getArguments();
115
115
  if (args.length > 1) {
116
- const [initial, prev = false, root, keyboard = true] = args.map(arg => arg.getText());
116
+ const [initial, prev = false, root, keyboard = true] = args.map((arg) => arg.getText());
117
117
  fn.replaceWithText(`tuiGetClosestFocusable({initial: ${initial}, root: ${root}, previous: ${prev}, keyboard: ${keyboard}})`);
118
118
  }
119
119
  });
@@ -10,7 +10,7 @@ exports.TUI_WARNING_NORMALIZE = `
10
10
  exports.TUI_WARNING_WRAPPER_MIXINS = '// TODO: (Taiga UI migration): use mixins to customize tuiWrapper. See https://taiga-ui.dev/wrapper';
11
11
  function replaceStyles() {
12
12
  var _a;
13
- (_a = (0, ng_morph_1.getActiveProject)()) === null || _a === void 0 ? void 0 : _a.getSourceFiles('**/**.less').forEach(sourceFile => {
13
+ (_a = (0, ng_morph_1.getActiveProject)()) === null || _a === void 0 ? void 0 : _a.getSourceFiles('**/**.less').forEach((sourceFile) => {
14
14
  let fullText = sourceFile.getFullText();
15
15
  if (fullText.includes('taiga-ui')) {
16
16
  breakpoints_1.DEPRECATED_BREAKPOINTS.forEach(({ from, to }) => {
@@ -26,7 +26,7 @@ function replaceStyles() {
26
26
  .replace('--tui-color-link', '--tui-link')
27
27
  .replaceAll("@import '~@taiga-ui", "@import '@taiga-ui")
28
28
  .replaceAll("@import '@taiga-ui/core/styles/taiga-ui-global", `${exports.TUI_WARNING_NORMALIZE}\n@import '@taiga-ui/styles/taiga-ui-global`)
29
- .replaceAll(/@import '@taiga-ui\/.+(.less)?';/g, val => `${val.replace("';", '')}.less';`.replace('.less.less', '.less'));
29
+ .replaceAll(/@import '@taiga-ui\/.+(.less)?';/g, (val) => `${val.replace("';", '')}.less';`.replace('.less.less', '.less'));
30
30
  sourceFile.replaceWithText(fullText);
31
31
  });
32
32
  }
@@ -2,31 +2,21 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateToV3_36 = void 0;
4
4
  const tasks_1 = require("@angular-devkit/schematics/tasks");
5
- const ng_morph_1 = require("ng-morph");
6
- const constants_1 = require("../../constants");
7
5
  const colored_log_1 = require("../../utils/colored-log");
8
- const get_file_system_1 = require("../utils/get-file-system");
9
- const replace_text_1 = require("../utils/replace-text");
6
+ const steps_1 = require("../steps");
10
7
  const OLD_PACKAGE = '@taiga-ui/addon-editor';
11
- const NEW_PACKAGE = '@tinkoff/tui-editor';
12
- const NEW_PACKAGE_VERSION = '^1.0.1';
8
+ const NEW_PACKAGE = '@taiga-ui/editor';
9
+ const NEW_PACKAGE_VERSION = '^2.0.0';
13
10
  // TODO: drop in v4.x
14
11
  function updateToV3_36(options) {
15
12
  return (tree, context) => {
16
- if (!(0, ng_morph_1.getPackageJsonDependency)(tree, OLD_PACKAGE)) {
17
- !options['skip-logs'] &&
18
- (0, colored_log_1.titleLog)(`${colored_log_1.FINISH_SYMBOL} No migrations required for ${OLD_PACKAGE}\n`);
19
- return;
20
- }
21
- const fileSystem = (0, get_file_system_1.getFileSystem)(tree);
22
13
  !options['skip-logs'] &&
23
14
  (0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} replacing imports for ${OLD_PACKAGE}...`);
24
- (0, replace_text_1.replaceText)([{ from: OLD_PACKAGE, to: NEW_PACKAGE }], constants_1.ALL_TS_FILES);
25
- (0, ng_morph_1.removePackageJsonDependency)(tree, OLD_PACKAGE);
26
- (0, ng_morph_1.addPackageJsonDependency)(tree, { name: NEW_PACKAGE, version: NEW_PACKAGE_VERSION });
15
+ (0, steps_1.replacePackageName)(OLD_PACKAGE, {
16
+ name: NEW_PACKAGE,
17
+ version: NEW_PACKAGE_VERSION,
18
+ }, tree);
27
19
  context.addTask(new tasks_1.NodePackageInstallTask());
28
- fileSystem.commitEdits();
29
- (0, ng_morph_1.saveActiveProject)();
30
20
  !options['skip-logs'] && (0, colored_log_1.titleLog)(`${colored_log_1.FINISH_SYMBOL} successfully migrated \n`);
31
21
  };
32
22
  }
@@ -14,7 +14,7 @@ const replace_tag_1 = require("../utils/templates/replace-tag");
14
14
  function replaceTextareaTag(options, fileSystem) {
15
15
  !options['skip-logs'] &&
16
16
  (0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} replacing <tui-text-area /> to <tui-textarea />`);
17
- (0, get_component_templates_1.getComponentTemplates)(constants_1.ALL_TS_FILES).forEach(resource => {
17
+ (0, get_component_templates_1.getComponentTemplates)(constants_1.ALL_TS_FILES).forEach((resource) => {
18
18
  const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
19
19
  const elements = (0, elements_1.findElementsByTagName)(template, 'tui-text-area');
20
20
  const path = fileSystem.resolve((0, template_resource_1.getPathFromTemplateResource)(resource));
@@ -11,13 +11,13 @@ function migrateExpand({ resource, recorder, fileSystem, }) {
11
11
  const template = (0, template_resource_1.getTemplateFromTemplateResource)(resource, fileSystem);
12
12
  const templateOffset = (0, template_resource_1.getTemplateOffset)(resource);
13
13
  const elements = (0, elements_1.findElementsByTagName)(template, 'tui-expand');
14
- elements.forEach(element => {
14
+ elements.forEach((element) => {
15
15
  var _a, _b, _c;
16
- const templateElement = (0, elements_1.findElementsByFn)(element.childNodes, el => el.tagName === 'ng-template')[0];
16
+ const templateElement = (0, elements_1.findElementsByFn)(element.childNodes, (el) => el.tagName === 'ng-template')[0];
17
17
  if (!templateElement) {
18
18
  return;
19
19
  }
20
- const tuiExpandAttr = templateElement.attrs.find(attr => attr.name === 'tuiexpandcontent');
20
+ const tuiExpandAttr = templateElement.attrs.find((attr) => attr.name === 'tuiexpandcontent');
21
21
  const insertTo = (_c = (_b = (_a = templateElement === null || templateElement === void 0 ? void 0 : templateElement.sourceCodeLocation) === null || _a === void 0 ? void 0 : _a.startTag) === null || _b === void 0 ? void 0 : _b.endOffset) !== null && _c !== void 0 ? _c : 0;
22
22
  if (!insertTo || tuiExpandAttr) {
23
23
  return;
@@ -32,7 +32,7 @@ function migrateExpandTemplates(fileSystem, options) {
32
32
  const progressLog = (0, progress_1.setupProgressLogger)({
33
33
  total: componentWithTemplatesPaths.length,
34
34
  });
35
- componentWithTemplatesPaths.forEach(resource => {
35
+ componentWithTemplatesPaths.forEach((resource) => {
36
36
  const path = fileSystem.resolve((0, template_resource_1.getPathFromTemplateResource)(resource));
37
37
  const recorder = fileSystem.edit(path);
38
38
  !options['skip-logs'] && progressLog('expand migration', true);
@@ -13,27 +13,30 @@ const get_file_system_1 = require("../utils/get-file-system");
13
13
  const enums_1 = require("../v4/steps/constants/enums");
14
14
  const steps_2 = require("./steps");
15
15
  const constants_1 = require("./steps/constants");
16
+ const modules_to_replace_1 = require("./steps/constants/modules-to-replace");
16
17
  const types_1 = require("./steps/constants/types");
17
- const migrate_option_providers_1 = require("./steps/migrate-option-providers");
18
- const migrate_proprietary_1 = require("./steps/migrate-proprietary");
19
- const migrate_styles_1 = require("./steps/migrate-styles");
18
+ const replace_modules_with_providers_1 = require("./steps/utils/replace-modules-with-providers");
20
19
  function main(options) {
21
20
  return (tree, context) => {
22
21
  const fileSystem = (0, get_file_system_1.getFileSystem)(tree);
23
22
  (0, steps_1.replaceIdentifiers)(options, constants_1.IDENTIFIERS_TO_REPLACE);
24
23
  (0, steps_1.removeModules)(options, constants_1.MODULES_TO_REMOVE);
24
+ (0, replace_modules_with_providers_1.replaceModulesWithProviders)(options, modules_to_replace_1.MODULES_TO_REPLACE_WITH_PROVIDERS);
25
25
  (0, steps_1.renameTypes)(options, types_1.TYPES_TO_RENAME);
26
26
  (0, steps_2.restoreTuiMapper)(options);
27
27
  (0, steps_2.restoreTuiMatcher)(options);
28
28
  (0, steps_2.migrateLegacyMask)(options);
29
29
  (0, steps_2.migrateDestroyService)(options);
30
- (0, migrate_option_providers_1.migrateOptionProviders)(options);
30
+ (0, steps_2.migrateOptionProviders)(options);
31
31
  (0, steps_2.migrateAllCountryIsoCodes)(options);
32
32
  (0, steps_1.replaceEnums)(options, enums_1.ENUMS_TO_REPLACE);
33
33
  (0, steps_2.migrateTemplates)(fileSystem, options);
34
- (0, migrate_styles_1.migrateStyles)();
35
34
  (0, steps_1.showWarnings)(context, constants_1.MIGRATION_WARNINGS);
36
- (0, migrate_proprietary_1.migrateProprietary)(fileSystem, options);
35
+ fileSystem.commitEdits();
36
+ (0, ng_morph_1.saveActiveProject)();
37
+ (0, steps_2.migrateStyles)();
38
+ (0, steps_2.migrateProprietary)(fileSystem, options);
39
+ (0, steps_2.updatePackages)(fileSystem, options);
37
40
  fileSystem.commitEdits();
38
41
  (0, ng_morph_1.saveActiveProject)();
39
42
  context.addTask(new tasks_1.NodePackageInstallTask());
@@ -55,8 +55,6 @@ export declare const DEPRECATED_VARS: {
55
55
  '--tui-positive-hover': string;
56
56
  '--tui-negative': string;
57
57
  '--tui-negative-hover': string;
58
- '--tui-support-': string;
59
- '--tui-chart-': string;
60
58
  '--tui-clear-inverse': string;
61
59
  '--tui-clear-inverse-hover': string;
62
60
  '--tui-clear-inverse-active': string;
@@ -84,6 +82,17 @@ export declare const DEPRECATED_VARS: {
84
82
  '--tui-positive-night-hover': string;
85
83
  '--tui-negative-night': string;
86
84
  '--tui-negative-night-hover': string;
85
+ '--tui-shadow': string;
86
+ '--tui-shadow-hover': string;
87
+ '--tui-shadow-dropdown': string;
88
+ '--tui-shadow-modal': string;
89
+ '--tui-shadow-sidebar': string;
90
+ '--tui-shadow-navigation': string;
91
+ '--tui-shadow-sheet': string;
92
+ };
93
+ export declare const DEPRECATED_NUMERIC_VARS: {
94
+ '--tui-chart-': string;
95
+ '--tui-support-': string;
87
96
  };
88
97
  export declare const NIGHT_VAR_COMMENT = "TODO: use tuiTheme=\"dark\" on an element to switch colors to dark theme";
89
98
  export declare const DEPRECATE_VARS_WITH_COMMENT: string[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEPRECATE_VARS_WITH_COMMENT = exports.NIGHT_VAR_COMMENT = exports.DEPRECATED_VARS = void 0;
3
+ exports.DEPRECATE_VARS_WITH_COMMENT = exports.NIGHT_VAR_COMMENT = exports.DEPRECATED_NUMERIC_VARS = exports.DEPRECATED_VARS = void 0;
4
4
  exports.DEPRECATED_VARS = {
5
5
  '--tui-font-text-l-2': '--tui-font-text-ui-l',
6
6
  '--tui-font-text-m-2': '--tui-font-text-ui-m',
@@ -26,7 +26,7 @@ exports.DEPRECATED_VARS = {
26
26
  '--tui-accent-hover': '--tui-background-accent-2-hover',
27
27
  '--tui-accent-active': '--tui-background-accent-2-pressed',
28
28
  '--tui-accent-text': '--tui-text-primary-on-accent-2',
29
- '--tui-selection': '--tui-service-selected-text',
29
+ '--tui-selection': '--tui-service-selection-background',
30
30
  '--tui-focus': '--tui-border-focus',
31
31
  '--tui-clear': '--tui-background-neutral-1',
32
32
  '--tui-clear-disabled': '--tui-background-neutral-1',
@@ -54,12 +54,10 @@ exports.DEPRECATED_VARS = {
54
54
  '--tui-text-03': '--tui-text-tertiary',
55
55
  '--tui-link': '--tui-text-action',
56
56
  '--tui-link-hover': '--tui-text-action-hover',
57
- '--tui-positive': '--tui-status-positive',
58
- '--tui-positive-hover': '--tui-status-positive',
59
- '--tui-negative': '--tui-status-negative',
60
- '--tui-negative-hover': '--tui-status-negative',
61
- '--tui-support-': '--tui-chart-categorical-',
62
- '--tui-chart-': '--tui-chart-categorical-0',
57
+ '--tui-positive': '--tui-text-positive',
58
+ '--tui-positive-hover': '--tui-text-positive-hover',
59
+ '--tui-negative': '--tui-text-negative',
60
+ '--tui-negative-hover': '--tui-text-negative-hover',
63
61
  '--tui-clear-inverse': '--tui-background-neutral-1',
64
62
  '--tui-clear-inverse-hover': '--tui-background-neutral-1-hover',
65
63
  '--tui-clear-inverse-active': '--tui-background-neutral-1-pressed',
@@ -87,6 +85,18 @@ exports.DEPRECATED_VARS = {
87
85
  '--tui-positive-night-hover': '--tui-status-positive',
88
86
  '--tui-negative-night': '--tui-status-negative',
89
87
  '--tui-negative-night-hover': '--tui-status-negative',
88
+ '--tui-shadow': 'var(--tui-shadow-small)',
89
+ '--tui-shadow-hover': 'var(--tui-shadow-small-hover)',
90
+ '--tui-shadow-dropdown': 'var(--tui-shadow-medium)',
91
+ '--tui-shadow-modal': 'var(--tui-shadow-popup)',
92
+ '--tui-shadow-sidebar': 'var(--tui-shadow-medium)',
93
+ '--tui-shadow-navigation': 'var(--tui-shadow-small)',
94
+ '--tui-shadow-sheet': 'var(--tui-shadow-popup)',
95
+ };
96
+ // warning: order is important
97
+ exports.DEPRECATED_NUMERIC_VARS = {
98
+ '--tui-chart-': '--tui-chart-categorical-0',
99
+ '--tui-support-': '--tui-chart-categorical-',
90
100
  };
91
101
  exports.NIGHT_VAR_COMMENT = 'TODO: use tuiTheme="dark" on an element to switch colors to dark theme';
92
102
  exports.DEPRECATE_VARS_WITH_COMMENT = [
@@ -7,11 +7,11 @@ const constants_1 = require("../../../constants");
7
7
  const palette_1 = require("./palette");
8
8
  function renameCssVars(pattern = constants_1.ALL_FILES) {
9
9
  const sourceFiles = (0, ng_morph_1.getSourceFiles)(pattern);
10
- sourceFiles.forEach(file => {
10
+ sourceFiles.forEach((file) => {
11
11
  let text = file.getFullText();
12
12
  // leave comments
13
13
  if (!file.getFilePath().endsWith('html')) {
14
- palette_1.DEPRECATE_VARS_WITH_COMMENT.forEach(variable => {
14
+ palette_1.DEPRECATE_VARS_WITH_COMMENT.forEach((variable) => {
15
15
  const wordRegex = new RegExp(`(^|\\n)(?=[^\\n]*\\b${variable}\\b)`, 'g');
16
16
  text = text.replaceAll(wordRegex, `$1// ${palette_1.NIGHT_VAR_COMMENT}\n`);
17
17
  });
@@ -25,6 +25,14 @@ function renameCssVars(pattern = constants_1.ALL_FILES) {
25
25
  .forEach(({ from, to }) => {
26
26
  text = text.replaceAll(from, to);
27
27
  });
28
+ Object.entries(palette_1.DEPRECATED_NUMERIC_VARS)
29
+ .map(([from, to]) => ({
30
+ from: new RegExp(`${from}`, 'g'),
31
+ to,
32
+ }))
33
+ .forEach(({ from, to }) => {
34
+ text = text.replaceAll(from, to);
35
+ });
28
36
  file.replaceWithText(text);
29
37
  });
30
38
  }
@@ -6,17 +6,19 @@ const ng_morph_1 = require("ng-morph");
6
6
  const colored_log_1 = require("../../../utils/colored-log");
7
7
  const get_file_system_1 = require("../../utils/get-file-system");
8
8
  const rename_icons_1 = require("./rename-icons");
9
+ const rename_proprietary_icons_1 = require("./rename-proprietary-icons");
9
10
  function migrateIcons(options) {
10
11
  return (0, schematics_1.chain)([
11
12
  (tree, _) => {
12
- if (hasProprietaryIcons(tree)) {
13
- // TODO: add proprietary-icons migration
14
- return;
15
- }
16
13
  const fileSystem = (0, get_file_system_1.getFileSystem)(tree);
17
14
  !options['skip-logs'] &&
18
- (0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} replacing strings...`);
19
- (0, rename_icons_1.renameIcons)();
15
+ (0, colored_log_1.infoLog)(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.REPLACE_SYMBOL} replacing icons...`);
16
+ if (hasProprietaryIcons(tree)) {
17
+ (0, rename_proprietary_icons_1.renameProprietaryIcons)();
18
+ }
19
+ else {
20
+ (0, rename_icons_1.renameIcons)();
21
+ }
20
22
  fileSystem.commitEdits();
21
23
  (0, ng_morph_1.saveActiveProject)();
22
24
  !options['skip-logs'] &&
@@ -20,7 +20,7 @@ const CHANGED_ICONS = [
20
20
  ];
21
21
  function renameIcons(pattern = constants_1.ALL_FILES) {
22
22
  const sourceFiles = (0, ng_morph_1.getSourceFiles)(pattern);
23
- sourceFiles.forEach(file => {
23
+ sourceFiles.forEach((file) => {
24
24
  let text = file.getFullText();
25
25
  CHANGED_ICONS.map(({ from, to }) => ({
26
26
  from: new RegExp(`\\b${from}\\b`, 'g'),
@@ -29,7 +29,7 @@ function renameIcons(pattern = constants_1.ALL_FILES) {
29
29
  text = text.replaceAll(from, to);
30
30
  });
31
31
  const regex = /\btuiIcon(?!Button\b)[A-Z][a-zA-Z0-9]*\b/g;
32
- text = text.replaceAll(regex, match => convertString(match));
32
+ text = text.replaceAll(regex, (match) => convertString(match));
33
33
  file.replaceWithText(text);
34
34
  });
35
35
  }
@@ -0,0 +1,2 @@
1
+ /// <reference lib="es2021" />
2
+ export declare function renameProprietaryIcons(pattern?: import("ng-morph").Pattern): void;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renameProprietaryIcons = void 0;
4
+ /// <reference lib="es2021" />
5
+ const ng_morph_1 = require("ng-morph");
6
+ const constants_1 = require("../../../constants");
7
+ function renameProprietaryIcons(pattern = constants_1.ALL_FILES) {
8
+ const sourceFiles = (0, ng_morph_1.getSourceFiles)(pattern);
9
+ sourceFiles.forEach((file) => {
10
+ let text = file.getFullText();
11
+ const regex = /\btuiIcon(?!Button\b)[A-Z][a-zA-Z0-9]*\b/g;
12
+ text = text.replaceAll(regex, (match) => convertString(match));
13
+ file.replaceWithText(text);
14
+ });
15
+ }
16
+ exports.renameProprietaryIcons = renameProprietaryIcons;
17
+ function convertString(input) {
18
+ const result = input
19
+ .replace(/^tuiIconTds/, '')
20
+ .replace(/SmallPragmatic$/, '')
21
+ .replace(/MediumPragmatic$/, '')
22
+ .replace(/Small$/, '')
23
+ .replace(/Medium$/, '')
24
+ .replace(/Flags$/, '')
25
+ .replace(/Service$/, '')
26
+ .replace(/Logo$/, '')
27
+ .replace(/LogoSiteheader$/, '')
28
+ .replace(/LogoSquare$/, '')
29
+ .replaceAll(/([A-Z0-9])/g, '-$1')
30
+ .toLowerCase();
31
+ const pack = extractPackName(input);
32
+ const subfolder = extractSubfolder(input);
33
+ return `@tui.${pack}${subfolder ? `.${subfolder}` : ''}.${result.startsWith('-') ? result.slice(1) : result}`;
34
+ }
35
+ function extractPackName(input) {
36
+ if (input.endsWith('Pragmatic')) {
37
+ return 'pragmatic';
38
+ }
39
+ if (input.endsWith('Service')) {
40
+ return 'service';
41
+ }
42
+ if (input.endsWith('Logo') ||
43
+ input.endsWith('LogoSquare') ||
44
+ input.endsWith('LogoSiteheader')) {
45
+ return 'logo';
46
+ }
47
+ if (input.endsWith('Flags')) {
48
+ return 'flags';
49
+ }
50
+ return 'fancy';
51
+ }
52
+ function extractSubfolder(input) {
53
+ if (input.includes('Medium')) {
54
+ return 'medium';
55
+ }
56
+ if (input.includes('Small')) {
57
+ return 'small';
58
+ }
59
+ if (input.includes('LogoSquare')) {
60
+ return 'square';
61
+ }
62
+ if (input.includes('LogoSiteheader')) {
63
+ return 'siteheader';
64
+ }
65
+ return null;
66
+ }