@taiga-ui/cdk 3.0.0-rc.6 → 3.1.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 (45) hide show
  1. package/bundles/taiga-ui-cdk-abstract.umd.js.map +1 -1
  2. package/bundles/taiga-ui-cdk-constants.umd.js +7 -2
  3. package/bundles/taiga-ui-cdk-constants.umd.js.map +1 -1
  4. package/bundles/taiga-ui-cdk-date-time.umd.js.map +1 -1
  5. package/bundles/taiga-ui-cdk-tokens.umd.js +4 -1
  6. package/bundles/taiga-ui-cdk-tokens.umd.js.map +1 -1
  7. package/bundles/taiga-ui-cdk-utils-dom.umd.js +6 -1
  8. package/bundles/taiga-ui-cdk-utils-dom.umd.js.map +1 -1
  9. package/constants/empty.d.ts +1 -1
  10. package/constants/version.d.ts +1 -1
  11. package/constants/version.js +1 -1
  12. package/esm2015/abstract/control.js +1 -1
  13. package/esm2015/constants/empty.js +7 -2
  14. package/esm2015/constants/version.js +2 -2
  15. package/esm2015/date-time/day-range.js +1 -1
  16. package/esm2015/date-time/day.js +1 -1
  17. package/esm2015/date-time/month.js +1 -1
  18. package/esm2015/tokens/is-webkit.js +5 -2
  19. package/esm2015/utils/dom/point-to-client-rect.js +7 -2
  20. package/fesm2015/taiga-ui-cdk-abstract.js.map +1 -1
  21. package/fesm2015/taiga-ui-cdk-constants.js +7 -2
  22. package/fesm2015/taiga-ui-cdk-constants.js.map +1 -1
  23. package/fesm2015/taiga-ui-cdk-date-time.js.map +1 -1
  24. package/fesm2015/taiga-ui-cdk-tokens.js +4 -1
  25. package/fesm2015/taiga-ui-cdk-tokens.js.map +1 -1
  26. package/fesm2015/taiga-ui-cdk-utils-dom.js +6 -1
  27. package/fesm2015/taiga-ui-cdk-utils-dom.js.map +1 -1
  28. package/package.json +6 -4
  29. package/schematics/constants/file-globs.d.ts +3 -2
  30. package/schematics/constants/file-globs.js +8 -3
  31. package/schematics/ng-update/index.js +15 -1
  32. package/schematics/ng-update/steps/migrate-progress.js +1 -1
  33. package/schematics/ng-update/steps/migrate-sliders/migrate-input-range.js +17 -1
  34. package/schematics/ng-update/steps/migrate-sliders/migrate-input-slider.js +12 -1
  35. package/schematics/ng-update/steps/migrate-templates.js +5 -4
  36. package/schematics/ng-update/steps/migrate-textfield-controller.js +2 -2
  37. package/schematics/ng-update/steps/replace-styles.d.ts +1 -0
  38. package/schematics/ng-update/steps/replace-styles.js +6 -2
  39. package/schematics/utils/colored-log.d.ts +1 -1
  40. package/schematics/utils/colored-log.js +1 -1
  41. package/schematics/utils/get-project.d.ts +2 -2
  42. package/schematics/utils/get-project.js +7 -4
  43. package/schematics/utils/progress.d.ts +5 -1
  44. package/schematics/utils/progress.js +16 -9
  45. package/utils/dom/point-to-client-rect.d.ts +1 -1
@@ -17,7 +17,7 @@ function migrateProgress(fileSystem) {
17
17
  }
18
18
  fileSystem.commitEdits();
19
19
  ng_morph_1.saveActiveProject();
20
- ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, '/', '**/**'));
20
+ ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, '/', constants_1.ALL_FILES));
21
21
  colored_log_1.successLog(`${colored_log_1.SMALL_TAB_SYMBOL}${colored_log_1.SUCCESS_SYMBOL} progress bars migrated \n`);
22
22
  }
23
23
  exports.migrateProgress = migrateProgress;
@@ -7,18 +7,29 @@ const ng_morph_1 = require("ng-morph");
7
7
  const ng_component_1 = require("../../../utils/angular/ng-component");
8
8
  const add_unique_import_1 = require("../../../utils/add-unique-import");
9
9
  const constants_1 = require("../../../constants");
10
+ const progress_1 = require("../../../utils/progress");
10
11
  const MIN_LABELS_MIGRATION_METHOD_NAME = 'tuiMigrationInputRangeMinLabel';
