11/* eslint-disable max-classes-per-file */
2- import { Config } from './config.interface' ;
3- import { hasValue , hasNoValue , isNotEmpty } from '../app/shared/empty.util' ;
4- import { DSpaceObject } from '../app/core/shared/dspace-object.model' ;
5- import { getDSORoute } from '../app/app-routing-paths' ;
6- import { HandleObject } from '../app/core/shared/handle-object.model' ;
2+ import { hasValue , hasNoValue , isNotEmpty } from '../empty.util' ;
3+ import { DSpaceObject } from '../../core/shared/dspace-object.model' ;
4+ import { getDSORoute } from '../../app-routing-paths' ;
5+ import { HandleObject } from '../../core/shared/handle-object.model' ;
76import { Injector } from '@angular/core' ;
8- import { HandleService } from '../app/shared/ handle.service' ;
7+ import { HandleService } from '../handle.service' ;
98import { combineLatest , Observable , of as observableOf } from 'rxjs' ;
109import { map , take } from 'rxjs/operators' ;
11-
12- export interface NamedThemeConfig extends Config {
13- name : string ;
14-
15- /**
16- * Specify another theme to build upon: whenever a themed component is not found in the current theme,
17- * its ancestor theme(s) will be checked recursively before falling back to the default theme.
18- */
19- extends ?: string ;
20-
21- /**
22- * A list of HTML tags that should be added to the HEAD section of the document, whenever this theme is active.
23- */
24- headTags ?: HeadTagConfig [ ] ;
25- }
26-
27- /**
28- * Interface that represents a single theme-specific HTML tag in the HEAD section of the page.
29- */
30- export interface HeadTagConfig extends Config {
31- /**
32- * The name of the HTML tag
33- */
34- tagName : string ;
35-
36- /**
37- * The attributes on the HTML tag
38- */
39- attributes ?: {
40- [ key : string ] : string ;
41- } ;
42- }
43-
44- export interface RegExThemeConfig extends NamedThemeConfig {
45- regex : string ;
46- }
47-
48- export interface HandleThemeConfig extends NamedThemeConfig {
49- handle : string ;
50- }
51-
52- export interface UUIDThemeConfig extends NamedThemeConfig {
53- uuid : string ;
54- }
10+ import { HandleThemeConfig , NamedThemeConfig , RegExThemeConfig , UUIDThemeConfig , ThemeConfig } from '../../../config/theme.config' ;
5511
5612export class Theme {
5713 constructor ( public config : NamedThemeConfig ) {
@@ -71,7 +27,7 @@ export class RegExTheme extends Theme {
7127 }
7228
7329 matches ( url : string , dso : DSpaceObject ) : Observable < boolean > {
74- let match ;
30+ let match : RegExpMatchArray ;
7531 const route = getDSORoute ( dso ) ;
7632
7733 if ( isNotEmpty ( route ) ) {
@@ -92,7 +48,7 @@ export class HandleTheme extends Theme {
9248
9349 constructor ( public config : HandleThemeConfig ,
9450 protected handleService : HandleService
95- ) {
51+ ) {
9652 super ( config ) ;
9753 this . normalizedHandle$ = this . handleService . normalizeHandle ( this . config . handle ) . pipe (
9854 take ( 1 ) ,
@@ -133,9 +89,3 @@ export const themeFactory = (config: ThemeConfig, injector: Injector): Theme =>
13389 return new Theme ( config as NamedThemeConfig ) ;
13490 }
13591} ;
136-
137- export type ThemeConfig
138- = NamedThemeConfig
139- | RegExThemeConfig
140- | HandleThemeConfig
141- | UUIDThemeConfig ;
0 commit comments