1
1
import type { GoslingSpec , TemplateTrackDef , VisUnitApiData } from '@gosling-lang/gosling-schema' ;
2
2
import type { HiGlassSpec } from '@gosling-lang/higlass-schema' ;
3
3
import { traverseToFixSpecDownstream } from './spec-preprocess' ;
4
- import { replaceTrackTemplates } from '../core/utils/template' ;
4
+ import { GoslingTemplates , replaceTrackTemplates } from '../core/utils/template' ;
5
5
import { getRelativeTrackInfo , type Size } from './bounding-box' ;
6
6
import type { CompleteThemeDeep } from '../core/utils/theme' ;
7
7
import type { UrlToFetchOptions } from 'src/core/gosling-component' ;
8
8
import { renderHiGlass as createHiGlassModels } from './create-higlass-models' ;
9
9
import { manageResponsiveSpecs } from './responsive' ;
10
10
import type { IdTable } from '../api/track-and-view-ids' ;
11
+ import { getTheme } from '@gosling-lang/gosling-theme' ;
11
12
12
13
/** The callback function called everytime after the spec has been compiled */
13
14
export type CompileCallback = (
@@ -18,15 +19,18 @@ export type CompileCallback = (
18
19
idTable : IdTable
19
20
) => void ;
20
21
22
+ /**
23
+ * Process the Gosling specification, including normalization and filling in defaults.
24
+ */
21
25
export function compile (
22
26
spec : GoslingSpec ,
23
27
callback : CompileCallback ,
24
- templates : TemplateTrackDef [ ] ,
25
- theme : Required < CompleteThemeDeep > ,
28
+ templates : TemplateTrackDef [ ] = GoslingTemplates ,
29
+ theme : Required < CompleteThemeDeep > = getTheme ( 'light' ) ,
26
30
containerStatus : {
27
31
containerSize ?: { width : number ; height : number } ;
28
32
containerParentSize ?: { width : number ; height : number } ;
29
- } ,
33
+ } = { } ,
30
34
urlToFetchOptions ?: UrlToFetchOptions
31
35
) {
32
36
// Make sure to keep the original spec as-is
0 commit comments