dotted-map 2.2.3 → 3.0.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 +6 -5
- package/dist/chunk-C0xms8kb.cjs +34 -0
- package/dist/index.cjs +12897 -0
- package/dist/index.d.cts +13 -0
- package/dist/index.d.mts +13 -0
- package/dist/index.mjs +12891 -0
- package/dist/types-ByIhMtjO.d.cts +70 -0
- package/dist/types-UL1f7mia.d.mts +70 -0
- package/dist/without-countries.cjs +85 -0
- package/dist/without-countries.d.cts +43 -0
- package/dist/without-countries.d.mts +43 -0
- package/dist/without-countries.mjs +83 -0
- package/package.json +46 -11
- package/.github/workflows/publish.yml +0 -22
- package/index.d.ts +0 -62
- package/index.js +0 -1
- package/src/countries.geo.json +0 -182
- package/src/with-countries.js +0 -180
- package/src/without-countries.js +0 -108
- package/webpack.config.js +0 -37
- package/without-countries.d.ts +0 -70
- package/without-countries.js +0 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
|
-
Requires NodeJS ≥
|
|
19
|
+
Requires NodeJS ≥ 18.
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
22
|
npm i dotted-map
|
|
@@ -25,9 +25,8 @@ npm i dotted-map
|
|
|
25
25
|
## Usage
|
|
26
26
|
|
|
27
27
|
```js
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// Or in the browser: import DottedMap from 'dotted-map';
|
|
28
|
+
import fs from 'fs';
|
|
29
|
+
import DottedMap from 'dotted-map';
|
|
31
30
|
|
|
32
31
|
const map = new DottedMap({ height: 60, grid: 'diagonal' });
|
|
33
32
|
|
|
@@ -54,13 +53,15 @@ fs.writeFileSync('./map.svg', svgMap);
|
|
|
54
53
|
|
|
55
54
|
If you use a large number of points (height or width ≥ 100), it may take a bit of time to compute the map (from 1 to 30 seconds depending on your device and number of points). This is why the result grid is cached. If you don’t change the parameters of `new DottedMap`, the next maps will be a lot faster to generate. You can however change the pins and the SVG options.
|
|
56
55
|
|
|
56
|
+
It’s also possible to use it in **Leaflet**, see [an example here](https://github.com/NTag/colivings/blob/main/src/App.js).
|
|
57
|
+
|
|
57
58
|
### Precomputing the map
|
|
58
59
|
|
|
59
60
|
Because the previous operation can be expansive (especially if you want to use DottedMap in a browser or React Native app), it’s possible to precompute the grid. You will still be able to add pins on-the-fly, in real time. This also allows you to import a lighter version of the library. This is especially useful if you always use the same map parameters, but only change the pins.
|
|
60
61
|
|
|
61
62
|
```js
|
|
62
63
|
// So you do this first step only once, when developing your app
|
|
63
|
-
|
|
64
|
+
import { getMapJSON } from 'dotted-map';
|
|
64
65
|
|
|
65
66
|
// This function accepts the same arguments as DottedMap in the example above.
|
|
66
67
|
const mapJsonString = getMapJSON({ height: 60, grid: 'diagonal' });
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
|
|
29
|
+
Object.defineProperty(exports, '__toESM', {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () {
|
|
32
|
+
return __toESM;
|
|
33
|
+
}
|
|
34
|
+
});
|