Skip to content

Commit 5200cd3

Browse files
refactor: move to monorepo
1 parent 9ab5be1 commit 5200cd3

File tree

149 files changed

+9352
-10826
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+9352
-10826
lines changed

.editorconfig

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
node_modules
2+
.DS_Store
3+
dist
4+
dist-ssr
5+
*.local
6+
.vite-ssg-temp

docs/.vscode/extensions.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"recommendations": ["johnsoncodehk.volar"]
3+
}

docs/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Jsvectormap documentation
2+
3+
Caught an error or typo don't hesitate to send pull request :]

docs/docs/available-maps.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: 'Available maps'
3+
description: This section lists all available maps.
4+
---
5+
6+
## Maps
7+
8+
| Name | Description | Projection | Download |
9+
| :------- | :-----------: | :-----------: | :--------: |
10+
| `world` | The world map | `Miller` | [Download](https://raw.githubusercontent.com/themustafaomar/jsvectormap/master/src/maps/world.js) |
11+
| `world_merc` | The world map (mercator) | `Mercator` | [Download](https://raw.githubusercontent.com/themustafaomar/jsvectormap/master/src/maps/world-merc.js) |
12+
| `us_mill_en` | The United States map | `Miller` | [Download](https://raw.githubusercontent.com/themustafaomar/jsvectormap/master/src/maps/us-mill-en.js) |
13+
| `us_merc_en` | The United States map (mercator) | `Mercator` | [Download](https://raw.githubusercontent.com/themustafaomar/jsvectormap/master/src/maps/us-merc-en.js) |
14+
| `us_lcc_en` | The United States map (lcc) | `Lambert Conformal Conic` | [Download](https://raw.githubusercontent.com/themustafaomar/jsvectormap/master/src/maps/us-lcc-en.js) |
15+
| `us_aea_en` | The United States map (aea) | `Albers Equal Area` | [Download](https://raw.githubusercontent.com/themustafaomar/jsvectormap/master/src/maps/us-aea-en.js) |
16+
| `spain` | The Spain map | `Mercator` | [Download](https://raw.githubusercontent.com/themustafaomar/jsvectormap/master/src/maps/spain.js) |
17+
| `russia` | The Russia map | `Mercator` | [Download](https://raw.githubusercontent.com/themustafaomar/jsvectormap/master/src/maps/russia.js) |
18+
| `canada` | The Canada map | -- | [Download](https://raw.githubusercontent.com/themustafaomar/jsvectormap/master/src/maps/canada.js) |
19+
| `iraq` | The Iraq map | -- | [Download](https://raw.githubusercontent.com/themustafaomar/jsvectormap/master/src/maps/iraq.js) |
20+
21+
## Generating maps
22+
23+
If you want to generate your own map, please refer to [jvectormap](https://github.com/bjornd/jvectormap) to know about the map generation process and how it works.

docs/docs/basic-example.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
title: 'Basic example'
3+
description: The section provides basic examples using diffrent approaches to get started.
4+
---
5+
6+
## Using CLI
7+
If you're using `webpack` or any module bundler, you need to import the map you want to work with after importing jsvectormap.
8+
9+
:::info
10+
Notice: We will be using `world_merc` in the incoming examples in the docs.
11+
:::
12+
13+
```javascript
14+
import jsVectorMap from 'jsvectormap'
15+
import 'jsvectormap/dist/maps/world'
16+
17+
const map = new jsVectorMap({
18+
selector: '#map',
19+
map: 'world',
20+
})
21+
```
22+
23+
## Customize style
24+
Style was written using `Sass` so you can overwrite the default style using variables without twaeaking it, you may want to take a look at [jsvectormap.scss](https://github.com/themustafaomar/jsvectormap/blob/master/src/scss/jsvectormap.scss) to know about all possiable variables.
25+
```scss
26+
// app.scss
27+
28+
$tooltip-bg-color: #374151;
29+
$tooltip-font-family: 'Inter', sans-serif;
30+
$tooltip-font-size: 0.925rem;
31+
32+
// ...
33+
```
34+
35+
## Manually
36+
Getting start `manually` with simple example.
37+
38+
```html
39+
<link rel="stylesheet" href="dist/css/jsvectormap.min.css" />
40+
<script src="dist/js/jsvectormap.min.js"></script>
41+
<script src="dist/maps/world.js"></script>
42+
43+
<div id="map" style="width: 600px; height: 350px"></div>
44+
```
45+
46+
```js
47+
var map = new jsVectorMap({
48+
selector: "#map",
49+
map: "world",
50+
});
51+
```

docs/docs/browser-support.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: 'Browser support'
3+
description: This section provides the list of browsers that Jsvectormap is compatible with.
4+
---
5+
6+
Jsvectormap supports all modern browsers including IE9+, in the jsvectormap v2 IE11 and earlier will be dropped.

docs/docs/changelog.md

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
---
2+
title: 'Changelog'
3+
description: Discover all the release notes for the Jsvectormap.
4+
---
5+
6+
## v1.5.3 (latest)
7+
8+
- fix: dragging doesn't work on mobile devices ([#126](https://github.com/themustafaomar/jsvectormap/issues/126))
9+
10+
## v1.5.2
11+
12+
- fix(markers): get/clear selected markers
13+
- fix: series doesn't receive markers nor regions
14+
- fix(events): tooltip fails when it's disabled ([#117](https://github.com/themustafaomar/jsvectormap/issues/117))
15+
- perf: massively improves performance when not using labels ([#115](https://github.com/themustafaomar/jsvectormap/pull/115))
16+
- style: replace let with const for the sake of consistency
17+
- refactor: abstract the zoom handlers
18+
- style: replace let with const
19+
- style: imporve variable declaration
20+
- fix: zoom on mobile ([#104](https://github.com/themustafaomar/jsvectormap/issues/104))
21+
- refactor: replace jsvectormap.js with index.js
22+
23+
## v1.5.1
24+
25+
- fix: region label fails ([#92](https://github.com/themustafaomar/jsvectormap/issues/92))
26+
- fix: add ability to customize circled markers ([#97](https://github.com/themustafaomar/jsvectormap/discussions/97))
27+
- refactor: improve consistency & readability ([5cf594d](https://github.com/themustafaomar/jsvectormap/commit/5cf594d62d3ea1175d7a56e994a90740246fd778))
28+
29+
## v1.5.0
30+
31+
- feat(events): onRegion/MarkerClick support ([#29](https://github.com/themustafaomar/jsvectormap/issues/29))
32+
- fix: shaky click selects a region ([#47](https://github.com/themustafaomar/jsvectormap/issues/47))
33+
- fix: lines reposition fails
34+
- refactor: improve the destroy method
35+
- refactor: build an abstract class for components
36+
- refactor: improve consistency & remove addMarker entirely
37+
- feat: ability to remove a line or multiple lines
38+
- refactor: better name conventions ([#86](https://github.com/themustafaomar/jsvectormap/pull/86))
39+
- refactor: move elements to components ([#81](https://github.com/themustafaomar/jsvectormap/pull/81))
40+
- refactor: get selector from merged options directly
41+
- fix: too much recursion error ([#75](https://github.com/themustafaomar/jsvectormap/issues/75)) ([#76](https://github.com/themustafaomar/jsvectormap/pull/76))
42+
- feat(lines): ability to remove lines ([#72](https://github.com/themustafaomar/jsvectormap/discussions/72))
43+
- fix(typo): 'tranparent' typo in default options ([#71](https://github.com/themustafaomar/jsvectormap/pull/71))
44+
45+
### Release Notes
46+
47+
Starting from v1.5.0 the `addLine` and `removeLine` are deprecated and will be removed soon, as an alternative please use `addLines` [see docs](/docs/lines) and `removeLines` [see docs](/docs/lines).
48+
49+
Events `onRegionTooltipShow` and `onMarkerTooltipShow` will receive the native event as the first argument.
50+
51+
```js
52+
const map = new jsVectorMap({})
53+
54+
// ❌ Avoid this in the future versions.
55+
map.addLine()
56+
57+
// ✅ Use `addLines` method to add a line or multiple lines.
58+
map.addLines({ from: 'Palestine', to: 'Ukraine' })
59+
60+
map.addLines([
61+
{ from: 'United States', to: 'Egypt' },
62+
{ from: 'Palestine', to: 'Ukraine' },
63+
])
64+
65+
// ❌ Avoid this in the future versions.
66+
map.removeLine('United States', 'Egypt')
67+
68+
// ✅ Use `removeLines` method to remove multiple lines or all lines.
69+
map.removeLines()
70+
71+
map.removeLines([{ from: 'United States', to: 'Egypt' }])
72+
73+
// Events
74+
75+
const map = new jsVectorMap({
76+
...
77+
onRegionTooltipShow(event, tooltip, index) {
78+
// ..
79+
}
80+
onMarkerTooltipShow(event, tooltip, index) {
81+
// ..
82+
}
83+
...
84+
})
85+
```
86+
87+
## v1.4.5
88+
89+
- fix: jsvectormap constructor is not accessible ([#69](https://github.com/themustafaomar/jsvectormap/issues/69))
90+
- refactor: drop webpack development server
91+
- docs: import typo
92+
- fix: touch events
93+
94+
## v1.4.4
95+
96+
- fix: lines position fail when zooming in/out ([#63](https://github.com/themustafaomar/jsvectormap/issues/63))
97+
98+
## v1.4.3
99+
100+
- refactor: switch addMap, maps, defaults to static ([3b3b13d](https://github.com/themustafaomar/jsvectormap/commit/3b3b13d2a81907dc88dc809b36e9c0c45cf50e7e))
101+
- revert: revert tooltip's css method ([83b7822](https://github.com/themustafaomar/jsvectormap/commit/83b782208d263f9802aded5f4b26c54519fd7e1f))
102+
- fix: touch handlers ([fc4dbe4](https://github.com/themustafaomar/jsvectormap/commit/fc4dbe4dffea50d723f0490dc86c71170fc46f8b))
103+
- chore: cleaning up ([a8be4ef](https://github.com/themustafaomar/jsvectormap/commit/a8be4effb41ea0ef59d802a3d03388fa2e15cccd))
104+
- fix: marker's render function ([5136fae](https://github.com/themustafaomar/jsvectormap/commit/5136fae14f441ff3439ed82590f2a48fe471b60c))
105+
106+
### BREAKING CHANGES
107+
108+
All other maps except `world` and `world_merc` are ignored from the npm package, but it's available on Github, you can download these maps from [Available maps](/docs/available-maps) page.
109+
110+
## v1.4.2
111+
112+
- fix: tooltip not destroyed
113+
114+
## v1.4.0
115+
116+
- refactor: drop dom handler class
117+
- refactor: move tooltip functionality to class [(#53)](https://github.com/themustafaomar/jsvectormap/pull/53)
118+
- fix: fix mouseup event & fix zoom buttons
119+
- refactor: clean up util api
120+
- refactor: refactor directory structure
121+
- fix: fix 'addMarkers' method doesn't work with arrays
122+
- fix(scroll): fix mouse wheel behavior [(#52)](https://github.com/themustafaomar/jsvectormap/pull/52)
123+
124+
### BREAKING CHANGES
125+
126+
In early versions the `map` container was an instance of a custom dom handler class that contains a `delegate` method, now it's just a DOM element, so the `delegate` method won't be available anymore.
127+
128+
```js
129+
const map = new jsVectorMap({
130+
// ...
131+
onLoaded: (map) => {
132+
// ❌ Won't work anymore.
133+
map.container.delegate('.jvm-region', 'click', (event) => {
134+
// ..
135+
})
136+
137+
// ✅ You will need to define your own event listener, example
138+
map.container.addEventListener('click', (event) => {
139+
if (event.target.matches('.jvm-region')) {
140+
// Do something
141+
}
142+
})
143+
},
144+
// ...
145+
})
146+
```
147+
148+
#### Tooltip instance
149+
150+
The tooltip also was a `DomHandler` instance, now it's a `Tooltip` instance which implements these methods `getElement`, `show`, `hide`, `text`, `css`.
151+
152+
```js
153+
const map = new jsVectorMap({
154+
// ...
155+
onMarkerTooltipShow(tooltip, index) {
156+
// ❌ Won't work anymore.
157+
const element = tooltip.selector
158+
159+
// Do something with the tooltip DOM element..
160+
161+
// ✅ If you need the tooltip DOM element, you can access it like so:
162+
const element = tooltip.getElement()
163+
164+
// Do something with the tooltip DOM element, or..
165+
// tooltip.css({ backgroundColor: 'red' })
166+
// tooltip.text('Hello')
167+
},
168+
// ...
169+
})
170+
```
171+
172+
## v1.3.3
173+
174+
- fix: dragging the map selects the region (#48)
175+
- fix: eventHandler's off method doesn't delete the reference
176+
- style: correct events names for consistency
177+
- feat: introduce a new event 'onDestroyed'
178+
- fix(add-markers): add markers method not working with object

docs/docs/data-visualization.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: 'Data visualization'
3+
description: Map visualization is used to analyze and display the geographically related data and present it in the form of maps.
4+
---
5+
6+
| Property | Description | Type | Default |
7+
| :------------ | :-----------: | :-----------: | ------------: |
8+
| `visualizeData` | Data visualization for `regions` | `Object` | `undefined` |
9+
10+
## How it works
11+
This option was introduced since version 1.3
12+
13+
```js
14+
const map = new jsVectorMap({
15+
visualizeData: {
16+
scale: ['#eeeeee', '#999999'],
17+
values: {
18+
EG: 29,
19+
US: 100,
20+
CA: 190,
21+
BR: 75,
22+
// ...
23+
}
24+
}
25+
})
26+
```

0 commit comments

Comments
 (0)