From 5433a4193ba817dfa8da8313f980e7d9780f6331 Mon Sep 17 00:00:00 2001 From: orangemug Date: Wed, 22 Mar 2017 10:36:20 +0000 Subject: [PATCH 1/9] Move from mapbox-gl-style-spec -> mapbox-gl. --- package.json | 3 +-- src/components/App.jsx | 6 +++--- src/components/filter/FilterEditor.jsx | 2 +- src/components/layers/LayerIdBlock.jsx | 2 +- src/components/layers/LayerSourceBlock.jsx | 2 +- src/components/layers/LayerSourceLayerBlock.jsx | 2 +- src/components/layers/LayerTypeBlock.jsx | 2 +- src/components/layers/MaxZoomBlock.jsx | 2 +- src/components/layers/MinZoomBlock.jsx | 2 +- src/components/map/MapboxGlMap.jsx | 2 +- src/components/modals/ExportModal.jsx | 4 ++-- src/components/modals/SettingsModal.jsx | 2 +- src/components/modals/SourcesModal.jsx | 2 +- src/components/sources/SourceTypeEditor.jsx | 2 +- src/libs/diffmessage.js | 2 +- src/libs/filterops.js | 2 +- src/libs/layer.js | 2 +- src/libs/style.js | 4 ++-- webpack.production.config.js | 2 -- 19 files changed, 22 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 644250a..1a34ac9 100644 --- a/package.json +++ b/package.json @@ -30,9 +30,8 @@ "lodash.clonedeep": "^4.5.0", "lodash.isequal": "^4.4.0", "lodash.throttle": "^4.1.1", - "mapbox-gl": "^0.33.0", + "mapbox-gl": "^0.34.0", "mapbox-gl-inspect": "^1.2.2", - "mapbox-gl-style-spec": "^8.11.0", "mousetrap": "^1.6.0", "ol-mapbox-style": "1.0.1", "openlayers": "^3.19.1", diff --git a/src/components/App.jsx b/src/components/App.jsx index ba10485..cccd958 100644 --- a/src/components/App.jsx +++ b/src/components/App.jsx @@ -10,9 +10,9 @@ import AppLayout from './AppLayout' import MessagePanel from './MessagePanel' import { downloadGlyphsMetadata, downloadSpriteMetadata } from '../libs/metadata' -import GlSpec from 'mapbox-gl-style-spec/reference/latest.js' -import validateStyleMin from 'mapbox-gl-style-spec/lib/validate_style.min' -import formatStyle from 'mapbox-gl-style-spec/lib/format' +import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' +import validateStyleMin from 'mapbox-gl/src/style-spec/validate_style.min' +import formatStyle from 'mapbox-gl/src/style-spec/format' import style from '../libs/style.js' import { initialStyleUrl, loadStyleUrl } from '../libs/urlopen' import { undoMessages, redoMessages } from '../libs/diffmessage' diff --git a/src/components/filter/FilterEditor.jsx b/src/components/filter/FilterEditor.jsx index fcfe7d8..0c8dbac 100644 --- a/src/components/filter/FilterEditor.jsx +++ b/src/components/filter/FilterEditor.jsx @@ -1,7 +1,7 @@ import React from 'react' import { combiningFilterOps } from '../../libs/filterops.js' -import GlSpec from 'mapbox-gl-style-spec/reference/latest.js' +import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' import DocLabel from '../fields/DocLabel' import SelectInput from '../inputs/SelectInput' import SingleFilterEditor from './SingleFilterEditor' diff --git a/src/components/layers/LayerIdBlock.jsx b/src/components/layers/LayerIdBlock.jsx index 7cdc9d2..7404c0e 100644 --- a/src/components/layers/LayerIdBlock.jsx +++ b/src/components/layers/LayerIdBlock.jsx @@ -1,6 +1,6 @@ import React from 'react' -import GlSpec from 'mapbox-gl-style-spec/reference/latest.js' +import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' import InputBlock from '../inputs/InputBlock' import StringInput from '../inputs/StringInput' diff --git a/src/components/layers/LayerSourceBlock.jsx b/src/components/layers/LayerSourceBlock.jsx index ea60b8a..2b3400f 100644 --- a/src/components/layers/LayerSourceBlock.jsx +++ b/src/components/layers/LayerSourceBlock.jsx @@ -1,6 +1,6 @@ import React from 'react' -import GlSpec from 'mapbox-gl-style-spec/reference/latest.js' +import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' import InputBlock from '../inputs/InputBlock' import StringInput from '../inputs/StringInput' import SelectInput from '../inputs/SelectInput' diff --git a/src/components/layers/LayerSourceLayerBlock.jsx b/src/components/layers/LayerSourceLayerBlock.jsx index 01b05a9..f1b24ea 100644 --- a/src/components/layers/LayerSourceLayerBlock.jsx +++ b/src/components/layers/LayerSourceLayerBlock.jsx @@ -1,6 +1,6 @@ import React from 'react' -import GlSpec from 'mapbox-gl-style-spec/reference/latest.js' +import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' import InputBlock from '../inputs/InputBlock' import StringInput from '../inputs/StringInput' import SelectInput from '../inputs/SelectInput' diff --git a/src/components/layers/LayerTypeBlock.jsx b/src/components/layers/LayerTypeBlock.jsx index 8286900..5817689 100644 --- a/src/components/layers/LayerTypeBlock.jsx +++ b/src/components/layers/LayerTypeBlock.jsx @@ -1,6 +1,6 @@ import React from 'react' -import GlSpec from 'mapbox-gl-style-spec/reference/latest.js' +import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' import InputBlock from '../inputs/InputBlock' import SelectInput from '../inputs/SelectInput' diff --git a/src/components/layers/MaxZoomBlock.jsx b/src/components/layers/MaxZoomBlock.jsx index ecf2646..16ebb9f 100644 --- a/src/components/layers/MaxZoomBlock.jsx +++ b/src/components/layers/MaxZoomBlock.jsx @@ -1,6 +1,6 @@ import React from 'react' -import GlSpec from 'mapbox-gl-style-spec/reference/latest.js' +import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' import InputBlock from '../inputs/InputBlock' import NumberInput from '../inputs/NumberInput' diff --git a/src/components/layers/MinZoomBlock.jsx b/src/components/layers/MinZoomBlock.jsx index 9585d67..aa2323c 100644 --- a/src/components/layers/MinZoomBlock.jsx +++ b/src/components/layers/MinZoomBlock.jsx @@ -1,6 +1,6 @@ import React from 'react' -import GlSpec from 'mapbox-gl-style-spec/reference/latest.js' +import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' import InputBlock from '../inputs/InputBlock' import NumberInput from '../inputs/NumberInput' diff --git a/src/components/map/MapboxGlMap.jsx b/src/components/map/MapboxGlMap.jsx index 729585e..2cdb6d0 100644 --- a/src/components/map/MapboxGlMap.jsx +++ b/src/components/map/MapboxGlMap.jsx @@ -4,7 +4,7 @@ import MapboxGl from 'mapbox-gl/dist/mapbox-gl.js' import MapboxInspect from 'mapbox-gl-inspect' import FeatureLayerPopup from './FeatureLayerPopup' import FeaturePropertyPopup from './FeaturePropertyPopup' -import validateColor from 'mapbox-gl-style-spec/lib/validate/validate_color' +import validateColor from 'mapbox-gl/src/style-spec/validate/validate_color' import style from '../../libs/style.js' import tokens from '../../config/tokens.json' import colors from 'mapbox-gl-inspect/lib/colors' diff --git a/src/components/modals/ExportModal.jsx b/src/components/modals/ExportModal.jsx index 0a06571..4a33023 100644 --- a/src/components/modals/ExportModal.jsx +++ b/src/components/modals/ExportModal.jsx @@ -1,7 +1,7 @@ import React from 'react' import { saveAs } from 'file-saver' -import GlSpec from 'mapbox-gl-style-spec/reference/latest.js' +import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' import InputBlock from '../inputs/InputBlock' import StringInput from '../inputs/StringInput' import SelectInput from '../inputs/SelectInput' @@ -10,7 +10,7 @@ import Button from '../Button' import Modal from './Modal' import MdFileDownload from 'react-icons/lib/md/file-download' import style from '../../libs/style.js' -import formatStyle from 'mapbox-gl-style-spec/lib/format' +import formatStyle from 'mapbox-gl/src/style-spec/format' import GitHub from 'github-api' diff --git a/src/components/modals/SettingsModal.jsx b/src/components/modals/SettingsModal.jsx index 66967c2..f3de03b 100644 --- a/src/components/modals/SettingsModal.jsx +++ b/src/components/modals/SettingsModal.jsx @@ -1,6 +1,6 @@ import React from 'react' -import GlSpec from 'mapbox-gl-style-spec/reference/latest.js' +import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' import InputBlock from '../inputs/InputBlock' import StringInput from '../inputs/StringInput' import SelectInput from '../inputs/SelectInput' diff --git a/src/components/modals/SourcesModal.jsx b/src/components/modals/SourcesModal.jsx index ba4d841..0e5058a 100644 --- a/src/components/modals/SourcesModal.jsx +++ b/src/components/modals/SourcesModal.jsx @@ -1,5 +1,5 @@ import React from 'react' -import GlSpec from 'mapbox-gl-style-spec/reference/latest.js' +import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' import Modal from './Modal' import Button from '../Button' import InputBlock from '../inputs/InputBlock' diff --git a/src/components/sources/SourceTypeEditor.jsx b/src/components/sources/SourceTypeEditor.jsx index 344e882..fc37e3e 100644 --- a/src/components/sources/SourceTypeEditor.jsx +++ b/src/components/sources/SourceTypeEditor.jsx @@ -1,5 +1,5 @@ import React from 'react' -import GlSpec from 'mapbox-gl-style-spec/reference/latest.js' +import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' import InputBlock from '../inputs/InputBlock' import StringInput from '../inputs/StringInput' import NumberInput from '../inputs/NumberInput' diff --git a/src/libs/diffmessage.js b/src/libs/diffmessage.js index 502c59e..80b2688 100644 --- a/src/libs/diffmessage.js +++ b/src/libs/diffmessage.js @@ -1,4 +1,4 @@ -import diffStyles from 'mapbox-gl-style-spec/lib/diff' +import diffStyles from 'mapbox-gl/src/style-spec/diff' export function diffMessages(beforeStyle, afterStyle) { const changes = diffStyles(beforeStyle, afterStyle) diff --git a/src/libs/filterops.js b/src/libs/filterops.js index 65984fd..da77be8 100644 --- a/src/libs/filterops.js +++ b/src/libs/filterops.js @@ -1,4 +1,4 @@ -import GlSpec from 'mapbox-gl-style-spec/reference/latest.js' +import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' export const combiningFilterOps = ['all', 'any', 'none'] export const setFilterOps = ['in', '!in'] export const otherFilterOps = Object diff --git a/src/libs/layer.js b/src/libs/layer.js index f018c46..f6418c5 100644 --- a/src/libs/layer.js +++ b/src/libs/layer.js @@ -1,4 +1,4 @@ -import GlSpec from 'mapbox-gl-style-spec/reference/latest.js' +import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' export function changeType(layer, newType) { const changedPaintProps = { ...layer.paint } diff --git a/src/libs/style.js b/src/libs/style.js index 3f012d2..0fd0c1f 100644 --- a/src/libs/style.js +++ b/src/libs/style.js @@ -1,6 +1,6 @@ import React from 'react'; -import spec from 'mapbox-gl-style-spec/reference/latest.min.js' -import derefLayers from 'mapbox-gl-style-spec/lib/deref' +import spec from 'mapbox-gl/src/style-spec/reference/latest' +import derefLayers from 'mapbox-gl/src/style-spec/deref' import tokens from '../config/tokens.json' // Empty style is always used if no style could be restored or fetched diff --git a/webpack.production.config.js b/webpack.production.config.js index 185fb9a..0ad9410 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -12,8 +12,6 @@ module.exports = { vendor: [ 'file-saver', 'mapbox-gl/dist/mapbox-gl.js', - //TODO: Build failure because cannot resolve migrations file - //"mapbox-gl-style-spec", "lodash.clonedeep", "lodash.throttle", 'color', From a76ce64e1d2463041a7bbcd620d417bf389baa21 Mon Sep 17 00:00:00 2001 From: orangemug Date: Wed, 22 Mar 2017 10:54:11 +0000 Subject: [PATCH 2/9] Temp updated to fix peer dependency issue --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1a34ac9..b7570f6 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "lodash.isequal": "^4.4.0", "lodash.throttle": "^4.1.1", "mapbox-gl": "^0.34.0", - "mapbox-gl-inspect": "^1.2.2", + "mapbox-gl-inspect": "orangemug/mapbox-gl-inspect#fix/update-peer-dep", "mousetrap": "^1.6.0", "ol-mapbox-style": "1.0.1", "openlayers": "^3.19.1", From a112c29c21687fffb9f9eaca53f9a074ad077d49 Mon Sep 17 00:00:00 2001 From: orangemug Date: Tue, 4 Apr 2017 08:55:45 +0100 Subject: [PATCH 3/9] Moved mapbox-gl-inspect to point at lukasmartinelli/mapbox-gl-inspect repo. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b7570f6..6137fd6 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "lodash.isequal": "^4.4.0", "lodash.throttle": "^4.1.1", "mapbox-gl": "^0.34.0", - "mapbox-gl-inspect": "orangemug/mapbox-gl-inspect#fix/update-peer-dep", + "mapbox-gl-inspect": "lukasmartinelli/mapbox-gl-inspect#7108dab80f", "mousetrap": "^1.6.0", "ol-mapbox-style": "1.0.1", "openlayers": "^3.19.1", From 1e429550c676f8c1abd6fbe936c3812355f25289 Mon Sep 17 00:00:00 2001 From: orangemug Date: Tue, 4 Apr 2017 19:18:41 +0100 Subject: [PATCH 4/9] Moved to mapbox-gl-inspect^1.2.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6137fd6..2380ebb 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "lodash.isequal": "^4.4.0", "lodash.throttle": "^4.1.1", "mapbox-gl": "^0.34.0", - "mapbox-gl-inspect": "lukasmartinelli/mapbox-gl-inspect#7108dab80f", + "mapbox-gl-inspect": "^1.2.3", "mousetrap": "^1.6.0", "ol-mapbox-style": "1.0.1", "openlayers": "^3.19.1", From c3174a0c725ac7ddcc1e9b611a5e0b4a3ffb2091 Mon Sep 17 00:00:00 2001 From: orangemug Date: Mon, 10 Apr 2017 13:29:57 +0100 Subject: [PATCH 5/9] Moved to using @mapbox/mapbox-gl-style-spec --- config/webpack.loaders.js | 2 +- package.json | 3 ++- src/components/App.jsx | 8 +++----- src/components/filter/FilterEditor.jsx | 4 ++-- src/components/layers/LayerIdBlock.jsx | 4 ++-- src/components/layers/LayerSourceBlock.jsx | 4 ++-- src/components/layers/LayerSourceLayerBlock.jsx | 4 ++-- src/components/layers/LayerTypeBlock.jsx | 4 ++-- src/components/layers/MaxZoomBlock.jsx | 10 +++++----- src/components/layers/MinZoomBlock.jsx | 10 +++++----- src/components/map/MapboxGlMap.jsx | 3 +-- src/components/modals/ExportModal.jsx | 9 ++++----- src/components/modals/SettingsModal.jsx | 8 ++++---- src/components/modals/SourcesModal.jsx | 4 ++-- src/components/sources/SourceTypeEditor.jsx | 12 ++++++------ src/libs/diffmessage.js | 4 ++-- src/libs/filterops.js | 4 ++-- src/libs/layer.js | 6 +++--- src/libs/style.js | 5 ++--- 19 files changed, 52 insertions(+), 56 deletions(-) diff --git a/config/webpack.loaders.js b/config/webpack.loaders.js index 438c3b8..7d9e528 100644 --- a/config/webpack.loaders.js +++ b/config/webpack.loaders.js @@ -6,7 +6,7 @@ module.exports = [ }, { test: /\.jsx?$/, - exclude: /(node_modules|bower_components|public)/, + exclude: /(.*node_modules(?!\/@mapbox\/mapbox-gl-style-spec)|bower_components|public)/, loader: 'babel', query: { presets: ['es2015', 'react'], diff --git a/package.json b/package.json index 5ddc740..b2dd2dc 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "license": "MIT", "homepage": "https://github.com/maputnik/editor#readme", "dependencies": { + "@mapbox/mapbox-gl-style-spec": "^8.11.0", "classnames": "^2.2.5", "codemirror": "^5.18.2", "color": "^1.0.3", @@ -30,7 +31,7 @@ "lodash.clonedeep": "^4.5.0", "lodash.isequal": "^4.4.0", "lodash.throttle": "^4.1.1", - "mapbox-gl": "^0.34.0", + "mapbox-gl": "^0.35.0", "mapbox-gl-inspect": "^1.2.3", "mousetrap": "^1.6.0", "ol-mapbox-style": "1.0.1", diff --git a/src/components/App.jsx b/src/components/App.jsx index cccd958..4f0f68c 100644 --- a/src/components/App.jsx +++ b/src/components/App.jsx @@ -10,9 +10,7 @@ import AppLayout from './AppLayout' import MessagePanel from './MessagePanel' import { downloadGlyphsMetadata, downloadSpriteMetadata } from '../libs/metadata' -import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' -import validateStyleMin from 'mapbox-gl/src/style-spec/validate_style.min' -import formatStyle from 'mapbox-gl/src/style-spec/format' +import styleSpec from '@mapbox/mapbox-gl-style-spec' import style from '../libs/style.js' import { initialStyleUrl, loadStyleUrl } from '../libs/urlopen' import { undoMessages, redoMessages } from '../libs/diffmessage' @@ -65,7 +63,7 @@ export default class App extends React.Component { sources: {}, vectorLayers: {}, inspectModeEnabled: false, - spec: GlSpec, + spec: styleSpec.latest, } this.layerWatcher = new LayerWatcher({ @@ -115,7 +113,7 @@ export default class App extends React.Component { this.updateIcons(newStyle.sprite) } - const errors = validateStyleMin(newStyle, GlSpec) + const errors = styleSpec.validate(newStyle, styleSpec.latest) if(errors.length === 0) { this.revisionStore.addRevision(newStyle) if(save) this.saveStyle(newStyle) diff --git a/src/components/filter/FilterEditor.jsx b/src/components/filter/FilterEditor.jsx index 0c8dbac..8641548 100644 --- a/src/components/filter/FilterEditor.jsx +++ b/src/components/filter/FilterEditor.jsx @@ -1,7 +1,7 @@ import React from 'react' import { combiningFilterOps } from '../../libs/filterops.js' -import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' +import styleSpec from '@mapbox/mapbox-gl-style-spec' import DocLabel from '../fields/DocLabel' import SelectInput from '../inputs/SelectInput' import SingleFilterEditor from './SingleFilterEditor' @@ -91,7 +91,7 @@ export default class CombiningFilterEditor extends React.Component {
+ return + return + return + return + return } diff --git a/src/components/layers/MinZoomBlock.jsx b/src/components/layers/MinZoomBlock.jsx index aa2323c..c4a7f36 100644 --- a/src/components/layers/MinZoomBlock.jsx +++ b/src/components/layers/MinZoomBlock.jsx @@ -1,6 +1,6 @@ import React from 'react' -import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' +import styleSpec from '@mapbox/mapbox-gl-style-spec' import InputBlock from '../inputs/InputBlock' import NumberInput from '../inputs/NumberInput' @@ -11,13 +11,13 @@ class MinZoomBlock extends React.Component { } render() { - return + return } diff --git a/src/components/map/MapboxGlMap.jsx b/src/components/map/MapboxGlMap.jsx index 2cdb6d0..bc2950e 100644 --- a/src/components/map/MapboxGlMap.jsx +++ b/src/components/map/MapboxGlMap.jsx @@ -1,10 +1,9 @@ import React from 'react' import ReactDOM from 'react-dom' -import MapboxGl from 'mapbox-gl/dist/mapbox-gl.js' +import MapboxGl from 'mapbox-gl' import MapboxInspect from 'mapbox-gl-inspect' import FeatureLayerPopup from './FeatureLayerPopup' import FeaturePropertyPopup from './FeaturePropertyPopup' -import validateColor from 'mapbox-gl/src/style-spec/validate/validate_color' import style from '../../libs/style.js' import tokens from '../../config/tokens.json' import colors from 'mapbox-gl-inspect/lib/colors' diff --git a/src/components/modals/ExportModal.jsx b/src/components/modals/ExportModal.jsx index 4a33023..b6db301 100644 --- a/src/components/modals/ExportModal.jsx +++ b/src/components/modals/ExportModal.jsx @@ -1,7 +1,7 @@ import React from 'react' import { saveAs } from 'file-saver' -import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' +import styleSpec from '@mapbox/mapbox-gl-style-spec' import InputBlock from '../inputs/InputBlock' import StringInput from '../inputs/StringInput' import SelectInput from '../inputs/SelectInput' @@ -10,7 +10,6 @@ import Button from '../Button' import Modal from './Modal' import MdFileDownload from 'react-icons/lib/md/file-download' import style from '../../libs/style.js' -import formatStyle from 'mapbox-gl/src/style-spec/format' import GitHub from 'github-api' @@ -44,8 +43,8 @@ class Gist extends React.Component { const preview = this.state.preview && (this.props.mapStyle.metadata || {})['maputnik:openmaptiles_access_token']; const mapStyleStr = preview ? - formatStyle(stripAccessTokens(style.replaceAccessToken(this.props.mapStyle))) : - formatStyle(stripAccessTokens(this.props.mapStyle)); + styleSpec.format(stripAccessTokens(style.replaceAccessToken(this.props.mapStyle))) : + styleSpec.format(stripAccessTokens(this.props.mapStyle)); const styleTitle = this.props.mapStyle.name || 'Style'; const htmlStr = ` @@ -197,7 +196,7 @@ class ExportModal extends React.Component { } downloadStyle() { - const blob = new Blob([formatStyle(stripAccessTokens(this.props.mapStyle))], {type: "application/json;charset=utf-8"}); + const blob = new Blob([styleSpec.format(stripAccessTokens(this.props.mapStyle))], {type: "application/json;charset=utf-8"}); saveAs(blob, this.props.mapStyle.id + ".json"); } diff --git a/src/components/modals/SettingsModal.jsx b/src/components/modals/SettingsModal.jsx index f3de03b..d3bc5b9 100644 --- a/src/components/modals/SettingsModal.jsx +++ b/src/components/modals/SettingsModal.jsx @@ -1,6 +1,6 @@ import React from 'react' -import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' +import styleSpec from '@mapbox/mapbox-gl-style-spec' import InputBlock from '../inputs/InputBlock' import StringInput from '../inputs/StringInput' import SelectInput from '../inputs/SelectInput' @@ -46,7 +46,7 @@ class SettingsModal extends React.Component { title={'Style Settings'} >
- + - + - + this.setState({ sourceId: v})} /> - + + return this.props.onChange({ @@ -42,7 +42,7 @@ class TileURLSourceEditor extends React.Component { const prefix = ['1st', '2nd', '3rd', '4th', '5th', '6th', '7th'] const tiles = this.props.source.tiles || [] return tiles.map((tileUrl, tileIndex) => { - return + return {this.renderTileUrls()} - + this.props.onChange({ @@ -63,7 +63,7 @@ class TileURLSourceEditor extends React.Component { })} /> - + this.props.onChange({ @@ -84,7 +84,7 @@ class GeoJSONSourceEditor extends React.Component { } render() { - return + return this.props.onChange({ diff --git a/src/libs/diffmessage.js b/src/libs/diffmessage.js index 80b2688..a4c01cd 100644 --- a/src/libs/diffmessage.js +++ b/src/libs/diffmessage.js @@ -1,7 +1,7 @@ -import diffStyles from 'mapbox-gl/src/style-spec/diff' +import styleSpec from '@mapbox/mapbox-gl-style-spec' export function diffMessages(beforeStyle, afterStyle) { - const changes = diffStyles(beforeStyle, afterStyle) + const changes = styleSpec.diff(beforeStyle, afterStyle) return changes.map(cmd => cmd.command + ' ' + cmd.args.join(' ')) } diff --git a/src/libs/filterops.js b/src/libs/filterops.js index da77be8..892e224 100644 --- a/src/libs/filterops.js +++ b/src/libs/filterops.js @@ -1,6 +1,6 @@ -import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' +import styleSpec from '@mapbox/mapbox-gl-style-spec' export const combiningFilterOps = ['all', 'any', 'none'] export const setFilterOps = ['in', '!in'] export const otherFilterOps = Object - .keys(GlSpec.filter_operator.values) + .keys(styleSpec.latest.filter_operator.values) .filter(op => combiningFilterOps.indexOf(op) < 0) diff --git a/src/libs/layer.js b/src/libs/layer.js index f6418c5..d6ee928 100644 --- a/src/libs/layer.js +++ b/src/libs/layer.js @@ -1,16 +1,16 @@ -import GlSpec from 'mapbox-gl/src/style-spec/reference/latest' +import styleSpec from '@mapbox/mapbox-gl-style-spec' export function changeType(layer, newType) { const changedPaintProps = { ...layer.paint } Object.keys(changedPaintProps).forEach(propertyName => { - if(!(propertyName in GlSpec['paint_' + newType])) { + if(!(propertyName in styleSpec.latest['paint_' + newType])) { delete changedPaintProps[propertyName] } }) const changedLayoutProps = { ...layer.layout } Object.keys(changedLayoutProps).forEach(propertyName => { - if(!(propertyName in GlSpec['layout_' + newType])) { + if(!(propertyName in styleSpec.latest['layout_' + newType])) { delete changedLayoutProps[propertyName] } }) diff --git a/src/libs/style.js b/src/libs/style.js index fefa987..cf2cff6 100644 --- a/src/libs/style.js +++ b/src/libs/style.js @@ -1,6 +1,5 @@ import React from 'react'; -import spec from 'mapbox-gl/src/style-spec/reference/latest' -import derefLayers from 'mapbox-gl/src/style-spec/deref' +import deref from '@mapbox/mapbox-gl-style-spec/deref' import tokens from '../config/tokens.json' // Empty style is always used if no style could be restored or fetched @@ -37,7 +36,7 @@ function ensureHasNoInteractive(style) { function ensureHasNoRefs(style) { const derefedStyle = { ...style, - layers: derefLayers(style.layers) + layers: deref(style.layers) } return derefedStyle } From d8e84d67da5515bdd0133adcb14b61ba61672892 Mon Sep 17 00:00:00 2001 From: orangemug Date: Mon, 10 Apr 2017 13:58:08 +0100 Subject: [PATCH 6/9] Revert to mapbox-gl 0.34 because of mapbox-gl-inspect. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b2dd2dc..1d6ae52 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "lodash.clonedeep": "^4.5.0", "lodash.isequal": "^4.4.0", "lodash.throttle": "^4.1.1", - "mapbox-gl": "^0.35.0", + "mapbox-gl": "^0.34.0", "mapbox-gl-inspect": "^1.2.3", "mousetrap": "^1.6.0", "ol-mapbox-style": "1.0.1", From 45942e604bb88b75f014cc263e71266b08a21206 Mon Sep 17 00:00:00 2001 From: orangemug Date: Thu, 13 Apr 2017 08:24:49 +0100 Subject: [PATCH 7/9] Updated @mapbox/mapbox-gl-style-spec to v9 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1d6ae52..65dccd8 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "license": "MIT", "homepage": "https://github.com/maputnik/editor#readme", "dependencies": { - "@mapbox/mapbox-gl-style-spec": "^8.11.0", + "@mapbox/mapbox-gl-style-spec": "^9.0.0", "classnames": "^2.2.5", "codemirror": "^5.18.2", "color": "^1.0.3", From 4bbfe1040ed84c7829f5a2eed1ad238677fbd641 Mon Sep 17 00:00:00 2001 From: orangemug Date: Tue, 11 Jul 2017 06:30:37 +0100 Subject: [PATCH 8/9] Fixed regexp for windows. --- config/webpack.loaders.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/webpack.loaders.js b/config/webpack.loaders.js index 7d9e528..05e3416 100644 --- a/config/webpack.loaders.js +++ b/config/webpack.loaders.js @@ -6,7 +6,7 @@ module.exports = [ }, { test: /\.jsx?$/, - exclude: /(.*node_modules(?!\/@mapbox\/mapbox-gl-style-spec)|bower_components|public)/, + exclude: /(.*node_modules(?![\/\\]@mapbox[\/\\]mapbox-gl-style-spec)|bower_components|public)/, loader: 'babel', query: { presets: ['es2015', 'react'], From e32c2e865c59be53320061819a2208920ccee557 Mon Sep 17 00:00:00 2001 From: Chris Whong Date: Wed, 4 Oct 2017 22:42:04 -0400 Subject: [PATCH 9/9] Add --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index e535aa7..27f86ac 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,10 @@ npm run lint npm run lint-styles ``` +## Related Projects + +- [maputnik-dev-server](https://github.com/nycplanning/labs-maputnik-dev-server) - An express.js server that allows for quickly loading the style from any mapboxGL map into mapuntnik. + ## Sponsors Thanks to the supporters of the **[Kickstarter campaign](https://www.kickstarter.com/projects/174808720/maputnik-visual-map-editor-for-mapbox-gl)**. This project would not be possible without these commercial and individual sponsors.