UNPKG

1.36 kBPlain TextView Raw
1/**
2 * Copyright 2018 The Incremental DOM Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS-IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17export interface ElementConstructor {
18 new (): Element;
19}
20
21export type AttrMutator = (a: Element, b: string, c: any) => void;
22
23export interface AttrMutatorConfig {
24 [x: string]: AttrMutator;
25}
26
27export type NameOrCtorDef = string | ElementConstructor;
28
29export type Key = string | number | null | undefined;
30
31export type Statics = Array<{}> | null | undefined;
32
33export type PatchFunction<T, R> = (
34 node: Element | DocumentFragment,
35 template: (a: T | undefined) => void,
36 data?: T | undefined
37) => R;
38
39export type MatchFnDef = (
40 matchNode: Node,
41 nameOrCtor: NameOrCtorDef,
42 expectedNameOrCtor: NameOrCtorDef,
43 key: Key,
44 expectedKey: Key
45) => boolean;
46
47export interface PatchConfig {
48 matches?: MatchFnDef;
49}