@rise-x/apps-sdk 0.15.1 → 0.16.0
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/README.md +16 -7
- package/build/ui/components/map.d.ts +4 -1
- package/build/ui/demo.html +3 -48
- package/build/ui/standalone.js +888 -65
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -771,7 +771,9 @@ Requirements in the app:
|
|
|
771
771
|
The one component with a real library behind it. It renders a Leaflet basemap
|
|
772
772
|
and nothing else — markers, routes and heat layers are yours to add. Leaflet is
|
|
773
773
|
fetched in its own chunk on first mount, so apps that never show a map pay
|
|
774
|
-
nothing for it.
|
|
774
|
+
nothing for it. The `light` and `dark` presets are OpenFreeMap vector styles
|
|
775
|
+
drawn by MapLibre GL, which arrives in a second chunk only when one of them is
|
|
776
|
+
shown.
|
|
775
777
|
|
|
776
778
|
`onReady` hands back the map **and the Leaflet module it was built from**. Build
|
|
777
779
|
layers off that `L`: the app then needs no `leaflet` dependency of its own, and
|
|
@@ -801,17 +803,24 @@ import { MapView, mapPin } from '@rise-x/apps-sdk/ui';
|
|
|
801
803
|
```
|
|
802
804
|
|
|
803
805
|
`tiles` also takes a preset (`'light'`, `'dark'`, `'streets'`, `'satellite'`), a
|
|
804
|
-
custom
|
|
806
|
+
custom raster layer (`{ url, ...TileLayerOptions }`), a MapLibre style
|
|
807
|
+
(`{ style }`), or `null` for no basemap at all.
|
|
805
808
|
|
|
806
|
-
The built-in presets
|
|
807
|
-
|
|
809
|
+
The built-in presets fetch from third-party hosts, so the host page's CSP must
|
|
810
|
+
allow them: `light` and `dark` need `connect-src https://tiles.openfreemap.org`
|
|
811
|
+
and `worker-src blob:` (MapLibre renders in a web worker); `streets` and
|
|
812
|
+
`satellite` load tile images, so `img-src` must allow
|
|
808
813
|
`https://tile.openstreetmap.org` and `https://server.arcgisonline.com`. The
|
|
809
814
|
host page's CSP controls this, so an app can't lift a block from its own
|
|
810
|
-
code. The Rise-X shell
|
|
811
|
-
other host, ask Rise-X to add it. If no tile loads,
|
|
815
|
+
code. The Rise-X shell's allow-list carries the built-in preset hosts; for
|
|
816
|
+
any other host, ask Rise-X to add it. If no tile of a raster layer loads,
|
|
812
817
|
`MapView` warns once and removes the layer so Leaflet stops re-requesting
|
|
813
818
|
blocked tiles on every pan and zoom — use `tiles={null}` or a custom
|
|
814
|
-
`MapTileSpec` on a permitted origin instead.
|
|
819
|
+
`MapTileSpec` on a permitted origin instead. A vector style that fails to
|
|
820
|
+
load is handled the same way: `MapView` warns with the style's origin and
|
|
821
|
+
removes the layer. A vector style also needs WebGL2;
|
|
822
|
+
on a browser without it `MapView` warns and renders as `tiles={null}`, so pick
|
|
823
|
+
a raster preset where that is a possibility. `mapPin()` has no `aria-label` of
|
|
815
824
|
its own; set one via `marker.getElement()` after `addTo(map)` if the marker
|
|
816
825
|
needs an accessible name (see the JSDoc on `mapPin`).
|
|
817
826
|
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { DivIconOptions, LatLngBoundsExpression, LatLngExpression, Map as LeafletMap, MapOptions, TileLayerOptions } from 'leaflet';
|
|
3
3
|
type MapTilePreset = 'light' | 'dark' | 'streets' | 'satellite';
|
|
4
|
-
type MapTileSpec = TileLayerOptions & {
|
|
4
|
+
type MapTileSpec = (TileLayerOptions & {
|
|
5
5
|
url: string;
|
|
6
|
+
}) | {
|
|
7
|
+
style: string;
|
|
8
|
+
maxZoom?: number;
|
|
6
9
|
};
|
|
7
10
|
declare const MAP_TILES: Record<MapTilePreset, MapTileSpec>;
|
|
8
11
|
type MapPinTone = 'default' | 'brand' | 'success' | 'warning' | 'error' | 'info';
|
package/build/ui/demo.html
CHANGED
|
@@ -11030,21 +11030,7 @@ CSS.
|
|
|
11030
11030
|
tabindex="0"
|
|
11031
11031
|
>
|
|
11032
11032
|
<div class="leaflet-pane leaflet-map-pane" style="left: 0px; top: 0px">
|
|
11033
|
-
<div class="leaflet-pane leaflet-tile-pane">
|
|
11034
|
-
<div class="leaflet-layer" style="z-index: 1">
|
|
11035
|
-
<div
|
|
11036
|
-
class="leaflet-tile-container leaflet-zoom-animated"
|
|
11037
|
-
style="z-index: 20; left: 0px; top: 0px"
|
|
11038
|
-
>
|
|
11039
|
-
<img
|
|
11040
|
-
alt=""
|
|
11041
|
-
src="https://d.basemaps.cartocdn.com/light_all/9/262/169.png"
|
|
11042
|
-
class="leaflet-tile"
|
|
11043
|
-
style="width: 256px; height: 256px; left: -94px; top: -76px"
|
|
11044
|
-
/>
|
|
11045
|
-
</div>
|
|
11046
|
-
</div>
|
|
11047
|
-
</div>
|
|
11033
|
+
<div class="leaflet-pane leaflet-tile-pane"></div>
|
|
11048
11034
|
<div class="leaflet-pane leaflet-overlay-pane"></div>
|
|
11049
11035
|
<div class="leaflet-pane leaflet-shadow-pane"></div>
|
|
11050
11036
|
<div class="leaflet-pane leaflet-marker-pane"></div>
|
|
@@ -11094,7 +11080,6 @@ CSS.
|
|
|
11094
11080
|
</svg>
|
|
11095
11081
|
Leaflet</a
|
|
11096
11082
|
>
|
|
11097
|
-
<span aria-hidden="true">|</span> © OpenStreetMap, © CARTO
|
|
11098
11083
|
</div>
|
|
11099
11084
|
</div>
|
|
11100
11085
|
</div>
|
|
@@ -11123,21 +11108,7 @@ CSS.
|
|
|
11123
11108
|
style="position: relative"
|
|
11124
11109
|
>
|
|
11125
11110
|
<div class="leaflet-pane leaflet-map-pane" style="left: 0px; top: 0px">
|
|
11126
|
-
<div class="leaflet-pane leaflet-tile-pane">
|
|
11127
|
-
<div class="leaflet-layer" style="z-index: 1">
|
|
11128
|
-
<div
|
|
11129
|
-
class="leaflet-tile-container leaflet-zoom-animated"
|
|
11130
|
-
style="z-index: 20; left: 0px; top: 0px"
|
|
11131
|
-
>
|
|
11132
|
-
<img
|
|
11133
|
-
alt=""
|
|
11134
|
-
src="https://a.basemaps.cartocdn.com/light_all/12/2098/1354.png"
|
|
11135
|
-
class="leaflet-tile"
|
|
11136
|
-
style="width: 256px; height: 256px; left: -242px; top: -94px"
|
|
11137
|
-
/>
|
|
11138
|
-
</div>
|
|
11139
|
-
</div>
|
|
11140
|
-
</div>
|
|
11111
|
+
<div class="leaflet-pane leaflet-tile-pane"></div>
|
|
11141
11112
|
<div class="leaflet-pane leaflet-overlay-pane"></div>
|
|
11142
11113
|
<div class="leaflet-pane leaflet-shadow-pane"></div>
|
|
11143
11114
|
<div class="leaflet-pane leaflet-marker-pane"></div>
|
|
@@ -11167,7 +11138,6 @@ CSS.
|
|
|
11167
11138
|
</svg>
|
|
11168
11139
|
Leaflet</a
|
|
11169
11140
|
>
|
|
11170
|
-
<span aria-hidden="true">|</span> © OpenStreetMap, © CARTO
|
|
11171
11141
|
</div>
|
|
11172
11142
|
</div>
|
|
11173
11143
|
</div>
|
|
@@ -11195,21 +11165,7 @@ CSS.
|
|
|
11195
11165
|
tabindex="0"
|
|
11196
11166
|
>
|
|
11197
11167
|
<div class="leaflet-pane leaflet-map-pane" style="left: 0px; top: 0px">
|
|
11198
|
-
<div class="leaflet-pane leaflet-tile-pane">
|
|
11199
|
-
<div class="leaflet-layer" style="z-index: 1">
|
|
11200
|
-
<div
|
|
11201
|
-
class="leaflet-tile-container leaflet-zoom-animated"
|
|
11202
|
-
style="z-index: 20; left: 0px; top: 0px"
|
|
11203
|
-
>
|
|
11204
|
-
<img
|
|
11205
|
-
alt=""
|
|
11206
|
-
src="https://c.basemaps.cartocdn.com/light_all/10/524/338.png"
|
|
11207
|
-
class="leaflet-tile"
|
|
11208
|
-
style="width: 256px; height: 256px; left: -184px; top: -142px"
|
|
11209
|
-
/>
|
|
11210
|
-
</div>
|
|
11211
|
-
</div>
|
|
11212
|
-
</div>
|
|
11168
|
+
<div class="leaflet-pane leaflet-tile-pane"></div>
|
|
11213
11169
|
<div class="leaflet-pane leaflet-overlay-pane"></div>
|
|
11214
11170
|
<div class="leaflet-pane leaflet-shadow-pane"></div>
|
|
11215
11171
|
<div class="leaflet-pane leaflet-marker-pane">
|
|
@@ -11339,7 +11295,6 @@ CSS.
|
|
|
11339
11295
|
</svg>
|
|
11340
11296
|
Leaflet</a
|
|
11341
11297
|
>
|
|
11342
|
-
<span aria-hidden="true">|</span> © OpenStreetMap, © CARTO
|
|
11343
11298
|
</div>
|
|
11344
11299
|
</div>
|
|
11345
11300
|
</div>
|