anymap-ts 0.10.0 → 0.11.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/anymap_ts/static/cesium.css +1 -0
- package/anymap_ts/static/cesium.js +16543 -1
- package/anymap_ts/static/leaflet.css +1 -1
- package/anymap_ts/static/leaflet.js +1 -1
- package/anymap_ts/static/openlayers.css +1 -1
- package/anymap_ts/static/openlayers.js +602 -7
- package/package.json +3 -2
- package/src/cesium/index.ts +43 -99
- package/src/leaflet/LeafletRenderer.ts +684 -113
- package/src/leaflet/index.ts +23 -0
- package/src/leaflet/leaflet-overrides.css +31 -0
- package/src/leaflet/leaflet-setup.ts +13 -0
- package/src/openlayers/OpenLayersRenderer.ts +1275 -181
- package/src/openlayers/index.ts +1 -0
- package/src/styles/openlayers.css +39 -0
package/src/leaflet/index.ts
CHANGED
|
@@ -2,11 +2,34 @@
|
|
|
2
2
|
* Leaflet module entry point for anywidget.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
// Setup must come first — it exposes L globally for plugins
|
|
6
|
+
import { L } from './leaflet-setup';
|
|
7
|
+
|
|
8
|
+
// Side-effect import: leaflet.heat attaches L.heatLayer to the global L
|
|
9
|
+
import 'leaflet.heat';
|
|
10
|
+
|
|
5
11
|
import { LeafletRenderer } from './LeafletRenderer';
|
|
6
12
|
import type { AnyModel } from '@anywidget/types';
|
|
7
13
|
|
|
8
14
|
// Import Leaflet CSS
|
|
9
15
|
import 'leaflet/dist/leaflet.css';
|
|
16
|
+
import './leaflet-overrides.css';
|
|
17
|
+
|
|
18
|
+
// Fix Leaflet default marker icons when bundled (esbuild inlines PNGs as data URLs)
|
|
19
|
+
// @ts-ignore - Import as data URL via esbuild loader
|
|
20
|
+
import markerIcon from 'leaflet/dist/images/marker-icon.png';
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
import markerIcon2x from 'leaflet/dist/images/marker-icon-2x.png';
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
import markerShadow from 'leaflet/dist/images/marker-shadow.png';
|
|
25
|
+
|
|
26
|
+
// @ts-ignore - Override prototype to fix icon paths for bundled builds
|
|
27
|
+
delete (L.Icon.Default.prototype as any)._getIconUrl;
|
|
28
|
+
L.Icon.Default.mergeOptions({
|
|
29
|
+
iconUrl: markerIcon,
|
|
30
|
+
iconRetinaUrl: markerIcon2x,
|
|
31
|
+
shadowUrl: markerShadow,
|
|
32
|
+
});
|
|
10
33
|
|
|
11
34
|
/**
|
|
12
35
|
* Store renderer reference on element for cleanup and multi-cell support.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* Match layer control toggle size to zoom control buttons */
|
|
2
|
+
.leaflet-control-layers-toggle {
|
|
3
|
+
width: 26px;
|
|
4
|
+
height: 26px;
|
|
5
|
+
background-size: 16px 16px;
|
|
6
|
+
}
|
|
7
|
+
.leaflet-touch .leaflet-control-layers-toggle {
|
|
8
|
+
width: 30px;
|
|
9
|
+
height: 30px;
|
|
10
|
+
background-size: 20px 20px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* Legend base styles */
|
|
14
|
+
.anymap-legend {
|
|
15
|
+
background: white;
|
|
16
|
+
color: #333;
|
|
17
|
+
padding: 8px 12px;
|
|
18
|
+
border-radius: 4px;
|
|
19
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
|
|
20
|
+
font-size: 12px;
|
|
21
|
+
line-height: 18px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/* Dark mode support */
|
|
25
|
+
@media (prefers-color-scheme: dark) {
|
|
26
|
+
.anymap-legend {
|
|
27
|
+
background: #1e1e1e;
|
|
28
|
+
color: #e0e0e0;
|
|
29
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Leaflet setup module — imports Leaflet and exposes it globally so that
|
|
3
|
+
* traditional Leaflet plugins (leaflet.heat, etc.) can attach to L.
|
|
4
|
+
*
|
|
5
|
+
* This module MUST be imported before any plugin side-effect imports.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// @ts-ignore - Import from explicit ESM path to avoid baseUrl conflict
|
|
9
|
+
import * as L from 'leaflet/dist/leaflet-src.esm.js';
|
|
10
|
+
|
|
11
|
+
(globalThis as any).L = L;
|
|
12
|
+
|
|
13
|
+
export { L };
|