jmapcloud-ng-core-types 0.3.0 → 0.3.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/index.ts CHANGED
@@ -37,7 +37,6 @@ export interface JUIService {
37
37
 
38
38
  export interface JLibraryService {
39
39
  maplibregl(): any
40
- // mapboxgl(): any // TODO: remove
41
40
  html2canvas(): any
42
41
  }
43
42
 
@@ -471,7 +470,7 @@ export interface JMapState {
471
470
  activeBasemapId: string | undefined
472
471
  basemaps: JBasemap[]
473
472
  selection: JMapSelection
474
- jmapLayerIdsSupportedByMapbox: JId[]
473
+ jmapLayerIdsSupportedByMaplibre: JId[]
475
474
  scaleControlPosition: JMAP_POSITIONS
476
475
  distanceUnit: JMAP_DISTANCE_UNITS
477
476
  isNavigationHistoryControlVisible: boolean
@@ -663,7 +662,7 @@ export interface JMapService {
663
662
  getExtent(): JBoundaryBox
664
663
  getCenter(): { x: number; y: number }
665
664
  getZoom(): number
666
- getMapBoxSourceIdByJMapLayerId(layerId: JId): string
665
+ getMaplibreSourceIdByJMapLayerId(layerId: JId): string
667
666
  isScaleControlVisible(): boolean
668
667
  setScaleControlVisibility(isVisible: boolean, position?: JMAP_POSITIONS): void
669
668
  setScaleControlUnits(units: "imperial" | "metric" | "nautical"): void
@@ -680,9 +679,9 @@ export interface JMapService {
680
679
  isLayerRendered(layerId: JId): boolean
681
680
  getLayersVisibilityStatus(): JMapLayersVisibilityStatus
682
681
  getLayersVisibilityStatusAsArray(): JMapLayerVisibilityStatus[]
683
- getMapboxSupportedJMapLayerIds(): JId[]
684
- getMapboxSupportedJMapLayerBefore(layerId: JId): JId | undefined
685
- getMapboxSupportedJMapLayerAfter(layerId: JId): JId | undefined
682
+ getMaplibreSupportedJMapLayerIds(): JId[]
683
+ getMaplibreSupportedJMapLayerIdBefore(layerId: JId): JId | undefined
684
+ getMaplibreSupportedJMapLayerIdAfter(layerId: JId): JId | undefined
686
685
  refreshLayerById(layerId: JId): void
687
686
  getRenderedJMapLayerIds(): JId[]
688
687
  getRenderedFeatures(layerId: JId, params?: JLocation | JBoundaryBox | JCircle | JGetRenderedFeaturesParams): Feature[]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jmapcloud-ng-core-types",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "JMap Cloud specific version of JMap Cloud NG Core types and interfaces",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/public/core.d.ts CHANGED
@@ -2791,11 +2791,11 @@ declare namespace JMap {
2791
2791
  /**
2792
2792
  * **JMap.Map.getMap**
2793
2793
  *
2794
- * Returns the Mapbox map instance, a MapBox map.
2794
+ * Returns the Maplibre map instance, a Maplibre map.
2795
2795
  *
2796
2796
  * @example ```ts
2797
2797
  *
2798
- * // returns the Mapbox map instance
2798
+ * // returns the Maplibre map instance
2799
2799
  * JMap.Map.getMap()
2800
2800
  * ```
2801
2801
  */
@@ -2804,13 +2804,13 @@ declare namespace JMap {
2804
2804
  /**
2805
2805
  * **JMap.Map.getMapJSLib**
2806
2806
  *
2807
- * Returns the MapBox JS library used to create the map.
2807
+ * Returns the JS library used to create the map (Maplibre).
2808
2808
  *
2809
- * Useful to be able to create a map library object, by example a popup.
2809
+ * Useful to be able to create a map library object, for instance a popup.
2810
2810
  *
2811
2811
  * @example ```ts
2812
2812
  *
2813
- * // Create a MapBox popup
2813
+ * // Create a Map popup
2814
2814
  * const myCustomPopup = JMap.Map.getMapJSLib().Popup({
2815
2815
  * closeButton: false,
2816
2816
  * closeOnClick: false
@@ -2946,7 +2946,7 @@ declare namespace JMap {
2946
2946
  function getZoom(): number
2947
2947
 
2948
2948
  /**
2949
- * ***JMap.Map.getMapBoxSourceIdByJMapLayerId***
2949
+ * ***JMap.Map.getMaplibreSourceIdByJMapLayerId***
2950
2950
  *
2951
2951
  * Returns the source id of the given Jmap layer id.
2952
2952
  *
@@ -2955,10 +2955,10 @@ declare namespace JMap {
2955
2955
  * @example ```ts
2956
2956
  *
2957
2957
  * // returns the source id of the JMap layer with id 4
2958
- * JMap.Map.getMapBoxSourceIdByJMapLayerId(4)
2958
+ * JMap.Map.getMaplibreSourceIdByJMapLayerId(4)
2959
2959
  * ```
2960
2960
  */
2961
- function getMapBoxSourceIdByJMapLayerId(layerId: JId): string
2961
+ function getMaplibreSourceIdByJMapLayerId(layerId: JId): string
2962
2962
 
2963
2963
  /**
2964
2964
  * ***JMap.Map.isNavigationHistoryControlVisible***
@@ -3247,26 +3247,26 @@ declare namespace JMap {
3247
3247
  function getLayersVisibilityStatusAsArray(): JMapLayerVisibilityStatus[]
3248
3248
 
3249
3249
  /**
3250
- * **JMap.Map.getMapboxSupportedJMapLayerIds**
3250
+ * **JMap.Map.getMaplibreSupportedJMapLayerIds**
3251
3251
  *
3252
3252
  * Returns all layer ids that are displayed by the map.
3253
3253
  *
3254
- * Mapbox doesn't support all layer types defined in JMap Server.
3254
+ * The Map JS library doesn't support all layer types defined in JMap .
3255
3255
  *
3256
3256
  * This function returns all layers ids that are managed by the map.
3257
3257
  *
3258
3258
  * @example ```ts
3259
3259
  *
3260
- * // returns layer ids supported by the Mapbox
3261
- * JMap.Map.getMapboxSupportedJMapLayerIds()
3260
+ * // returns layer ids supported by the Map JS library
3261
+ * JMap.Map.getMaplibreSupportedJMapLayerIds()
3262
3262
  * ```
3263
3263
  */
3264
- function getMapboxSupportedJMapLayerIds(): JId[]
3264
+ function getMaplibreSupportedJMapLayerIds(): JId[]
3265
3265
 
3266
3266
  /**
3267
- * **JMap.Map.getMapboxSupportedJMapLayerBefore**
3267
+ * **JMap.Map.getMaplibreSupportedJMapLayerIdBefore**
3268
3268
  *
3269
- * Returns the Mapbox supported JMap layer id that is ordered before the JMap layer id provided in argument.
3269
+ * Returns the Map JS library supported JMap layer id that is ordered before the JMap layer id provided in argument.
3270
3270
  *
3271
3271
  * @throws Error if layer is not found
3272
3272
  * @param layerId The JMap layer id
@@ -3274,15 +3274,15 @@ declare namespace JMap {
3274
3274
  * @example ```ts
3275
3275
  *
3276
3276
  * // Returns the layer id that is located before layer id=4
3277
- * JMap.Map.getMapboxSupportedJMapLayerBefore(4)
3277
+ * JMap.Map.getMaplibreSupportedJMapLayerIdBefore(4)
3278
3278
  * ```
3279
3279
  */
3280
- function getMapboxSupportedJMapLayerBefore(layerId: JId): JId | undefined
3280
+ function getMaplibreSupportedJMapLayerIdBefore(layerId: JId): JId | undefined
3281
3281
 
3282
3282
  /**
3283
- * **JMap.Map.getMapboxSupportedJMapLayerAfter**
3283
+ * **JMap.Map.getMaplibreSupportedJMapLayerIdAfter**
3284
3284
  *
3285
- * Returns the Mapbox supported JMap layer id that is ordered after the JMap layer id provided in argument.
3285
+ * Returns the Map JS library supported JMap layer id that is ordered after the JMap layer id provided in argument.
3286
3286
  *
3287
3287
  * @throws Error if layer is not found
3288
3288
  * @param layerId The JMap layer id
@@ -3290,10 +3290,10 @@ declare namespace JMap {
3290
3290
  * @example ```ts
3291
3291
  *
3292
3292
  * // Returns the layer id that is located after layer id=3
3293
- * JMap.Map.getMapboxSupportedJMapLayerAfter(3)
3293
+ * JMap.Map.getMaplibreSupportedJMapLayerIdAfter(3)
3294
3294
  * ```
3295
3295
  */
3296
- function getMapboxSupportedJMapLayerAfter(layerId: JId): JId | undefined
3296
+ function getMaplibreSupportedJMapLayerIdAfter(layerId: JId): JId | undefined
3297
3297
 
3298
3298
  /**
3299
3299
  * **JMap.Map.refreshLayerById**
@@ -3318,7 +3318,7 @@ declare namespace JMap {
3318
3318
  *
3319
3319
  * Returns the ids of the layers that are displayed on the map.
3320
3320
  *
3321
- * Mapbox doesn't support all layer types defined on JMap Server.
3321
+ * The Map JS library doesn't support all layer types defined on JMap Server.
3322
3322
  *
3323
3323
  * This function returns all layers ids that are managed by the map.
3324
3324
  *
@@ -3333,11 +3333,11 @@ declare namespace JMap {
3333
3333
  /**
3334
3334
  * **JMap.Map.getRenderedFeatures**
3335
3335
  *
3336
- * Returns rendered geojson features for the specified Jmap layer. Features that are not rendered (i.e. filtered by MapBox) are not returned
3336
+ * Returns rendered geojson features for the specified Jmap layer. Features that are not rendered (i.e. filtered by the Map JS library) are not returned
3337
3337
  *
3338
3338
  * If the JMap layer is not visible, no features are returned.
3339
3339
  *
3340
- * MapBox splits geometries along tiles internally, meaning for instance that a polygon feature that crosses many tiles will be returned as multiple polygon pieces (sharing all properties of the original source features).
3340
+ * The Map JS library splits geometries along tiles internally, meaning for instance that a polygon feature that crosses many tiles will be returned as multiple polygon pieces (sharing all properties of the original source features).
3341
3341
  * By default, getRenderedFeatures will only return one of those pieces (a random one).
3342
3342
  * If you pass a JGetRenderedFeaturesParams with keepAllTiles = true, all feature pieces will be returned by getRenderedFeatures.
3343
3343
  *
@@ -3364,8 +3364,8 @@ declare namespace JMap {
3364
3364
  * ne: { x: 48.54, y: 70.43 }
3365
3365
  * })
3366
3366
  *
3367
- * // Returns all rendered geojson features for layer 4 that intersect a circle (radius in km), without any mapbox filter
3368
- * JMap.Map.getRenderedFeatures(4, {filter: { center: { x: 45.54, y: 65.43 }, radius: .5 }, ignoreMapBoxFilter: true})
3367
+ * // Returns all rendered geojson features for layer 4 that intersect a circle (radius in km), without any Map JS library filter
3368
+ * JMap.Map.getRenderedFeatures(4, {geoFilter: { center: { x: 45.54, y: 65.43 }, radius: .5 }})
3369
3369
  * ```
3370
3370
  */
3371
3371
  function getRenderedFeatures(
@@ -3376,11 +3376,11 @@ declare namespace JMap {
3376
3376
  /**
3377
3377
  * **JMap.Map.getSourceFeatures**
3378
3378
  *
3379
- * Returns geojson features for the specified JMap layer whether or not they are currently rendered by MapBox (i.e. whether or not they are filtered on screen)
3379
+ * Returns geojson features for the specified JMap layer whether or not they are currently rendered by the map (i.e. whether or not they are filtered on screen)
3380
3380
  *
3381
3381
  * If the JMap layer is not visible, no features are returned.
3382
3382
  *
3383
- * MapBox splits geometries along tiles internally, meaning for instance that a polygon feature that crosses many tiles will be returned as multiple polygon pieces (sharing all properties of the original source features).
3383
+ * The map splits geometries along tiles internally, meaning for instance that a polygon feature that crosses many tiles will be returned as multiple polygon pieces (sharing all properties of the original source features).
3384
3384
  * By default, getSourceFeatures will only return one of those pieces (a random one).
3385
3385
  * If you pass a JGetSourceFeaturesParams with keepAllTiles = true, all feature pieces will be returned by getSourceFeatures.
3386
3386
  * If you pass a JGetSourceFeaturesParams with keepAllTiles = false (or if keepAllTiles is not specified), and if a viewport is specified in the JGetSourceFeaturesParams, the sole feature piece returned is garanteed to be included in the viewport.
@@ -3673,7 +3673,7 @@ declare namespace JMap {
3673
3673
  * @example ```ts
3674
3674
  *
3675
3675
  * // Navigate to a location on the map
3676
- * JMap.Map.navigateTo({center: { x: 45.34, y: 65.87 }, zoom: 5, bearing: 170, pitch: 30, mapBoxEventData: { stopJMapEventPropagation: true }})
3676
+ * JMap.Map.navigateTo({center: { x: 45.34, y: 65.87 }, zoom: 5, bearing: 170, pitch: 30, maplibreEventData: { stopJMapEventPropagation: true }})
3677
3677
  * ```
3678
3678
  */
3679
3679
  function navigateTo(params: JMapNavigateToParams): void
@@ -3973,7 +3973,7 @@ declare namespace JMap {
3973
3973
  *
3974
3974
  * Set the map mouse cursor.
3975
3975
  *
3976
- * If cursor is an empty string will unset the cursor (the mapbox default will be used).
3976
+ * If cursor is an empty string will unset the cursor (the map default cursor will be used).
3977
3977
  *
3978
3978
  * @throws if the map is not ready
3979
3979
  * @param cursor the mouse cursor
@@ -5684,7 +5684,7 @@ declare namespace JMap {
5684
5684
  *
5685
5685
  * Returns loaded JMap project projection.
5686
5686
  *
5687
- * In MapBox, projection is always "***EPSG:3857***", but that function returns the project
5687
+ * In the map, the projection is always "***EPSG:3857***", but that function returns the project
5688
5688
  * defined projection (so it can be different than ***ESPG:3857***).
5689
5689
  *
5690
5690
  * @throws If no project is loaded
@@ -8609,7 +8609,7 @@ declare namespace JMap {
8609
8609
  * "custom-map-move-start",
8610
8610
  * args => {
8611
8611
  * console.log(`The map start moving`, args.map, args.mapEvent)
8612
- * // mapEvent is the Mapbox event
8612
+ * // mapEvent is the Maplibre event
8613
8613
  * }
8614
8614
  * )
8615
8615
  * ```
@@ -8630,7 +8630,7 @@ declare namespace JMap {
8630
8630
  * "custom-map-move",
8631
8631
  * args => {
8632
8632
  * console.log(`The map is moving`, args.map, args.mapEvent)
8633
- * // mapEvent is the Mapbox event
8633
+ * // mapEvent is the Maplibre event
8634
8634
  * }
8635
8635
  * )
8636
8636
  * ```
@@ -8651,7 +8651,7 @@ declare namespace JMap {
8651
8651
  * "custom-map-move-end",
8652
8652
  * args => {
8653
8653
  * console.log(`The map stop moving`, args.map, args.mapEvent)
8654
- * // mapEvent is the Mapbox event
8654
+ * // mapEvent is the Maplibre event
8655
8655
  * }
8656
8656
  * )
8657
8657
  * ```
@@ -8673,7 +8673,7 @@ declare namespace JMap {
8673
8673
  * args => {
8674
8674
  * console.log(
8675
8675
  * `The mouse is moving on layer id="${args.layerId}"`, map.location,
8676
- * args.map, args.mapEvent // mapEvent is the Mapbox event
8676
+ * args.map, args.mapEvent // mapEvent is the Maplibre event
8677
8677
  * )
8678
8678
  * }
8679
8679
  * )
@@ -8701,7 +8701,7 @@ declare namespace JMap {
8701
8701
  * args => {
8702
8702
  * console.log(
8703
8703
  * `The mouse is moving on layer id="${args.layerId}"`,
8704
- * args.map, args.mapEvent // the mapEvent is the Mapbox event
8704
+ * args.map, args.mapEvent // the mapEvent is the Maplibre event
8705
8705
  * )
8706
8706
  * console.log(
8707
8707
  * `The mouse cursor is over ${args.features.length} features`,
@@ -8737,7 +8737,7 @@ declare namespace JMap {
8737
8737
  * args => {
8738
8738
  * console.log(
8739
8739
  * `The mouse entered an element of layer id="${args.layerId}"`,
8740
- * args.map, args.mapEvent // mapEvent is the Mapbox event
8740
+ * args.map, args.mapEvent // mapEvent is the Maplibre event
8741
8741
  * )
8742
8742
  * console.log(
8743
8743
  * `The mouse cursor is over ${args.features.length} features`,
@@ -8773,7 +8773,7 @@ declare namespace JMap {
8773
8773
  * args => {
8774
8774
  * console.log(
8775
8775
  * `The mouse leaved the layer id="${args.layerId}"`, args.location,
8776
- * args.map, args.mapEvent // mapEvent is the Mapbox event
8776
+ * args.map, args.mapEvent // mapEvent is the Maplibre event
8777
8777
  * )
8778
8778
  * }
8779
8779
  * )
@@ -8797,7 +8797,7 @@ declare namespace JMap {
8797
8797
  * const location = args.location
8798
8798
  * console.log(
8799
8799
  * `The mouse has been clicked at { x="${location.x}, y="${location.y}" }"`,
8800
- * args.map, args.mapEvent // mapEvent is the Mapbox event
8800
+ * args.map, args.mapEvent // mapEvent is the Maplibre event
8801
8801
  * )
8802
8802
  * }
8803
8803
  * )
@@ -12123,19 +12123,6 @@ declare namespace JMap {
12123
12123
  * Here you'll find all external library JMap expose to its client
12124
12124
  */
12125
12125
  namespace Library {
12126
- // /**
12127
- // * **JMap.Library.mapboxgl**
12128
- // *
12129
- // * Returns the mapboxgl library.
12130
- // *
12131
- // * @example ```ts
12132
- // *
12133
- // * // get the mapboxgl library
12134
- // * const mapboxgl = JMap.Library.mapboxgl()
12135
- // * ```
12136
- // */
12137
- // function mapboxgl(): any
12138
-
12139
12126
  /**
12140
12127
  * **JMap.Library.maplibregl**
12141
12128
  *
@@ -172,19 +172,19 @@ declare interface JCoreExtension {
172
172
  onRegistrationDone?: () => void
173
173
 
174
174
  /**
175
- * An optional handler that returns a Mapbox GL JS RequestParameters object
175
+ * An optional handler that returns a Maplibre RequestParameters object
176
176
  *
177
- * Provide this handler if your extentions needs to add something special in MapBox map requests,
177
+ * Provide this handler if your extentions needs to add something special in map requests,
178
178
  * like providing credentials, adding headers, etc.
179
179
  *
180
180
  * Great care must be taken to not blindly modify every request passed to this handler. You should only modify requests known to your extension. This can usually
181
181
  * be determined by looking at the url received by the handler.
182
182
  *
183
- * See Mapbox documentation for reference:
183
+ * See Maplibre documentation for reference:
184
184
  *
185
- * https://docs.mapbox.com/mapbox-gl-js/api/map/#map-parameters
185
+ * https://maplibre.org/maplibre-gl-js/docs/API/types/maplibregl.MapOptions
186
186
  *
187
- * https://docs.mapbox.com/mapbox-gl-js/api/properties/#requestparameters
187
+ * https://maplibre.org/maplibre-gl-js/docs/API/types/maplibregl.RequestParameters
188
188
  *
189
189
  * @example ```ts
190
190
  * JMap.Extension.register({
@@ -32,7 +32,7 @@ declare type JPolygon = JPoint[]
32
32
  declare interface JCircle {
33
33
  center: JLocation
34
34
  /**
35
- * With mapbox the radius unit is kilometer
35
+ * The radius unit is kilometer
36
36
  */
37
37
  radius: number
38
38
  }
@@ -276,8 +276,8 @@ declare interface JLayer extends JLayerTreeElement {
276
276
  metadataSections: JLayerMetadataSection[]
277
277
  attributes: JLayerAttribute[]
278
278
  mouseOver: JMapMouseOver
279
- minimumVisibleMapboxZoom: number | undefined
280
- maximumVisibleMapboxZoom: number | undefined
279
+ minimumVisibleZoom: number | undefined
280
+ maximumVisibleZoom: number | undefined
281
281
  styleRules: JLayerStyleRule[]
282
282
  defaultStyleRule: JLayerStyleRule | undefined
283
283
  thematics: JLayerThematic[]
@@ -440,8 +440,8 @@ declare interface JLayerStyleRuleCondition {
440
440
  declare interface JLayerStyleScaled {
441
441
  id: string
442
442
  styleId: string
443
- minimumVisibleMapboxZoom: number
444
- maximumVisibleMapboxZoom: number
443
+ minimumVisibleZoom: number
444
+ maximumVisibleZoom: number
445
445
  }
446
446
 
447
447
  declare interface JLayerStyleSample {
@@ -162,14 +162,14 @@ declare interface JMapNavigationStep {
162
162
  }
163
163
 
164
164
  /**
165
- * **JMapBoxEventData**
165
+ * **JMaplibreEventData**
166
166
  *
167
- * This interface describe optionnal data we can pass to MapBox events
167
+ * This interface describe optionnal data we can pass to Map events
168
168
  * in order to transport useful information while consuming the events in your application
169
169
  *
170
170
  *
171
171
  */
172
- declare interface JMapBoxEventData {
172
+ declare interface JMaplibreEventData {
173
173
  /**
174
174
  * **stopJMapEventPropagation**
175
175
  *
@@ -187,11 +187,6 @@ declare interface JMapBoxEventData {
187
187
  preventNavigationStepPush?: boolean
188
188
  }
189
189
 
190
- declare interface JMapMapboxLayerStyleDefinition {
191
- styleLayer: maplibregl.LayerSpecification
192
- borderStyleLayer?: maplibregl.LayerSpecification
193
- }
194
-
195
190
  declare interface JMapNavigateToParams extends JPanAndZoomOptions {
196
191
  center: JLocation
197
192
  zoom: number
@@ -264,9 +259,9 @@ declare interface JZoomOptions {
264
259
 
265
260
  declare interface JPanAndZoomOptions extends Partial<JZoomOptions> {
266
261
  /**
267
- * Event related options
262
+ * Event related options/data passed to Maplibre event
268
263
  */
269
- mapBoxEventData?: JMapBoxEventData
264
+ maplibreEventData?: JMaplibreEventData
270
265
  }
271
266
 
272
267
  declare interface JCoreMapOptions {
@@ -301,8 +296,8 @@ declare interface JCoreMapOptions {
301
296
  * If a mapbox token is set through the JMap Admin interface,
302
297
  * the JMap Cloud NG Core library will use it automatically, nothing else to do for you.
303
298
  *
304
- * The Mapbox token is used by JMap in order to fully use Mapbox capabilities
305
- * like displaying a mapbox base maps.
299
+ * The mapbox token is used by JMap in order to fully use mapbox capabilities
300
+ * like displaying a mapbox base maps or using mapbox geocoding.
306
301
  *
307
302
  * But if no token is set in JMap Admin, or if you want to use
308
303
  * the mapbox token of your choice, you have to set the "***mapboxToken***" parameter :
@@ -2,8 +2,8 @@ declare interface JMapMouseOver {
2
2
  text: string
3
3
  preventTextDuplication: boolean
4
4
  backgroundColor: string
5
- maximumVisibleMapboxZoom: number
6
- minimumVisibleMapboxZoom: number
5
+ maximumVisibleZoom: number
6
+ minimumVisibleZoom: number
7
7
  }
8
8
 
9
9
  declare interface JMouseOverContent {
@@ -29,8 +29,8 @@ declare interface JProject {
29
29
  colorSelection: string
30
30
  colorBackground: string
31
31
  initialExtent: JBounds | null
32
- minimumVisibleMapboxZoom: number
33
- maximumVisibleMapboxZoom: number
32
+ minimumVisibleZoom: number
33
+ maximumVisibleZoom: number
34
34
  mapUnit: JMAP_DISTANCE_UNITS
35
35
  apiKey: {
36
36
  google: string | null