Skip to content

Commit

Permalink
Cherry pick 2.3.0 release branch changes into main (#10724)
Browse files Browse the repository at this point in the history
* Implement dual ESM + CJS compatibility in style-spec (#10718)

* Implement dual ESM + CJS compatibility in style-spec

* Try to catch additional references to non-cjs files

* Remove accidentally-committed files

* Revert main entry point

* Revert module field as well

* Update sources and markers while fog transitioning (#10691)

* Update sources while fog transitioning

* Apply fix to markers

* Remove unnecessary comment

* Include dist/package.json in npm published files (#10668)

* Disable fog tile culling with low horizon-blend (#10679)

* Cherry-pick changelogs
  • Loading branch information
rreusser authored Jun 1, 2021
1 parent 572bf33 commit 79f594f
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/dist/style-spec
*.es.js
*.js.map
*.cjs.map
node_modules
package-lock.json
*.sublime-*
Expand All @@ -21,7 +22,7 @@ test/integration/**/test-results.xml
test/integration/dist/**/*.js
test/integration/dist/**/*.json
.eslintcache
src/style-spec/dist/index.js
src/style-spec/dist/index.cjs
_batfish_site
_batfish_tmp
_site
Expand Down
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
## 2.3.0

### ✨ Features and improvements
* Add configurable fog as a root style specification ([#10564](https://github.com/mapbox/mapbox-gl-js/pull/10564))
* Add support for data-driven expressions in `line-dasharray` and `line-cap` properties. ([#10591](https://github.com/mapbox/mapbox-gl-js/pull/10591))
* Add support for data-driven `text-line-height` ([#10612](https://github.com/mapbox/mapbox-gl-js/pull/10612))
* Add client-side elevation querying with `map.queryTerrainElevation(lngLat)` when terrain is active ([#10602](https://github.com/mapbox/mapbox-gl-js/pull/10602))
* Reduce GPU memory footprint when terrain is active by sharing a single depth stencil renderbuffer for all draping ([#10611](https://github.com/mapbox/mapbox-gl-js/pull/10611))
* Optimize tile cover by preventing unnecessary tile loads when terrain is active ([#10467](https://github.com/mapbox/mapbox-gl-js/pull/10467))
* Batch render DOM elements to avoid reflow ([#10530](https://github.com/mapbox/mapbox-gl-js/pull/10530), [#10567](https://github.com/mapbox/mapbox-gl-js/pull/10567)) (h/t [zarov](https://github.com/zarov))

### 🐞 Bug fixes
* Fix style property transitions not invalidating the terrain render cache ([#10485](https://github.com/mapbox/mapbox-gl-js/pull/10485))
* Fix raster tile expiry data not being retained. ([#10494](https://github.com/mapbox/mapbox-gl-js/pull/10494)) (h/t [andycalder](https://github.com/andycalder))
* Fix undefined type error when removing `line-gradient` paint property ([#10557](https://github.com/mapbox/mapbox-gl-js/pull/10557))
* Fix unclustered points in a clustered GeoJSON source incorrectly snapping to a grid at high zoom levels. ([#10523](https://github.com/mapbox/mapbox-gl-js/pull/10523))
* Fix `map.loadImage` followed with a delay by `map.addImage` failing in Safari and Firefox. ([#10524](https://github.com/mapbox/mapbox-gl-js/pull/10524))
* Allow conditional display of formatted images in text ([#10553](https://github.com/mapbox/mapbox-gl-js/pull/10553))
* Fix fill-extrusion elevation underflow below sea level ([#10570](https://github.com/mapbox/mapbox-gl-js/pull/10570))
* Fix dashed lines with square line caps. ([#9561](https://github.com/mapbox/mapbox-gl-js/pull/9561))
* Fix markers sometimes throwing an error after being removed from a 3D map. ([#10478](https://github.com/mapbox/mapbox-gl-js/pull/10478)) (h/t [andycalder](https://github.com/andycalder))
* Set `type=button` on attribution button to prevent accidental form submit when map is nested in `<form>` ([#10531](https://github.com/mapbox/mapbox-gl-js/pull/10531))
* Fix nine documentation typos ([#10546](https://github.com/mapbox/mapbox-gl-js/pull/10546), [#10548](https://github.com/mapbox/mapbox-gl-js/pull/10548) [#10551](https://github.com/mapbox/mapbox-gl-js/pull/10551) [#10646](https://github.com/mapbox/mapbox-gl-js/pull/10646)) (h/t [coliff](https://github.com/coliff))

## 2.2.0

### Features and improvements
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
"build/",
"dist/mapbox-gl*",
"dist/style-spec/",
"dist/package.json",
"flow-typed/*.js",
"src/",
".flowconfig",
Expand Down
2 changes: 1 addition & 1 deletion src/render/painter.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class Painter {

_updateFog(style: Style) {
const fog = style.fog;
if (!fog || (fog && fog.getOpacity(this.transform.pitch) !== 1.0)) {
if (!fog || fog.getOpacity(this.transform.pitch) < 1 || fog.properties.get('horizon-blend') < 0.03) {
this.transform.fogCullDistSq = null;
return;
}
Expand Down
8 changes: 8 additions & 0 deletions src/style-spec/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 13.20.0

### ✨ Features and improvements

* Add configurable fog as a root style specification ([#10564](https://github.com/mapbox/mapbox-gl-js/pull/10564))
* Add support for data-driven expressions in `line-dasharray` and `line-cap` properties. ([#10591](https://github.com/mapbox/mapbox-gl-js/pull/10591))
* Add support for data-driven `text-line-height` ([#10612](https://github.com/mapbox/mapbox-gl-js/pull/10612))

## 13.19.0

### ✨ Features and improvements
Expand Down
13 changes: 11 additions & 2 deletions src/style-spec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,23 @@
"mapbox-gl-js"
],
"license": "ISC",
"main": "./dist/index.js",
"main": "./dist/index.cjs",
"module": "./dist/index.es.js",
"type": "module",
"exports": {
".": {
"require": "./dist/index.cjs",
"import": "./dist/index.es.js"
},
"./": {
"import": "./"
}
},
"scripts": {
"copy-flow-typed": "cp -R ../../flow-typed .",
"build": "../../node_modules/.bin/rollup -c && ../../node_modules/.bin/rollup -c --environment esm",
"prepublishOnly": "git clean -fdx && yarn copy-flow-typed && yarn build",
"postpublish": "rm -r flow-typed dist/index.js"
"postpublish": "rm -r flow-typed dist/index.cjs"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion src/style-spec/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const config = [{
input: `${__dirname}/style-spec.js`,
output: {
name: 'mapboxGlStyleSpecification',
file: `${__dirname}/dist/${esm ? 'index.es.js' : 'index.js'}`,
file: `${__dirname}/dist/${esm ? 'index.es.js' : 'index.cjs'}`,
format: esm ? 'esm' : 'umd',
sourcemap: true
},
Expand Down
7 changes: 7 additions & 0 deletions src/ui/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -2685,6 +2685,13 @@ class Map extends Camera {
this.style.update(parameters);
}

const fogIsTransitioning = this.style && this.style.fog && this.style.fog.hasTransition();

if (fogIsTransitioning) {
this.style._markersNeedUpdate = true;
this._sourcesDirty = true;
}

// If we are in _render for any reason other than an in-progress paint
// transition, update source caches to check for and load any tiles we
// need for the current transform
Expand Down
2 changes: 1 addition & 1 deletion test/build/style-spec.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test('@mapbox/mapbox-gl-style-spec npm package', (t) => {
});

t.test('exports components directly, not behind `default` - https://github.com/mapbox/mapbox-gl-js/issues/6601', (t) => {
const spec = require('../../dist/style-spec/index.js');
const spec = require('../../dist/style-spec/index.cjs');
t.ok(spec.validate);
t.notOk(spec.default && spec.default.validate);
t.end();
Expand Down

0 comments on commit 79f594f

Please sign in to comment.