mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Initial creation of react-lazylog types
This commit is contained in:
parent
42e514d82c
commit
84e66f7ede
28
types/react-lazylog/build/LazyLog.d.ts
vendored
Normal file
28
types/react-lazylog/build/LazyLog.d.ts
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
import { Component, ReactNode, CSSProperties } from "react";
|
||||
import { Range } from "immutable";
|
||||
|
||||
export interface LazyLogProps {
|
||||
url: string;
|
||||
fetchOptions?: RequestInit;
|
||||
stream?: boolean;
|
||||
height?: string | number;
|
||||
width?: string | number;
|
||||
follow?: boolean;
|
||||
scrollToLine?: number;
|
||||
highlight?: number | number[];
|
||||
selectableLines?: boolean;
|
||||
formatPart?: (text: string) => ReactNode;
|
||||
onLoad?: () => any;
|
||||
onError?: (error: any) => any;
|
||||
onHighlight?: (range: Range) => any;
|
||||
rowHeight?: number;
|
||||
overscanRowCount?: number;
|
||||
containerStyle?: CSSProperties;
|
||||
style?: CSSProperties;
|
||||
}
|
||||
|
||||
export class LazyLog extends Component<LazyLogProps> {
|
||||
static defaultProps: Partial<LazyLogProps>;
|
||||
}
|
||||
|
||||
export default LazyLog;
|
||||
22
types/react-lazylog/build/Line.d.ts
vendored
Normal file
22
types/react-lazylog/build/Line.d.ts
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
import { Component, ReactNode, CSSProperties, MouseEventHandler } from "react";
|
||||
|
||||
export interface LineProps {
|
||||
data: { text: string }[];
|
||||
number: number;
|
||||
rowHeight: number;
|
||||
highlight?: boolean;
|
||||
selectable?: boolean;
|
||||
style?: CSSProperties;
|
||||
formatPart?: (text: string) => ReactNode;
|
||||
onLineNumberClick?: MouseEventHandler<HTMLAnchorElement>;
|
||||
|
||||
/**
|
||||
* This is never called
|
||||
* https://github.com/mozilla-frontend-infra/react-lazylog/issues/18
|
||||
*/
|
||||
onRowClick?: () => any;
|
||||
}
|
||||
|
||||
export default class Line extends Component<LineProps> {
|
||||
static defaultProps: Partial<LineProps>;
|
||||
}
|
||||
12
types/react-lazylog/build/LineContent.d.ts
vendored
Normal file
12
types/react-lazylog/build/LineContent.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import { Component, ReactNode, CSSProperties } from "react";
|
||||
|
||||
export interface LineContentProps {
|
||||
data: { text: string }[];
|
||||
number: number;
|
||||
formatPart?: (text: string) => ReactNode;
|
||||
style?: CSSProperties;
|
||||
}
|
||||
|
||||
export default class LineContent extends Component<LineContentProps> {
|
||||
static defaultProps: Partial<LineContentProps>;
|
||||
}
|
||||
12
types/react-lazylog/build/LineNumber.d.ts
vendored
Normal file
12
types/react-lazylog/build/LineNumber.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
import { Component, ReactNode, CSSProperties, MouseEventHandler } from "react";
|
||||
|
||||
export interface LineNumberProps {
|
||||
number: number;
|
||||
highlight?: boolean;
|
||||
onClick?: MouseEventHandler<HTMLAnchorElement>;
|
||||
style?: CSSProperties;
|
||||
}
|
||||
|
||||
export default class LinePart extends Component<LineNumberProps> {
|
||||
static defaultProps: Partial<LineNumberProps>;
|
||||
}
|
||||
11
types/react-lazylog/build/LinePart.d.ts
vendored
Normal file
11
types/react-lazylog/build/LinePart.d.ts
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
import { Component, ReactNode, CSSProperties } from "react";
|
||||
|
||||
export interface LinePartProps {
|
||||
part: { text: string };
|
||||
format?: (text: string) => ReactNode;
|
||||
style?: CSSProperties;
|
||||
}
|
||||
|
||||
export default class LinePart extends Component<LinePartProps> {
|
||||
static defaultProps: Partial<LinePartProps>;
|
||||
}
|
||||
5
types/react-lazylog/build/Loading.d.ts
vendored
Normal file
5
types/react-lazylog/build/Loading.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import { Component } from "react";
|
||||
|
||||
export interface LoadingProps {}
|
||||
|
||||
export default class Loading extends Component<LoadingProps> {}
|
||||
19
types/react-lazylog/build/ScrollFollow.d.ts
vendored
Normal file
19
types/react-lazylog/build/ScrollFollow.d.ts
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
import { Component, ReactNode } from "react";
|
||||
|
||||
export interface ScrollFollowRenderProps {
|
||||
onScroll: (
|
||||
args: { scrollTop: number; scrollHeight: number; clientHeight: number }
|
||||
) => void;
|
||||
follow: boolean;
|
||||
startFollowing: () => void;
|
||||
stopFollowing: () => void;
|
||||
}
|
||||
|
||||
export interface ScrollFollowProps {
|
||||
render: (props: ScrollFollowRenderProps) => ReactNode;
|
||||
startFollowing?: boolean;
|
||||
}
|
||||
|
||||
export class ScrollFollow extends Component<ScrollFollowProps> {}
|
||||
|
||||
export default ScrollFollow;
|
||||
8
types/react-lazylog/index.d.ts
vendored
Normal file
8
types/react-lazylog/index.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
// Type definitions for react-lazylog 3.1.4
|
||||
// Project: https://github.com/mozilla-frontend-infra/react-lazylog
|
||||
// Definitions by: Benjamin Romano <https://github.com/benjaminRomano>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
export * from "./build/LazyLog";
|
||||
export * from "./build/ScrollFollow";
|
||||
6
types/react-lazylog/package.json
Normal file
6
types/react-lazylog/package.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"immutable": ">=3.8.2"
|
||||
}
|
||||
}
|
||||
38
types/react-lazylog/react-lazylog-tests.tsx
Normal file
38
types/react-lazylog/react-lazylog-tests.tsx
Normal file
@ -0,0 +1,38 @@
|
||||
import * as React from "react";
|
||||
import LinePart, { LinePartProps } from "react-lazylog/build/LinePart";
|
||||
import LineNumber, { LineNumberProps } from "react-lazylog/build/LineNumber";
|
||||
import LineContent, { LineContentProps } from "react-lazylog/build/LineContent";
|
||||
import Line, { LineProps } from "react-lazylog/build/Line";
|
||||
import Loading from "react-lazylog/build/Loading";
|
||||
import {
|
||||
LazyLog,
|
||||
LazyLogProps,
|
||||
ScrollFollow,
|
||||
ScrollFollowProps,
|
||||
ScrollFollowRenderProps
|
||||
} from "react-lazylog";
|
||||
|
||||
LinePart.defaultProps.style = { color: "green" };
|
||||
const linePart = <LinePart part={{ text: "log" }} />;
|
||||
|
||||
LineNumber.defaultProps.style = { color: "green" };
|
||||
const lineNumber = <LineNumber number={5} />;
|
||||
|
||||
LineContent.defaultProps.style = { color: "green" };
|
||||
const lineContent = <LineContent number={5} data={[{ text: "hello" }]} />;
|
||||
|
||||
Line.defaultProps.style = { color: "green" };
|
||||
const line = <Line number={5} data={[{ text: "hello" }]} rowHeight={10} />;
|
||||
|
||||
const loading = <Loading />;
|
||||
|
||||
const scrollFollow = (
|
||||
<ScrollFollow
|
||||
render={({ follow, onScroll, startFollowing, stopFollowing }) => (
|
||||
<div />
|
||||
)}
|
||||
/>
|
||||
);
|
||||
|
||||
LazyLog.defaultProps.style = { color: "green" };
|
||||
const lazyLog = <LazyLog url={"https://google.com/log.txt"} />;
|
||||
22
types/react-lazylog/tsconfig.json
Normal file
22
types/react-lazylog/tsconfig.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6", "dom"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"react-lazylog-tests.tsx",
|
||||
"index.d.ts",
|
||||
"lib/build/LazyLog.d.ts",
|
||||
"lib/build/LinePart.d.ts"
|
||||
]
|
||||
}
|
||||
1
types/react-lazylog/tslint.json
Normal file
1
types/react-lazylog/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user