@taiga-ui/cdk 4.7.0 → 4.8.1-canary.d818d28

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 (47) 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 +8 -9
  6. package/directives/auto-focus/handlers/abstract.handler.d.ts +3 -2
  7. package/directives/auto-focus/handlers/default.handler.d.ts +2 -1
  8. package/directives/auto-focus/handlers/ios.handler.d.ts +2 -10
  9. package/esm2022/classes/control.mjs +1 -1
  10. package/esm2022/constants/used-icons.mjs +4 -1
  11. package/esm2022/constants/version.mjs +2 -2
  12. package/esm2022/directives/auto-focus/autofocus.options.mjs +21 -15
  13. package/esm2022/directives/auto-focus/handlers/abstract.handler.mjs +5 -4
  14. package/esm2022/directives/auto-focus/handlers/default.handler.mjs +4 -4
  15. package/esm2022/directives/auto-focus/handlers/ios.handler.mjs +4 -19
  16. package/esm2022/directives/pan/pan.service.mjs +10 -12
  17. package/esm2022/directives/swipe/swipe.service.mjs +23 -25
  18. package/esm2022/directives/zoom/zoom.service.mjs +27 -29
  19. package/esm2022/types/index.mjs +2 -1
  20. package/esm2022/types/loose-union.mjs +2 -0
  21. package/esm2022/utils/browser/is-safari.mjs +2 -1
  22. package/esm2022/utils/di/create-options.mjs +1 -1
  23. package/esm2022/utils/miscellaneous/create-token.mjs +2 -2
  24. package/fesm2022/taiga-ui-cdk-classes.mjs.map +1 -1
  25. package/fesm2022/taiga-ui-cdk-constants.mjs +4 -1
  26. package/fesm2022/taiga-ui-cdk-constants.mjs.map +1 -1
  27. package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs +31 -40
  28. package/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs.map +1 -1
  29. package/fesm2022/taiga-ui-cdk-directives-pan.mjs +9 -11
  30. package/fesm2022/taiga-ui-cdk-directives-pan.mjs.map +1 -1
  31. package/fesm2022/taiga-ui-cdk-directives-swipe.mjs +22 -24
  32. package/fesm2022/taiga-ui-cdk-directives-swipe.mjs.map +1 -1
  33. package/fesm2022/taiga-ui-cdk-directives-zoom.mjs +26 -28
  34. package/fesm2022/taiga-ui-cdk-directives-zoom.mjs.map +1 -1
  35. package/fesm2022/taiga-ui-cdk-utils-browser.mjs +1 -0
  36. package/fesm2022/taiga-ui-cdk-utils-browser.mjs.map +1 -1
  37. package/fesm2022/taiga-ui-cdk-utils-di.mjs.map +1 -1
  38. package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs +1 -1
  39. package/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs.map +1 -1
  40. package/package.json +362 -362
  41. package/schematics/ng-add/index.js +1 -1
  42. package/schematics/ng-update/v4/steps/constants/attrs-to-replace.js +9 -0
  43. package/schematics/ng-update/v4/steps/migrate-editor.js +5 -4
  44. package/types/index.d.ts +1 -0
  45. package/types/loose-union.d.ts +36 -0
  46. package/utils/di/create-options.d.ts +2 -3
  47. package/utils/miscellaneous/create-token.d.ts +2 -2
