@rescript/webapi 0.1.0-experimental-0aaab65 → 0.1.0-experimental-f6d2a7d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rescript/webapi",
3
- "version": "0.1.0-experimental-0aaab65",
3
+ "version": "0.1.0-experimental-f6d2a7d",
4
4
  "description": "Experimental successor to [rescript-webapi](https://github.com/TheSpyder/rescript-webapi)",
5
5
  "homepage": "https://rescript-lang.github.io/experimental-rescript-webapi/",
6
6
  "bugs": "https://github.com/rescript-lang/experimental-rescript-webapi/issues",
@@ -84,7 +84,7 @@ Returns the first element that is a descendant of node that matches selectors.
84
84
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/querySelector)
85
85
  */
86
86
  @send
87
- external querySelector: (document, string) => element = "querySelector"
87
+ external querySelector: (document, string) => Null.t<element> = "querySelector"
88
88
 
89
89
  /**
90
90
  Returns all element descendants of node that match selectors.
@@ -66,7 +66,7 @@ Returns the first element that is a descendant of node that matches selectors.
66
66
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/DocumentFragment/querySelector)
67
67
  */
68
68
  @send
69
- external querySelector: (T.t, string) => element = "querySelector"
69
+ external querySelector: (T.t, string) => Null.t<element> = "querySelector"
70
70
 
71
71
  /**
72
72
  Returns all element descendants of node that match selectors.
@@ -267,7 +267,7 @@ Returns the first element that is a descendant of node that matches selectors.
267
267
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Document/querySelector)
268
268
  */
269
269
  @send
270
- external querySelector: (T.t, string) => element = "querySelector"
270
+ external querySelector: (T.t, string) => Null.t<element> = "querySelector"
271
271
 
272
272
  /**
273
273
  Returns all element descendants of node that match selectors.
@@ -388,16 +388,46 @@ When supplied, options's navigationUI member indicates whether showing navigatio
388
388
  external scrollBy2: (T.t, ~x: float, ~y: float) => unit = "scrollBy"
389
389
 
390
390
  /**
391
+ `scrollIntoView()`
392
+
393
+ Scrolls the element's ancestor containers such that the element on which scrollIntoView() is called is visible to the user.
394
+
395
+ ```res
396
+ element->Element.scrollIntoView()
397
+ ```
398
+
399
+ [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollIntoView)
400
+ */
401
+ @send
402
+ external scrollIntoView: T.t => unit = "scrollIntoView"
403
+
404
+ /**
405
+ `scrollIntoView(true)`
406
+
407
+ Scrolls the element's ancestor containers such that the element on which scrollIntoView() is called is visible to the user.
408
+
409
+ ```res
410
+ element->Element.scrollIntoView_alignToTop()
411
+ ```
412
+
391
413
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollIntoView)
392
414
  */
393
415
  @send
394
- external scrollIntoView: (T.t, ~arg: bool=?) => unit = "scrollIntoView"
416
+ external scrollIntoView_alignToTop: (T.t, @as(json`true`) _) => unit = "scrollIntoView"
395
417
 
396
418
  /**
419
+ `scrollIntoView({ behavior: "smooth" })`
420
+
421
+ Scrolls the element's ancestor containers such that the element on which scrollIntoView() is called is visible to the user.
422
+
423
+ ```res
424
+ element->Element.scrollIntoView_withOptions({ behavior: DOMAPI.Smooth })
425
+ ```
426
+
397
427
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollIntoView)
398
428
  */
399
429
  @send
400
- external scrollIntoView2: (T.t, ~arg: scrollIntoViewOptions=?) => unit = "scrollIntoView"
430
+ external scrollIntoView_withOptions: (T.t, scrollIntoViewOptions) => unit = "scrollIntoView"
401
431
 
402
432
  /**
403
433
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/Element/scrollTo)
package/src/Global.res CHANGED
@@ -535,7 +535,7 @@ The event listener is appended to target's event listener list and is not append
535
535
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
536
536
  */
537
537
  external addEventListener: (
538
- ~type_: string,
538
+ ~type_: eventType,
539
539
  ~callback: eventListener<'event>,
540
540
  ~options: addEventListenerOptions=?,
541
541
  ) => unit = "addEventListener"
@@ -556,10 +556,10 @@ If an AbortSignal is passed for options's signal, then the event listener will b
556
556
  The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture.
557
557
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener)
558
558
  */
559
- external addEventListener2: (
560
- ~type_: string,
559
+ external addEventListener_useCapture: (
560
+ ~type_: eventType,
561
561
  ~callback: eventListener<'event>,
562
- ~options: bool=?,
562
+ @as(json`true`) _,
563
563
  ) => unit = "addEventListener"
564
564
 
565
565
  /**
@@ -576,10 +576,10 @@ external removeEventListener: (
576
576
  Removes the event listener in target's event listener list with the same type, callback, and options.
577
577
  [Read more on MDN](https://developer.mozilla.org/docs/Web/API/EventTarget/removeEventListener)
578
578
  */
579
- external removeEventListener2: (
580
- ~type_: string,
579
+ external removeEventListener_useCapture: (
580
+ ~type_: eventType,
581
581
  ~callback: eventListener<'event>,
582
- ~options: bool=?,
582
+ @as(json`true`) _,
583
583
  ) => unit = "removeEventListener"
584
584
 
585
585
  /**