@@ -480,6 +480,77 @@ external flushSync: (unit => unit) => unit = "flushSync";
480
480
481
481
module Experimental : {
482
482
/* This module is used to bind to APIs for future versions of ReactDOM. There is no guarantee of backwards compatibility or stability. */
483
+ /*
484
+ preload options.
485
+ https://react.dev/reference/react-dom/preload#parameters
486
+ */
487
+ [@ deriving jsProperties]
488
+ type preloadOptions = {
489
+ /* Its possible values are audio, document, embed, fetch, font, image, object, script, style, track, video, worker. */
490
+ [@mel.as "as"] [@mel.optional]
491
+ _as: option ([
492
+ | ` audio
493
+ | ` document
494
+ | ` embed
495
+ | ` fetch
496
+ | ` font
497
+ | ` image
498
+ | [@ mel . as "object" ] ` object_
499
+ | ` script
500
+ | ` style
501
+ | ` track
502
+ | ` video
503
+ | ` worker
504
+ ] ),
505
+ /*
506
+ Suggests a relative priority for fetching the resource.
507
+ The possible values are auto (the default), high, and low.
508
+ */
509
+ [@mel.optional]
510
+ fetchPriority: option ([ ` auto | ` high | ` low ] ),
511
+ /*
512
+ The Referrer header to send when fetching.
513
+ Its possible values are no-referrer-when-downgrade (the default), no-referrer, origin, origin-when-cross-origin, and unsafe-url.
514
+ */
515
+ [@mel.optional]
516
+ referrerPolicy: option ([
517
+ | [@ mel . as "no-referrer" ] ` noReferrer
518
+ | [@ mel . as "no-referrer-when-downgrade" ] ` noReferrerWhenDowngrade
519
+ | [@ mel . as "origin" ] ` origin
520
+ | [@ mel . as "origin-when-cross-origin" ] ` originWhenCrossOrigin
521
+ | [@ mel . as "unsafe-url" ] ` unsafeUrl
522
+ ] ),
523
+ /*
524
+ For use only with as: "image". Specifies the source set of the image.
525
+ https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images
526
+ */
527
+ [@mel.optional]
528
+ imageSrcSet: option (string ),
529
+ /*
530
+ For use only with as: "image". Specifies the source sizes of the image.
531
+ https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images
532
+ */
533
+ [@mel.optional]
534
+ imageSizes: option (string ),
535
+ /*
536
+ a required string. It must be "anonymous", "use-credentials", and "".
537
+ https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin
538
+ */
539
+ [@mel.optional]
540
+ crossOrigin: option (string ),
541
+ /*
542
+ A cryptographic hash of the module, to verify its authenticity.
543
+ https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
544
+ */
545
+ [@mel.optional]
546
+ integrity: option (string ),
547
+ /*
548
+ A cryptographic nonce to allow the module when using a strict Content Security Policy.
549
+ https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce
550
+ */
551
+ [@mel.optional]
552
+ nonce: option (string ),
553
+ };
483
554
484
555
/*
485
556
preinit options.
@@ -562,7 +633,7 @@ module Experimental: {
562
633
[@ mel . module "react-dom" ]
563
634
external preinitModule : (string , ~options : preOptions =?, unit ) => unit = "preinitModule" ;
564
635
[@ mel . module "react-dom" ]
565
- external preload : string => unit = "preload" ;
636
+ external preload : ( string , ~ options : preloadOptions =? , unit ) => unit = "preload" ;
566
637
[@ mel . module "react-dom" ]
567
638
external preloadModule : (string , ~options : preOptions =?, unit ) => unit = "preloadModule" ;
568
639
}
0 commit comments