run prettier

This commit is contained in:
Peng Xiao
2022-07-03 21:38:09 +08:00
parent d237837641
commit d00a3dbff2
40 changed files with 213 additions and 125 deletions

View File

@@ -273,7 +273,7 @@ export class TextShape extends TLTextShape<TextShapeProps> {
const {
props: { text, stroke, fontSize, fontFamily },
} = this
// Stretch to the bound size
// Stretch to the bound size
const bounds = this.getBounds()
return (

View File

@@ -20,25 +20,25 @@ export type Easing =
| 'easeInOutExpo'
export const EASINGS: Record<Easing, (t: number) => number> = {
linear: (t) => t,
easeInQuad: (t) => t * t,
easeOutQuad: (t) => t * (2 - t),
easeInOutQuad: (t) => (t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t),
easeInCubic: (t) => t * t * t,
easeOutCubic: (t) => --t * t * t + 1,
easeInOutCubic: (t) => (t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1),
easeInQuart: (t) => t * t * t * t,
easeOutQuart: (t) => 1 - --t * t * t * t,
easeInOutQuart: (t) => (t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t),
easeInQuint: (t) => t * t * t * t * t,
easeOutQuint: (t) => 1 + --t * t * t * t * t,
easeInOutQuint: (t) => (t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t),
easeInSine: (t) => 1 - Math.cos((t * Math.PI) / 2),
easeOutSine: (t) => Math.sin((t * Math.PI) / 2),
easeInOutSine: (t) => -(Math.cos(Math.PI * t) - 1) / 2,
easeInExpo: (t) => (t <= 0 ? 0 : Math.pow(2, 10 * t - 10)),
easeOutExpo: (t) => (t >= 1 ? 1 : 1 - Math.pow(2, -10 * t)),
easeInOutExpo: (t) =>
linear: t => t,
easeInQuad: t => t * t,
easeOutQuad: t => t * (2 - t),
easeInOutQuad: t => (t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t),
easeInCubic: t => t * t * t,
easeOutCubic: t => --t * t * t + 1,
easeInOutCubic: t => (t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1),
easeInQuart: t => t * t * t * t,
easeOutQuart: t => 1 - --t * t * t * t,
easeInOutQuart: t => (t < 0.5 ? 8 * t * t * t * t : 1 - 8 * --t * t * t * t),
easeInQuint: t => t * t * t * t * t,
easeOutQuint: t => 1 + --t * t * t * t * t,
easeInOutQuint: t => (t < 0.5 ? 16 * t * t * t * t * t : 1 + 16 * --t * t * t * t * t),
easeInSine: t => 1 - Math.cos((t * Math.PI) / 2),
easeOutSine: t => Math.sin((t * Math.PI) / 2),
easeInOutSine: t => -(Math.cos(Math.PI * t) - 1) / 2,
easeInExpo: t => (t <= 0 ? 0 : Math.pow(2, 10 * t - 10)),
easeOutExpo: t => (t >= 1 ? 1 : 1 - Math.pow(2, -10 * t)),
easeInOutExpo: t =>
t <= 0
? 0
: t >= 1
@@ -46,4 +46,4 @@ export const EASINGS: Record<Easing, (t: number) => number> = {
: t < 0.5
? Math.pow(2, 20 * t - 10) / 2
: (2 - Math.pow(2, -20 * t + 10)) / 2,
}
}

View File

@@ -49,4 +49,4 @@ export const shapes: TLReactShapeConstructor<Shape>[] = [
TextShape,
YouTubeShape,
LogseqPortalShape,
]
]

View File

@@ -24,7 +24,10 @@ export class TextAreaUtils {
)
}
/** Inserts `text` at the cursors position, replacing any selection, with **undo** support and by firing the `input` event. */
/**
* Inserts `text` at the cursors position, replacing any selection, with **undo** support and by
* firing the `input` event.
*/
static insert(field: HTMLTextAreaElement | HTMLInputElement, text: string): void {
const document = field.ownerDocument
const initialFocus = document.activeElement
@@ -43,7 +46,10 @@ export class TextAreaUtils {
}
}
/** Replaces the entire content, equivalent to `field.value = text` but with **undo** support and by firing the `input` event. */
/**
* Replaces the entire content, equivalent to `field.value = text` but with **undo** support and
* by firing the `input` event.
*/
static set(field: HTMLTextAreaElement | HTMLInputElement, text: string): void {
field.select()
TextAreaUtils.insert(field, text)
@@ -58,7 +64,10 @@ export class TextAreaUtils {
)
}
/** Adds the `wrappingText` before and after fields selection (or cursor). If `endWrappingText` is provided, it will be used instead of `wrappingText` at on the right. */
/**
* Adds the `wrappingText` before and after fields selection (or cursor). If `endWrappingText` is
* provided, it will be used instead of `wrappingText` at on the right.
*/
static wrapSelection(
field: HTMLTextAreaElement | HTMLInputElement,
wrap: string,
@@ -73,7 +82,10 @@ export class TextAreaUtils {
field.selectionEnd = (selectionEnd || 0) + wrap.length
}
/** Finds and replaces strings and regex in the fields value, like `field.value = field.value.replace()` but better */
/**
* Finds and replaces strings and regex in the fields value, like `field.value =
* field.value.replace()` but better
*/
static replace(
field: HTMLTextAreaElement | HTMLInputElement,
searchValue: string | RegExp,

View File

@@ -183,4 +183,3 @@ export const TextLabel = React.memo(function TextLabel({
</div>
)
})

View File

@@ -1,4 +1,4 @@
import { LETTER_SPACING } from "./constants"
import { LETTER_SPACING } from './constants'
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let melm: any