chore: remove all typings, add them all to .gitignore file and update turbo.json (#949)

This commit is contained in:
Yun Feng
2022-07-31 08:38:22 +08:00
committed by GitHub
parent b618f095df
commit aecaefbf45
47 changed files with 3 additions and 770 deletions

View File

@@ -6,3 +6,4 @@ dist
es
lib
temp
typings

View File

@@ -1,92 +0,0 @@
export interface ParserOptions {
silent?: boolean;
source?: string;
}
export interface ParserError {
message?: string;
reason?: string;
filename?: string;
line?: number;
column?: number;
source?: string;
}
export interface Loc {
line?: number;
column?: number;
}
export interface Node {
type?: string;
parent?: Node;
position?: {
start?: Loc;
end?: Loc;
source?: string;
content?: string;
};
}
export interface Rule extends Node {
selectors?: string[];
declarations?: Array<Declaration | Comment>;
}
export interface Declaration extends Node {
property?: string;
value?: string;
}
export interface Comment extends Node {
comment?: string;
}
export interface Charset extends Node {
charset?: string;
}
export interface CustomMedia extends Node {
name?: string;
media?: string;
}
export interface Document extends Node {
document?: string;
vendor?: string;
rules?: Array<Rule | Comment | AtRule>;
}
export interface FontFace extends Node {
declarations?: Array<Declaration | Comment>;
}
export interface Host extends Node {
rules?: Array<Rule | Comment | AtRule>;
}
export interface Import extends Node {
import?: string;
}
export interface KeyFrames extends Node {
name?: string;
vendor?: string;
keyframes?: Array<KeyFrame | Comment>;
}
export interface KeyFrame extends Node {
values?: string[];
declarations?: Array<Declaration | Comment>;
}
export interface Media extends Node {
media?: string;
rules?: Array<Rule | Comment | AtRule>;
}
export interface Namespace extends Node {
namespace?: string;
}
export interface Page extends Node {
selectors?: string[];
declarations?: Array<Declaration | Comment>;
}
export interface Supports extends Node {
supports?: string;
rules?: Array<Rule | Comment | AtRule>;
}
export declare type AtRule = Charset | CustomMedia | Document | FontFace | Host | Import | KeyFrames | Media | Namespace | Page | Supports;
export interface StyleRules {
source?: string;
rules: Array<Rule | Comment | AtRule>;
parsingErrors?: ParserError[];
}
export interface Stylesheet extends Node {
stylesheet?: StyleRules;
}
export declare function parse(css: string, options?: ParserOptions): Stylesheet;

View File

@@ -1,5 +0,0 @@
import snapshot, { serializeNodeWithId, transformAttribute, visitSnapshot, cleanupSnapshot, needMaskingText, classMatchesRegex, IGNORED_NODE } from './snapshot';
import rebuild, { buildNodeWithSN, addHoverClass, createCache } from './rebuild';
export * from './types';
export * from './utils';
export { snapshot, serializeNodeWithId, rebuild, buildNodeWithSN, addHoverClass, createCache, transformAttribute, visitSnapshot, cleanupSnapshot, needMaskingText, classMatchesRegex, IGNORED_NODE, };

View File

@@ -1,21 +0,0 @@
import { serializedNodeWithId, BuildCache } from './types';
import { Mirror } from './utils';
export declare function addHoverClass(cssText: string, cache: BuildCache): string;
export declare function createCache(): BuildCache;
export declare function buildNodeWithSN(n: serializedNodeWithId, options: {
doc: Document;
mirror: Mirror;
skipChild?: boolean;
hackCss: boolean;
afterAppend?: (n: Node) => unknown;
cache: BuildCache;
}): Node | null;
declare function rebuild(n: serializedNodeWithId, options: {
doc: Document;
onVisit?: (node: Node) => unknown;
hackCss?: boolean;
afterAppend?: (n: Node) => unknown;
cache: BuildCache;
mirror: Mirror;
}): Node | null;
export default rebuild;

View File

@@ -1,59 +0,0 @@
import { serializedNodeWithId, MaskInputOptions, SlimDOMOptions, DataURLOptions, MaskTextFn, MaskInputFn, KeepIframeSrcFn, serializedElementNodeWithId } from './types';
import { Mirror } from './utils';
export declare const IGNORED_NODE = -2;
export declare function absoluteToStylesheet(cssText: string | null, href: string): string;
export declare function absoluteToDoc(doc: Document, attributeValue: string): string;
export declare function transformAttribute(doc: Document, tagName: string, name: string, value: string): string;
export declare function _isBlockedElement(element: HTMLElement, blockClass: string | RegExp, blockSelector: string | null): boolean;
export declare function classMatchesRegex(node: Node | null, regex: RegExp, checkAncestors: boolean): boolean;
export declare function needMaskingText(node: Node, maskTextClass: string | RegExp, maskTextSelector: string | null): boolean;
export declare function serializeNodeWithId(n: Node, options: {
doc: Document;
mirror: Mirror;
blockClass: string | RegExp;
blockSelector: string | null;
maskTextClass: string | RegExp;
maskTextSelector: string | null;
skipChild: boolean;
inlineStylesheet: boolean;
newlyAddedElement?: boolean;
maskInputOptions?: MaskInputOptions;
maskTextFn: MaskTextFn | undefined;
maskInputFn: MaskInputFn | undefined;
slimDOMOptions: SlimDOMOptions;
dataURLOptions?: DataURLOptions;
keepIframeSrcFn?: KeepIframeSrcFn;
inlineImages?: boolean;
recordCanvas?: boolean;
preserveWhiteSpace?: boolean;
onSerialize?: (n: Node) => unknown;
onIframeLoad?: (iframeNode: HTMLIFrameElement, node: serializedElementNodeWithId) => unknown;
iframeLoadTimeout?: number;
onStylesheetLoad?: (linkNode: HTMLLinkElement, node: serializedElementNodeWithId) => unknown;
stylesheetLoadTimeout?: number;
}): serializedNodeWithId | null;
declare function snapshot(n: Document, options?: {
mirror?: Mirror;
blockClass?: string | RegExp;
blockSelector?: string | null;
maskTextClass?: string | RegExp;
maskTextSelector?: string | null;
inlineStylesheet?: boolean;
maskAllInputs?: boolean | MaskInputOptions;
maskTextFn?: MaskTextFn;
maskInputFn?: MaskTextFn;
slimDOM?: boolean | SlimDOMOptions;
dataURLOptions?: DataURLOptions;
inlineImages?: boolean;
recordCanvas?: boolean;
preserveWhiteSpace?: boolean;
onSerialize?: (n: Node) => unknown;
onIframeLoad?: (iframeNode: HTMLIFrameElement, node: serializedElementNodeWithId) => unknown;
iframeLoadTimeout?: number;
onStylesheetLoad?: (linkNode: HTMLLinkElement, node: serializedElementNodeWithId) => unknown;
stylesheetLoadTimeout?: number;
keepIframeSrcFn?: KeepIframeSrcFn;
}): serializedNodeWithId | null;
export declare function visitSnapshot(node: serializedNodeWithId, onVisit: (node: serializedNodeWithId) => unknown): void;
export declare function cleanupSnapshot(): void;
export default snapshot;

View File

@@ -1,27 +0,0 @@
import { MaskInputFn, MaskInputOptions, IMirror, serializedNodeWithId } from './types';
export declare function isElement(n: Node): n is Element;
export declare function isShadowRoot(n: Node): n is ShadowRoot;
export declare function isNativeShadowDom(shadowRoot: ShadowRoot): boolean;
export declare class Mirror implements IMirror<Node> {
private idNodeMap;
private nodeMetaMap;
getId(n: Node | undefined | null): number;
getNode(id: number): Node | null;
getIds(): number[];
getMeta(n: Node): serializedNodeWithId | null;
removeNodeFromMap(n: Node): void;
has(id: number): boolean;
hasNode(node: Node): boolean;
add(n: Node, meta: serializedNodeWithId): void;
replace(id: number, n: Node): void;
reset(): void;
}
export declare function createMirror(): Mirror;
export declare function maskInputValue({ maskInputOptions, tagName, type, value, maskInputFn, }: {
maskInputOptions: MaskInputOptions;
tagName: string;
type: string | number | boolean | null;
value: string | null;
maskInputFn?: MaskInputFn;
}): string;
export declare function is2DCanvasBlank(canvas: HTMLCanvasElement): boolean;