11
12
  const MAX_LABELS_MIGRATION_METHOD_NAME = 'tuiMigrationInputRangeMaxLabel';
12
13
  function migrateInputRange(fileSystem) {
13
14
  const templateResources = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
14
15
  const COMPONENTS_WITH_MIN_LABELS = new Set();
15
16
  const COMPONENTS_WITH_MAX_LABELS = new Set();
17
+ let progressLog = progress_1.setupProgressLogger({
18
+ total: templateResources.length,
19
+ prefix: '[replaceMinMaxLabel]',
20
+ });
16
21
  for (const templateResource of templateResources) {
22
+ progressLog(templateResource.componentPath);
17
23
  replaceMinLabel(templateResource, fileSystem, COMPONENTS_WITH_MIN_LABELS);
18
24
  replaceMaxLabel(templateResource, fileSystem, COMPONENTS_WITH_MAX_LABELS);
19
25
  }
20
26
  save(fileSystem);
27
+ progressLog = progress_1.setupProgressLogger({
28
+ total: COMPONENTS_WITH_MIN_LABELS.size,
29
+ prefix: '[COMPONENTS_WITH_MIN_LABELS]',
30
+ });
21
31
  for (const componentPath of Array.from(COMPONENTS_WITH_MIN_LABELS)) {
32
+ progressLog(componentPath);
22
33
  addMinMaxLabelMethod(componentPath, MIN_LABELS_MIGRATION_METHOD_NAME, [
23
34
  'const currentValue = context.$implicit;',
24
35
  'const minValue = 0; // TODO: (Taiga UI migration) replace with the MIN value of the input-range',
@@ -27,7 +38,12 @@ function migrateInputRange(fileSystem) {
27
38
  'return String(currentValue);',
28
39
  ]);
29
40
  }
41
+ progressLog = progress_1.setupProgressLogger({
42
+ total: COMPONENTS_WITH_MAX_LABELS.size,
43
+ prefix: '[COMPONENTS_WITH_MAX_LABELS]',
44
+ });
30
45
  for (const componentPath of Array.from(COMPONENTS_WITH_MAX_LABELS)) {
46
+ progressLog(componentPath);
31
47
  addMinMaxLabelMethod(componentPath, MAX_LABELS_MIGRATION_METHOD_NAME, [
32
48
  'const currentValue = context.$implicit;',
33
49
  'const maxValue = 100; // TODO: (Taiga UI migration) replace with the MAX value of the input',
@@ -83,5 +99,5 @@ function addMinMaxLabelMethod(componentPath, methodName, methodCode) {
83
99
  function save(fileSystem) {
84
100
  fileSystem.commitEdits();
85
101
  ng_morph_1.saveActiveProject();
86
- ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, '/', '**/**'));
102
+ ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, '/', constants_1.ALL_FILES));
87
103
  }
@@ -8,10 +8,16 @@ const add_unique_import_1 = require("../../../utils/add-unique-import");
8
8
  const get_component_templates_1 = require("../../../utils/templates/get-component-templates");
9
9
  const elements_1 = require("../../../utils/templates/elements");
10
10
  const constants_1 = require("../../../constants");
11
+ const progress_1 = require("../../../utils/progress");
11
12
  function migrateInputSlider(fileSystem) {
12
13
  const templateResources = get_component_templates_1.getComponentTemplates(constants_1.ALL_TS_FILES);
13
14
  const COMPONENTS_WITH_MIN_MAX_LABELS = new Set();
15
+ let progressLog = progress_1.setupProgressLogger({
16
+ total: templateResources.length,
17
+ prefix: '[replaceMinMaxLabels]',
18
+ });
14
19
  for (const templateResource of templateResources) {
20
+ progressLog(templateResource.componentPath);
15
21
  replaceMinMaxLabels(templateResource, fileSystem, COMPONENTS_WITH_MIN_MAX_LABELS);
16
22
  }
17
23
  /**
@@ -20,8 +26,13 @@ function migrateInputSlider(fileSystem) {
20
26
  * */
21
27
  fileSystem.commitEdits();
22
28
  ng_morph_1.saveActiveProject();
23
- ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, '/', '**/**'));
29
+ ng_morph_1.setActiveProject(ng_morph_1.createProject(fileSystem.tree, '/', constants_1.ALL_FILES));
30
+ progressLog = progress_1.setupProgressLogger({
31
+ total: COMPONENTS_WITH_MIN_MAX_LABELS.size,
32
+ prefix: '[addMinMaxLabelMethod]',
33
+ });
24
34
  for (const componentPath of Array.from(COMPONENTS_WITH_MIN_MAX_LABELS)) {
35
+ progressLog(componentPath);
25
36
  addMinMaxLabelMethod(componentPath);
26
37
  }
27
38
  }
