@@ -43,6 +43,117 @@ module Ref = {
43
43
external callbackDomRef : callbackDomRef => domRef = "%identity"
44
44
}
45
45
46
+ // Resource Preloading APIs
47
+
48
+ /** The CORS policy to use. */
49
+ type crossOrigin = [
50
+ | #anonymous
51
+ | # "use-credentials"
52
+ ]
53
+
54
+ /** The Referrer header to send when fetching. */
55
+ type referrerPolicy = [
56
+ | # "referrer-when-downgrade"
57
+ | # "no-referrer"
58
+ | #origin
59
+ | # "origin-when-cross-origin"
60
+ | # "unsafe-url"
61
+ ]
62
+
63
+ /** Suggests a relative priority for fetching the resource. */
64
+ type fetchPriority = [#auto | #high | #low ]
65
+
66
+ /** `prefetchDNS` lets you eagerly look up the IP of a server that you expect to load resources from. */
67
+ @module ("react-dom" )
68
+ external prefetchDNS : string => unit = "prefetchDNS"
69
+
70
+ /** `preconnect` lets you eagerly connect to a server that you expect to load resources from. */
71
+ @module ("react-dom" )
72
+ external preconnect : string => unit = "preconnect"
73
+
74
+ type preloadOptions = {
75
+ /** The type of resource. */
76
+ @as ("as" )
77
+ as_ : [
78
+ | #audio
79
+ | #document
80
+ | #embed
81
+ | #fetch
82
+ | #font
83
+ | #image
84
+ | #object
85
+ | #script
86
+ | #style
87
+ | #track
88
+ | #video
89
+ | #worker
90
+ ],
91
+ /** The CORS policy to use. It is required when as is set to "fetch". */
92
+ crossOrigin ?: crossOrigin ,
93
+ /** The Referrer header to send when fetching. */
94
+ referrerPolicy ?: referrerPolicy ,
95
+ /** A cryptographic hash of the resource, to verify its authenticity. */
96
+ integrity ?: string ,
97
+ /** The MIME type of the resource. */
98
+ @as ("type" )
99
+ type_ ?: string ,
100
+ /** A cryptographic nonce to allow the resource when using a strict Content Security Policy. */
101
+ nonce ?: string ,
102
+ /** Suggests a relative priority for fetching the resource. */
103
+ fetchPriority ?: fetchPriority ,
104
+ /** For use only with as: "image". Specifies the source set of the image. */
105
+ imageSrcSet ?: string ,
106
+ /** For use only with as: "image". Specifies the sizes of the image. */
107
+ imageSizes ?: string ,
108
+ }
109
+
110
+ /** `preload` lets you eagerly fetch a resource such as a stylesheet, font, or external script that you expect to use. */
111
+ @module ("react-dom" )
112
+ external preload : (string , preloadOptions ) => unit = "preload"
113
+
114
+ type preloadModuleOptions = {
115
+ /** The type of resource. */
116
+ @as ("as" )
117
+ as_ : [#script ],
118
+ /** The CORS policy to use. It is required when as is set to "fetch". */
119
+ crossOrigin ?: crossOrigin ,
120
+ /** A cryptographic hash of the resource, to verify its authenticity. */
121
+ integrity ?: string ,
122
+ /** A cryptographic nonce to allow the resource when using a strict Content Security Policy. */
123
+ nonce ?: string ,
124
+ }
125
+
126
+ /** `preloadModule` lets you eagerly fetch an ESM module that you expect to use. */
127
+ @module ("react-dom" )
128
+ external preloadModule : (string , preloadModuleOptions ) => unit = "preloadModule"
129
+
130
+ type preinitOptions = {
131
+ /** The type of resource. */
132
+ @as ("as" )
133
+ as_ : [#script | #style ],
134
+ /** Required with stylesheets. Says where to insert the stylesheet relative to others. Stylesheets with higher precedence can override those with lower precedence. */
135
+ precedence ?: [#reset | #low | #medium | #high ],
136
+ /** The CORS policy to use. It is required when as is set to "fetch". */
137
+ crossOrigin ?: crossOrigin ,
138
+ /** The Referrer header to send when fetching. */
139
+ referrerPolicy ?: referrerPolicy ,
140
+ /** A cryptographic hash of the resource, to verify its authenticity. */
141
+ integrity ?: string ,
142
+ nonce ?: string ,
143
+ /** Suggests a relative priority for fetching the resource. */
144
+ fetchPriority ?: fetchPriority ,
145
+ }
146
+
147
+ /** `preinit` lets you eagerly fetch and evaluate a stylesheet or external script. */
148
+ @module ("react-dom" )
149
+ external preinit : (string , preinitOptions ) => unit = "preinit"
150
+
151
+ /** To preinit an ESM module, call the `preinitModule` function from react-dom. */
152
+ @module ("react-dom" )
153
+ external preinitModule : (string , preloadModuleOptions ) => unit = "preinitModule"
154
+
155
+ // Runtime
156
+
46
157
type domProps = JsxDOM .domProps
47
158
48
159
@variadic @module ("react" )
0 commit comments