@taiga-ui/cdk 3.44.0-canary.b3de48e → 3.44.1-canary.aa80e1e

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 (117) hide show
  1. package/bundles/taiga-ui-cdk-abstract.umd.js +4 -1
  2. package/bundles/taiga-ui-cdk-abstract.umd.js.map +1 -1
  3. package/bundles/taiga-ui-cdk-constants.umd.js +1 -1
  4. package/bundles/taiga-ui-cdk-constants.umd.js.map +1 -1
  5. package/bundles/taiga-ui-cdk-tokens.umd.js +86 -123
  6. package/bundles/taiga-ui-cdk-tokens.umd.js.map +1 -1
  7. package/bundles/taiga-ui-cdk-utils-miscellaneous.umd.js +6 -10
  8. package/bundles/taiga-ui-cdk-utils-miscellaneous.umd.js.map +1 -1
  9. package/constants/version.d.ts +1 -1
  10. package/constants/version.js +1 -1
  11. package/esm2015/abstract/interactive.js +5 -2
  12. package/esm2015/constants/version.js +2 -2
  13. package/esm2015/tokens/active-element.js +38 -40
  14. package/esm2015/tokens/default-renderer.js +6 -6
  15. package/esm2015/tokens/ensure-base-href.js +12 -13
  16. package/esm2015/tokens/is-android.js +4 -5
  17. package/esm2015/tokens/is-apple.js +4 -6
  18. package/esm2015/tokens/is-chromium.js +4 -5
  19. package/esm2015/tokens/is-cypress.js +4 -5
  20. package/esm2015/tokens/is-e2e.js +4 -5
  21. package/esm2015/tokens/is-firefox.js +6 -7
  22. package/esm2015/tokens/is-ios.js +4 -6
  23. package/esm2015/tokens/is-mobile.js +5 -6
  24. package/esm2015/tokens/is-playwright.js +3 -5
  25. package/esm2015/tokens/is-stackblitz.js +4 -5
  26. package/esm2015/tokens/is-webkit.js +6 -7
  27. package/esm2015/tokens/range.js +4 -5
  28. package/esm2015/tokens/removed-element.js +13 -14
  29. package/esm2015/tokens/take-only-trusted-events.js +3 -5
  30. package/esm2015/tokens/touch-supported.js +4 -5
  31. package/esm2015/tokens/window-height.js +4 -5
  32. package/esm2015/utils/miscellaneous/create-options.js +3 -5
  33. package/esm2015/utils/miscellaneous/create-token.js +2 -4
  34. package/fesm2015/taiga-ui-cdk-abstract.js +5 -2
  35. package/fesm2015/taiga-ui-cdk-abstract.js.map +1 -1
  36. package/fesm2015/taiga-ui-cdk-constants.js +1 -1
  37. package/fesm2015/taiga-ui-cdk-constants.js.map +1 -1
  38. package/fesm2015/taiga-ui-cdk-tokens.js +79 -116
  39. package/fesm2015/taiga-ui-cdk-tokens.js.map +1 -1
  40. package/fesm2015/taiga-ui-cdk-utils-miscellaneous.js +6 -10
  41. package/fesm2015/taiga-ui-cdk-utils-miscellaneous.js.map +1 -1
  42. package/package.json +1 -1
  43. package/schematics/ng-add/tests/schematic-ng-add-standalone.spec.d.ts +1 -0
  44. package/schematics/ng-add/tests/schematic-ng-add-standalone.spec.js +381 -0
  45. package/schematics/ng-add/tests/schematic-ng-add.spec.d.ts +1 -0
  46. package/schematics/ng-add/tests/schematic-ng-add.spec.js +270 -0
  47. package/schematics/ng-update/v3/tests/schematic-date-time.spec.d.ts +1 -0
  48. package/schematics/ng-update/v3/tests/schematic-date-time.spec.js +117 -0
  49. package/schematics/ng-update/v3/tests/schematic-migrate-hints.spec.d.ts +1 -0
  50. package/schematics/ng-update/v3/tests/schematic-migrate-hints.spec.js +102 -0
  51. package/schematics/ng-update/v3/tests/schematic-migrate-polymorpheus.spec.d.ts +1 -0
  52. package/schematics/ng-update/v3/tests/schematic-migrate-polymorpheus.spec.js +107 -0
  53. package/schematics/ng-update/v3/tests/schematic-migrate-progress.spec.d.ts +1 -0
  54. package/schematics/ng-update/v3/tests/schematic-migrate-progress.spec.js +113 -0
  55. package/schematics/ng-update/v3/tests/schematic-migrate-sliders.spec.d.ts +1 -0
  56. package/schematics/ng-update/v3/tests/schematic-migrate-sliders.spec.js +380 -0
  57. package/schematics/ng-update/v3/tests/schematic-migrate-tds.spec.d.ts +1 -0
  58. package/schematics/ng-update/v3/tests/schematic-migrate-tds.spec.js +119 -0
  59. package/schematics/ng-update/v3/tests/schematic-migrate-textfields.spec.d.ts +1 -0
  60. package/schematics/ng-update/v3/tests/schematic-migrate-textfields.spec.js +123 -0
  61. package/schematics/ng-update/v3/tests/schematic-miscellaneous.spec.d.ts +1 -0
  62. package/schematics/ng-update/v3/tests/schematic-miscellaneous.spec.js +81 -0
  63. package/schematics/ng-update/v3/tests/schematic-rename-types.spec.d.ts +1 -0
  64. package/schematics/ng-update/v3/tests/schematic-rename-types.spec.js +157 -0
  65. package/schematics/ng-update/v3/tests/schematic-replace-consts.spec.d.ts +1 -0
  66. package/schematics/ng-update/v3/tests/schematic-replace-consts.spec.js +135 -0
  67. package/schematics/ng-update/v3/tests/schematic-replace-deep-imports.spec.d.ts +1 -0
  68. package/schematics/ng-update/v3/tests/schematic-replace-deep-imports.spec.js +53 -0
  69. package/schematics/ng-update/v3/tests/schematic-replace-deprecated-functions.spec.d.ts +1 -0
  70. package/schematics/ng-update/v3/tests/schematic-replace-deprecated-functions.spec.js +835 -0
  71. package/schematics/ng-update/v3/tests/schematic-replace-enums.spec.d.ts +1 -0
  72. package/schematics/ng-update/v3/tests/schematic-replace-enums.spec.js +68 -0
  73. package/schematics/ng-update/v3/tests/schematic-replace-functions.spec.d.ts +1 -0
  74. package/schematics/ng-update/v3/tests/schematic-replace-functions.spec.js +195 -0
  75. package/schematics/ng-update/v3/tests/schematic-replace-html.spec.d.ts +1 -0
  76. package/schematics/ng-update/v3/tests/schematic-replace-html.spec.js +611 -0
  77. package/schematics/ng-update/v3/tests/schematic-replace-proprietary-consts.spec.d.ts +1 -0
  78. package/schematics/ng-update/v3/tests/schematic-replace-proprietary-consts.spec.js +100 -0
  79. package/schematics/ng-update/v3/tests/schematic-replace-services.spec.d.ts +1 -0
  80. package/schematics/ng-update/v3/tests/schematic-replace-services.spec.js +102 -0
  81. package/schematics/ng-update/v3/tests/schematic-replace-styles.spec.d.ts +1 -0
  82. package/schematics/ng-update/v3/tests/schematic-replace-styles.spec.js +286 -0
  83. package/schematics/ng-update/v3/tests/schematic-textfield-icon.spec.d.ts +1 -0
  84. package/schematics/ng-update/v3/tests/schematic-textfield-icon.spec.js +141 -0
  85. package/schematics/ng-update/v3/tests/schematic-warnings.spec.d.ts +1 -0
  86. package/schematics/ng-update/v3/tests/schematic-warnings.spec.js +104 -0
  87. package/schematics/ng-update/v3-30/tests/schematic-migrate-icons.spec.d.ts +1 -0
  88. package/schematics/ng-update/v3-30/tests/schematic-migrate-icons.spec.js +87 -0
  89. package/schematics/ng-update/v3-35/tests/schematic-migrate-icons.spec.d.ts +1 -0
  90. package/schematics/ng-update/v3-35/tests/schematic-migrate-icons.spec.js +101 -0
  91. package/schematics/ng-update/v3-36/tests/schematic-migrate-editor.spec.d.ts +1 -0
  92. package/schematics/ng-update/v3-36/tests/schematic-migrate-editor.spec.js +117 -0
  93. package/schematics/ng-update/v3-40/tests/schematic-migrate-textarea.spec.d.ts +1 -0
  94. package/schematics/ng-update/v3-40/tests/schematic-migrate-textarea.spec.js +90 -0
  95. package/schematics/ng-update/v3-5/tests/schematic-migrate-templates.spec.d.ts +1 -0
  96. package/schematics/ng-update/v3-5/tests/schematic-migrate-templates.spec.js +74 -0
  97. package/schematics/ng-update/v4/tests/schematic-migrate-thumbnail-card.spec.d.ts +1 -0
  98. package/schematics/ng-update/v4/tests/schematic-migrate-thumbnail-card.spec.js +72 -0
  99. package/tokens/active-element.d.ts +1 -2
  100. package/tokens/default-renderer.d.ts +2 -2
  101. package/tokens/ensure-base-href.d.ts +1 -2
  102. package/tokens/is-android.d.ts +1 -2
  103. package/tokens/is-apple.d.ts +1 -2
  104. package/tokens/is-chromium.d.ts +1 -2
  105. package/tokens/is-cypress.d.ts +1 -2
  106. package/tokens/is-e2e.d.ts +1 -2
  107. package/tokens/is-firefox.d.ts +1 -2
  108. package/tokens/is-ios.d.ts +1 -2
  109. package/tokens/is-mobile.d.ts +1 -2
  110. package/tokens/is-playwright.d.ts +1 -2
  111. package/tokens/is-stackblitz.d.ts +1 -2
  112. package/tokens/is-webkit.d.ts +1 -2
  113. package/tokens/range.d.ts +1 -2
  114. package/tokens/removed-element.d.ts +1 -3
  115. package/tokens/take-only-trusted-events.d.ts +1 -2
  116. package/tokens/touch-supported.d.ts +1 -2
  117. package/tokens/window-height.d.ts +1 -3
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ /* eslint-disable rxjs/no-topromise */
5
+ const schematics_1 = require("@angular-devkit/schematics");
6
+ const testing_1 = require("@angular-devkit/schematics/testing");
7
+ const ng_morph_1 = require("ng-morph");
8
+ const path_1 = require("path");
9
+ const create_angular_json_1 = require("../../../utils/create-angular-json");
10
+ const collectionPath = path_1.join(__dirname, `../../../migration.json`);
11
+ describe(`ng-update`, () => {
12
+ let host;
13
+ let runner;
14
+ beforeEach(() => {
15
+ host = new testing_1.UnitTestTree(new schematics_1.HostTree());
16
+ runner = new testing_1.SchematicTestRunner(`schematics`, collectionPath);
17
+ ng_morph_1.setActiveProject(ng_morph_1.createProject(host));
18
+ createMainFiles();
19
+ ng_morph_1.saveActiveProject();
20
+ });
21
+ it(`should replaces enums with strings and removes imports`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
22
+ const tree = yield runner
23
+ .runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
24
+ .toPromise();
25
+ expect(tree.readContent(`test/app/app.component.ts`)).toEqual(`import {Component} from '@angular/core';
26
+ import {some} from '@taiga-ui/cdk';
27
+ import {TuiLineType} from '@taiga-ui/cdk';
28
+ const lineType: TuiLineType = 'solid';
29
+
30
+ @Component({templateUrl: './app.template.html'})
31
+ export class AppComponent {
32
+ some = 'left';
33
+ some2 = 'string';
34
+ some3 = () => {
35
+ if(this.some2 === 'right') {
36
+ return
37
+ }
38
+ }
39
+ decimal = 'never';
40
+ }`);
41
+ }));
42
+ afterEach(() => {
43
+ ng_morph_1.resetActiveProject();
44
+ });
45
+ });
46
+ function createMainFiles() {
47
+ ng_morph_1.createSourceFile(`test/app/app.component.ts`, `import {Component} from '@angular/core';
48
+ import {TuiTextAlign, some} from '@taiga-ui/cdk';
49
+ import {TuiLineType} from '@taiga-ui/cdk';
50
+ import {TuiDecimal} from '@taiga-ui/core';
51
+
52
+ const lineType: TuiLineType = TuiLineType.Solid;
53
+
54
+ @Component({templateUrl: './app.template.html'})
55
+ export class AppComponent {
56
+ some: TuiTextAlign = TuiTextAlign.Left;
57
+ some2 = 'string';
58
+ some3 = () => {
59
+ if(this.some2 === TuiTextAlign.Right) {
60
+ return
61
+ }
62
+ }
63
+ decimal = TuiDecimal.Never;
64
+ }`);
65
+ ng_morph_1.createSourceFile(`test/app/app.template.html`, `<app></app>`);
66
+ create_angular_json_1.createAngularJson();
67
+ ng_morph_1.createSourceFile(`package.json`, `{"dependencies": {"@angular/core": "~13.0.0"}}`);
68
+ }
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ /* eslint-disable no-irregular-whitespace,rxjs/no-topromise */
5
+ const schematics_1 = require("@angular-devkit/schematics");
6
+ const testing_1 = require("@angular-devkit/schematics/testing");
7
+ const ng_morph_1 = require("ng-morph");
8
+ const path_1 = require("path");
9
+ const create_angular_json_1 = require("../../../utils/create-angular-json");
10
+ const collectionPath = path_1.join(__dirname, `../../../migration.json`);
11
+ const AFTER = `import {Component} from '@angular/core';
12
+ import { tuiGetClosestFocusable } from '@taiga-ui/cdk';
13
+ import {
14
+ TUI_NUMBER_FORMAT,
15
+ tuiFormatNumber,
16
+ TuiNumberFormatSettings,
17
+ } from '@taiga-ui/core';
18
+
19
+ element.focus();
20
+ element.focus();
21
+ element.focus();
22
+ element.blur();
23
+ element.focus({preventScroll: true});
24
+
25
+ tuiFormatNumber(1000);
26
+ tuiFormatNumber(1.234, {decimalLimit: 2, decimalSeparator: ',', thousandSeparator: ' ', zeroPadding: true});
27
+ tuiFormatNumber(123.45, {decimalLimit: 3, decimalSeparator: '.', thousandSeparator: ' ', zeroPadding: true});
28
+ tuiFormatNumber(12345.67, {decimalLimit: 4, decimalSeparator: ',', thousandSeparator: '.', zeroPadding: true});
29
+ tuiFormatNumber(27, {decimalLimit: 5, decimalSeparator: ',', thousandSeparator: '.', zeroPadding: false});
30
+
31
+ tuiGetClosestFocusable({initial: el, root: el, previous: false, keyboard: false});
32
+ tuiGetClosestFocusable({initial: host, root: root, previous: previous, keyboard: true});
33
+ tuiGetClosestFocusable({initial: button, root: wrapper, previous: prev, keyboard: true});
34
+ tuiGetClosestFocusable({initial: host, root: host, previous: true, keyboard: true});
35
+
36
+ const dynamicDecimalLimit = Math.random() > 0.5;
37
+ const decimalSeparatorVariable = ',';
38
+ const thousandSeparatorVariable = '_';
39
+ const zeroPaddingVariable = false;
40
+ tuiFormatNumber(42, {decimalLimit: dynamicDecimalLimit === null ? Infinity : dynamicDecimalLimit, decimalSeparator: decimalSeparatorVariable, thousandSeparator: thousandSeparatorVariable, zeroPadding: zeroPaddingVariable});
41
+
42
+ @Component({templateUrl: './app.template.html'})
43
+ export class AppComponent extends AbstractTuiController {
44
+ some = number ?? 5;
45
+
46
+ get formattedNumber(): number {
47
+ return tuiFormatNumber(Math.floor(rawNumber), {decimalLimit: Infinity, decimalSeparator: this.numberFormat.decimalSeparator, thousandSeparator: this.numberFormat.thousandSeparator, zeroPadding: true});
48
+ }
49
+
50
+ method(): void {
51
+ return someFn(b ?? "some");
52
+ }
53
+
54
+ get formattedDayPart(): string {
55
+ this.some = '1000'.padStart(10, " ");
56
+ return String(this.day).padStart(2, '0');
57
+ }
58
+
59
+ test(): void {
60
+ tuiGetClosestFocusable({initial: this.host, root: this.elementRef.nativeElement, previous: false, keyboard: true});
61
+ tuiGetClosestFocusable({initial: wrapper, root: this.elementRef.nativeElement, previous: true, keyboard: false});
62
+ const focusable = tuiGetClosestFocusable({initial: this.elementRef.nativeElement, root: this.elementRef.nativeElement, previous: false, keyboard: true});
63
+ const focusable = tuiGetClosestFocusable({initial: initial, root: this.wrapper.nativeElement, previous: !first, keyboard: true});
64
+ }
65
+
66
+ constructor(@Inject(TUI_NUMBER_FORMAT) private readonly numberFormat: TuiNumberFormatSettings) {}
67
+
68
+ private hasClosest(suitableNode: any, selector: string): void {
69
+ const element = (suitableNode as Element).closest(selector);
70
+ return Boolean(element);
71
+ }
72
+ }
73
+
74
+ expect(element.closest('div')).toEqual(div);
75
+
76
+ const event = new CustomEvent("hello", {
77
+ bubbles: true,
78
+ cancelable: true,
79
+ detail: true,
80
+ });
81
+ `;
82
+ const BEFORE = `import {Component} from '@angular/core';
83
+ import { fallbackValue, tuiCustomEvent, getClosestElement, padStart, tuiGetClosestFocusable, tuiSetNativeFocused, setNativeFocused } from '@taiga-ui/cdk';
84
+ import {
85
+ TUI_NUMBER_FORMAT,
86
+ tuiFormatNumber,
87
+ TuiNumberFormatSettings,
88
+ } from '@taiga-ui/core';
89
+
90
+ setNativeFocused(element);
91
+ tuiSetNativeFocused(element);
92
+ tuiSetNativeFocused(element, true);
93
+ tuiSetNativeFocused(element, false);
94
+ tuiSetNativeFocused(element, true, true);
95
+
96
+ tuiFormatNumber(1000);
97
+ tuiFormatNumber(1.234, 2);
98
+ tuiFormatNumber(123.45, 3, '.');
99
+ tuiFormatNumber(12345.67, 4, ',', '.');
100
+ tuiFormatNumber(27, 5, ',', '.', false);
101
+
102
+ tuiGetClosestFocusable(el, false, el, false);
103
+ tuiGetClosestFocusable(host, previous, root);
104
+ tuiGetClosestFocusable(button, prev, wrapper);
105
+ tuiGetClosestFocusable(host, true, host, true);
106
+
107
+ const dynamicDecimalLimit = Math.random() > 0.5;
108
+ const decimalSeparatorVariable = ',';
109
+ const thousandSeparatorVariable = '_';
110
+ const zeroPaddingVariable = false;
111
+ tuiFormatNumber(42, dynamicDecimalLimit, decimalSeparatorVariable, thousandSeparatorVariable, zeroPaddingVariable);
112
+
113
+ @Component({templateUrl: './app.template.html'})
114
+ export class AppComponent extends AbstractTuiController {
115
+ some = fallbackValue(number, 5);
116
+
117
+ get formattedNumber(): number {
118
+ return tuiFormatNumber(
119
+ Math.floor(rawNumber),
120
+ null,
121
+ this.numberFormat.decimalSeparator,
122
+ this.numberFormat.thousandSeparator,
123
+ );
124
+ }
125
+
126
+ method(): void {
127
+ return someFn(fallbackValue<string>(b, "some"));
128
+ }
129
+
130
+ get formattedDayPart(): string {
131
+ this.some = padStart('1000', 10);
132
+ return padStart(String(this.day), 2, '0');
133
+ }
134
+
135
+ test(): void {
136
+ tuiGetClosestFocusable(this.host, false, this.elementRef.nativeElement);
137
+ tuiGetClosestFocusable(wrapper, true, this.elementRef.nativeElement, false);
138
+ const focusable = tuiGetClosestFocusable(
139
+ this.elementRef.nativeElement,
140
+ false,
141
+ this.elementRef.nativeElement,
142
+ );
143
+ const focusable = tuiGetClosestFocusable(
144
+ initial,
145
+ !first,
146
+ this.wrapper.nativeElement,
147
+ );
148
+ }
149
+
150
+ constructor(@Inject(TUI_NUMBER_FORMAT) private readonly numberFormat: TuiNumberFormatSettings) {}
151
+
152
+ private hasClosest(suitableNode: any, selector: string): void {
153
+ const element = getClosestElement(suitableNode as Element, selector);
154
+ return Boolean(element);
155
+ }
156
+ }
157
+
158
+ expect(getClosestElement(element, 'div')).toEqual(div);
159
+
160
+ const event = tuiCustomEvent(
161
+ "hello",
162
+ {
163
+ bubbles: true,
164
+ cancelable: true,
165
+ detail: true,
166
+ },
167
+ document,
168
+ );
169
+ `;
170
+ describe(`replace functions (depth of file structure = 1)`, () => {
171
+ let host;
172
+ let runner;
173
+ beforeEach(() => {
174
+ host = new testing_1.UnitTestTree(new schematics_1.HostTree());
175
+ runner = new testing_1.SchematicTestRunner(`schematics`, collectionPath);
176
+ ng_morph_1.setActiveProject(ng_morph_1.createProject(host));
177
+ createMainFiles();
178
+ ng_morph_1.saveActiveProject();
179
+ });
180
+ it(`should replace functions`, () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
181
+ const tree = yield runner
182
+ .runSchematicAsync(`updateToV3`, { 'skip-logs': process.env[`TUI_CI`] === `true` }, host)
183
+ .toPromise();
184
+ expect(tree.readContent(`test/app.component.ts`)).toEqual(AFTER);
185
+ }));
186
+ afterEach(() => {
187
+ ng_morph_1.resetActiveProject();
188
+ });
189
+ });
190
+ function createMainFiles() {
191
+ ng_morph_1.createSourceFile(`test/app.component.ts`, BEFORE);
192
+ ng_morph_1.createSourceFile(`test/app.template.html`, `<app></app>`);
193
+ create_angular_json_1.createAngularJson();
194
+ ng_morph_1.createSourceFile(`package.json`, `{"dependencies": {"@angular/core": "~13.0.0"}}`);
195
+ }