@@ -36,14 +36,15 @@ function migrateTemplates(fileSystem) {
36
36
  migrateBinaryAttributes,
37
37
  addWarningForFormatNumberPipe,
38
38
  ];
39
- componentWithTemplatesPaths.forEach((resource, templateIndex, templates) => {
39
+ const progressLog = progress_1.setupProgressLogger({
40
+ total: componentWithTemplatesPaths.length,
41
+ });
42
+ componentWithTemplatesPaths.forEach(resource => {
40
43
  const path = fileSystem.resolve(template_resource_1.getPathFromTemplateResource(resource));
41
44
  const recorder = fileSystem.edit(path);
42
- const isLastTemplate = templateIndex === templates.length - 1;
43
45
  actions.forEach((action, actionIndex) => {
44
46
  const isLastAction = actionIndex === actions.length - 1;
45
- const progressLog = `${templateIndex + 1} / ${templates.length} (${action.name}...)`;
46
- progress_1.printProgress(`${colored_log_1.SMALL_TAB_SYMBOL.repeat(2)}${progressLog}`, isLastTemplate && isLastAction);
47
+ progressLog(action.name, isLastAction);
47
48
  action({ resource, fileSystem, recorder });
48
49
  });
49
50
  });
@@ -24,12 +24,12 @@ const TEXTFIELDS = [
24
24
  ];
25
25
  const ATTRS_MAP = {
26
26
  tuitextfieldautocomplete: 'autocomplete',
27
- tuitextfieldinputMode: 'inputmode',
27
+ tuitextfieldinputmode: 'inputmode',
28
28
  tuitextfieldmaxlength: 'maxlength',
29
29
  tuitextfieldtype: 'type',
30
30
  tuitextfieldexampletext: 'placeholder',
31
31
  '[tuitextfieldautocomplete]': '[attr.autocomplete]',
32
- '[tuitextfieldinputMode]': '[attr.inputmode]',
32
+ '[tuitextfieldinputmode]': '[attr.inputmode]',
33
33
  '[tuitextfieldmaxlength]': '[attr.maxlength]',
34
34
  '[tuitextfieldtype]': '[attr.type]',
35
35
  '[tuitextfieldexampletext]': '[attr.placeholder]',
@@ -1 +1,2 @@
1
+ export declare const TUI_WARNING_NORMALIZE = "\n// [WARNING]: In version 3.0 we drop to support normalize(v7) out-of-the-box\n// You need to manually download css file from https://necolas.github.io/normalize.css/\n// If you're looking to use reset styles or you can write your own reset.css";
1
2
  export declare function replaceStyles(): void;
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.replaceStyles = void 0;
3
+ exports.replaceStyles = exports.TUI_WARNING_NORMALIZE = void 0;
4
4
  const ng_morph_1 = require("ng-morph");
5
5
  const breakpoints_1 = require("../constants/breakpoints");
6
+ exports.TUI_WARNING_NORMALIZE = `
7
+ // [WARNING]: In version 3.0 we drop to support normalize(v7) out-of-the-box
8
+ // You need to manually download css file from https://necolas.github.io/normalize.css/
9
+ // If you're looking to use reset styles or you can write your own reset.css`;
6
10
  function replaceStyles() {
7
11
  var _a;
8
12
  (_a = ng_morph_1.getActiveProject()) === null || _a === void 0 ? void 0 : _a.getSourceFiles('**/**.less').forEach(sourceFile => {
@@ -12,7 +16,7 @@ function replaceStyles() {
12
16
  fullText = fullText.replaceAll(new RegExp(`(?<=@media.*)(${from})(?=[\\s,{])`, 'g'), to);
13
17
  });
14
18
  }
15
- sourceFile.replaceWithText(fullText.replace(`@import '~@taiga-ui/core/styles/taiga-ui-global';`, `@import '~@taiga-ui/styles/taiga-ui-global';`));
19
+ sourceFile.replaceWithText(fullText.replace(`@import '~@taiga-ui/core/styles/taiga-ui-global';`, `${exports.TUI_WARNING_NORMALIZE}\n@import '~@taiga-ui/styles/taiga-ui-global';`));
16
20
  });
17
21
  }
18
22
  exports.replaceStyles = replaceStyles;
@@ -7,5 +7,5 @@ export declare const SMALL_TAB_SYMBOL = " ";
7
7
  export declare const START_SYMBOL = "\uD83D\uDE80";
8
8
  export declare const FINISH_SYMBOL = "\uD83C\uDFC6";
9
9
  export declare const REPLACE_SYMBOL = "\u26A1\uFE0F";
10
- export declare const PROCESSING_SYMBOL = "\u2611\uFE0F ";
10
+ export declare const PROCESSING_SYMBOL = "> ";
11
11
  export declare const SUCCESS_SYMBOL = "\u2705 ";
@@ -25,5 +25,5 @@ exports.SMALL_TAB_SYMBOL = ` `; // @note: if you use \t then we have big gaps
25
25
  exports.START_SYMBOL = `🚀`;
26
26
  exports.FINISH_SYMBOL = `🏆`;
27
27
  exports.REPLACE_SYMBOL = `⚡️`;
28
- exports.PROCESSING_SYMBOL = `☑️ `;
28
+ exports.PROCESSING_SYMBOL = `> `;
29
29
  exports.SUCCESS_SYMBOL = `✅ `;
@@ -1,3 +1,3 @@
1
- import { workspaces } from '@angular-devkit/core';
2
1
  import { Schema } from '../ng-add/schema';
3
- export declare function getProject(options: Schema, workspace: workspaces.WorkspaceDefinition): workspaces.ProjectDefinition | undefined;
2
+ import { ProjectDefinition, WorkspaceDefinition } from '@angular-devkit/core/src/workspace';
3
+ export declare function getProject(options: Schema, workspace: WorkspaceDefinition): ProjectDefinition | undefined;
@@ -2,9 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getProject = void 0;
4
4
  function getProject(options, workspace) {
5
- var _a;
6
- const projectName = options.project || ((_a = workspace.extensions.defaultProject) === null || _a === void 0 ? void 0 : _a.toString()) || '';
7
- const project = workspace.projects.get(projectName);
8
- return project;
5
+ var _a, _b;
6
+ const firstProjectName = (_a = Array.from(workspace.projects.keys())) === null || _a === void 0 ? void 0 : _a[0];
7
+ const projectName = options.project ||
8
+ ((_b = workspace.extensions.defaultProject) === null || _b === void 0 ? void 0 : _b.toString()) ||
9
+ firstProjectName ||
10
+ '';
11
+ return workspace.projects.get(projectName);
9
12
  }
10
13
  exports.getProject = getProject;
@@ -1 +1,5 @@
1
- export declare function printProgress(progressLog: string, isLastLog?: boolean): void;
1
+ export declare function setupProgressLogger({ total, prefix, tabs, }: {
2
+ total: number;
3
+ prefix?: string;
4
+ tabs?: number;
5
+ }): (message: string, incrementIndex?: boolean) => void;
@@ -1,13 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.printProgress = void 0;
3
+ exports.setupProgressLogger = void 0;
4
4
  const readline_1 = require("readline");
5
- function printProgress(progressLog, isLastLog = false) {
6
- readline_1.clearLine(process.stdout, 0);
7
- readline_1.cursorTo(process.stdout, 0);
8
- process.stdout.write(progressLog);
9
- if (isLastLog) {
10
- process.stdout.write('\n');
11
- }
5
+ const colored_log_1 = require("./colored-log");
6
+ function setupProgressLogger({ total, prefix = '', tabs = 2, }) {
7
+ let i = 1;
8
+ return (message, incrementIndex = true) => {
9
+ const isLast = i === total;
10
+ const progressLog = `(${i} / ${total}) ${prefix} ${isLast ? colored_log_1.SUCCESS_SYMBOL : message}`;
11
+ i = incrementIndex ? i + 1 : i;
12
+ readline_1.clearLine(process.stdout, 0);
13
+ readline_1.cursorTo(process.stdout, 0);
14
+ process.stdout.write(colored_log_1.SMALL_TAB_SYMBOL.repeat(tabs) + progressLog);
15
+ if (isLast && incrementIndex) {
16
+ process.stdout.write('\n');
17
+ }
18
+ };
12
19
  }
13
- exports.printProgress = printProgress;
20
+ exports.setupProgressLogger = setupProgressLogger;
@@ -1 +1 @@
1
- export declare function tuiPointToClientRect(x?: number, y?: number): ClientRect;
1
+ export declare function tuiPointToClientRect(x?: number, y?: number): DOMRect;