-
Notifications
You must be signed in to change notification settings - Fork 474
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor!: remove deprecated functions without
tui
-prefix
- Loading branch information
1 parent
129fd55
commit aafe5e9
Showing
149 changed files
with
511 additions
and
755 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,3 @@ | ||
/** | ||
* @deprecated: use {@link drawLine} instead | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
export function drawLine(point: [number, number]): string { | ||
export function tuiDrawLine(point: [number, number]): string { | ||
return `L ${point}`; | ||
} | ||
|
||
export const tuiDrawLine = drawLine; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,16 @@ | ||
import {TuiPoint} from '@taiga-ui/core'; | ||
|
||
import {drawCurve} from './draw-curve'; | ||
import {drawLine} from './draw-line'; | ||
import {tuiDrawCurve} from './draw-curve'; | ||
import {tuiDrawLine} from './draw-line'; | ||
|
||
const COEFFICIENT = 500; | ||
|
||
/** | ||
* @deprecated: use {@link tuiDraw} instead | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
export function draw( | ||
export function tuiDraw( | ||
array: readonly TuiPoint[], | ||
index: number, | ||
smoothing: number, | ||
): string { | ||
return smoothing | ||
? drawCurve(array, index, smoothing / COEFFICIENT) | ||
: drawLine([array[index][0], array[index][1]]); | ||
? tuiDrawCurve(array, index, smoothing / COEFFICIENT) | ||
: tuiDrawLine([array[index][0], array[index][1]]); | ||
} | ||
|
||
export const tuiDraw = draw; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
import {TuiPoint} from '@taiga-ui/core'; | ||
|
||
/** | ||
* @deprecated: use {@link tuiLineAngle} instead | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
export function lineAngle(a: TuiPoint, b: TuiPoint): number { | ||
export function tuiLineAngle(a: TuiPoint, b: TuiPoint): number { | ||
const x = b[0] - a[0]; | ||
const y = b[1] - a[1]; | ||
|
||
return Math.atan2(y, x); | ||
} | ||
|
||
export const tuiLineAngle = lineAngle; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
import {TuiPoint} from '@taiga-ui/core'; | ||
|
||
/** | ||
* @deprecated: use {@link tuiLineLength} instead | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
export function lineLength(a: TuiPoint, b: TuiPoint): number { | ||
export function tuiLineLength(a: TuiPoint, b: TuiPoint): number { | ||
const x = b[0] - a[0]; | ||
const y = b[1] - a[1]; | ||
|
||
return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)); | ||
} | ||
|
||
export const tuiLineLength = lineLength; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import {Pipe, PipeTransform} from '@angular/core'; | ||
import {TuiCurrencyVariants} from '@taiga-ui/addon-commerce/types'; | ||
import {formatCurrency} from '@taiga-ui/addon-commerce/utils'; | ||
import {tuiFormatCurrency} from '@taiga-ui/addon-commerce/utils'; | ||
|
||
@Pipe({ | ||
name: `tuiCurrency`, | ||
}) | ||
export class TuiCurrencyPipe implements PipeTransform { | ||
transform(currency: TuiCurrencyVariants): string { | ||
return formatCurrency(currency); | ||
return tuiFormatCurrency(currency); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
import {formatCurrency} from '../format-currency'; | ||
import {tuiFormatCurrency} from '../format-currency'; | ||
|
||
describe(`formatCurrency`, () => { | ||
describe(`tuiFormatCurrency`, () => { | ||
it(`returns founded currency symbol`, () => { | ||
const usdCode = `USD`; | ||
|
||
expect(formatCurrency(usdCode)).toBe(`$`); | ||
expect(tuiFormatCurrency(usdCode)).toBe(`$`); | ||
}); | ||
|
||
it(`returns custom currency`, () => { | ||
const customCurrency = `CSTM`; | ||
|
||
expect(formatCurrency(customCurrency)).toBe(customCurrency); | ||
expect(tuiFormatCurrency(customCurrency)).toBe(customCurrency); | ||
}); | ||
|
||
it(`returns empty string if there is no value`, () => { | ||
const noCurrency = null; | ||
|
||
expect(formatCurrency(noCurrency)).toBe(``); | ||
expect(tuiFormatCurrency(noCurrency)).toBe(``); | ||
}); | ||
|
||
it(`returns correct currency from number currency code`, () => { | ||
const dollarCode = 840; | ||
|
||
expect(formatCurrency(dollarCode)).toBe(`$`); | ||
expect(tuiFormatCurrency(dollarCode)).toBe(`$`); | ||
}); | ||
|
||
it(`returns correct currency from number currency code with 2 decimal`, () => { | ||
const australianDollar = 36; | ||
|
||
expect(formatCurrency(australianDollar)).toBe(`A$`); | ||
expect(tuiFormatCurrency(australianDollar)).toBe(`A$`); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import {AbstractControl, ValidationErrors} from '@angular/forms'; | ||
import {isExpireValid} from '@taiga-ui/addon-commerce/utils'; | ||
import {tuiIsExpireValid} from '@taiga-ui/addon-commerce/utils'; | ||
import {TuiValidationError} from '@taiga-ui/cdk'; | ||
|
||
export function tuiCardExpireValidator({ | ||
value, | ||
}: AbstractControl): ValidationErrors | null { | ||
return value?.expire?.length === 5 && !isExpireValid(value?.expire) | ||
return value?.expire?.length === 5 && !tuiIsExpireValid(value?.expire) | ||
? {expire: new TuiValidationError(`Expire date`)} | ||
: null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,11 @@ | ||
import MarkdownIt from 'markdown-it'; | ||
import Token from 'markdown-it/lib/token'; | ||
|
||
/** | ||
* @deprecated: use {@link tuiTryParseMarkdownCodeBlock} instead | ||
*/ | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
export function tryParseMarkdownCodeBlock(text: string = ``): string[] { | ||
export function tuiTryParseMarkdownCodeBlock(text: string = ``): string[] { | ||
const tokens: Token[] = new MarkdownIt().parse(text, {}); | ||
const result = tokens | ||
.filter(({tag, type}) => tag === `code` && type === `fence`) | ||
.map(({content}) => content); | ||
|
||
return result.length ? result : [text]; | ||
} | ||
|
||
export const tuiTryParseMarkdownCodeBlock = tryParseMarkdownCodeBlock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.