File tree 3 files changed +39
-26
lines changed
3 files changed +39
-26
lines changed Original file line number Diff line number Diff line change 1
- import { InjectionToken } from '@angular /core' ;
1
+ import { createSingleInjectionToken } from '@daffodil /core' ;
2
2
3
3
import { DaffMediaGalleryRegistration } from './media-gallery-registration.interface' ;
4
4
5
- export const DAFF_MEDIA_GALLERY_TOKEN = new InjectionToken < DaffMediaGalleryRegistration > ( 'DAFF_MEDIA_GALLERY_TOKEN' ) ;
5
+ export const {
6
+ token : DAFF_MEDIA_GALLERY_TOKEN ,
7
+ provider : daffProvideMediaGalleryToken ,
8
+ } = createSingleInjectionToken < DaffMediaGalleryRegistration > ( 'DAFF_MEDIA_GALLERY_TOKEN' ) ;
Original file line number Diff line number Diff line change 1
- import { InjectionToken } from '@angular /core' ;
1
+ import { createSingleInjectionToken } from '@daffodil /core' ;
2
2
3
- /**
4
- * A multi provider injection token that marks a component as renderable for the `DaffMediaRendererComponent`.
5
- */
6
- export const daffThumbnailCompatToken = new InjectionToken < unknown > ( 'thumbnailCompatToken' ) ;
3
+ export const {
4
+ /**
5
+ * A multi provider injection token that marks a component as renderable for the `DaffMediaRendererComponent`.
6
+ */
7
+ token : daffThumbnailCompatToken ,
8
+ provider : daffProvidedaffThumbnailCompatToken ,
9
+ } = createSingleInjectionToken < unknown > ( 'thumbnailCompatToken' ) ;
Original file line number Diff line number Diff line change 1
1
import { DOCUMENT } from '@angular/common' ;
2
2
import {
3
3
ElementRef ,
4
- InjectionToken ,
5
4
inject ,
6
5
} from '@angular/core' ;
7
6
7
+ import { createSingleInjectionToken } from '@daffodil/core' ;
8
+
8
9
/**
9
10
* An interface that enables a user to enable or disable scrolling on sidebars.
10
11
*
@@ -15,25 +16,31 @@ export interface DaffSidebarScroll {
15
16
disable ( ) : void ;
16
17
}
17
18
18
- /**
19
- * An injection token that can be used within a sidebar to determine
20
- * what to do enabling and disabling scrolling. By default, the body
21
- * is the element where scrolling is controlled.
22
- */
23
- export const DAFF_SIDEBAR_SCROLL_TOKEN = new InjectionToken < DaffSidebarScroll > ( 'DAFF_SIDEBAR_SCROLL_TOKEN' , {
24
- providedIn : 'root' ,
25
- factory : ( ) => {
26
- const document = inject ( DOCUMENT ) ;
27
- return {
28
- enable : ( ) => {
29
- document . body . style . overflow = null ;
30
- } ,
31
- disable : ( ) => {
32
- document . body . style . overflow = 'hidden' ;
33
- } ,
34
- } ;
19
+ export const {
20
+ /**
21
+ * An injection token that can be used within a sidebar to determine
22
+ * what to do enabling and disabling scrolling. By default, the body
23
+ * is the element where scrolling is controlled.
24
+ */
25
+ token : DAFF_SIDEBAR_SCROLL_TOKEN ,
26
+ provider : daffProvideSidebarScrollToken ,
27
+ } = createSingleInjectionToken < DaffSidebarScroll > (
28
+ 'DAFF_SIDEBAR_SCROLL_TOKEN' ,
29
+ {
30
+ providedIn : 'root' ,
31
+ factory : ( ) => {
32
+ const document = inject ( DOCUMENT ) ;
33
+ return {
34
+ enable : ( ) => {
35
+ document . body . style . overflow = null ;
36
+ } ,
37
+ disable : ( ) => {
38
+ document . body . style . overflow = 'hidden' ;
39
+ } ,
40
+ } ;
41
+ } ,
35
42
} ,
36
- } ) ;
43
+ ) ;
37
44
38
45
39
46
/**
You can’t perform that action at this time.
0 commit comments