File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 5
5
"unpkg" : " min.js" ,
6
6
"main" : " cjs/index.js" ,
7
7
"module" : " esm/index.js" ,
8
+ "types" : " types.d.ts" ,
8
9
"scripts" : {
9
10
"build" : " npm run cjs && npm run bundle && npm run min && npm run test && npm run size" ,
10
11
"bundle" : " rollup --config rollup.config.js && npm run cleanup" ,
Original file line number Diff line number Diff line change
1
+ export interface IDomDiffNodeMarkerOptions {
2
+ before : Node ;
3
+ }
4
+
5
+ export interface IDomDiffOptionsGenericComparisonFn {
6
+ /**
7
+ * A callback to compare between two generic nodes. returns `true` to indicate they are the same
8
+ */
9
+ compare : ( currentNode : Node , futureNode : Node ) => boolean ;
10
+ }
11
+
12
+ export interface IDomDiffOPtionsEachNodeCallbackFn {
13
+ /**
14
+ * The optional `{node: (generic, info) => node}` is invoked per each operation on the DOM.
15
+ * This can be useful to represent node through wrappers, whenever that is needed.
16
+ * @param info
17
+ * `1` when the item/node is being appended
18
+ * `0` when the item/node is being used as insert _before_ reference
19
+ * `-0` when the item/node is being used as insert _after_ reference
20
+ * `-1` when the item/node is being removed
21
+ */
22
+ node : ( generic : Node , info : - 1 | - 0 | 0 | 1 ) => Node ;
23
+ }
24
+
25
+ /**
26
+ * A vDOM-less implementation of the [petit-dom](https://github.com/yelouafi/petit-dom) diffing logic
27
+ * that will mutate child nodes the first argument - parentNode
28
+ * @param parentNode Where changes happen
29
+ * @param currentNodes Array of current items / nodes
30
+ * @param futureNodes Array of future items / nodes
31
+ */
32
+ export default function domdiff (
33
+ parentNode : Node ,
34
+ currentNodes : ArrayLike < Node > ,
35
+ futureNodes : ArrayLike < Node > ,
36
+ options ?: IDomDiffNodeMarkerOptions | IDomDiffOptionsGenericComparisonFn | IDomDiffOPtionsEachNodeCallbackFn
37
+ ) : void ;
You can’t perform that action at this time.
0 commit comments