Skip to content

Commit c2e20d6

Browse files
Merge pull request #88 from geospoc/feat/major-housekeeping
2 parents 070c808 + b551526 commit c2e20d6

File tree

14 files changed

+14686
-6258
lines changed

14 files changed

+14686
-6258
lines changed

.github/semantic.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
titleAndCommits: true
33
# Allows use of Merge commits (eg on github: "Merge branch 'master' into feature/ride-unicorns")
44
# this is only relevant when using commitsOnly: true (or titleAndCommits: true)
5-
allowMergeCommits: true
5+
allowMergeCommits: true

.github/workflows/shipjs-trigger.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,24 @@ jobs:
88
name: Release
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v2
11+
- name: Checkout code
12+
uses: actions/checkout@v2
1213
with:
1314
ref: main
14-
- uses: actions/setup-node@v1
15+
16+
- name: Setup node environment
17+
uses: actions/setup-node@v1
1518
with:
16-
registry-url: "https://npm.pkg.github.com"
19+
registry-url: 'https://npm.pkg.github.com'
1720
scope: '@geospoc'
18-
- run: npm install
21+
22+
- name: Install dependencies
23+
run: npm install
1924
env:
20-
NODE_AUTH_TOKEN: ${{ secrets.READ_PACKAGES_PAT }}
21-
- run: npm run release:trigger
25+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Release pkg to registry
28+
run: npm run release:trigger
2229
env:
2330
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2431
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@geospoc:registry=https://npm.pkg.github.com

build/rollup.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import babel from 'rollup-plugin-babel';
1+
import babel from '@rollup/plugin-babel';
22
import commonjs from '@rollup/plugin-commonjs';
33
import vue from 'rollup-plugin-vue';
44

