-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
102 changed files
with
12,820 additions
and
8,757 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @mapbox/gl-js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: / | ||
open-pull-requests-limit: 999 | ||
schedule: | ||
interval: weekly | ||
|
||
- package-ecosystem: github-actions | ||
open-pull-requests-limit: 999 | ||
directory: / | ||
schedule: | ||
interval: weekly |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Auto-merge patch dependency updates | ||
on: pull_request | ||
|
||
permissions: write-all | ||
|
||
jobs: | ||
dependabot: | ||
runs-on: ubuntu-latest | ||
if: github.actor == 'dependabot[bot]' | ||
steps: | ||
- name: Dependabot metadata | ||
id: metadata | ||
uses: dependabot/[email protected] | ||
with: | ||
github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
- name: Approve Dependabot PRs | ||
if: steps.metadata.outputs.update-type == 'version-update:semver-patch' | ||
run: gh pr review --approve "$PR_URL" | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
- name: Enable auto-merge for Dependabot PRs | ||
if: steps.metadata.outputs.update-type == 'version-update:semver-patch' | ||
run: gh pr merge --auto --squash "$PR_URL" | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: test | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.x | ||
cache: 'npm' | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.npm | ||
node_modules | ||
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-npm- | ||
- run: npm ci | ||
- run: npm test |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,44 @@ | ||
## Changelog | ||
# Changelog | ||
|
||
# 1.2.2 | ||
## 1.4.3 | ||
|
||
* Fix for layer not found error in `featuresAt` function by @caldwellc in https://github.com/mapbox/mapbox-gl-draw/pull/1194 | ||
* Trigger `featureChanged` on feature props change by @wyozi in https://github.com/mapbox/mapbox-gl-draw/pull/1196 | ||
* Remove `preventDefault()` on `touchstart` and `touchmove` events by @Archetylator in https://github.com/mapbox/mapbox-gl-draw/pull/1195 | ||
|
||
## 1.4.2 | ||
|
||
* Fix key event handler checks for `mapboxgl-canvas` by @neodescis in https://github.com/mapbox/mapbox-gl-draw/pull/1165 | ||
* Fix draw updates not firing consistently by @gynekolog in https://github.com/mapbox/mapbox-gl-draw/pull/1160 | ||
* Fix boxZoom restoring after removal by @kibala145 in https://github.com/mapbox/mapbox-gl-draw/pull/1017 | ||
|
||
## 1.4.1 | ||
|
||
* Revert use of passive event listeners instead of `preventDefault` in https://github.com/mapbox/mapbox-gl-draw/pull/1158 | ||
|
||
## 1.4.0 | ||
|
||
* Reduce NPM package size and big dependency and dev environment cleanup by @mourner in https://github.com/mapbox/mapbox-gl-draw/pull/1119 https://github.com/mapbox/mapbox-gl-draw/pull/1053 | ||
* Add Bezier Curve mode by @Jeff-Numix in https://github.com/mapbox/mapbox-gl-draw/pull/1068 | ||
* Update control buttons styles by @chriswhong in https://github.com/mapbox/mapbox-gl-draw/pull/1125 | ||
* Use passive event listeners instead of `preventDefault` by @danielsippel in https://github.com/mapbox/mapbox-gl-draw/pull/1146 | ||
* Adding sorting rank value for MultiLineString by @zhangchn in https://github.com/mapbox/mapbox-gl-draw/pull/1142 | ||
* Expose constants and lib APIs to make it easier to write custom draw modes by @thaddmt in https://github.com/mapbox/mapbox-gl-draw/pull/1100 | ||
|
||
## 1.3.0 | ||
|
||
- ⚠️ Removed GeoJSON validation in `draw.add` — responsibility for valid input is now on the user. #1052 | ||
- Fixed NPM security warnings about dependencies. #1052 | ||
- Fixed midpoint calculation when terrain is enabled. #1039 | ||
- Reduced the size of the plugin's CSS code from 33KB to 5KB. #1038 (h/t @johanrd) | ||
- Fixed `simple_select` mode handling on touch devices. #1008 (h/t @corinv) | ||
|
||
## 1.2.2 | ||
|
||
### Bug Fixes: | ||
- Fix midpoint calculation when using mapbox-gl-draw with 3d terrain | ||
|
||
# 1.2.1 | ||
## 1.2.1 | ||
|
||
### Bug Fixes: | ||
- Upgrade `peerDependencies` to allow `[email protected]+` to be used with gl-draw. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
# @mapbox/mapbox-gl-draw | ||
|
||
[![Build Status](https://travis-ci.org/mapbox/mapbox-gl-draw.svg?branch=main)](https://travis-ci.org/mapbox/mapbox-gl-draw) | ||
![Build Status](https://github.com/mapbox/mapbox-gl-draw/actions/workflows/main.yml/badge.svg) | ||
|
||
Adds support for drawing and editing features on [mapbox-gl.js](https://www.mapbox.com/mapbox-gl-js/) maps. [See a live example here](https://www.mapbox.com/mapbox-gl-js/example/mapbox-gl-draw/) | ||
|
||
**Requires [mapbox-gl-js](https://github.com/mapbox/mapbox-gl-js).** | ||
|
||
**If you are developing with `mapbox-gl-draw`, see [API.md](https://github.com/mapbox/mapbox-gl-draw/blob/main/docs/API.md) for documentation.** | ||
|
||
### Installing | ||
|
||
``` | ||
|
@@ -28,7 +30,7 @@ import MapboxDraw from "@mapbox/mapbox-gl-draw"; | |
**When using a CDN** | ||
|
||
```html | ||
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-draw/v1.3.0/mapbox-gl-draw.js'></script> | ||
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-draw/v1.4.3/mapbox-gl-draw.js'></script> | ||
``` | ||
|
||
#### CSS | ||
|
@@ -40,7 +42,7 @@ import '@mapbox/mapbox-gl-draw/dist/mapbox-gl-draw.css' | |
|
||
**When using CDN** | ||
```html | ||
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-draw/v1.3.0/mapbox-gl-draw.css' type='text/css' /> | ||
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-draw/v1.4.3/mapbox-gl-draw.css' type='text/css' /> | ||
``` | ||
|
||
### Typescript | ||
|
@@ -58,7 +60,7 @@ mapboxgl.accessToken = 'YOUR_ACCESS_TOKEN'; | |
var map = new mapboxgl.Map({ | ||
container: 'map', | ||
style: 'mapbox://styles/mapbox/streets-v11', | ||
style: 'mapbox://styles/mapbox/streets-v12', | ||
center: [40, -74.50], | ||
zoom: 9 | ||
}); | ||
|
@@ -92,8 +94,8 @@ Install dependencies, build the source files and crank up a server via: | |
|
||
``` | ||
git clone [email protected]:mapbox/mapbox-gl-draw.git | ||
yarn install | ||
yarn start & open "http://localhost:9967/debug/?access_token=<token>" | ||
npm ci | ||
npm start & open "http://localhost:9967/debug/?access_token=<token>" | ||
``` | ||
|
||
### Testing | ||
|
@@ -118,8 +120,8 @@ To CDN: | |
``` | ||
# make sure you are authenticated for AWS | ||
git checkout v{x.y.z} | ||
yarn install | ||
yarn run prepublish | ||
npm ci | ||
npm run prepublish | ||
aws s3 cp --recursive --acl public-read dist s3://mapbox-gl-js/plugins/mapbox-gl-draw/v{x.y.z} | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
/* eslint-disable */ | ||
'use strict'; | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import {fileURLToPath} from 'url'; | ||
|
||
const __dirname = fileURLToPath(new URL('.', import.meta.url)); | ||
|
||
const script = fs.readFileSync(path.join(__dirname, '../debug/access_token.js'), 'utf-8') | ||
.replace('process.env.MapboxAccessToken', | ||
JSON.stringify(process.env.MapboxAccessToken)) | ||
.replace('process.env.MAPBOX_ACCESS_TOKEN', | ||
JSON.stringify(process.env.MAPBOX_ACCESS_TOKEN)); | ||
.replace('process.env.MapboxAccessToken', | ||
JSON.stringify(process.env.MapboxAccessToken)) | ||
.replace('process.env.MAPBOX_ACCESS_TOKEN', | ||
JSON.stringify(process.env.MAPBOX_ACCESS_TOKEN)); | ||
|
||
fs.writeFileSync(path.join(__dirname, '../debug/access_token_generated.js'), script); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,10 @@ | ||
'use strict'; | ||
export function getAccessToken() { | ||
const accessToken = | ||
process.env.MapboxAccessToken || | ||
process.env.MAPBOX_ACCESS_TOKEN || | ||
(new URLSearchParams(location.search).get('access_token')) || | ||
localStorage.getItem('accessToken'); | ||
|
||
mapboxgl.accessToken = getAccessToken(); | ||
|
||
function getAccessToken() { | ||
var accessToken = ( | ||
process.env.MapboxAccessToken || | ||
process.env.MAPBOX_ACCESS_TOKEN || | ||
getURLParameter('access_token') || | ||
localStorage.getItem('accessToken') | ||
); | ||
localStorage.setItem('accessToken', accessToken); | ||
return accessToken; | ||
} | ||
|
||
function getURLParameter(name) { | ||
var regexp = new RegExp('[?&]' + name + '=([^&#]*)', 'i'); | ||
var output = regexp.exec(window.location.href); | ||
return output && output[1]; | ||
localStorage.setItem('accessToken', accessToken); | ||
return accessToken; | ||
} |
Oops, something went wrong.