@zwishing/emap 0.1.0 → 0.1.3

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.
@@ -46,6 +46,14 @@ export interface TopologySourceOptions {
46
46
  */
47
47
  mapshaperRunner?: MapshaperRunner;
48
48
  }
49
+ export interface TopologySourceFromBytesOptions extends Omit<TopologySourceOptions, 'data'> {
50
+ /**
51
+ * Filename handed to mapshaper's importer. The extension is significant:
52
+ * use `.geojson`, `.topojson`, `.json`, `.zip`, `.shp`, `.kml`, or `.msx`
53
+ * so mapshaper can choose the right parser.
54
+ */
55
+ filename?: string;
56
+ }
49
57
  export declare class TopologySource extends EventDispatcher implements ITopologySource {
50
58
  id: string;
51
59
  type: 'topology';
@@ -73,6 +81,12 @@ export declare class TopologySource extends EventDispatcher implements ITopology
73
81
  * load `error`, so callers can safely add the returned source to a map.
74
82
  */
75
83
  static fromUrl(id: string, url: string, options?: Omit<TopologySourceOptions, 'data'>): Promise<TopologySource>;
84
+ /**
85
+ * Convenience loader for in-memory bytes, e.g. files selected through an
86
+ * `<input type="file">`. Resolves after the import succeeds and rejects on
87
+ * the first load error.
88
+ */
89
+ static fromBytes(id: string, bytes: Uint8Array | ArrayBuffer, options?: TopologySourceFromBytesOptions): Promise<TopologySource>;
76
90
  /**
77
91
  * Replace the source's data and trigger a re-import.
78
92
  *
@@ -1,4 +1,3 @@
1
- import 'maplibre-gl/dist/maplibre-gl.css';
2
1
  import { Control } from './control';
3
2
  import { Emap } from '../map/map';
4
3
  export interface BasemapStyle {
@@ -14,6 +13,7 @@ export declare class BasemapControl implements Control {
14
13
  private _map;
15
14
  private _container;
16
15
  private _basemapContainer;
16
+ private _maplibre;
17
17
  private _maplibreMap;
18
18
  private _styles;
19
19
  private _activeStyle;
@@ -25,6 +25,7 @@ export declare class BasemapControl implements Control {
25
25
  private _toggleStyle;
26
26
  private _showBasemap;
27
27
  private _initMapLibre;
28
+ private _loadMapLibre;
28
29
  private _setStyle;
29
30
  private _createMapLibreStyle;
30
31
  private _syncBasemap;
package/package.json CHANGED
@@ -1,30 +1,39 @@
1
1
  {
2
2
  "name": "@zwishing/emap",
3
- "version": "0.1.0",
3
+ "version": "0.1.3",
4
4
  "description": "A modern, decoupled rendering engine for mapshaper data",
5
- "main": "dist/emap.js",
5
+ "main": "dist/emap.mjs",
6
6
  "module": "dist/emap.mjs",
7
+ "browser": "dist/emap.js",
7
8
  "types": "dist/index.d.ts",
8
9
  "exports": {
9
10
  ".": {
10
11
  "types": "./dist/index.d.ts",
11
- "import": "./dist/emap.mjs",
12
- "default": "./dist/emap.js"
12
+ "import": "./dist/emap.mjs"
13
13
  },
14
- "./style.css": "./dist/emap.css",
15
- "./dist/": "./dist/",
14
+ "./style.css": {
15
+ "types": "./style.css.d.ts",
16
+ "default": "./dist/emap.css"
17
+ },
18
+ "./dist/emap-worker.js": "./dist/emap-worker.js",
19
+ "./dist/mapshaper-vendor.js": "./dist/mapshaper-vendor.js",
20
+ "./dist/mapshaper-vendor.mjs": "./dist/mapshaper-vendor.mjs",
21
+ "./dist/emap.js": "./dist/emap.js",
16
22
  "./package.json": "./package.json"
17
23
  },
18
24
  "sideEffects": [
19
25
  "*.css",
20
- "./dist/mapshaper-vendor.js"
26
+ "./dist/mapshaper-vendor.js",
27
+ "./dist/mapshaper-vendor.mjs"
21
28
  ],
22
29
  "files": [
23
30
  "dist/emap.js",
24
31
  "dist/emap.mjs",
25
32
  "dist/emap-worker.js",
26
33
  "dist/mapshaper-vendor.js",
34
+ "dist/mapshaper-vendor.mjs",
27
35
  "dist/emap.css",
36
+ "style.css.d.ts",
28
37
  "dist/**/*.d.ts",
29
38
  "README.md",
30
39
  "SECURITY.md",
@@ -41,7 +50,7 @@
41
50
  "typecheck": "tsc --noEmit",
42
51
  "test": "vitest",
43
52
  "test:run": "vitest run",
44
- "prepublishOnly": "npm run typecheck && npm run test:run && npm run build"
53
+ "prepublishOnly": "npm run typecheck && npm run build && npm run test:run"
45
54
  },
46
55
  "keywords": [
47
56
  "mapshaper",
package/style.css.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const css: string;
2
+ export default css;