@@ -14,7 +14,6 @@ export default [
1414
plugins: [
1515
babel({
1616
exclude: 'node_modules/**',
17-
runtimeHelpers: true,
1817
}),
1918
commonjs(),
2019
vue(),
@@ -32,7 +31,6 @@ export default [
3231
plugins: [
3332
babel({
3433
exclude: 'node_modules/**',
35-
runtimeHelpers: true,
3634
}),
3735
commonjs(),
3836
vue(),
@@ -54,7 +52,6 @@ export default [
5452
plugins: [
5553
babel({
5654
exclude: 'node_modules/**',
57-
runtimeHelpers: true,
5855
}),
5956
commonjs(),
6057
vue(),

build/rollup.min.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import babel from 'rollup-plugin-babel';
1+
import babel from '@rollup/plugin-babel';
22
import commonjs from '@rollup/plugin-commonjs';
33
import { terser } from 'rollup-plugin-terser';
44
import vue from 'rollup-plugin-vue';
@@ -17,7 +17,6 @@ export default {
1717
plugins: [
1818
babel({
1919
exclude: 'node_modules/**',
20-
runtimeHelpers: true,
2120
}),
2221
commonjs(),
2322
terser(),

docs/.vuepress/config.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
module.exports = {
2+
title: 'v-mapbox Geocoder',
3+
description: 'Geocoder control for your awesome v-mapbox application',
4+
head: [['link', { rel: 'icon', href: '/favicon.ico' }]],
5+
themeConfig: {
6+
nav: [
7+
{
8+
text: 'Guide',
9+
link: '/guide/',
10+
},
11+
],
12+
sidebar: [
13+
{
14+
title: 'Guide',
15+
collapsable: false,
16+
children: [['/guide/', 'Quickstart']],
17+
},
18+
// ['/plugins/', 'Plugins'],
19+
],
20+
theme: '@vuepress/theme-default',
21+
lastUpdated: 'Last Updated', // string | boolean
22+
// Smooth Scrolling
23+
smoothScroll: true,
24+
// Assumes GitHub. Can also be a full GitLab url.
25+
repo: 'geospoc/v-mapbox-geocoder',
26+
// Optional options for generating "Edit this page" link
27+
// if your docs are in a different repo from your main project:
28+
docsRepo: 'geospoc/v-mapbox-geocoder',
29+
// if your docs are not at the root of the repo:
30+
docsDir: 'docs',
31+
// if your docs are in a specific branch (defaults to 'master'):
32+
docsBranch: 'master',
33+
// defaults to false, set to true to enable
34+
editLinks: true,
35+
// custom text for edit link. Defaults to "Edit this page"
36+
editLinkText: 'Help us improve this page!',
37+
},
38+
};

docs/.vuepress/public/favicon.ico

14.7 KB
Binary file not shown.

docs/.vuepress/public/logo.svg

Lines changed: 7 additions & 0 deletions
Loading

docs/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
home: true
3+
heroImage: /logo.svg
4+
actionText: Get Started →
5+
actionLink: /guide/
6+
features:
7+
- title: Declarative style
8+
details: You can use map elements like layers, markers, popups as Vue components and control them via synchronized props
9+
- title: Vuefied
10+
details: Map elements declared as components respect Vue lifecycle, emit map events like Vue events and can be used in OOP-style
11+
- title: Promisified async actions
12+
details: You can do async map operations and get results in Promise without messing with map events and figuring out what action cause it
13+
footer: MIT Licensed
14+
---
15+
16+
::: tip Dependencies
17+
[Vue.js 2.6+](https://github.com/vuejs/vue)
18+
[Mapbox GL JS 1.11+](https://github.com/mapbox/mapbox-gl-js)
19+
[map-promisified](https://github.com/soal/map-promisified)
20+
:::
21+

docs/guide/README.md

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Quickstart
2+
3+
## Installation
4+
5+
You can install `@geospoc/v-mapbox-geocoder` via GitHub package registry.
6+
Note that you need to install `@mapbox/mapbox-gl-geocoder` & `v-mapbox` aswell:
7+
8+
```bash
9+
npm login --registry=https://npm.pkg.github.com --scope=@geospoc
10+
npm i @mapbox/mapbox-gl-geocoder v-mapbox @geospoc/v-mapbox-geocoder
11+
```
12+
13+
## Usage
14+
15+
Now you can add the geocoder control like other controls
16+
17+
```html
18+
<template>
19+
<MglMap
20+
:accessToken="accessToken"
21+
:mapStyle="mapStyle"
22+
>
23+
<MglGeocoderControl
24+
:accessToken="accessToken"
25+
:input.sync="defaultInput"
26+
:mapboxgl="mapbox"
27+
container="geocoder_container_id"
28+
position="top-left"
29+
@results="handleSearch"
30+
/>
31+
</MglMap>
32+
</template>
33+
34+
<script>
35+
import mapboxgl from 'mapbox-gl';
36+
import { MglMap } from 'v-mapbox';
37+
import MglGeocoderControl from '@geospoc/v-mapbox-geocoder';
38+
// you can also import this in your main.js or nuxt.config.js
39+
// or even main/global (s)css file
40+
import '@mapbox/mapbox-gl-geocoder/dist/mapbox-gl-geocoder.css'
41+
42+
export default {
43+
name: 'App',
44+
components: {
45+
MglMap,
46+
MglGeocoderControl
47+
},
48+
data() {
49+
return {
50+
accessToken: 'YOUR_ACCESS_TOKEN',
51+
mapStyle: 'YOUR_MAP_STYLE',
52+
defaultInput: 'Bodhgaya',
53+
mapbox: mapboxgl,
54+
}
55+
},
56+
methods: {
57+
handleSearch(event) {
58+
console.log(event)
59+
}
60+
},
61+
};
62+
</script>
63+
```
64+
65+
## Props
66+
67+
_The props that you send to the `<MglGeocoderControl />` component_
68+
69+
### Available properties
70+
- `accessToken` **[String][57]** Required.
71+
- `origin` **[String][57]** Use to set a custom API origin. (optional, default `https://api.mapbox.com`)
72+
- `mapboxgl` **[Object][56]?** A [mapbox-gl][58] instance to use when creating [Markers][59]. Required if `marker` is `true`.
73+
- `zoom` **[Number][60]** On geocoded result what zoom level should the map animate to when a `bbox` isn't found in the response. If a `bbox` is found the map will fit to the `bbox`. (optional, default `16`)
74+
- `flyTo` **([Boolean][61] \| [Object][56])** If `false`, animating the map to a selected result is disabled. If `true`, animating the map will use the default animation parameters. If an object, it will be passed as `options` to the map [`flyTo`][62] or [`fitBounds`][63] method providing control over the animation of the transition. (optional, default `true`)
75+
- `placeholder` **[String][57]** Override the default placeholder attribute value. (optional, default `Search`)
76+
- `proximity` **[Object][56]?** a proximity argument: this is
77+
a geographical point given as an object with `latitude` and `longitude`
78+
properties. Search results closer to this point will be given
79+
higher priority.
80+
- `trackProximity` **[Boolean][61]** If `true`, the geocoder proximity will automatically update based on the map view. (optional, default `true`)
81+
- `collapsed` **[Boolean][61]** If `true`, the geocoder control will collapse until hovered or in focus. (optional, default `false`)
82+
- `clearAndBlurOnEsc` **[Boolean][61]** If `true`, the geocoder control will clear it's contents and blur when user presses the escape key. (optional, default `false`)
83+
- `clearOnBlur` **[Boolean][61]** If `true`, the geocoder control will clear its value when the input blurs. (optional, default `false`)
84+
- `bbox` **[Array][64]?** a bounding box argument: this is
85+
a bounding box given as an array in the format `[minX, minY, maxX, maxY]`.
86+
Search results will be limited to the bounding box.
87+
- `countries` **[String][57]?** a comma separated list of country codes to
88+
limit results to specified country or countries.
89+
- `types` **[String][57]?** a comma seperated list of types that filter
90+
results to match those specified. See [https://docs.mapbox.com/api/search/#data-types][65]
91+
for available types.
92+
If reverseGeocode is enabled, you should specify one type. If you configure more than one type, the first type will be used.
93+
- `minLength` **[Number][60]** Minimum number of characters to enter before results are shown. (optional, default `2`)
94+
- `limit` **[Number][60]** Maximum number of results to show. (optional, default `5`)
95+
- `language` **[String][57]?** Specify the language to use for response text and query result weighting. Options are IETF language tags comprised of a mandatory ISO 639-1 language code and optionally one or more IETF subtags for country or script. More than one value can also be specified, separated by commas. Defaults to the browser's language settings.
96+
- `filter` **[Function][66]?** A function which accepts a Feature in the [Carmen GeoJSON][67] format to filter out results from the Geocoding API response before they are included in the suggestions list. Return `true` to keep the item, `false` otherwise.
97+
- `localGeocoder` **[Function][66]?** A function accepting the query string which performs local geocoding to supplement results from the Mapbox Geocoding API. Expected to return an Array of GeoJSON Features in the [Carmen GeoJSON][67] format.
98+
- `reverseMode` **(distance | score)** Set the factors that are used to sort nearby results. (optional, default `distance`)
99+
- `reverseGeocode` **[boolean][61]** If `true`, enable reverse geocoding mode. In reverse geocoding, search input is expected to be coordinates in the form `lat, lon`, with suggestions being the reverse geocodes. (optional, default `false`)
100+
- `enableEventLogging` **[Boolean][61]** Allow Mapbox to collect anonymous usage statistics from the plugin. (optional, default `true`)
101+
- `marker` **([Boolean][61] \| [Object][56])** If `true`, a [Marker][59] will be added to the map at the location of the user-selected result using a default set of Marker options. If the value is an object, the marker will be constructed using these options. If `false`, no marker will be added to the map. Requires that `mapboxgl` also be set. (optional, default `true`)
102+
- `render` **[Function][66]?** A function that specifies how the results should be rendered in the dropdown menu. This function should accepts a single [Carmen GeoJSON][67] object as input and return a string. Any HTML in the returned string will be rendered.
103+
- `getItemValue` **[Function][66]?** A function that specifies how the selected result should be rendered in the search bar. This function should accept a single [Carmen GeoJSON][67] object as input and return a string. HTML tags in the output string will not be rendered. Defaults to `(item) => item.place_name`.
104+
- `mode` **[String][57]** A string specifying the geocoding [endpoint][68] to query. Options are `mapbox.places` and `mapbox.places-permanent`. The `mapbox.places-permanent` mode requires an enterprise license for permanent geocodes. (optional, default `mapbox.places`)
105+
- `localGeocoderOnly` **[Boolean][61]** If `true`, indicates that the `localGeocoder` results should be the only ones returned to the user. If `false`, indicates that the `localGeocoder` results should be combined with those from the Mapbox API with the `localGeocoder` results ranked higher. (optional, default `false`)
106+
107+
108+
[56]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
109+
110+
[57]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
111+
112+
[58]: https://github.com/mapbox/mapbox-gl-js
113+
114+
[59]: https://docs.mapbox.com/mapbox-gl-js/api/#marker
115+
116+
[60]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
117+
118+
[61]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
119+
120+
[62]: https://docs.mapbox.com/mapbox-gl-js/api/#map#flyto
121+
122+
[63]: https://docs.mapbox.com/mapbox-gl-js/api/#map#fitbounds
123+
124+
[64]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
125+
126+
[65]: https://docs.mapbox.com/api/search/#data-types
127+
128+
[66]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function
129+
130+
[67]: https://github.com/mapbox/carmen/blob/master/carmen-geojson.md
131+
132+
[68]: https://docs.mapbox.com/api/search/#endpoints

0 commit comments

Comments
 (0)