Skip to content

Commit

Permalink
UG dev setup
Browse files Browse the repository at this point in the history
  • Loading branch information
helitopia committed Aug 27, 2024
1 parent 46756d6 commit 3e58c68
Show file tree
Hide file tree
Showing 35 changed files with 31 additions and 967 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"autoprefixer": "^10.4.19",
"babel-loader": "^8.3.0",
"glob": "^10.4.1",
"node-sass": "^7.0.3",
"postcss": "^8.4.38",
"rollup": "^2.79.1",
"rollup-plugin-scss": "^3.0.0",
Expand Down
17 changes: 1 addition & 16 deletions packages/jsvectormap/build/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,6 @@ function scssOptions(filename, outputStyle = 'expanded') {
}
}

function getCommonMaps() {
return ['world-merc', 'world'].map((file) => ({
external: ['jsvectormap'],
input: `../maps/src/${file}.js`,
output: {
file: `dist/maps/${file}.js`,
format: 'cjs',
plugins: [terser()],
globals: { jsvectormap: LIBRARY_NAME },
},
plugins: [resolve()],
}))
}

const builds = ['umd', 'es', 'cjs'].map((format) => {
const extension = format === 'umd'
? 'js'
Expand Down Expand Up @@ -67,6 +53,5 @@ export default [
scss(scssOptions('jsvectormap.min', 'compressed')),
],
},
...builds,
...getCommonMaps(),
...builds
]
2 changes: 1 addition & 1 deletion packages/jsvectormap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"style": "./dist/jsvectormap.css",
"sass": "./src/scss/jsvectormap.scss"
},
"./*": "./*"
"./*": "./dist/*"
},
"style": "dist/jsvectormap.min.css",
"sass": "src/scss/jsvectormap.scss",
Expand Down
2 changes: 1 addition & 1 deletion packages/jsvectormap/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
input: 'src/js/index.js',
output: {
name: 'jsVectorMap',
file: 'dist/jsvectormap.js',
file: 'dist/jsvectormap.esm.js',
format: 'es',
},
plugins: [
Expand Down
3 changes: 2 additions & 1 deletion packages/jsvectormap/src/js/core/createRegions.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { merge } from '../util'
import Region from '../components/region'

export default function createRegions() {
export default function createRegions(strokeScaling) {
this._regionLabelsGroup = this._regionLabelsGroup || this.canvas.createGroup('jvm-regions-labels-group')

for (const code in this._mapData.paths) {
const region = new Region({
map: this,
code: code,
path: this._mapData.paths[code].path,
strokeScaling,
style: merge({}, this.params.regionStyle),
labelStyle: this.params.regionLabelStyle,
labelsGroup: this._regionLabelsGroup,
Expand Down
1 change: 1 addition & 0 deletions packages/maps/src/_ug-world.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion packages/maps/src/canada.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/maps/src/iraq.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/maps/src/italy.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/maps/src/russia.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/maps/src/spain.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/maps/src/us-aea-en.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/maps/src/us-lcc-en.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/maps/src/us-merc-en.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/maps/src/us-mill-en.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/maps/src/world-merc.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/maps/src/world.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/playground/assets/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ body {
font-size: .925rem;
}

.workspace-wrapper #map {
.workspace-wrapper .value--map {
width: 800px;
height: 475px;
margin: 2rem auto 0;
Expand Down
Binary file removed packages/playground/assets/images/marker.png
Binary file not shown.
Binary file removed packages/playground/assets/images/marker2.png
Binary file not shown.
Binary file removed packages/playground/assets/images/marker3.png
Binary file not shown.
Binary file removed packages/playground/assets/images/pin.png
Binary file not shown.
Binary file removed packages/playground/assets/images/pingreen.png
Binary file not shown.
3 changes: 1 addition & 2 deletions packages/playground/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/assets/css/style.css" />
<title>jsvectormap (Workspace)</title>
Expand All @@ -16,7 +15,7 @@ <h1>jsvectormap workspace.</h1>
</div>
<a href="#">Github Repository</a>
</header>
<div id="map"></div>
<div class="value--map"></div>
</div>
<script type="module" src="/main.js"></script>
</body>
Expand Down
85 changes: 22 additions & 63 deletions packages/playground/main.js
Original file line number Diff line number Diff line change
@@ -1,65 +1,24 @@
import jsVectorMap from 'jsvectormap'
import 'jsvectormap/dist/maps/world-merc'
import 'jsvectormap/dist/jsvectormap.css'

const markers = [
{ name: 'Russia', coords: [61, 105] },
{ name: 'Geenland', coords: [72, -42] },
{ name: 'Canada', coords: [56.1304, -106.3468] },
{ name: 'Palestine', coords: [31.5, 34.8] },
{ name: 'Brazil', coords: [-14.2350, -51.9253] },
]

const map = new jsVectorMap({
map: 'world_merc',
selector: document.querySelector('#map'),
zoomButtons: false,

regionsSelectable: true,
markersSelectable: true,
markersSelectableOne: true,

regionStyle: {
initial: { fill: '#d1d5db' }
},

// Labels
labels: {
markers: {
render: function(marker) {
return marker.name
},
import JsVectorMap from 'jsvectormap'
import 'jsvectormap/jsvectormap.css'
import 'jsvectormap-maps/_ug-world.js'

let map = new JsVectorMap({
selector: document.querySelector('.value--map'),
map: "ug-world",
zoomButtons: false,
zoomMax: 1000,
backgroundColor: "#b3dff5",
regionsSelectable: true,
regionsSelectableOne: true,
showTooltip: false,
regionStyle: {
initial: {
fill: "#fdfbe5",
stroke: "#757674",
strokeWidth: 1
},
selected: {
fill: "#e7f3ea"
}
},
},

// Marker and label style
markers: markers,
markerStyle: { initial: { fill: '#66F' } },

// Event handling
onLoaded: function(map) {
console.log(map)
},
onViewportChange: function(x, y, z) {
console.log(x, y, z)
},
onRegionSelected: function (index, isSelected, selectedRegions) {
console.log(index, isSelected, selectedRegions)
},
onRegionTooltipShow: function (event, tooltip, index) {
console.log(tooltip, index)
console.log(tooltip)

tooltip.css({ backgroundColor: 'white', color: '#35373e' }).text(
tooltip.text() + ' (Hello World `region`)'
)
},
onMarkerSelected: function (code, isSelected, selectedMarkers) {
console.log(code, isSelected, selectedMarkers)
},
onMarkerTooltipShow: function (event, tooltip, code) {
tooltip.text(
tooltip.text() + ' (Hello World (marker))'
)
},
})
2 changes: 1 addition & 1 deletion packages/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"vite": "^5.2.0"
},
"dependencies": {
"jsvectormap": "workspace:*",
"jsvectormap": "*",
"jsvectormap-maps": "*"
}
}
91 changes: 0 additions & 91 deletions packages/playground/samples/addmarkers.html

This file was deleted.

Loading

0 comments on commit 3e58c68

Please sign in to comment.