1
1
import { start } from "../../start" ;
2
- import { setLink } from "../../link" ;
3
- import { type DefaultColorScheme , setDefaultColorSchemeClientSide } from "./defaultColorScheme" ;
2
+ import type { DefaultColorScheme } from "./defaultColorScheme" ;
4
3
import { isBrowser } from "../../tools/isBrowser" ;
5
4
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- used in doc
6
5
import { type DsfrHead } from "../DsfrHead" ;
@@ -12,8 +11,6 @@ export function startReactDsfr(params: {
12
11
defaultColorScheme : DefaultColorScheme ;
13
12
/** Default: false */
14
13
verbose ?: boolean ;
15
- /** Default: <a /> */
16
- Link ?: Function ;
17
14
/**
18
15
* When true, the nonce of the script tag will be checked, fetched from {@link DsfrHead} component and injected in react-dsfr scripts.
19
16
*
@@ -42,38 +39,33 @@ export function startReactDsfr(params: {
42
39
*/
43
40
trustedTypesPolicyName ?: string ;
44
41
} ) {
42
+ if ( ! isBrowser ) {
43
+ return ;
44
+ }
45
+
45
46
const {
46
47
defaultColorScheme,
47
48
verbose = false ,
48
- Link,
49
49
doCheckNonce = false ,
50
50
trustedTypesPolicyName = "react-dsfr"
51
51
} = params ;
52
52
53
- setDefaultColorSchemeClientSide ( { defaultColorScheme } ) ;
54
-
55
- if ( Link !== undefined ) {
56
- setLink ( { "Link" : Link as any } ) ;
57
- }
58
-
59
- if ( isBrowser ) {
60
- start ( {
61
- defaultColorScheme,
62
- verbose,
63
- doCheckNonce,
64
- trustedTypesPolicyName,
65
- "nextParams" : {
66
- "doPersistDarkModePreferenceWithCookie" : false ,
67
- "registerEffectAction" : action => {
68
- if ( isAfterFirstEffect ) {
69
- action ( ) ;
70
- } else {
71
- actions . push ( action ) ;
72
- }
53
+ start ( {
54
+ defaultColorScheme,
55
+ verbose,
56
+ doCheckNonce,
57
+ trustedTypesPolicyName,
58
+ "nextParams" : {
59
+ "doPersistDarkModePreferenceWithCookie" : false ,
60
+ "registerEffectAction" : action => {
61
+ if ( isAfterFirstEffect ) {
62
+ action ( ) ;
63
+ } else {
64
+ actions . push ( action ) ;
73
65
}
74
66
}
75
- } ) ;
76
- }
67
+ }
68
+ } ) ;
77
69
}
78
70
79
71
export function dsfrEffect ( ) : void {
0 commit comments