@colisweb/rescript-toolkit 5.8.1 → 5.9.1

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": "@colisweb/rescript-toolkit",
3
- "version": "5.8.1",
3
+ "version": "5.9.1",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "clean": "rescript clean",
@@ -0,0 +1,379 @@
1
+ type coordinates = {
2
+ lat: float,
3
+ lng: float,
4
+ }
5
+
6
+ module Geo = {
7
+ module Point = {
8
+ type t
9
+
10
+ @new
11
+ external make: (float, float) => t = "H.geo.Point"
12
+ }
13
+ module Rect = {
14
+ type t
15
+ }
16
+ module LineString = {
17
+ type t
18
+ @val
19
+ external fromFlexiblePolyline: 'polyline => t = "H.geo.LineString.fromFlexiblePolyline"
20
+
21
+ @send
22
+ external getLatLngAltArray: (t, unit) => array<float> = "getLatLngAltArray"
23
+ }
24
+ }
25
+
26
+ module Event = {
27
+ type t<'data>
28
+
29
+ module Target = {
30
+ type t<'data>
31
+
32
+ type data = {maxZoom: int}
33
+
34
+ @send
35
+ external getData: (t<'data>, unit) => 'data = "getData"
36
+ @send
37
+ external getObjectData: (t<'data>, unit) => data = "getData"
38
+ @send
39
+ external getGeometry: (t<'data>, unit) => Geo.Point.t = "getGeometry"
40
+ @send
41
+ external getBoundingBox: (t<'data>, unit) => Geo.Rect.t = "getBoundingBox"
42
+ }
43
+
44
+ @get
45
+ external target: t<'data> => Target.t<'data> = "target"
46
+ }
47
+
48
+ module Layers = {
49
+ type map
50
+
51
+ type rec t = {vector: vector}
52
+ and vector = {normal: normalVector}
53
+ and normalVector = {map: map}
54
+ }
55
+
56
+ module Url = {
57
+ module MultiValueQueryParameter = {
58
+ type t
59
+
60
+ @new
61
+ external make: array<string> => t = "H.service.Url.MultiValueQueryParameter"
62
+ }
63
+ }
64
+
65
+ module Platform = {
66
+ type t
67
+ type options = {apikey: string}
68
+
69
+ @new
70
+ external make: options => t = "H.service.Platform"
71
+
72
+ type layersOptions = {pois: bool}
73
+
74
+ module Router = {
75
+ type t
76
+
77
+ type routeRequestParams = {
78
+ routingMode: string,
79
+ transportMode: string,
80
+ origin: string,
81
+ destination: string,
82
+ return: string,
83
+ via?: Url.MultiValueQueryParameter.t,
84
+ }
85
+
86
+ type rec result = {routes: array<route>}
87
+ and route = {sections: array<section>}
88
+ and section = {
89
+ polyline: string,
90
+ id: string,
91
+ arrival: location,
92
+ departure: location,
93
+ transport: transport,
94
+ }
95
+ and transport = {mode: string}
96
+ and location = {
97
+ place: place,
98
+ time: string,
99
+ }
100
+ and place = {
101
+ location: coordinates,
102
+ originalLocation: coordinates,
103
+ @as("type") type_: string,
104
+ waypoint?: int,
105
+ }
106
+
107
+ @send
108
+ external calculateRoute: (t, routeRequestParams, result => unit, 'error => unit) => unit =
109
+ "calculateRoute"
110
+ }
111
+
112
+ @send
113
+ external createDefaultLayers: (t, layersOptions) => Layers.t = "createDefaultLayers"
114
+ @send
115
+ external getRoutingService: (t, 'a, int) => Router.t = "getRoutingService"
116
+ }
117
+
118
+ module Map = {
119
+ type instance
120
+ type object
121
+ type objectLayer
122
+
123
+ type options = {
124
+ zoom: int,
125
+ center: coordinates,
126
+ }
127
+
128
+ @new
129
+ external make: (Dom.element, Layers.map, options) => instance = "H.Map"
130
+
131
+ module Icon = {
132
+ type t
133
+
134
+ type rec options = {
135
+ size?: size,
136
+ anchor?: anchor,
137
+ }
138
+ and size = {
139
+ w: int,
140
+ h: int,
141
+ }
142
+ and anchor = {
143
+ x: float,
144
+ y: float,
145
+ }
146
+
147
+ @new
148
+ external make: (string, options) => t = "H.map.Icon"
149
+ }
150
+ module DomIcon = {
151
+ type t
152
+ @new
153
+ external make: string => t = "H.map.DomIcon"
154
+ }
155
+
156
+ module Marker = {
157
+ type t
158
+
159
+ type options = {icon?: Icon.t, min?: int, max?: int}
160
+ @new
161
+ external makeWithCoordinates: (coordinates, options) => t = "H.map.Marker"
162
+ @new
163
+ external makeWithGeoPoint: (Geo.Point.t, options) => t = "H.map.Marker"
164
+
165
+ @send
166
+ external setData: (t, string) => unit = "setData"
167
+
168
+ external toObject: t => object = "%identity"
169
+ }
170
+ module DomMarker = {
171
+ type t
172
+
173
+ type options = {icon?: DomIcon.t}
174
+ @new
175
+ external make: (coordinates, options) => t = "H.map.DomMarker"
176
+
177
+ @send
178
+ external setData: (t, string) => unit = "setData"
179
+
180
+ external toObject: t => object = "%identity"
181
+ }
182
+
183
+ module Viewport = {
184
+ type t
185
+
186
+ @send
187
+ external resize: (t, unit) => unit = "resize"
188
+ }
189
+ module ViewModel = {
190
+ type t
191
+
192
+ type options = {
193
+ zoom?: int,
194
+ bounds: Geo.Rect.t,
195
+ }
196
+
197
+ @send
198
+ external setLookAtData: (t, options) => unit = "setLookAtData"
199
+ }
200
+
201
+ module Group = {
202
+ type t
203
+ @new
204
+ external make: unit => t = "H.map.Group"
205
+
206
+ type makeOptions = {objects: array<object>}
207
+ @new
208
+ external makeFromObjects: makeOptions => t = "H.map.Group"
209
+
210
+ @send
211
+ external addEventListener: (t, string, Event.t<'data> => unit) => unit = "addEventListener"
212
+
213
+ @send
214
+ external addMarker: (t, Marker.t) => unit = "addObject"
215
+
216
+ external toObject: t => object = "%identity"
217
+ }
218
+ module Polyline = {
219
+ type t
220
+
221
+ type style = {
222
+ ...JsxDOMStyle.t,
223
+ lineWidth: int,
224
+ strokeColor: string,
225
+ }
226
+ type options = {style?: style}
227
+
228
+ @new
229
+ external make: (Geo.LineString.t, options) => t = "H.map.Polyline"
230
+
231
+ @send
232
+ external getBoundingBox: (t, unit) => Geo.Rect.t = "getBoundingBox"
233
+ }
234
+ module Circle = {
235
+ type t
236
+
237
+ type rec options = {style?: style}
238
+ and style = {fillColor?: string}
239
+ @new
240
+ external make: (Geo.Point.t, int, options) => t = "H.map.Circle"
241
+ external toObject: t => object = "%identity"
242
+
243
+ type dataOptions = {maxZoom?: int}
244
+
245
+ @send
246
+ external setData: (t, dataOptions) => unit = "setData"
247
+ }
248
+
249
+ @send
250
+ external addMarker: (instance, Marker.t) => unit = "addObject"
251
+ @send
252
+ external addGroup: (instance, Group.t) => unit = "addObject"
253
+ @send
254
+ external addObject: (instance, object) => unit = "addObject"
255
+ @send
256
+ external addPolyline: (instance, Polyline.t) => unit = "addObject"
257
+
258
+ @send
259
+ external addLayer: (instance, objectLayer) => unit = "addLayer"
260
+ @send
261
+ external setCenter: (instance, coordinates) => unit = "setCenter"
262
+ @send
263
+ external setCenterWithAnimation: (instance, Geo.Point.t, bool) => unit = "setCenter"
264
+ @send
265
+ external setZoom: (instance, int) => unit = "setZoom"
266
+
267
+ @send
268
+ external getViewPort: (instance, unit) => Viewport.t = "getViewPort"
269
+ @send
270
+ external getViewModel: (instance, unit) => ViewModel.t = "getViewModel"
271
+ }
272
+ module Clustering = {
273
+ module NoisePoint = {
274
+ type t
275
+
276
+ @send
277
+ external getData: (t, unit) => 'data = "getData"
278
+ @send
279
+ external setData: (t, 'data) => unit = "setData"
280
+ @send
281
+ external getPosition: (t, unit) => Geo.Point.t = "getPosition"
282
+ @send
283
+ external getMinZoom: (t, unit) => int = "getMinZoom"
284
+ }
285
+
286
+ module Cluster = {
287
+ type t
288
+
289
+ @send
290
+ external forEachDataPoint: (t, NoisePoint.t => unit) => unit = "forEachDataPoint"
291
+ @send
292
+ external getBoundingBox: (t, unit) => Geo.Rect.t = "getBoundingBox"
293
+ @send
294
+ external getPosition: (t, unit) => Geo.Point.t = "getPosition"
295
+ @send
296
+ external getMinZoom: (t, unit) => int = "getMinZoom"
297
+ @send
298
+ external getMaxZoom: (t, unit) => int = "getMaxZoom"
299
+ }
300
+
301
+ type theme = {
302
+ getClusterPresentation: Cluster.t => Map.Marker.t,
303
+ getNoisePresentation: NoisePoint.t => Map.Marker.t,
304
+ }
305
+
306
+ module DataPoint = {
307
+ type t<'a>
308
+ @new
309
+ external make: (float, float, Js.Nullable.t<float>, 'data) => t<'data> =
310
+ "H.clustering.DataPoint"
311
+ }
312
+ module Provider = {
313
+ type t<'a>
314
+
315
+ type rec options = {clusteringOptions: clusteringOptions, theme?: theme}
316
+ and clusteringOptions = {
317
+ eps: int,
318
+ // minimum weight of points required to form a cluster
319
+ minWeight: int,
320
+ }
321
+ @new
322
+ external make: (array<DataPoint.t<'a>>, options) => t<'a> = "H.clustering.Provider"
323
+
324
+ @send
325
+ external addEventListener: (t<'a>, string, Event.t<'a> => unit) => unit = "addEventListener"
326
+ }
327
+ }
328
+
329
+ module MapLayer = {
330
+ module ObjectLayer = {
331
+ @new
332
+ external make: Clustering.Provider.t<'data> => Map.objectLayer = "H.map.layer.ObjectLayer"
333
+ }
334
+ }
335
+
336
+ module MapEvents = {
337
+ type t
338
+
339
+ @new
340
+ external make: Map.instance => t = "H.mapevents.MapEvents"
341
+ }
342
+ module Behavior = {
343
+ type t
344
+
345
+ @new
346
+ external make: MapEvents.t => t = "H.mapevents.Behavior"
347
+ }
348
+ module Ui = {
349
+ type t
350
+
351
+ @new
352
+ external createDefault: (Map.instance, Layers.t) => t = "H.ui.UI.createDefault"
353
+
354
+ module InfoBubble = {
355
+ type t
356
+ type state =
357
+ | @as("open") Open
358
+ | @as("closed") Closed
359
+
360
+ type options = {
361
+ content: string,
362
+ onStateChange?: unknown => unit,
363
+ }
364
+ @new
365
+ external make: (Geo.Point.t, options) => t = "H.ui.InfoBubble"
366
+
367
+ @send
368
+ external setPosition: (t, Geo.Point.t) => unit = "setPosition"
369
+ @send
370
+ external setContent: (t, string) => unit = "setContent"
371
+ @send
372
+ external setState: (t, state) => unit = "setState"
373
+ @send
374
+ external open_: (t, unit) => unit = "open"
375
+ }
376
+
377
+ @send
378
+ external addBubble: (t, InfoBubble.t) => unit = "addBubble"
379
+ }