Skip to content

Commit

Permalink
feat!: drop support of legacy not-chromium Edge (EdgeHTML)
Browse files Browse the repository at this point in the history
  • Loading branch information
nsbarsukov authored and splincode committed Aug 9, 2022
1 parent d5277c2 commit c4e79b6
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 98 deletions.
4 changes: 4 additions & 0 deletions projects/cdk/constants/browser.ts
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
/**
* @deprecated
* TODO: drop support of legacy Edge (EdgeHTML) in v4.x
*/
export const CHROMIUM_EDGE_START_VERSION = 79;
1 change: 0 additions & 1 deletion projects/cdk/utils/browser/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export * from './is-edge';
export * from './is-edge-older-than';
export * from './is-firefox';
export * from './is-ie';
export * from './is-safari';
3 changes: 0 additions & 3 deletions projects/cdk/utils/browser/is-ie.ts

This file was deleted.

5 changes: 0 additions & 5 deletions projects/cdk/utils/browser/test/browsers.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import {tuiIsEdge} from '../is-edge';
import {tuiIsEdgeOlderThan} from '../is-edge-older-than';
import {tuiIsFirefox} from '../is-firefox';
import {tuiIsIE} from '../is-ie';

describe(`Browsers`, () => {
it(`isIE`, () => {
expect(tuiIsIE(`trident`)).toBe(true);
});

it(`isEdge`, () => {
expect(tuiIsEdge(`edge`)).toBe(true);
});
Expand Down
7 changes: 2 additions & 5 deletions projects/core/components/svg/svg.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ import {
SecurityContext,
} from '@angular/core';
import {DomSanitizer, SafeHtml} from '@angular/platform-browser';
import {USER_AGENT, WINDOW} from '@ng-web-apis/common';
import {WINDOW} from '@ng-web-apis/common';
import {
tuiAssert,
tuiGetDocumentOrShadowRoot,
tuiIsIE,
tuiPure,
tuiRequiredSetter,
TuiStaticRequestService,
Expand Down Expand Up @@ -46,7 +45,6 @@ const FAILED_EXTERNAL_ICON = `Failed to load external SVG`;
})
export class TuiSvgComponent {
private readonly src$ = new ReplaySubject<void>(1);
private readonly isIE = tuiIsIE(this.userAgent);
private icon = ``;

@Input()
Expand All @@ -70,7 +68,6 @@ export class TuiSvgComponent {
private readonly staticRequestService: TuiStaticRequestService,
@Inject(DomSanitizer) private readonly sanitizer: DomSanitizer,
@Inject(ElementRef) private readonly elementRef: ElementRef<Element>,
@Inject(USER_AGENT) private readonly userAgent: string,
@Inject(TUI_SVG_SRC_PROCESSOR)
private readonly srcProcessor: TuiStringHandler<string>,
@Inject(TUI_SVG_CONTENT_PROCESSOR)
Expand Down Expand Up @@ -111,7 +108,7 @@ export class TuiSvgComponent {
}

private get isExternal(): boolean {
return this.isUrl || (this.isIE && this.isUse) || this.isCrossDomain;
return this.isUrl || this.isCrossDomain;
}

private get isUrl(): boolean {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import {AfterViewInit, Component, Inject, ViewChild} from '@angular/core';
import {DomSanitizer, SafeStyle} from '@angular/platform-browser';
import {changeDetection} from '@demo/emulate/change-detection';
import {USER_AGENT} from '@ng-web-apis/common';
import {TuiDocDemoComponent} from '@taiga-ui/addon-doc';
import {TuiDestroyService, tuiIsIE, tuiIsString, tuiPure, tuiPx} from '@taiga-ui/cdk';
import {TuiDestroyService, tuiIsString, tuiPure, tuiPx} from '@taiga-ui/cdk';
import {TuiBrightness} from '@taiga-ui/core';
import {Subject} from 'rxjs';
import {takeUntil} from 'rxjs/operators';
Expand All @@ -24,15 +23,12 @@ export class TuiCustomizationComponent implements AfterViewInit {
@ViewChild(`demo`)
private readonly demo?: TuiDocDemoComponent;

readonly isIE = tuiIsIE(this.userAgent);

readonly change$ = new Subject<void>();

constructor(
@Inject(TuiDestroyService) private readonly destroy$: TuiDestroyService,
@Inject(DomSanitizer) private readonly sanitizer: DomSanitizer,
@Inject(TUI_DOC_CUSTOMIZATION_VARS) private variables: Record<string, string>,
@Inject(USER_AGENT) private readonly userAgent: string,
) {}

get style(): SafeStyle {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,71 +1,68 @@
<h2 *ngIf="isIE; else customization">Not available in Internet Explorer.</h2>
<ng-template #customization>
<tui-doc-demo
#demo
[attr.style]="style"
>
<ng-content></ng-content>
</tui-doc-demo>
<tui-doc-documentation
*ngIf="basic; else withMode"
<tui-doc-demo
#demo
[attr.style]="style"
>
<ng-content></ng-content>
</tui-doc-demo>
<tui-doc-documentation
*ngIf="basic; else withMode"
class="tui-space_top-6"
[tuiMode]="null"
>
<ng-template
*ngFor="let variable of keys"
[documentationPropertyName]="variable"
[documentationPropertyType]="getType(variable)"
[documentationPropertyValue]="getVariable(variable)"
(documentationPropertyValueChange)="onModelChange(variable, $event)"
></ng-template>
</tui-doc-documentation>
<ng-template #withMode>
<tui-accordion
class="tui-space_top-6"
[tuiMode]="null"
>
<ng-template
*ngFor="let variable of keys"
[documentationPropertyName]="variable"
[documentationPropertyType]="getType(variable)"
[documentationPropertyValue]="getVariable(variable)"
(documentationPropertyValueChange)="onModelChange(variable, $event)"
></ng-template>
</tui-doc-documentation>
<ng-template #withMode>
<tui-accordion
class="tui-space_top-6"
[tuiMode]="null"
>
<tui-accordion-item>
Default
<tui-doc-documentation *tuiAccordionItemContent>
<ng-container *ngFor="let variable of keys">
<ng-template
*ngIf="!isDark(variable) && !isLight(variable)"
[documentationPropertyName]="variable"
[documentationPropertyType]="getType(variable)"
[documentationPropertyValue]="getVariable(variable)"
(documentationPropertyValueChange)="onModelChange(variable, $event)"
></ng-template>
</ng-container>
</tui-doc-documentation>
</tui-accordion-item>
<tui-accordion-item *ngIf="hasLight">
Light
<tui-doc-documentation *tuiAccordionItemContent>
<ng-container *ngFor="let variable of keys">
<ng-template
*ngIf="isLight(variable)"
[documentationPropertyName]="variable"
[documentationPropertyType]="getType(variable)"
[documentationPropertyValue]="getVariable(variable)"
(documentationPropertyValueChange)="onModelChange(variable, $event)"
></ng-template>
</ng-container>
</tui-doc-documentation>
</tui-accordion-item>
<tui-accordion-item *ngIf="hasLight">
Dark
<tui-doc-documentation *tuiAccordionItemContent>
<ng-container *ngFor="let variable of keys">
<ng-template
*ngIf="isDark(variable)"
[documentationPropertyName]="variable"
[documentationPropertyType]="getType(variable)"
[documentationPropertyValue]="getVariable(variable)"
(documentationPropertyValueChange)="onModelChange(variable, $event)"
></ng-template>
</ng-container>
</tui-doc-documentation>
</tui-accordion-item>
</tui-accordion>
</ng-template>
<tui-accordion-item>
Default
<tui-doc-documentation *tuiAccordionItemContent>
<ng-container *ngFor="let variable of keys">
<ng-template
*ngIf="!isDark(variable) && !isLight(variable)"
[documentationPropertyName]="variable"
[documentationPropertyType]="getType(variable)"
[documentationPropertyValue]="getVariable(variable)"
(documentationPropertyValueChange)="onModelChange(variable, $event)"
></ng-template>
</ng-container>
</tui-doc-documentation>
</tui-accordion-item>
<tui-accordion-item *ngIf="hasLight">
Light
<tui-doc-documentation *tuiAccordionItemContent>
<ng-container *ngFor="let variable of keys">
<ng-template
*ngIf="isLight(variable)"
[documentationPropertyName]="variable"
[documentationPropertyType]="getType(variable)"
[documentationPropertyValue]="getVariable(variable)"
(documentationPropertyValueChange)="onModelChange(variable, $event)"
></ng-template>
</ng-container>
</tui-doc-documentation>
</tui-accordion-item>
<tui-accordion-item *ngIf="hasLight">
Dark
<tui-doc-documentation *tuiAccordionItemContent>
<ng-container *ngFor="let variable of keys">
<ng-template
*ngIf="isDark(variable)"
[documentationPropertyName]="variable"
[documentationPropertyType]="getType(variable)"
[documentationPropertyValue]="getVariable(variable)"
(documentationPropertyValueChange)="onModelChange(variable, $event)"
></ng-template>
</ng-container>
</tui-doc-documentation>
</tui-accordion-item>
</tui-accordion>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
<td class="tui-table__td">Opera</td>
<td class="tui-table__td">36+</td>
</tr>
<tr class="tui-table__tr">
<td class="tui-table__td">Edge (Chromium)</td>
<td class="tui-table__td">80+</td>
</tr>
<tr class="tui-table__tr">
<td class="tui-table__td">Microsoft Internet Explorer</td>
<td class="tui-table__td">
Expand All @@ -52,7 +56,7 @@
</tr>
<tr class="tui-table__tr">
<td class="tui-table__td">Edge (EdgeHTML)</td>
<td class="tui-table__td">16+</td>
<td class="tui-table__td"><strong>Not supported</strong></td>
</tr>
</tbody>
</table>
Expand Down
6 changes: 1 addition & 5 deletions projects/demo/src/modules/utils/browser/examples/1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Component, Inject} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {USER_AGENT} from '@ng-web-apis/common';
import {tuiIsEdge, tuiIsEdgeOlderThan, tuiIsFirefox, tuiIsIE} from '@taiga-ui/cdk';
import {tuiIsEdge, tuiIsEdgeOlderThan, tuiIsFirefox} from '@taiga-ui/cdk';

@Component({
selector: `tui-browser-example-1`,
Expand All @@ -22,10 +22,6 @@ export class TuiBrowserExample1 {
return `Edge until 13`;
}

if (tuiIsIE(this.userAgent)) {
return `Unfortunately, you have IE11`;
}

if (tuiIsFirefox(this.userAgent)) {
return `Okay, you have Firefox!`;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
```ts
import {isIE} from '@taiga-ui/cdk';
import {tuiIsEdge} from '@taiga-ui/cdk';
import {USER_AGENT} from '@ng-web-apis/common';

// ...
export class MyComponent {
areThereProblems = isIE(this.userAgent);
areThereProblems = tuiIsEdge(this.userAgent);

constructor(@Inject(USER_AGENT) private readonly userAgent: string) {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
CHROMIUM_EDGE_START_VERSION,
TuiDestroyService,
tuiIsEdgeOlderThan,
tuiIsIE,
tuiPure,
TuiResizeService,
} from '@taiga-ui/cdk';
Expand All @@ -31,9 +30,11 @@ function calculateColorSegments(colors: string[], progressWidth: number): string
providers: [TuiDestroyService, TuiResizeService],
})
export class TuiProgressColorSegmentsDirective {
private readonly isOldBrowsers =
tuiIsEdgeOlderThan(CHROMIUM_EDGE_START_VERSION, this.userAgent) ||
tuiIsIE(this.userAgent);
// TODO: drop support of legacy Edge (EdgeHTML) in v4.x
private readonly isOldBrowsers = tuiIsEdgeOlderThan(
CHROMIUM_EDGE_START_VERSION,
this.userAgent,
);

@Input(`tuiProgressColorSegments`)
colors: string[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export class TuiProgressCircleComponent {
return this.value / this.max;
}

// TODO: drop support of legacy Edge (EdgeHTML) in v4.x
get oldEdgeRadiusFallback(): number | null {
if (!tuiIsEdgeOlderThan(CHROMIUM_EDGE_START_VERSION, this.userAgent)) {
return null;
Expand Down
1 change: 1 addition & 0 deletions projects/kit/components/slider/slider.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export class TuiSliderComponent {
return 100 / Math.max(1, this.segments);
}

// TODO: drop support of legacy Edge (EdgeHTML) in v4.x
@HostBinding(`class._old-edge`)
get isOldEdge(): boolean {
return tuiIsEdgeOlderThan(CHROMIUM_EDGE_START_VERSION, this.userAgent);
Expand Down

0 comments on commit c4e79b6

Please sign in to comment.