@@ -29,7 +29,7 @@ function addAngularCdkDep(tree) {
29
29
  if (!angularCore) {
30
30
  return;
31
31
  }
32
- const majorVersionArr = /[0-9]+/.exec(angularCore);
32
+ const majorVersionArr = /\d+/.exec(angularCore);
33
33
  if (majorVersionArr) {
34
34
  (0, ng_morph_1.addPackageJsonDependency)(tree, {
35
35
  name: '@angular/cdk',
@@ -301,4 +301,13 @@ exports.ATTRS_TO_REPLACE = [
301
301
  attrName: '[tuiAppearanceFocus]',
302
302
  },
303
303
  },
304
+ {
305
+ from: {
306
+ attrName: '*tuiRow',
307
+ withTagNames: ['tr'],
308
+ },
309
+ to: {
310
+ attrName: '*ngFor',
311
+ },
312
+ },
304
313
  ];
@@ -50,13 +50,14 @@ function migrateEditor(fileSystem, options) {
50
50
  {
51
51
  from: [
52
52
  { name: 'defaultEditorTools', moduleSpecifier },
53
- {
54
- name: 'TUI_EDITOR_DEFAULT_TOOLS',
55
- moduleSpecifier: '@tinkoff/tui-editor',
56
- },
53
+ { name: 'TUI_EDITOR_DEFAULT_TOOLS', moduleSpecifier },
57
54
  ],
58
55
  to: { name: 'TUI_EDITOR_DEFAULT_TOOLS', moduleSpecifier: '@taiga-ui/editor' },
59
56
  },
57
+ {
58
+ from: { name: 'TUI_EDITOR_DEFAULT_EDITOR_TOOLS', moduleSpecifier },
59
+ to: { name: 'TUI_EDITOR_DEFAULT_TOOLS', moduleSpecifier: '@taiga-ui/editor' },
60
+ },
60
61
  {
61
62
  from: { name: 'TuiColorPickerModule', moduleSpecifier },
62
63
  to: { name: 'TuiColorPickerModule', moduleSpecifier: '@taiga-ui/legacy' },
package/types/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './context';
2
2
  export * from './handler';
3
+ export * from './loose-union';
3
4
  export * from './mapper';
4
5
  export * from './matcher';
5
6
  export * from './rounding';
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @example
3
+ * type Color = 'primary' | 'secondary' | string;
4
+ *
5
+ * Your brand has some known colors, like `primary` and `secondary`.
6
+ * But you also want to make sure that users can specify any color they want.
7
+ *
8
+ * @Input() color: Color = '';
9
+ *
10
+ * <my-icon color="red" />
11
+ *
12
+ * But there's an issue. We aren't getting `color`
13
+ * suggestions when we use the `MyIcon` component.
14
+ * If we try to autocomplete the `color` prop, we get no suggestions.
15
+ * Ideally, we want `primary` and `secondary` to be part of that list.
16
+ * How do we manage that?
17
+ *
18
+ * This works because of a quirk of the TypeScript compiler.
19
+ * When you create a union between a string literal type and `string`,
20
+ * TypeScript will eagerly widen the type to `string`.
21
+ *
22
+ * But if we change type to
23
+ * type Color = 'primary' | 'secondary' | (string & {});
24
+ *
25
+ * TypeScript has already forgotten that `"primary"` and `"secondary"`
26
+ * were ever part of the type. But by intersecting `string` with
27
+ * an empty object, we trick TypeScript into retaining the string
28
+ * literal types for a bit longer.
29
+ *
30
+ * This might feel pretty fragile to you. This doesn't seem like
31
+ * intended behavior from TypeScript. Well, the team actually
32
+ * know about this trick. They test against it. And someday, they may make
33
+ * it so that a plain `string` type will just work.
34
+ * But until then, keep this in mind.
35
+ */
36
+ export type TuiLooseUnion<U> = U | (U extends string ? Record<never, never> & string : U extends number ? Record<never, never> & number : U extends symbol ? Record<never, never> & symbol : U extends bigint ? Record<never, never> & bigint : never);
@@ -1,3 +1,2 @@
1
- import type { InjectionToken, Provider } from '@angular/core';
2
- import type { TuiHandler } from '@taiga-ui/cdk/types';
3
- export declare function tuiCreateOptions<T>(defaults: T): [token: InjectionToken<T>, provider: TuiHandler<Partial<T>, Provider>];
1
+ import type { FactoryProvider, InjectionToken } from '@angular/core';
2
+ export declare function tuiCreateOptions<T>(defaults: T): [token: InjectionToken<T>, provider: (item: Partial<T>) => FactoryProvider];
@@ -1,3 +1,3 @@
1
1
  import { InjectionToken } from '@angular/core';
2
- export declare function tuiCreateToken<T>(defaults: T): InjectionToken<T>;
3
- export declare function tuiCreateTokenFromFactory<T>(factory: () => T): InjectionToken<T>;
2
+ export declare function tuiCreateToken<T>(defaults?: T): InjectionToken<T>;
3
+ export declare function tuiCreateTokenFromFactory<T>(factory?: () => T): InjectionToken<T>;