1
1
import { nextSiblings , treeInsert , schedule , has } from './lib/dom'
2
2
import { element , configured , withDefaults , withClasses , withAttributes , withText , withInnerHTML } from './lib/dom'
3
3
4
- import { iterator , preetyShowList , showIfSomeLength , deepDependencies } from './lib/util'
4
+ import { iterator , preetyShowList , showIfSomeLength , deepDependencies , flatDependencies , Links } from './lib/util'
5
5
import { Predicate , negate , or } from './lib/util'
6
6
import { Peek , peekWhile } from './lib/read'
7
7
import is from './lib/is_test'
@@ -25,7 +25,8 @@ export const literateKtConfig = {
25
25
dependsOn : ( deps : Array < string > ) => ` depends on ${ preetyShowList ( deps . map ( t => t . bold ( ) . italics ( ) ) ) } ` ,
26
26
expectingFor : ( what :any , that :any ) => `Expecting ${ what } for ${ that } ` ,
27
27
adjNounDesc : ( adj :string , noun :string , desc :string ) => `${ adj } ${ noun } ${ desc } `
28
- }
28
+ } ,
29
+ dependencyOrdered : false
29
30
} ;
30
31
31
32
////
@@ -116,5 +117,10 @@ function solveDependencies(e_root: Element): Array<Element> {
116
117
117
118
const linkIds = ( e :Element ) => e . getAttribute ( depend ) ?. split ( dependSeprator ) ?? [ ] ;
118
119
const links = ( e :Element ) => linkIds ( e ) . map ( id => document . getElementById ( id ) ) ;
119
- return deepDependencies ( e_root , links ) ;
120
+ return dependencySolver < Element > ( ) ( e_root , links ) ;
121
+ }
122
+ function dependencySolver < T > ( ) : ( root :T , link :Links < T > ) => Array < T > {
123
+ const { dependencyOrdered } = literateKtConfig ;
124
+
125
+ return dependencyOrdered ? deepDependencies : flatDependencies ;
120
126
}
0 commit comments