- `,
- changeDetection: ChangeDetectionStrategy.OnPush,
- providers: [tuiAsFocusableItemAccessor(TestFocusableComponent)],
- })
- class TestFocusableComponent implements TuiFocusableElementAccessor {
- @ViewChild('input')
- public input?: ElementRef;
-
- public focusedChange = EMPTY;
-
- public get nativeFocusableElement(): HTMLInputElement | null {
- return this.input?.nativeElement ?? null;
- }
-
- public get focused(): boolean {
- return this.input
- ? document.activeElement === this.input.nativeElement
- : false;
- }
- }
-
- @Component({
- standalone: true,
- imports: [TestFocusableComponent, TuiAutoFocusDirective],
- template: `
-
- `,
- changeDetection: ChangeDetectionStrategy.OnPush,
- })
- class TestComponentWithTuiButton {
- @ViewChild(TestFocusableComponent)
- public focusable!: TestFocusableComponent;
- }
-
- let fixture: ComponentFixture;
- let testComponent: TestComponentWithTuiButton;
-
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [TestComponentWithTuiButton, TestFocusableComponent],
- providers: [NG_EVENT_PLUGINS],
- });
-
- fixture = TestBed.createComponent(TestComponentWithTuiButton);
- testComponent = fixture.componentInstance;
- });
-
- it('Focuses native element of a TUI_FOCUSABLE_ITEM_ACCESSOR', fakeAsync(() => {
- fixture.detectChanges();
- tick(100);
- expect(testComponent.focusable.focused).toBe(true);
- expect(document.activeElement).toBe(
- testComponent.focusable.nativeFocusableElement,
- );
- }));
- });
-
describe('works for iOS decoy method', () => {
@Component({
standalone: true,
@@ -155,26 +81,12 @@ describe('TuiAutoFocus directive', () => {
provide: TUI_AUTOFOCUS_HANDLER,
useClass: TuiIosAutofocusHandler,
useFactory: (
- focusable: TuiFocusableElementAccessor | null,
el: ElementRef,
renderer: Renderer2,
zone: NgZone,
win: Window,
- ) =>
- new TuiIosAutofocusHandler(
- focusable,
- el,
- renderer,
- zone,
- win,
- ),
- deps: [
- [new Optional(), new Self(), TUI_FOCUSABLE_ITEM_ACCESSOR],
- ElementRef,
- Renderer2,
- NgZone,
- WINDOW,
- ],
+ ) => new TuiIosAutofocusHandler(el, renderer, zone, win),
+ deps: [ElementRef, Renderer2, NgZone, WINDOW],
},
],
});
diff --git a/projects/cdk/directives/media/media.directive.ts b/projects/cdk/directives/media/media.directive.ts
index e67ef7695198..6249fb599a65 100644
--- a/projects/cdk/directives/media/media.directive.ts
+++ b/projects/cdk/directives/media/media.directive.ts
@@ -12,6 +12,7 @@ import {tuiInjectElement} from '@taiga-ui/cdk/utils';
standalone: true,
selector: 'video[tuiMedia], audio[tuiMedia]',
exportAs: 'tuiMedia',
+ host: {'(durationchange)': '0'},
})
export class TuiMediaDirective {
private readonly el = tuiInjectElement();
@@ -61,7 +62,6 @@ export class TuiMediaDirective {
return Boolean(this.el.paused);
}
- // @bad TODO: Make sure no other events can affect this like network issues etc.
@HostListener('ended', ['true'])
@HostListener('pause', ['true'])
@HostListener('play', ['false'])
@@ -83,11 +83,6 @@ export class TuiMediaDirective {
this.currentTimeChange.emit(this.currentTime);
}
- @HostListener('durationchange')
- protected changeDetectionTrigger(): void {
- // @bad TODO: consider if other events need to trigger CD
- }
-
private updatePlaybackRate(playbackRate: number): void {
this.playbackRate = playbackRate;
this.el.playbackRate = this.playbackRate;
diff --git a/projects/cdk/directives/obscured/obscured.service.ts b/projects/cdk/directives/obscured/obscured.service.ts
index 0dfd28f779f6..3ddf12fa3568 100644
--- a/projects/cdk/directives/obscured/obscured.service.ts
+++ b/projects/cdk/directives/obscured/obscured.service.ts
@@ -1,11 +1,9 @@
import {inject, Injectable, NgZone} from '@angular/core';
import {ANIMATION_FRAME} from '@ng-web-apis/common';
-import {POLLING_TIME} from '@taiga-ui/cdk/constants';
import {tuiZoneOptimized} from '@taiga-ui/cdk/observables';
import {tuiGetElementObscures, tuiInjectElement} from '@taiga-ui/cdk/utils/dom';
import {distinctUntilChanged, map, Observable, startWith, throttleTime} from 'rxjs';
-// @bad TODO: Consider Intersection Observer with fallback to current implementation
/**
* Service that monitors element visibility by polling and returning
* either null or an array of elements that overlap given element edges
@@ -14,7 +12,7 @@ import {distinctUntilChanged, map, Observable, startWith, throttleTime} from 'rx
export class TuiObscuredService extends Observable {
private readonly el = tuiInjectElement();
private readonly obscured$ = inject(ANIMATION_FRAME).pipe(
- throttleTime(POLLING_TIME),
+ throttleTime(100),
map(() => tuiGetElementObscures(this.el)),
startWith(null),
distinctUntilChanged(),
diff --git a/projects/cdk/observables/typed-from-event.ts b/projects/cdk/observables/typed-from-event.ts
index 0cfc4d5cdf92..123e1d1300f4 100644
--- a/projects/cdk/observables/typed-from-event.ts
+++ b/projects/cdk/observables/typed-from-event.ts
@@ -1,7 +1,26 @@
-import type {TuiEventWith, TuiTypedEventTarget} from '@taiga-ui/cdk/types';
import type {Observable} from 'rxjs';
import {fromEvent} from 'rxjs';
+export interface TuiTypedEventTarget {
+ addEventListener(
+ type: string,
+ listener: ((evt: E) => void) | null,
+ options?: AddEventListenerOptions | boolean,
+ ): void;
+ removeEventListener(
+ type: string,
+ listener?: ((evt: E) => void) | null,
+ options?: EventListenerOptions | boolean,
+ ): void;
+}
+
+/**
+ * Wrapper around {@link Event} to add typings to target and currentTarget.
+ */
+export type TuiEventWith> = G & {
+ readonly currentTarget: T;
+};
+
export function tuiTypedFromEvent(
target: Window,
event: E,
diff --git a/projects/cdk/schematics/ng-update/v4/steps/templates/migrate-money.ts b/projects/cdk/schematics/ng-update/v4/steps/templates/migrate-money.ts
index 2e9a1ff861f8..85679e58507c 100644
--- a/projects/cdk/schematics/ng-update/v4/steps/templates/migrate-money.ts
+++ b/projects/cdk/schematics/ng-update/v4/steps/templates/migrate-money.ts
@@ -2,7 +2,6 @@ import type {UpdateRecorder} from '@angular-devkit/schematics';
import type {DevkitFileSystem} from '@taiga-ui/morph';
import type {Attribute} from 'parse5/dist/common/token';
-import {tuiCleanObject} from '../../../../../utils/miscellaneous/clean-object';
import type {TemplateResource} from '../../../../ng-update/interfaces';
import {removeAttrs} from '../../../../ng-update/v4/steps/utils/remove-attrs';
import {addImportToClosestModule} from '../../../../utils/add-import-to-closest-module';
@@ -12,6 +11,7 @@ import {
getTemplateFromTemplateResource,
getTemplateOffset,
} from '../../../../utils/templates/template-resource';
+import {cleanObject} from '../utils/clean-object';
export function migrateMoney({
resource,
@@ -62,7 +62,7 @@ export function migrateMoney({
);
const format = JSON.stringify(
- tuiCleanObject({
+ cleanObject({
decimal: decimalAttr?.value,
precision: precisionAttr?.value,
}),
diff --git a/projects/cdk/schematics/ng-update/v4/steps/utils/clean-object.ts b/projects/cdk/schematics/ng-update/v4/steps/utils/clean-object.ts
new file mode 100644
index 000000000000..980c550a2511
--- /dev/null
+++ b/projects/cdk/schematics/ng-update/v4/steps/utils/clean-object.ts
@@ -0,0 +1,20 @@
+export type TuiDeepPartial = {
+ [K in keyof T]?: T[K] extends object ? TuiDeepPartial : T[K];
+};
+
+type EmptyValue = '' | null | undefined;
+
+function checkValueIsEmpty(value: EmptyValue | T): value is EmptyValue {
+ // eslint-disable-next-line
+ const nextValue: any = typeof value === 'string' ? value.trim() : value;
+
+ return [undefined, null, NaN, ''].includes(nextValue);
+}
+
+export function cleanObject(object: T): TuiDeepPartial {
+ return JSON.parse(
+ JSON.stringify(object, (_key: string, value: unknown) =>
+ checkValueIsEmpty(value) ? undefined : value,
+ ),
+ );
+}
diff --git a/projects/cdk/tokens/is-mobile.ts b/projects/cdk/tokens/environment.ts
similarity index 61%
rename from projects/cdk/tokens/is-mobile.ts
rename to projects/cdk/tokens/environment.ts
index 73ac050a98c3..b26b89ee9e04 100644
--- a/projects/cdk/tokens/is-mobile.ts
+++ b/projects/cdk/tokens/environment.ts
@@ -1,6 +1,8 @@
import {inject} from '@angular/core';
-import {USER_AGENT} from '@ng-web-apis/common';
-import {tuiCreateTokenFromFactory} from '@taiga-ui/cdk/utils';
+import {NAVIGATOR, USER_AGENT, WINDOW} from '@ng-web-apis/common';
+import {TUI_FALSE_HANDLER} from '@taiga-ui/cdk/constants';
+import type {TuiPlatform} from '@taiga-ui/cdk/types';
+import {tuiCreateTokenFromFactory, tuiIsIos} from '@taiga-ui/cdk/utils';
// https://stackoverflow.com/a/11381730/2706426 http://detectmobilebrowsers.com/
const firstRegex =
@@ -8,11 +10,46 @@ const firstRegex =
const secondRegex =
/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/;
-/**
- * Mobile browser detection
- */
export const TUI_IS_MOBILE = tuiCreateTokenFromFactory(
() =>
firstRegex.test(inject(USER_AGENT).toLowerCase()) ||
secondRegex.test(inject(USER_AGENT).slice(0, 4).toLowerCase()),
);
+
+export const TUI_IS_IOS = tuiCreateTokenFromFactory(() => tuiIsIos(inject(NAVIGATOR)));
+
+export const TUI_IS_ANDROID = tuiCreateTokenFromFactory(
+ () => inject(TUI_IS_MOBILE) && !inject(TUI_IS_IOS),
+);
+
+export const TUI_IS_WEBKIT = tuiCreateTokenFromFactory(
+ () => !!inject(WINDOW)?.webkitConvertPointFromNodeToPage,
+);
+
+export const TUI_PLATFORM = tuiCreateTokenFromFactory(() => {
+ if (inject(TUI_IS_IOS)) {
+ return 'ios';
+ }
+
+ return inject(TUI_IS_ANDROID) ? 'android' : 'web';
+});
+
+/**
+ * Detect if app is running under Cypress
+ * {@link https://docs.cypress.io/faq/questions/using-cypress-faq#Is-there-any-way-to-detect-if-my-app-is-running-under-Cypress Cypress docs}
+ */
+export const TUI_IS_CYPRESS = tuiCreateTokenFromFactory(
+ () => !!inject(WINDOW).Cypress,
+);
+
+/**
+ * Manually provide `true` when running tests in Playwright
+ */
+export const TUI_IS_PLAYWRIGHT = tuiCreateTokenFromFactory(TUI_FALSE_HANDLER);
+
+/**
+ * Detect if app is running under any of test frameworks
+ */
+export const TUI_IS_E2E = tuiCreateTokenFromFactory(
+ () => inject(TUI_IS_CYPRESS) || inject(TUI_IS_PLAYWRIGHT),
+);
diff --git a/projects/cdk/tokens/index.ts b/projects/cdk/tokens/index.ts
index aaf322696737..3312ef07d418 100644
--- a/projects/cdk/tokens/index.ts
+++ b/projects/cdk/tokens/index.ts
@@ -1,21 +1,7 @@
export * from './active-element';
export * from './base-href';
+export * from './environment';
export * from './fallback-value';
-export * from './focusable-item-accessor';
-export * from './fonts-ready';
-export * from './is-android';
-export * from './is-apple';
-export * from './is-chromium';
-export * from './is-cypress';
-export * from './is-e2e';
-export * from './is-firefox';
-export * from './is-ios';
-export * from './is-mobile';
-export * from './is-playwright';
-export * from './is-stackblitz';
-export * from './is-webkit';
-export * from './platform';
export * from './range';
export * from './removed-element';
-export * from './touch-supported';
export * from './window-size';
diff --git a/projects/cdk/tokens/is-android.ts b/projects/cdk/tokens/is-android.ts
deleted file mode 100644
index a262291fec44..000000000000
--- a/projects/cdk/tokens/is-android.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import {inject} from '@angular/core';
-import {tuiCreateTokenFromFactory} from '@taiga-ui/cdk/utils';
-
-import {TUI_IS_IOS} from './is-ios';
-import {TUI_IS_MOBILE} from './is-mobile';
-
-/**
- * Mobile browser that is not iOS (technically includes Windows Phone, Blackberry etc.)
- */
-export const TUI_IS_ANDROID = tuiCreateTokenFromFactory(
- () => inject(TUI_IS_MOBILE) && !inject(TUI_IS_IOS),
-);
diff --git a/projects/cdk/tokens/is-cypress.ts b/projects/cdk/tokens/is-cypress.ts
deleted file mode 100644
index b38c43e34f38..000000000000
--- a/projects/cdk/tokens/is-cypress.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import {inject} from '@angular/core';
-import {WINDOW} from '@ng-web-apis/common';
-import {tuiCreateTokenFromFactory} from '@taiga-ui/cdk/utils';
-
-interface WindowWithCypress extends Window {
- Cypress?: unknown;
-}
-
-/**
- * Detect if app is running under Cypress
- * {@link https://docs.cypress.io/faq/questions/using-cypress-faq#Is-there-any-way-to-detect-if-my-app-is-running-under-Cypress Cypress docs}
- */
-export const TUI_IS_CYPRESS = tuiCreateTokenFromFactory(
- () => !!inject(WINDOW).Cypress,
-);
diff --git a/projects/cdk/tokens/is-e2e.ts b/projects/cdk/tokens/is-e2e.ts
deleted file mode 100644
index 2694a8eb7290..000000000000
--- a/projects/cdk/tokens/is-e2e.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import {inject} from '@angular/core';
-import {tuiCreateTokenFromFactory} from '@taiga-ui/cdk/utils';
-
-import {TUI_IS_CYPRESS} from './is-cypress';
-import {TUI_IS_PLAYWRIGHT} from './is-playwright';
-
-/**
- * Detect if app is running under any of test frameworks
- */
-export const TUI_IS_E2E = tuiCreateTokenFromFactory(
- () => inject(TUI_IS_CYPRESS) || inject(TUI_IS_PLAYWRIGHT),
-);
diff --git a/projects/cdk/tokens/is-ios.ts b/projects/cdk/tokens/is-ios.ts
deleted file mode 100644
index 0af1d1bf7c8a..000000000000
--- a/projects/cdk/tokens/is-ios.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import {inject} from '@angular/core';
-import {NAVIGATOR} from '@ng-web-apis/common';
-import {tuiCreateTokenFromFactory, tuiIsIos} from '@taiga-ui/cdk/utils';
-
-/**
- * iOS browser detection
- */
-export const TUI_IS_IOS = tuiCreateTokenFromFactory(() => tuiIsIos(inject(NAVIGATOR)));
diff --git a/projects/cdk/tokens/is-playwright.ts b/projects/cdk/tokens/is-playwright.ts
deleted file mode 100644
index bae170c1cfa2..000000000000
--- a/projects/cdk/tokens/is-playwright.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import {TUI_FALSE_HANDLER} from '@taiga-ui/cdk/constants';
-import {tuiCreateTokenFromFactory} from '@taiga-ui/cdk/utils';
-
-/**
- * Detect if app is running under Playwright
- */
-export const TUI_IS_PLAYWRIGHT = tuiCreateTokenFromFactory(TUI_FALSE_HANDLER);
diff --git a/projects/cdk/tokens/is-webkit.ts b/projects/cdk/tokens/is-webkit.ts
deleted file mode 100644
index 3e64bf681b96..000000000000
--- a/projects/cdk/tokens/is-webkit.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import {inject} from '@angular/core';
-import {WINDOW} from '@ng-web-apis/common';
-import {tuiCreateTokenFromFactory} from '@taiga-ui/cdk/utils';
-
-/**
- * Webkit browser engine detection
- */
-export const TUI_IS_WEBKIT = tuiCreateTokenFromFactory(
- (): boolean => !!inject(WINDOW)?.webkitConvertPointFromNodeToPage,
-);
diff --git a/projects/cdk/tokens/platform.ts b/projects/cdk/tokens/platform.ts
deleted file mode 100644
index a9bbfba29cdf..000000000000
--- a/projects/cdk/tokens/platform.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-import {inject} from '@angular/core';
-import type {TuiPlatform} from '@taiga-ui/cdk/types';
-import {tuiCreateTokenFromFactory} from '@taiga-ui/cdk/utils';
-
-import {TUI_IS_ANDROID} from './is-android';
-import {TUI_IS_IOS} from './is-ios';
-
-export const TUI_PLATFORM = tuiCreateTokenFromFactory(() => {
- if (inject(TUI_IS_IOS)) {
- return 'ios';
- }
-
- return inject(TUI_IS_ANDROID) ? 'android' : 'web';
-});
diff --git a/projects/cdk/types/deep-partial.ts b/projects/cdk/types/deep-partial.ts
deleted file mode 100644
index e669cffc2b4a..000000000000
--- a/projects/cdk/types/deep-partial.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export type TuiDeepPartial = {
- [K in keyof T]?: T[K] extends object ? TuiDeepPartial : T[K];
-};
diff --git a/projects/cdk/types/event-with.ts b/projects/cdk/types/event-with.ts
deleted file mode 100644
index d2199c5defad..000000000000
--- a/projects/cdk/types/event-with.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-export interface TuiTypedEventTarget {
- addEventListener(
- type: string,
- listener: ((evt: E) => void) | null,
- options?: AddEventListenerOptions | boolean,
- ): void;
- removeEventListener(
- type: string,
- listener?: ((evt: E) => void) | null,
- options?: EventListenerOptions | boolean,
- ): void;
-}
-
-/**
- * Wrapper around {@link Event} to add typings to target and currentTarget.
- */
-export type TuiEventWith> = G & {
- readonly currentTarget: T;
-};
diff --git a/projects/cdk/types/focusable-element-accessor.ts b/projects/cdk/types/focusable-element-accessor.ts
deleted file mode 100644
index 1a7902fa44fe..000000000000
--- a/projects/cdk/types/focusable-element-accessor.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-import type {Observable} from 'rxjs';
-
-export interface TuiNativeFocusableElement extends Element, HTMLOrSVGElement {}
-
-/**
- * Public interface for any focusable component or directive
- * TODO: shorten `nativeFocusableElement` in 4.0
- */
-export interface TuiFocusableElementAccessor {
- focused: boolean;
- readonly focusedChange: Observable;
- nativeFocusableElement: TuiNativeFocusableElement | null;
-}
diff --git a/projects/cdk/types/index.ts b/projects/cdk/types/index.ts
index 178814544708..870cb1dc3524 100644
--- a/projects/cdk/types/index.ts
+++ b/projects/cdk/types/index.ts
@@ -1,10 +1,5 @@
export * from './context';
-export * from './deep-partial';
-export * from './event-with';
-export * from './focusable-element-accessor';
export * from './handler';
-export * from './input-mode';
-export * from './input-type';
export * from './mapper';
export * from './matcher';
export * from './platform';
diff --git a/projects/cdk/types/input-mode.ts b/projects/cdk/types/input-mode.ts
deleted file mode 100644
index 5dafa6de74e3..000000000000
--- a/projects/cdk/types/input-mode.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-export type TuiInputMode =
- | 'decimal'
- | 'email'
- | 'none'
- | 'numeric'
- | 'search'
- | 'tel'
- | 'text'
- | 'url';
diff --git a/projects/cdk/types/input-type.ts b/projects/cdk/types/input-type.ts
deleted file mode 100644
index 648ef821133c..000000000000
--- a/projects/cdk/types/input-type.ts
+++ /dev/null
@@ -1 +0,0 @@
-export type TuiInputType = 'email' | 'password' | 'tel' | 'text' | 'url';
diff --git a/projects/cdk/utils/browser/index.ts b/projects/cdk/utils/browser/index.ts
index e500915a5672..ad58a89aa4f0 100644
--- a/projects/cdk/utils/browser/index.ts
+++ b/projects/cdk/utils/browser/index.ts
@@ -1,5 +1,4 @@
export * from './is-apple';
-export * from './is-apple-platform';
export * from './is-edge';
export * from './is-firefox';
export * from './is-ios';
diff --git a/projects/cdk/utils/browser/is-apple-platform.ts b/projects/cdk/utils/browser/is-apple-platform.ts
deleted file mode 100644
index b65e97bc7b6d..000000000000
--- a/projects/cdk/utils/browser/is-apple-platform.ts
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * @description:
- * All Chrome / Chromium-based browsers will return MacIntel on macOS,
- * no matter what the hardware architecture is. See the source code here:
- * https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/frame/navigator_id.cc;l=64;drc=703d3c472cf27470dad21a3f2c8972aca3732cd6
- * But maybe in future years, it will be changed to MacM1
- *
- * Documentation:
- * https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform
- */
-export function tuiIsApplePlatform(navigator: Navigator): boolean {
- return navigator.platform.startsWith('Mac') || navigator.platform === 'iPhone';
-}
diff --git a/projects/cdk/utils/browser/is-apple.ts b/projects/cdk/utils/browser/is-apple.ts
index 8181cce0ac1e..637d07a11ca1 100644
--- a/projects/cdk/utils/browser/is-apple.ts
+++ b/projects/cdk/utils/browser/is-apple.ts
@@ -1,7 +1,13 @@
-import {tuiIsIos} from './is-ios';
-
-const SAFARI_REG_EXP = /^((?!chrome|android).)*safari/i;
-
+/**
+ * @description:
+ * All Chrome / Chromium-based browsers will return MacIntel on macOS,
+ * no matter what the hardware architecture is. See the source code here:
+ * https://source.chromium.org/chromium/chromium/src/+/master:third_party/blink/renderer/core/frame/navigator_id.cc;l=64;drc=703d3c472cf27470dad21a3f2c8972aca3732cd6
+ * But maybe in future years, it will be changed to MacM1
+ *
+ * Documentation:
+ * https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform
+ */
export function tuiIsApple(navigator: Navigator): boolean {
- return tuiIsIos(navigator) || SAFARI_REG_EXP.test(navigator.userAgent.toLowerCase());
+ return navigator.platform.startsWith('Mac') || navigator.platform === 'iPhone';
}
diff --git a/projects/cdk/utils/browser/is-ios.ts b/projects/cdk/utils/browser/is-ios.ts
index 033a2f2a6331..c68ea0ba913a 100644
--- a/projects/cdk/utils/browser/is-ios.ts
+++ b/projects/cdk/utils/browser/is-ios.ts
@@ -1,10 +1,10 @@
-import {tuiIsApplePlatform} from './is-apple-platform';
+import {tuiIsApple} from './is-apple';
const IOS_REG_EXP = /ipad|iphone|ipod/;
export function tuiIsIos(navigator: Navigator): boolean {
return (
IOS_REG_EXP.test(navigator.userAgent.toLowerCase()) ||
- (tuiIsApplePlatform(navigator) && navigator.maxTouchPoints > 1)
+ (tuiIsApple(navigator) && navigator.maxTouchPoints > 1)
);
}
diff --git a/projects/cdk/utils/miscellaneous/index.ts b/projects/cdk/utils/miscellaneous/index.ts
index 5c68b47b30e9..ac63f8d800c0 100644
--- a/projects/cdk/utils/miscellaneous/index.ts
+++ b/projects/cdk/utils/miscellaneous/index.ts
@@ -2,7 +2,6 @@ export * from './array-remove';
export * from './array-shallow-equals';
export * from './array-toggle';
export * from './change-date-separator';
-export * from './clean-object';
export * from './create-token';
export * from './default-sort';
export * from './directive-binding';
diff --git a/projects/cdk/utils/miscellaneous/test/clean-object.spec.ts b/projects/cdk/utils/miscellaneous/test/clean-object.spec.ts
deleted file mode 100644
index 0e17e56de535..000000000000
--- a/projects/cdk/utils/miscellaneous/test/clean-object.spec.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-import {tuiCleanObject} from '@taiga-ui/cdk';
-
-describe('tuiCleanObject', () => {
- it('should be clear empty values', (): void => {
- expect(
- tuiCleanObject({
- a: null,
- b: undefined,
- c: '',
- d: null,
- e: NaN,
- f: [
- {
- a: 2,
- b: undefined,
- c: '',
- },
- {
- a: 0,
- b: undefined,
- c: '',
- },
- ],
- g: {
- a: 4,
- b: undefined,
- c: ' ',
- },
- }),
- ).toEqual({f: [{a: 2}, {a: 0}], g: {a: 4}});
- });
-});
diff --git a/projects/core/components/calendar/calendar-spin.component.ts b/projects/core/components/calendar/calendar-spin.component.ts
index 3af1db1227e2..35a1cd8adf0b 100644
--- a/projects/core/components/calendar/calendar-spin.component.ts
+++ b/projects/core/components/calendar/calendar-spin.component.ts
@@ -11,7 +11,6 @@ import {TUI_FIRST_DAY, TUI_LAST_DAY, TuiMonth} from '@taiga-ui/cdk';
import {TuiLinkDirective} from '@taiga-ui/core/components/link';
import {TuiSpinButtonComponent} from '@taiga-ui/core/components/spin-button';
import {TuiMonthPipe} from '@taiga-ui/core/pipes';
-import type {TuiWithOptionalMinMax} from '@taiga-ui/core/types';
@Component({
standalone: true,
@@ -21,7 +20,7 @@ import type {TuiWithOptionalMinMax} from '@taiga-ui/core/types';
styleUrls: ['./calendar-spin.style.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
-export class TuiCalendarSpinComponent implements TuiWithOptionalMinMax {
+export class TuiCalendarSpinComponent {
@Input()
public value = TuiMonth.currentLocal();
diff --git a/projects/core/components/calendar/calendar.component.ts b/projects/core/components/calendar/calendar.component.ts
index 46afe845fdb9..6c61330c465c 100644
--- a/projects/core/components/calendar/calendar.component.ts
+++ b/projects/core/components/calendar/calendar.component.ts
@@ -17,7 +17,6 @@ import {
tuiNullableSame,
} from '@taiga-ui/cdk';
import {TuiScrollbarComponent} from '@taiga-ui/core/components/scrollbar';
-import type {TuiWithOptionalMinMax} from '@taiga-ui/core/types';
import {
TuiCalendarSheetComponent,
@@ -41,7 +40,7 @@ import {TuiCalendarYearComponent} from './calendar-year.component';
styleUrls: ['./calendar.style.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
-export class TuiCalendarComponent implements TuiWithOptionalMinMax {
+export class TuiCalendarComponent {
private day: TuiDay | TuiDayRange | readonly TuiDay[] | null = null;
private view: 'month' | 'year' = 'month';
diff --git a/projects/core/components/data-list/data-list.component.ts b/projects/core/components/data-list/data-list.component.ts
index f6829e48bbd6..ef52394a2cb3 100644
--- a/projects/core/components/data-list/data-list.component.ts
+++ b/projects/core/components/data-list/data-list.component.ts
@@ -76,7 +76,6 @@ export class TuiDataListComponent implements TuiDataListAccessor {
tuiMoveFocus(elements.indexOf(current), elements, step);
}
- // TODO: Consider aria-activedescendant for proper accessibility implementation
@HostListener('wheel.silent.passive')
@HostListener('mouseleave', ['$event.target'])
@HostListener('keydown.tab')
diff --git a/projects/core/components/data-list/option.component.ts b/projects/core/components/data-list/option.component.ts
index e77239f07d93..07de8a98aae8 100644
--- a/projects/core/components/data-list/option.component.ts
+++ b/projects/core/components/data-list/option.component.ts
@@ -81,7 +81,6 @@ export class TuiOptionComponent implements OnDestroy {
}
}
- // @bad TODO: Consider aria-activedescendant for proper accessibility implementation
protected onMouseMove(): void {
if (!this.isMobile && !tuiIsNativeFocused(this.el)) {
this.el.focus({preventScroll: true});
diff --git a/projects/core/components/expand/test/expand.component.spec.ts b/projects/core/components/expand/test/expand.component.spec.ts
index 9612fdf1d237..e39398d430b0 100644
--- a/projects/core/components/expand/test/expand.component.spec.ts
+++ b/projects/core/components/expand/test/expand.component.spec.ts
@@ -4,6 +4,7 @@ import {fakeAsync, TestBed, tick} from '@angular/core/testing';
import type {TuiExpandComponent} from '@taiga-ui/core';
import {TUI_EXPAND_LOADED, TuiExpand} from '@taiga-ui/core';
import {TuiPageObject} from '@taiga-ui/testing';
+import {NG_EVENT_PLUGINS} from '@tinkoff/ng-event-plugins';
const ANIMATION_DELAY = 900;
@@ -45,8 +46,7 @@ describe('expand', () => {
beforeEach(async () => {
TestBed.configureTestingModule({
imports: [TestComponent],
- // TODO: why tests are failed with NG_EVENT_PLUGINS
- // providers: [NG_EVENT_PLUGINS],
+ providers: [NG_EVENT_PLUGINS],
});
await TestBed.compileComponents();
fixture = TestBed.createComponent(TestComponent);
@@ -148,7 +148,7 @@ describe('expand', () => {
* JSDOM doesn't support native transitionend
*/
function transitionend(): void {
- const event = new Event('transitionend.self');
+ const event = new Event('transitionend');
(event as any).propertyName = 'opacity';
testComponent.expandElement.nativeElement.dispatchEvent(event);
diff --git a/projects/core/components/group/group.style.less b/projects/core/components/group/group.style.less
index 669e0f2e252b..cafae496a110 100644
--- a/projects/core/components/group/group.style.less
+++ b/projects/core/components/group/group.style.less
@@ -1,5 +1,6 @@
@import '@taiga-ui/core/styles/taiga-ui-local';
+// TODO: Refactor
.tui-group {
position: relative;
display: flex;
@@ -7,11 +8,6 @@
--t-radius: var(--tui-radius-m);
- // TODO: Remove this hack after accordion redesign
- tui-accordion& {
- width: 100%;
- }
-
& > * {
flex: 1 1 0;
min-width: 0;
diff --git a/projects/core/components/label/label.directive.ts b/projects/core/components/label/label.directive.ts
index d4cf1a44beff..3e4778fe1f58 100644
--- a/projects/core/components/label/label.directive.ts
+++ b/projects/core/components/label/label.directive.ts
@@ -27,7 +27,7 @@ class TuiLabelStyles {}
standalone: true,
selector: 'label[tuiLabel]',
host: {
- '[attr.for]': 'el.htmlFor || parent?.id',
+ '[attr.for]': 'el.htmlFor || parent?.input.id',
'[class._textfield]': 'textfield',
},
})
diff --git a/projects/core/components/scrollbar/scrollbar.directive.ts b/projects/core/components/scrollbar/scrollbar.directive.ts
index 9d45a14f27cf..02fc4a463f15 100644
--- a/projects/core/components/scrollbar/scrollbar.directive.ts
+++ b/projects/core/components/scrollbar/scrollbar.directive.ts
@@ -1,7 +1,7 @@
import {Directive, inject, Input, NgZone} from '@angular/core';
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import {ANIMATION_FRAME} from '@ng-web-apis/common';
-import {POLLING_TIME, tuiInjectElement, tuiScrollFrom, tuiZonefree} from '@taiga-ui/cdk';
+import {tuiInjectElement, tuiScrollFrom, tuiZonefree} from '@taiga-ui/cdk';
import {TUI_SCROLL_REF} from '@taiga-ui/core/tokens';
import {merge, throttleTime} from 'rxjs';
@@ -27,7 +27,7 @@ export class TuiScrollbarDirective {
});
protected readonly styleSub = merge(
- inject(ANIMATION_FRAME).pipe(throttleTime(POLLING_TIME)),
+ inject(ANIMATION_FRAME).pipe(throttleTime(100)),
tuiScrollFrom(this.el),
)
.pipe(tuiZonefree(inject(NgZone)), takeUntilDestroyed())
diff --git a/projects/core/components/svg-defs-host/svg-defs-host.component.ts b/projects/core/components/svg-defs-host/svg-defs-host.component.ts
index e0a64ef40998..4f5d9e2864a7 100644
--- a/projects/core/components/svg-defs-host/svg-defs-host.component.ts
+++ b/projects/core/components/svg-defs-host/svg-defs-host.component.ts
@@ -12,7 +12,7 @@ import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
import type {SafeHtml} from '@angular/platform-browser';
import {TuiSvgService} from '@taiga-ui/core/services';
-// TODO: Consider for legacy in 4.0
+// TODO: Move to legacy in 4.0
@Component({
standalone: true,
selector: 'tui-svg-defs-host',
@@ -28,7 +28,6 @@ export class TuiSvgDefsHostComponent implements OnInit {
protected readonly isBrowser = isPlatformBrowser(inject(PLATFORM_ID));
protected items!: IterableIterator;
- // @bad TODO: Looks like it could be async piped but it was probably written like that for a reason
public ngOnInit(): void {
this.svgService.items$
.pipe(takeUntilDestroyed(this.destroyRef))
diff --git a/projects/core/components/svg/svg.component.ts b/projects/core/components/svg/svg.component.ts
index 0dafa687a301..b0ec733a816d 100644
--- a/projects/core/components/svg/svg.component.ts
+++ b/projects/core/components/svg/svg.component.ts
@@ -41,7 +41,7 @@ export interface TuiIconError {
readonly message: string;
}
-// TODO: Consider moving to CDK along with SvgService and SvgDefsHostComponent
+// TODO: Move to legacy along with all related infrastructure SvgService and SvgDefsHostComponent
@Component({
standalone: true,
selector: 'tui-svg',
@@ -69,6 +69,7 @@ export class TuiSvgComponent {
protected readonly innerHTML$: Observable;
constructor() {
+ // TODO: Consider legacy mode where all icons are treated as external to support new icons
this.innerHTML$ = this.src$.pipe(
switchMap(() => {
if (tuiIsString(this.icon)) {
diff --git a/projects/core/components/textfield/textfield.component.ts b/projects/core/components/textfield/textfield.component.ts
index ae95fdb69f1b..55b925281e27 100644
--- a/projects/core/components/textfield/textfield.component.ts
+++ b/projects/core/components/textfield/textfield.component.ts
@@ -9,16 +9,8 @@ import {
} from '@angular/core';
import {NgControl} from '@angular/forms';
import {ResizeObserverModule} from '@ng-web-apis/resize-observer';
-import type {
- TuiContext,
- TuiFocusableElementAccessor,
- TuiStringHandler,
-} from '@taiga-ui/cdk';
-import {
- tuiAsFocusableItemAccessor,
- tuiIsNativeFocused,
- TuiNativeValidatorDirective,
-} from '@taiga-ui/cdk';
+import type {TuiContext, TuiStringHandler} from '@taiga-ui/cdk';
+import {tuiIsNativeFocused, TuiNativeValidatorDirective} from '@taiga-ui/cdk';
import {TuiButtonDirective} from '@taiga-ui/core/components/button';
import type {TuiDataListHost} from '@taiga-ui/core/components/data-list';
import {tuiAsDataListHost, TuiWithDataList} from '@taiga-ui/core/components/data-list';
@@ -32,7 +24,6 @@ import {
import {TuiIconsDirective} from '@taiga-ui/core/directives/icons';
import type {PolymorpheusContent} from '@tinkoff/ng-polymorpheus';
import {PolymorpheusModule} from '@tinkoff/ng-polymorpheus';
-import {EMPTY} from 'rxjs';
import {TuiTextfieldDirective} from './textfield.directive';
import {TUI_TEXTFIELD_OPTIONS, TuiTextfieldOptionsDirective} from './textfield.options';
@@ -49,7 +40,6 @@ export interface TuiTextfieldContext extends TuiContext {
styleUrls: ['./textfield.style.less'],
changeDetection: ChangeDetectionStrategy.OnPush,
providers: [
- tuiAsFocusableItemAccessor(TuiTextfieldComponent),
tuiAsDataListHost(TuiTextfieldComponent),
tuiAppearanceOptionsProvider(TUI_TEXTFIELD_OPTIONS),
tuiDropdownOptionsProvider({limitWidth: 'fixed'}),
@@ -75,9 +65,7 @@ export interface TuiTextfieldContext extends TuiContext {
},
],
})
-export class TuiTextfieldComponent
- implements TuiDataListHost, TuiFocusableElementAccessor
-{
+export class TuiTextfieldComponent implements TuiDataListHost {
@ContentChild(TuiTextfieldDirective, {read: ElementRef})
private readonly el?: ElementRef;
@@ -108,15 +96,12 @@ export class TuiTextfieldComponent
@Input()
public content: PolymorpheusContent>;
- // TODO: Refactor
- public readonly focusedChange = EMPTY;
-
- public get nativeFocusableElement(): HTMLInputElement {
- return this.input;
- }
+ public get input(): HTMLInputElement {
+ if (!this.el) {
+ throw new Error('[tuiTextfield] component is required');
+ }
- public get id(): string {
- return this.input.id || '';
+ return this.el.nativeElement;
}
// TODO: Do not change to `this.input`, will be refactored
@@ -129,14 +114,6 @@ export class TuiTextfieldComponent
this.dropdown?.toggle(false);
}
- protected get input(): HTMLInputElement {
- if (!this.el) {
- throw new Error('[tuiTextfield] component is required');
- }
-
- return this.el.nativeElement;
- }
-
protected get computedFiller(): string {
const value = this.input.value || '';
const filler = value + this.filler.slice(value.length);
diff --git a/projects/core/services/svg.service.ts b/projects/core/services/svg.service.ts
index f760f6d05423..8414049cf501 100644
--- a/projects/core/services/svg.service.ts
+++ b/projects/core/services/svg.service.ts
@@ -8,7 +8,7 @@ import {BehaviorSubject} from 'rxjs';
/**
* Service for reusing SVGs without inlining each instance
- * TODO: Consider for legacy in 4.0
+ * TODO: Move to legacy in 4.0
*/
@Injectable({
providedIn: 'root',
diff --git a/projects/core/styles/theme/variables.less b/projects/core/styles/theme/variables.less
index 73025c27cd09..e7adcb19462e 100644
--- a/projects/core/styles/theme/variables.less
+++ b/projects/core/styles/theme/variables.less
@@ -2,18 +2,15 @@
:root,
[tuiTheme='light'][tuiTheme='light'] {
- // Deprecated TODO 4.0 delete variables --tui-heading-font and --tui-text-font
- --tui-heading-font: 'Manrope', @font-fallback;
- --tui-text-font: 'Manrope', @font-fallback;
// Fonts
- --tui-font-heading: var(--tui-heading-font);
+ --tui-font-heading: 'Manrope', @font-fallback;
--tui-font-heading-1: bold 3.125rem/3.5rem var(--tui-font-heading);
--tui-font-heading-2: bold 2.75rem/3rem var(--tui-font-heading);
--tui-font-heading-3: bold 2.25rem/2.5rem var(--tui-font-heading);
--tui-font-heading-4: bold 1.75rem/2rem var(--tui-font-heading);
--tui-font-heading-5: bold 1.5rem/1.75rem var(--tui-font-heading);
--tui-font-heading-6: bold 1.25rem/1.5rem var(--tui-font-heading);
- --tui-font-text: var(--tui-text-font);
+ --tui-font-text: 'Manrope', @font-fallback;
--tui-font-text-xl: normal 1.1875rem/1.75rem var(--tui-font-text);
--tui-font-text-l: normal 1.0625rem/1.75rem var(--tui-font-text);
--tui-font-text-l-2: normal 1.0625rem/1.5rem var(--tui-font-text);
diff --git a/projects/core/tokens/index.ts b/projects/core/tokens/index.ts
index 6e8a639cdceb..f183205e333b 100644
--- a/projects/core/tokens/index.ts
+++ b/projects/core/tokens/index.ts
@@ -13,8 +13,5 @@ export * from './sanitizer';
export * from './scroll-ref';
export * from './selection-stream';
export * from './spin-icons';
-export * from './textfield-appearance';
-export * from './textfield-host';
export * from './theme';
-export * from './value-accessor';
export * from './viewport';
diff --git a/projects/core/tokens/textfield-host.ts b/projects/core/tokens/textfield-host.ts
deleted file mode 100644
index 6aee605678b3..000000000000
--- a/projects/core/tokens/textfield-host.ts
+++ /dev/null
@@ -1,16 +0,0 @@
-import type {Provider, Type} from '@angular/core';
-import {InjectionToken} from '@angular/core';
-import {tuiProvide} from '@taiga-ui/cdk';
-import type {TuiTextfieldHost} from '@taiga-ui/core/types';
-
-/**
- * An interface to communicate with textfield based controls
- * TODO: Consider moving to legacy in 4.0
- */
-export const TUI_TEXTFIELD_HOST = new InjectionToken(
- '[TUI_TEXTFIELD_HOST]',
-);
-
-export function tuiAsTextfieldHost(host: Type): Provider {
- return tuiProvide(TUI_TEXTFIELD_HOST, host);
-}
diff --git a/projects/core/types/index.ts b/projects/core/types/index.ts
index a9cc8a976f03..809cef1a6b08 100644
--- a/projects/core/types/index.ts
+++ b/projects/core/types/index.ts
@@ -5,6 +5,4 @@ export * from './point';
export * from './portal-item';
export * from './range-state';
export * from './size';
-export * from './textfield-host';
export * from './value-content-context';
-export * from './with-optional-min-max';
diff --git a/projects/core/types/point.ts b/projects/core/types/point.ts
index 32ed0604be6d..d5e70163d298 100644
--- a/projects/core/types/point.ts
+++ b/projects/core/types/point.ts
@@ -1 +1,2 @@
+// TODO: Refactor to [x: number, y: number] across the library
export type TuiPoint = Readonly<[number, number]>;
diff --git a/projects/core/types/with-optional-min-max.ts b/projects/core/types/with-optional-min-max.ts
deleted file mode 100644
index c8a57f8860e7..000000000000
--- a/projects/core/types/with-optional-min-max.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-// @bad TODO: declare methods
-export interface TuiWithOptionalMinMax {
- max: T | null;
- min: T | null;
-}
diff --git a/projects/core/utils/miscellaneous/icons-path-factory.ts b/projects/core/utils/miscellaneous/icons-path-factory.ts
index f491e2a2504d..2df61e2c250a 100644
--- a/projects/core/utils/miscellaneous/icons-path-factory.ts
+++ b/projects/core/utils/miscellaneous/icons-path-factory.ts
@@ -6,6 +6,7 @@ export const TUI_CACHE_BUSTING_PAYLOAD = `?v=${TUI_VERSION}` as const;
export const DEFAULT_ICONS_PATH: TuiStringHandler = name =>
name.includes('.svg#') ? name : `#${name}`;
+// TODO: Move to legacy with tui-svg
export function tuiIconsPathFactory(staticPath: string): TuiStringHandler {
const base = staticPath.endsWith('/') ? staticPath : `${staticPath}/`;
diff --git a/projects/core/utils/miscellaneous/index.ts b/projects/core/utils/miscellaneous/index.ts
index 610f37bac890..02908df745c9 100644
--- a/projects/core/utils/miscellaneous/index.ts
+++ b/projects/core/utils/miscellaneous/index.ts
@@ -1,4 +1,3 @@
-export * from './get-border';
export * from './icons-path-factory';
export * from './is-editing-key';
export * from './is-obscured';
diff --git a/projects/core/utils/miscellaneous/is-presumed-html-string.ts b/projects/core/utils/miscellaneous/is-presumed-html-string.ts
index 0aeb15c480ee..0fbea517da32 100644
--- a/projects/core/utils/miscellaneous/is-presumed-html-string.ts
+++ b/projects/core/utils/miscellaneous/is-presumed-html-string.ts
@@ -1,3 +1,4 @@
+// TODO: Move to legacy with tui-svg
export function tuiIsPresumedHTMLString(candidate: string): boolean {
const trimmed = candidate.trim();
diff --git a/projects/demo/src/modules/components/abstract/control.ts b/projects/demo/src/modules/components/abstract/control.ts
index 9a278c31348f..c87ec07f4908 100644
--- a/projects/demo/src/modules/components/abstract/control.ts
+++ b/projects/demo/src/modules/components/abstract/control.ts
@@ -1,5 +1,4 @@
import type {AbstractControl} from '@angular/forms';
-import type {TuiInputMode, TuiInputType} from '@taiga-ui/cdk';
import type {
TuiDropdownAlign,
TuiDropdownWidth,
@@ -41,7 +40,7 @@ export abstract class AbstractExampleTuiControl
public readonly hintAppearanceVariants = ['', 'error', 'dark'];
- public readonly typeVariants: readonly TuiInputType[] = [
+ public readonly typeVariants: readonly string[] = [
'text',
'email',
'password',
@@ -51,7 +50,7 @@ export abstract class AbstractExampleTuiControl
public readonly maxLengthVariants: readonly TuiPossibleGenericType[] = [10];
- public readonly inputModeVariants: readonly TuiInputMode[] = ['text', 'numeric'];
+ public readonly inputModeVariants: readonly string[] = ['text', 'numeric'];
public readonly customContentVariants: PolymorpheusContent[] = [
'',
@@ -68,7 +67,7 @@ export abstract class AbstractExampleTuiControl
public maxLength: TuiPossibleGenericType | null = null;
- public type: TuiInputType = this.typeVariants[0];
+ public type = this.typeVariants[0];
public cleaner = false;
diff --git a/projects/demo/src/modules/components/input-date-range/examples/1/index.ts b/projects/demo/src/modules/components/input-date-range/examples/1/index.ts
index cdea6170c23a..b86bc9c217a2 100644
--- a/projects/demo/src/modules/components/input-date-range/examples/1/index.ts
+++ b/projects/demo/src/modules/components/input-date-range/examples/1/index.ts
@@ -3,8 +3,7 @@ import {FormControl, FormGroup, ReactiveFormsModule} from '@angular/forms';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiDay, TuiDayRange} from '@taiga-ui/cdk';
-import {TuiUnfinishedValidatorDirective} from '@taiga-ui/kit';
-import {TuiInputDateRangeModule} from '@taiga-ui/legacy';
+import {TuiInputDateRangeModule, TuiUnfinishedValidatorDirective} from '@taiga-ui/legacy';
@Component({
standalone: true,
diff --git a/projects/demo/src/modules/components/input-date/examples/1/index.ts b/projects/demo/src/modules/components/input-date/examples/1/index.ts
index 6f53614b823e..6d5f5bebd31c 100644
--- a/projects/demo/src/modules/components/input-date/examples/1/index.ts
+++ b/projects/demo/src/modules/components/input-date/examples/1/index.ts
@@ -6,7 +6,11 @@ import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiDay} from '@taiga-ui/cdk';
import {TuiErrorComponent} from '@taiga-ui/core';
import {TuiFieldErrorPipe} from '@taiga-ui/kit';
-import {TuiInputDateModule, TuiTextfieldControllerModule} from '@taiga-ui/legacy';
+import {
+ TuiInputDateModule,
+ TuiTextfieldControllerModule,
+ TuiUnfinishedValidatorDirective,
+} from '@taiga-ui/legacy';
@Component({
standalone: true,
@@ -17,6 +21,7 @@ import {TuiInputDateModule, TuiTextfieldControllerModule} from '@taiga-ui/legacy
TuiFieldErrorPipe,
ReactiveFormsModule,
AsyncPipe,
+ TuiUnfinishedValidatorDirective,
],
templateUrl: './index.html',
encapsulation,
diff --git a/projects/demo/src/modules/components/input-time/examples/1/index.ts b/projects/demo/src/modules/components/input-time/examples/1/index.ts
index 6987f312c5ff..db3bc308ceb2 100644
--- a/projects/demo/src/modules/components/input-time/examples/1/index.ts
+++ b/projects/demo/src/modules/components/input-time/examples/1/index.ts
@@ -3,8 +3,11 @@ import {FormControl, FormGroup, ReactiveFormsModule} from '@angular/forms';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TuiTime} from '@taiga-ui/cdk';
-import {TuiUnfinishedValidatorDirective} from '@taiga-ui/kit';
-import {TuiInputTimeModule, TuiTextfieldControllerModule} from '@taiga-ui/legacy';
+import {
+ TuiInputTimeModule,
+ TuiTextfieldControllerModule,
+ TuiUnfinishedValidatorDirective,
+} from '@taiga-ui/legacy';
@Component({
standalone: true,
@@ -13,6 +16,7 @@ import {TuiInputTimeModule, TuiTextfieldControllerModule} from '@taiga-ui/legacy
TuiInputTimeModule,
TuiTextfieldControllerModule,
TuiUnfinishedValidatorDirective,
+ TuiUnfinishedValidatorDirective,
],
templateUrl: './index.html',
encapsulation,
diff --git a/projects/demo/src/modules/components/primitive-textfield/examples/1/index.ts b/projects/demo/src/modules/components/primitive-textfield/examples/1/index.ts
index 73872c760e74..452d21b6b241 100644
--- a/projects/demo/src/modules/components/primitive-textfield/examples/1/index.ts
+++ b/projects/demo/src/modules/components/primitive-textfield/examples/1/index.ts
@@ -1,8 +1,8 @@
import {Component, ViewChild} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
-import type {TuiNativeFocusableElement} from '@taiga-ui/cdk';
import {TuiHintDirective, TuiSvgComponent} from '@taiga-ui/core';
+import type {TuiNativeFocusableElement} from '@taiga-ui/legacy';
import {
AbstractTuiControl,
TuiPrimitiveTextfieldComponent,
diff --git a/projects/demo/src/modules/components/primitive-textfield/examples/2/index.ts b/projects/demo/src/modules/components/primitive-textfield/examples/2/index.ts
index 41d8959bc1a5..ecffa8e85a83 100644
--- a/projects/demo/src/modules/components/primitive-textfield/examples/2/index.ts
+++ b/projects/demo/src/modules/components/primitive-textfield/examples/2/index.ts
@@ -1,8 +1,8 @@
import {Component, ViewChild} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
-import type {TuiNativeFocusableElement} from '@taiga-ui/cdk';
import {TuiHintOptionsDirective} from '@taiga-ui/core';
+import type {TuiNativeFocusableElement} from '@taiga-ui/legacy';
import {
AbstractTuiControl,
TuiPrimitiveTextfieldComponent,
diff --git a/projects/demo/src/modules/components/primitive-textfield/index.ts b/projects/demo/src/modules/components/primitive-textfield/index.ts
index 40db3221c21d..19df7d6bcd39 100644
--- a/projects/demo/src/modules/components/primitive-textfield/index.ts
+++ b/projects/demo/src/modules/components/primitive-textfield/index.ts
@@ -4,7 +4,7 @@ import {RouterLink} from '@angular/router';
import {changeDetection} from '@demo/emulate/change-detection';
import {DemoRoute} from '@demo/routes';
import {TuiDemo} from '@demo/utils';
-import type {TuiContext, TuiInputMode, TuiInputType} from '@taiga-ui/cdk';
+import type {TuiContext} from '@taiga-ui/cdk';
import {tuiProvide} from '@taiga-ui/cdk';
import type {TuiSizeL, TuiSizeS} from '@taiga-ui/core';
import {
@@ -84,7 +84,7 @@ export default class PageComponent extends AbstractExampleTuiInteractive {
protected iconLeft = '';
- protected readonly typeVariants: readonly TuiInputType[] = [
+ protected readonly typeVariants: readonly string[] = [
'text',
'email',
'password',
@@ -106,7 +106,7 @@ export default class PageComponent extends AbstractExampleTuiInteractive {
protected maxLength = null;
- protected readonly inputModeVariants: readonly TuiInputMode[] = ['text', 'numeric'];
+ protected readonly inputModeVariants: readonly string[] = ['text', 'numeric'];
protected inputMode = this.inputModeVariants[0];
diff --git a/projects/demo/src/modules/components/utils/tokens/examples/2/index.html b/projects/demo/src/modules/components/utils/tokens/examples/2/index.html
index 9baaefb6b5f2..74e51b6b842d 100644
--- a/projects/demo/src/modules/components/utils/tokens/examples/2/index.html
+++ b/projects/demo/src/modules/components/utils/tokens/examples/2/index.html
@@ -1,4 +1,19 @@
- All Taiga UI components that can be focused provide this token so you can inject them into your directives that work
- with focus.
+ A token with a factory. It takes
+
+ TUI_IS_MOBILE
+
+ and
+
+ TUI_IS_IOS
+
+ , returns true if the device is mobile but not iOS (technically includes Windows Phone, Blackberry etc.)
diff --git a/projects/demo/src/modules/components/utils/tokens/examples/2/index.ts b/projects/demo/src/modules/components/utils/tokens/examples/2/index.ts
index c18bd511b205..f8a844b171aa 100644
--- a/projects/demo/src/modules/components/utils/tokens/examples/2/index.ts
+++ b/projects/demo/src/modules/components/utils/tokens/examples/2/index.ts
@@ -1,14 +1,17 @@
import {Component, inject} from '@angular/core';
+import {RouterLink} from '@angular/router';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
-import {TUI_FOCUSABLE_ITEM_ACCESSOR} from '@taiga-ui/cdk';
+import {TUI_IS_ANDROID} from '@taiga-ui/cdk';
+import {TuiLinkDirective} from '@taiga-ui/core';
@Component({
standalone: true,
+ imports: [RouterLink, TuiLinkDirective],
templateUrl: './index.html',
encapsulation,
changeDetection,
})
export default class ExampleComponent {
- protected readonly focusable = inject(TUI_FOCUSABLE_ITEM_ACCESSOR, {optional: true});
+ protected readonly isAndroid = inject(TUI_IS_ANDROID);
}
diff --git a/projects/demo/src/modules/components/utils/tokens/examples/3/index.html b/projects/demo/src/modules/components/utils/tokens/examples/3/index.html
index 74e51b6b842d..2b0b3c564cf1 100644
--- a/projects/demo/src/modules/components/utils/tokens/examples/3/index.html
+++ b/projects/demo/src/modules/components/utils/tokens/examples/3/index.html
@@ -7,13 +7,5 @@
>
TUI_IS_MOBILE
- and
-
- TUI_IS_IOS
-
- , returns true if the device is mobile but not iOS (technically includes Windows Phone, Blackberry etc.)
+ and if it is true detects iOS devices with a regex
diff --git a/projects/demo/src/modules/components/utils/tokens/examples/3/index.ts b/projects/demo/src/modules/components/utils/tokens/examples/3/index.ts
index f8a844b171aa..275bde4d9831 100644
--- a/projects/demo/src/modules/components/utils/tokens/examples/3/index.ts
+++ b/projects/demo/src/modules/components/utils/tokens/examples/3/index.ts
@@ -2,16 +2,16 @@ import {Component, inject} from '@angular/core';
import {RouterLink} from '@angular/router';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
-import {TUI_IS_ANDROID} from '@taiga-ui/cdk';
+import {TUI_IS_IOS} from '@taiga-ui/cdk';
import {TuiLinkDirective} from '@taiga-ui/core';
@Component({
standalone: true,
- imports: [RouterLink, TuiLinkDirective],
+ imports: [TuiLinkDirective, RouterLink],
templateUrl: './index.html',
encapsulation,
changeDetection,
})
export default class ExampleComponent {
- protected readonly isAndroid = inject(TUI_IS_ANDROID);
+ protected readonly isIos = inject(TUI_IS_IOS);
}
diff --git a/projects/demo/src/modules/components/utils/tokens/examples/4/index.html b/projects/demo/src/modules/components/utils/tokens/examples/4/index.html
index 2b0b3c564cf1..c18c8e91e158 100644
--- a/projects/demo/src/modules/components/utils/tokens/examples/4/index.html
+++ b/projects/demo/src/modules/components/utils/tokens/examples/4/index.html
@@ -1,11 +1,4 @@
- A token with a factory. It takes
-
- TUI_IS_MOBILE
-
- and if it is true detects iOS devices with a regex
+ A token with a factory. It takes USER_AGENT token and parses it with a complex Regex to detect users with mobile
+ devices
diff --git a/projects/demo/src/modules/components/utils/tokens/examples/4/index.ts b/projects/demo/src/modules/components/utils/tokens/examples/4/index.ts
index 275bde4d9831..0431e96c0411 100644
--- a/projects/demo/src/modules/components/utils/tokens/examples/4/index.ts
+++ b/projects/demo/src/modules/components/utils/tokens/examples/4/index.ts
@@ -1,17 +1,14 @@
import {Component, inject} from '@angular/core';
-import {RouterLink} from '@angular/router';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
-import {TUI_IS_IOS} from '@taiga-ui/cdk';
-import {TuiLinkDirective} from '@taiga-ui/core';
+import {TUI_IS_MOBILE} from '@taiga-ui/cdk';
@Component({
standalone: true,
- imports: [TuiLinkDirective, RouterLink],
templateUrl: './index.html',
encapsulation,
changeDetection,
})
export default class ExampleComponent {
- protected readonly isIos = inject(TUI_IS_IOS);
+ protected readonly isMobile = inject(TUI_IS_MOBILE);
}
diff --git a/projects/demo/src/modules/components/utils/tokens/examples/5/index.html b/projects/demo/src/modules/components/utils/tokens/examples/5/index.html
index c18c8e91e158..904ea55f6dbb 100644
--- a/projects/demo/src/modules/components/utils/tokens/examples/5/index.html
+++ b/projects/demo/src/modules/components/utils/tokens/examples/5/index.html
@@ -1,4 +1,77 @@
-
- A token with a factory. It takes USER_AGENT token and parses it with a complex Regex to detect users with mobile
- devices
-
+
+
+ Using
+ TUI_NUMBER_FORMAT
+ injection token you can customize numbers formatting.
+