@rescript/webapi 0.1.0-experimental-0d6538f → 0.1.0-experimental-56ed473
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-
|
|
3
|
+
"version": "0.1.0-experimental-56ed473",
|
|
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",
|
package/src/DOMAPI/Document.res
CHANGED
package/src/DOMAPI/Element.res
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
open DOMAPI
|
|
2
|
+
open IntersectionObserverAPI
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IntersectionObserver)
|
|
6
|
+
*/
|
|
7
|
+
@new
|
|
8
|
+
external make: (
|
|
9
|
+
~callback: intersectionObserverCallback,
|
|
10
|
+
~options: intersectionObserverInit=?,
|
|
11
|
+
) => intersectionObserver = "IntersectionObserver"
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IntersectionObserver/observe)
|
|
15
|
+
*/
|
|
16
|
+
@send
|
|
17
|
+
external observe: (intersectionObserver, element) => unit = "observe"
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IntersectionObserver/unobserve)
|
|
21
|
+
*/
|
|
22
|
+
@send
|
|
23
|
+
external unobserve: (intersectionObserver, element) => unit = "unobserve"
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IntersectionObserver/disconnect)
|
|
27
|
+
*/
|
|
28
|
+
@send
|
|
29
|
+
external disconnect: intersectionObserver => unit = "disconnect"
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IntersectionObserver/takeRecords)
|
|
33
|
+
*/
|
|
34
|
+
@send
|
|
35
|
+
external takeRecords: intersectionObserver => array<intersectionObserverEntry> = "takeRecords"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
open DOMAPI
|
|
2
|
+
open IntersectionObserverAPI
|
|
3
|
+
|
|
4
|
+
external fromDocument: document => root = "%identity"
|
|
5
|
+
external fromElement: element => root = "%identity"
|
|
6
|
+
external fromNull: root = "null"
|
|
7
|
+
|
|
8
|
+
type decoded =
|
|
9
|
+
| Element(element)
|
|
10
|
+
| Document(document)
|
|
11
|
+
| Null
|
|
12
|
+
|
|
13
|
+
let decode = (t: root): decoded => {
|
|
14
|
+
open Prelude
|
|
15
|
+
if Element.isInstanceOf(t) {
|
|
16
|
+
Element(t->unsafeConversation)
|
|
17
|
+
} else if Document.isInstanceOf(t) {
|
|
18
|
+
Document(t->unsafeConversation)
|
|
19
|
+
} else {
|
|
20
|
+
Null
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
@@warning("-30")
|
|
2
|
+
|
|
3
|
+
open DOMAPI
|
|
4
|
+
|
|
5
|
+
@editor.completeFrom(IntersectionObserverRoot)
|
|
6
|
+
type root
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
provides a way to asynchronously observe changes in the intersection of a target element with an ancestor element or with a top-level document's viewport.
|
|
10
|
+
[See IntersectionObserver on MDN](https://developer.mozilla.org/docs/Web/API/IntersectionObserver)
|
|
11
|
+
*/
|
|
12
|
+
@editor.completeFrom(IntersectionObserver)
|
|
13
|
+
type intersectionObserver = {
|
|
14
|
+
/**
|
|
15
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IntersectionObserver/root)
|
|
16
|
+
*/
|
|
17
|
+
root: root,
|
|
18
|
+
/**
|
|
19
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IntersectionObserver/rootMargin)
|
|
20
|
+
*/
|
|
21
|
+
rootMargin: string,
|
|
22
|
+
/**
|
|
23
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IntersectionObserver/thresholds)
|
|
24
|
+
*/
|
|
25
|
+
thresholds: array<float>,
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
This Intersection Observer API interface describes the intersection between the target element and its root container at a specific moment of transition.
|
|
30
|
+
[See IntersectionObserverEntry on MDN](https://developer.mozilla.org/docs/Web/API/IntersectionObserverEntry)
|
|
31
|
+
*/
|
|
32
|
+
type intersectionObserverEntry = {
|
|
33
|
+
/**
|
|
34
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IntersectionObserverEntry/time)
|
|
35
|
+
*/
|
|
36
|
+
time: float,
|
|
37
|
+
/**
|
|
38
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IntersectionObserverEntry/rootBounds)
|
|
39
|
+
*/
|
|
40
|
+
rootBounds: Null.t<domRectReadOnly>,
|
|
41
|
+
/**
|
|
42
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IntersectionObserverEntry/boundingClientRect)
|
|
43
|
+
*/
|
|
44
|
+
boundingClientRect: domRectReadOnly,
|
|
45
|
+
/**
|
|
46
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IntersectionObserverEntry/intersectionRect)
|
|
47
|
+
*/
|
|
48
|
+
intersectionRect: domRectReadOnly,
|
|
49
|
+
/**
|
|
50
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IntersectionObserverEntry/isIntersecting)
|
|
51
|
+
*/
|
|
52
|
+
isIntersecting: bool,
|
|
53
|
+
/**
|
|
54
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IntersectionObserverEntry/intersectionRatio)
|
|
55
|
+
*/
|
|
56
|
+
intersectionRatio: float,
|
|
57
|
+
/**
|
|
58
|
+
[Read more on MDN](https://developer.mozilla.org/docs/Web/API/IntersectionObserverEntry/target)
|
|
59
|
+
*/
|
|
60
|
+
target: element,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
type intersectionObserverInit = {
|
|
64
|
+
mutable root?: root,
|
|
65
|
+
mutable rootMargin?: string,
|
|
66
|
+
mutable threshold?: array<float>,
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
type intersectionObserverCallback = (array<intersectionObserverEntry>, intersectionObserver) => unit
|