File size: 3,483 Bytes
bc20498
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import type { AnimationConfig } from '../animate/public.js';

export type AnimationFn = (
	node: Element,
	{ from, to }: { from: PositionRect; to: PositionRect },
	params: any
) => AnimationConfig;

export type Listener = (entry: ResizeObserverEntry) => any;

//todo: documentation says it is DOMRect, but in IE it would be ClientRect
export type PositionRect = DOMRect | ClientRect;

export interface PromiseInfo<T> {
	ctx: null | any;
	// unique object instance as a key to compare different promises
	token: {};
	hasCatch: boolean;
	pending: FragmentFactory;
	then: FragmentFactory;
	catch: FragmentFactory;
	// ctx index for resolved value and rejected error
	value: number;
	error: number;
	// resolved value or rejected error
	resolved?: T;
	// the current factory function for creating the fragment
	current: FragmentFactory | null;
	// the current fragment
	block: Fragment | null;
	// tuple of the pending, then, catch fragment
	blocks: [null | Fragment, null | Fragment, null | Fragment];
	// DOM elements to mount and anchor on for the {#await} block
	mount: () => HTMLElement;
	anchor: HTMLElement;
}

// TODO: Remove this
export interface ResizeObserverSize {
	readonly blockSize: number;
	readonly inlineSize: number;
}

export interface ResizeObserverEntry {
	readonly borderBoxSize: readonly ResizeObserverSize[];
	readonly contentBoxSize: readonly ResizeObserverSize[];
	readonly contentRect: DOMRectReadOnly;
	readonly devicePixelContentBoxSize: readonly ResizeObserverSize[];
	readonly target: Element;
}

export type ResizeObserverBoxOptions = 'border-box' | 'content-box' | 'device-pixel-content-box';

export interface ResizeObserverOptions {
	box?: ResizeObserverBoxOptions;
}

export interface ResizeObserver {
	disconnect(): void;
	observe(target: Element, options?: ResizeObserverOptions): void;
	unobserve(target: Element): void;
}

export interface ResizeObserverCallback {
	(entries: ResizeObserverEntry[], observer: ResizeObserver): void;
}

export declare let ResizeObserver: {
	prototype: ResizeObserver;
	new (callback: ResizeObserverCallback): ResizeObserver;
};

export interface StyleInformation {
	stylesheet: CSSStyleSheet;
	rules: Record<string, true>;
}

export type TaskCallback = (now: number) => boolean | void;

export type TaskEntry = { c: TaskCallback; f: () => void };

/**
 * INTERNAL, DO NOT USE. Code may change at any time.
 */
export interface Fragment {
	key: string | null;
	first: null;
	/* create  */ c: () => void;
	/* claim   */ l: (nodes: any) => void;
	/* hydrate */ h: () => void;
	/* mount   */ m: (target: HTMLElement, anchor: any) => void;
	/* update  */ p: (ctx: T$$['ctx'], dirty: T$$['dirty']) => void;
	/* measure */ r: () => void;
	/* fix     */ f: () => void;
	/* animate */ a: () => void;
	/* intro   */ i: (local: any) => void;
	/* outro   */ o: (local: any) => void;
	/* destroy */ d: (detaching: 0 | 1) => void;
}

export type FragmentFactory = (ctx: any) => Fragment;

export interface T$$ {
	dirty: number[];
	ctx: any[];
	bound: any;
	update: () => void;
	callbacks: any;
	after_update: any[];
	props: Record<string, 0 | string>;
	fragment: null | false | Fragment;
	not_equal: any;
	before_update: any[];
	context: Map<any, any>;
	on_mount: any[];
	on_destroy: any[];
	skip_bound: boolean;
	on_disconnect: any[];
	root: Element | ShadowRoot;
}

export interface Task {
	abort(): void;
	promise: Promise<void>;
}

/**
 * Anything except a function
 */
type NotFunction<T> = T extends Function ? never : T;