Skip to content

Commit

Permalink
refactor(monorepo): moving to monorepo (themustafaomar#153)
Browse files Browse the repository at this point in the history
* refactor: move to monorepo

* refactor(maps): clean up maps package

* feat: build packages with scripts

* fix: update jsvectormap cover path

* refactor: support umd, es and cjs formats

* fix: playground scripts and jsvectormap css import

* fix(scripts): root scripts
  • Loading branch information
themustafaomar authored Jun 8, 2024
1 parent 9ab5be1 commit 08283f0
Show file tree
Hide file tree
Showing 154 changed files with 9,584 additions and 10,876 deletions.
7 changes: 0 additions & 7 deletions .editorconfig

This file was deleted.

File renamed without changes
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules
packages/*/dist
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://jvm-docs.vercel.app">
<img src="assets/images/jsvectormap.jpg" alt="Jsvectormap sample" width="500" />
<img src=".github/jsvectormap.jpg" alt="Jsvectormap sample" width="500" />
</a>
</p>

Expand Down
20 changes: 0 additions & 20 deletions build/maps.js

This file was deleted.

47 changes: 0 additions & 47 deletions build/package.js

This file was deleted.

6 changes: 6 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
.DS_Store
dist
dist-ssr
*.local
.vite-ssg-temp
3 changes: 3 additions & 0 deletions docs/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["johnsoncodehk.volar"]
}
3 changes: 3 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Jsvectormap documentation

Caught an error or typo don't hesitate to send pull request :]
23 changes: 23 additions & 0 deletions docs/docs/available-maps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: 'Available maps'
description: This section lists all available maps.
---

## Maps

| Name | Description | Projection | Download |
| :------- | :-----------: | :-----------: | :--------: |
| `world` | The world map | `Miller` | [Download](https://raw.githubusercontent.com/themustafaomar/jsvectormap/master/src/maps/world.js) |
| `world_merc` | The world map (mercator) | `Mercator` | [Download](https://raw.githubusercontent.com/themustafaomar/jsvectormap/master/src/maps/world-merc.js) |
| `us_mill_en` | The United States map | `Miller` | [Download](https://raw.githubusercontent.com/themustafaomar/jsvectormap/master/src/maps/us-mill-en.js) |
| `us_merc_en` | The United States map (mercator) | `Mercator` | [Download](https://raw.githubusercontent.com/themustafaomar/jsvectormap/master/src/maps/us-merc-en.js) |
| `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) |
| `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) |
| `spain` | The Spain map | `Mercator` | [Download](https://raw.githubusercontent.com/themustafaomar/jsvectormap/master/src/maps/spain.js) |
| `russia` | The Russia map | `Mercator` | [Download](https://raw.githubusercontent.com/themustafaomar/jsvectormap/master/src/maps/russia.js) |
| `canada` | The Canada map | -- | [Download](https://raw.githubusercontent.com/themustafaomar/jsvectormap/master/src/maps/canada.js) |
| `iraq` | The Iraq map | -- | [Download](https://raw.githubusercontent.com/themustafaomar/jsvectormap/master/src/maps/iraq.js) |

## Generating maps

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.
51 changes: 51 additions & 0 deletions docs/docs/basic-example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
title: 'Basic example'
description: The section provides basic examples using diffrent approaches to get started.
---

## Using CLI
If you're using `webpack` or any module bundler, you need to import the map you want to work with after importing jsvectormap.

:::info
Notice: We will be using `world_merc` in the incoming examples in the docs.
:::

```javascript
import jsVectorMap from 'jsvectormap'
import 'jsvectormap/dist/maps/world'

const map = new jsVectorMap({
selector: '#map',
map: 'world',
})
```

## Customize style
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.
```scss
// app.scss

$tooltip-bg-color: #374151;
$tooltip-font-family: 'Inter', sans-serif;
$tooltip-font-size: 0.925rem;

// ...
```

## Manually
Getting start `manually` with simple example.

```html
<link rel="stylesheet" href="dist/css/jsvectormap.min.css" />
<script src="dist/js/jsvectormap.min.js"></script>
<script src="dist/maps/world.js"></script>

<div id="map" style="width: 600px; height: 350px"></div>
```

```js
var map = new jsVectorMap({
selector: "#map",
map: "world",
});
```
6 changes: 6 additions & 0 deletions docs/docs/browser-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: 'Browser support'
description: This section provides the list of browsers that Jsvectormap is compatible with.
---

Jsvectormap supports all modern browsers including IE9+, in the jsvectormap v2 IE11 and earlier will be dropped.
178 changes: 178 additions & 0 deletions docs/docs/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
---
title: 'Changelog'
description: Discover all the release notes for the Jsvectormap.
---

## v1.5.3 (latest)

- fix: dragging doesn't work on mobile devices ([#126](https://github.com/themustafaomar/jsvectormap/issues/126))

## v1.5.2

- fix(markers): get/clear selected markers
- fix: series doesn't receive markers nor regions
- fix(events): tooltip fails when it's disabled ([#117](https://github.com/themustafaomar/jsvectormap/issues/117))
- perf: massively improves performance when not using labels ([#115](https://github.com/themustafaomar/jsvectormap/pull/115))
- style: replace let with const for the sake of consistency
- refactor: abstract the zoom handlers
- style: replace let with const
- style: imporve variable declaration
- fix: zoom on mobile ([#104](https://github.com/themustafaomar/jsvectormap/issues/104))
- refactor: replace jsvectormap.js with index.js

## v1.5.1

- fix: region label fails ([#92](https://github.com/themustafaomar/jsvectormap/issues/92))
- fix: add ability to customize circled markers ([#97](https://github.com/themustafaomar/jsvectormap/discussions/97))
- refactor: improve consistency & readability ([5cf594d](https://github.com/themustafaomar/jsvectormap/commit/5cf594d62d3ea1175d7a56e994a90740246fd778))

## v1.5.0

- feat(events): onRegion/MarkerClick support ([#29](https://github.com/themustafaomar/jsvectormap/issues/29))
- fix: shaky click selects a region ([#47](https://github.com/themustafaomar/jsvectormap/issues/47))
- fix: lines reposition fails
- refactor: improve the destroy method
- refactor: build an abstract class for components
- refactor: improve consistency & remove addMarker entirely
- feat: ability to remove a line or multiple lines
- refactor: better name conventions ([#86](https://github.com/themustafaomar/jsvectormap/pull/86))
- refactor: move elements to components ([#81](https://github.com/themustafaomar/jsvectormap/pull/81))
- refactor: get selector from merged options directly
- fix: too much recursion error ([#75](https://github.com/themustafaomar/jsvectormap/issues/75)) ([#76](https://github.com/themustafaomar/jsvectormap/pull/76))
- feat(lines): ability to remove lines ([#72](https://github.com/themustafaomar/jsvectormap/discussions/72))
- fix(typo): 'tranparent' typo in default options ([#71](https://github.com/themustafaomar/jsvectormap/pull/71))

### Release Notes

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).

Events `onRegionTooltipShow` and `onMarkerTooltipShow` will receive the native event as the first argument.

```js
const map = new jsVectorMap({})

// ❌ Avoid this in the future versions.
map.addLine()

// ✅ Use `addLines` method to add a line or multiple lines.
map.addLines({ from: 'Palestine', to: 'Ukraine' })

map.addLines([
{ from: 'United States', to: 'Egypt' },
{ from: 'Palestine', to: 'Ukraine' },
])

// ❌ Avoid this in the future versions.
map.removeLine('United States', 'Egypt')

// ✅ Use `removeLines` method to remove multiple lines or all lines.
map.removeLines()

map.removeLines([{ from: 'United States', to: 'Egypt' }])

// Events

const map = new jsVectorMap({
...
onRegionTooltipShow(event, tooltip, index) {
// ..
}
onMarkerTooltipShow(event, tooltip, index) {
// ..
}
...
})
```

## v1.4.5

- fix: jsvectormap constructor is not accessible ([#69](https://github.com/themustafaomar/jsvectormap/issues/69))
- refactor: drop webpack development server
- docs: import typo
- fix: touch events

## v1.4.4

- fix: lines position fail when zooming in/out ([#63](https://github.com/themustafaomar/jsvectormap/issues/63))

## v1.4.3

- refactor: switch addMap, maps, defaults to static ([3b3b13d](https://github.com/themustafaomar/jsvectormap/commit/3b3b13d2a81907dc88dc809b36e9c0c45cf50e7e))
- revert: revert tooltip's css method ([83b7822](https://github.com/themustafaomar/jsvectormap/commit/83b782208d263f9802aded5f4b26c54519fd7e1f))
- fix: touch handlers ([fc4dbe4](https://github.com/themustafaomar/jsvectormap/commit/fc4dbe4dffea50d723f0490dc86c71170fc46f8b))
- chore: cleaning up ([a8be4ef](https://github.com/themustafaomar/jsvectormap/commit/a8be4effb41ea0ef59d802a3d03388fa2e15cccd))
- fix: marker's render function ([5136fae](https://github.com/themustafaomar/jsvectormap/commit/5136fae14f441ff3439ed82590f2a48fe471b60c))

### BREAKING CHANGES

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.

## v1.4.2

- fix: tooltip not destroyed

## v1.4.0

- refactor: drop dom handler class
- refactor: move tooltip functionality to class [(#53)](https://github.com/themustafaomar/jsvectormap/pull/53)
- fix: fix mouseup event & fix zoom buttons
- refactor: clean up util api
- refactor: refactor directory structure
- fix: fix 'addMarkers' method doesn't work with arrays
- fix(scroll): fix mouse wheel behavior [(#52)](https://github.com/themustafaomar/jsvectormap/pull/52)

### BREAKING CHANGES

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.

```js
const map = new jsVectorMap({
// ...
onLoaded: (map) => {
// ❌ Won't work anymore.
map.container.delegate('.jvm-region', 'click', (event) => {
// ..
})

// ✅ You will need to define your own event listener, example
map.container.addEventListener('click', (event) => {
if (event.target.matches('.jvm-region')) {
// Do something
}
})
},
// ...
})
```

#### Tooltip instance

The tooltip also was a `DomHandler` instance, now it's a `Tooltip` instance which implements these methods `getElement`, `show`, `hide`, `text`, `css`.

```js
const map = new jsVectorMap({
// ...
onMarkerTooltipShow(tooltip, index) {
// ❌ Won't work anymore.
const element = tooltip.selector

// Do something with the tooltip DOM element..

// ✅ If you need the tooltip DOM element, you can access it like so:
const element = tooltip.getElement()

// Do something with the tooltip DOM element, or..
// tooltip.css({ backgroundColor: 'red' })
// tooltip.text('Hello')
},
// ...
})
```

## v1.3.3

- fix: dragging the map selects the region (#48)
- fix: eventHandler's off method doesn't delete the reference
- style: correct events names for consistency
- feat: introduce a new event 'onDestroyed'
- fix(add-markers): add markers method not working with object
Loading

0 comments on commit 08283f0

Please sign in to comment.