mirror of
https://github.com/maputnik/editor.git
synced 2026-09-01 18:07:37 +00:00
Compare commits
1 Commits
v2.0.0
..
e8a62b4355
| Author | SHA1 | Date | |
|---|---|---|---|
| e8a62b4355 |
@@ -48,7 +48,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
node-version: [16.x]
|
node-version: [12.x, 14.x, 16.x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@@ -68,6 +68,10 @@ jobs:
|
|||||||
build-artifacts:
|
build-artifacts:
|
||||||
name: "build/artifacts (${{ matrix.os }})"
|
name: "build/artifacts (${{ matrix.os }})"
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
env:
|
||||||
|
GOPATH: ${{ github.workspace }}
|
||||||
|
GO111MODULE: off
|
||||||
|
|
||||||
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'push' || github.event_name == 'pull_request' }}
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
@@ -109,16 +113,16 @@ jobs:
|
|||||||
|
|
||||||
# Build and upload desktop CLI artifacts
|
# Build and upload desktop CLI artifacts
|
||||||
- name: Set up Go
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v3
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: ^1.19.x
|
go-version: ^1.14.x
|
||||||
id: go
|
id: go
|
||||||
|
|
||||||
- name: Check out code into the Go module directory
|
- name: Check out code into the Go module directory
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
repository: maputnik/desktop
|
repository: maputnik/desktop
|
||||||
ref: master
|
ref: v1.0.7
|
||||||
path: ./src/github.com/maputnik/desktop/
|
path: ./src/github.com/maputnik/desktop/
|
||||||
|
|
||||||
- name: Make
|
- name: Make
|
||||||
|
|||||||
+3
-6
@@ -12,11 +12,8 @@ RUN npm run build
|
|||||||
|
|
||||||
#---------------------------------------------------------------------------
|
#---------------------------------------------------------------------------
|
||||||
|
|
||||||
# Create a clean python-based image with just the build results
|
# Create a clean nginx-alpine image with just the build results
|
||||||
FROM python:3-slim
|
|
||||||
WORKDIR /maputnik
|
|
||||||
|
|
||||||
COPY --from=builder /maputnik/build/build .
|
FROM nginx:alpine
|
||||||
|
|
||||||
EXPOSE 8888
|
COPY --from=builder /maputnik/build/build /usr/share/nginx/html/
|
||||||
CMD python -m http.server 8888
|
|
||||||
|
|||||||
Generated
+6871
-32707
File diff suppressed because it is too large
Load Diff
+6
-7
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "maputnik",
|
"name": "maputnik",
|
||||||
"version": "2.0.0-pre.1",
|
"version": "1.7.0",
|
||||||
"description": "A MapLibre GL visual style editor",
|
"description": "A MapboxGL visual style editor",
|
||||||
"main": "''",
|
"main": "''",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"stats": "webpack --config config/webpack.production.config.js --progress=profile --json > stats.json",
|
"stats": "webpack --config config/webpack.production.config.js --progress=profile --json > stats.json",
|
||||||
@@ -28,10 +28,9 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/runtime": "^7.17.9",
|
"@babel/runtime": "^7.17.9",
|
||||||
"@mapbox/mapbox-gl-rtl-text": "^0.2.3",
|
"@mapbox/mapbox-gl-rtl-text": "^0.2.3",
|
||||||
"@maplibre/maplibre-gl-style-spec": "^17.0.1",
|
"@mapbox/mapbox-gl-style-spec": "^13.23.1",
|
||||||
"@mdi/react": "^1.5.0",
|
"@mdi/react": "^1.5.0",
|
||||||
"array-move": "^4.0.0",
|
"array-move": "^4.0.0",
|
||||||
"buffer": "^6.0.3",
|
|
||||||
"classnames": "^2.3.1",
|
"classnames": "^2.3.1",
|
||||||
"codemirror": "^5.65.2",
|
"codemirror": "^5.65.2",
|
||||||
"color": "^4.2.3",
|
"color": "^4.2.3",
|
||||||
@@ -47,8 +46,8 @@
|
|||||||
"lodash.get": "^4.4.2",
|
"lodash.get": "^4.4.2",
|
||||||
"lodash.isequal": "^4.5.0",
|
"lodash.isequal": "^4.5.0",
|
||||||
"lodash.throttle": "^4.1.1",
|
"lodash.throttle": "^4.1.1",
|
||||||
|
"mapbox-gl": "^1.13.2",
|
||||||
"mapbox-gl-inspect": "^1.3.1",
|
"mapbox-gl-inspect": "^1.3.1",
|
||||||
"maplibre-gl": "^2.4.0",
|
|
||||||
"maputnik-design": "github:maputnik/design#172b06c",
|
"maputnik-design": "github:maputnik/design#172b06c",
|
||||||
"ol": "^6.14.1",
|
"ol": "^6.14.1",
|
||||||
"ol-mapbox-style": "^7.1.1",
|
"ol-mapbox-style": "^7.1.1",
|
||||||
@@ -101,7 +100,7 @@
|
|||||||
"node": true,
|
"node": true,
|
||||||
"es6": true
|
"es6": true
|
||||||
},
|
},
|
||||||
"parser": "@babel/eslint-parser",
|
"parser": "babel-eslint",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 6,
|
"ecmaVersion": 6,
|
||||||
"sourceType": "module",
|
"sourceType": "module",
|
||||||
@@ -119,7 +118,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.17.9",
|
"@babel/core": "^7.17.9",
|
||||||
"@babel/eslint-parser": "^7.19.1",
|
|
||||||
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
||||||
"@babel/plugin-transform-runtime": "^7.17.0",
|
"@babel/plugin-transform-runtime": "^7.17.0",
|
||||||
"@babel/preset-env": "^7.16.11",
|
"@babel/preset-env": "^7.16.11",
|
||||||
@@ -138,6 +136,7 @@
|
|||||||
"@wdio/mocha-framework": "^7.19.3",
|
"@wdio/mocha-framework": "^7.19.3",
|
||||||
"@wdio/selenium-standalone-service": "^7.19.1",
|
"@wdio/selenium-standalone-service": "^7.19.1",
|
||||||
"@wdio/spec-reporter": "^7.19.1",
|
"@wdio/spec-reporter": "^7.19.1",
|
||||||
|
"babel-eslint": "^10.1.0",
|
||||||
"babel-loader": "^8.2.4",
|
"babel-loader": "^8.2.4",
|
||||||
"babel-plugin-istanbul": "^6.1.1",
|
"babel-plugin-istanbul": "^6.1.1",
|
||||||
"babel-plugin-static-fs": "^3.0.0",
|
"babel-plugin-static-fs": "^3.0.0",
|
||||||
|
|||||||
+22
-5
@@ -2,7 +2,6 @@ import autoBind from 'react-autobind';
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import cloneDeep from 'lodash.clonedeep'
|
import cloneDeep from 'lodash.clonedeep'
|
||||||
import clamp from 'lodash.clamp'
|
import clamp from 'lodash.clamp'
|
||||||
import buffer from 'buffer'
|
|
||||||
import get from 'lodash.get'
|
import get from 'lodash.get'
|
||||||
import {unset} from 'lodash'
|
import {unset} from 'lodash'
|
||||||
import {arrayMoveMutable} from 'array-move'
|
import {arrayMoveMutable} from 'array-move'
|
||||||
@@ -26,7 +25,7 @@ import ModalSurvey from './ModalSurvey'
|
|||||||
import ModalDebug from './ModalDebug'
|
import ModalDebug from './ModalDebug'
|
||||||
|
|
||||||
import { downloadGlyphsMetadata, downloadSpriteMetadata } from '../libs/metadata'
|
import { downloadGlyphsMetadata, downloadSpriteMetadata } from '../libs/metadata'
|
||||||
import {latest, validate} from '@maplibre/maplibre-gl-style-spec'
|
import {latest, validate} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import style from '../libs/style'
|
import style from '../libs/style'
|
||||||
import { initialStyleUrl, loadStyleUrl, removeStyleQuerystring } from '../libs/urlopen'
|
import { initialStyleUrl, loadStyleUrl, removeStyleQuerystring } from '../libs/urlopen'
|
||||||
import { undoMessages, redoMessages } from '../libs/diffmessage'
|
import { undoMessages, redoMessages } from '../libs/diffmessage'
|
||||||
@@ -37,10 +36,23 @@ import LayerWatcher from '../libs/layerwatcher'
|
|||||||
import tokens from '../config/tokens.json'
|
import tokens from '../config/tokens.json'
|
||||||
import isEqual from 'lodash.isequal'
|
import isEqual from 'lodash.isequal'
|
||||||
import Debug from '../libs/debug'
|
import Debug from '../libs/debug'
|
||||||
|
import queryUtil from '../libs/query-util'
|
||||||
import {formatLayerId} from '../util/format';
|
import {formatLayerId} from '../util/format';
|
||||||
|
|
||||||
// Buffer must be defined globally for @maplibre/maplibre-gl-style-spec validate() function to succeed.
|
import MapboxGl from 'mapbox-gl'
|
||||||
window.Buffer = buffer.Buffer;
|
|
||||||
|
|
||||||
|
// Similar functionality as <https://github.com/mapbox/mapbox-gl-js/blob/7e30aadf5177486c2cfa14fe1790c60e217b5e56/src/util/mapbox.js>
|
||||||
|
function normalizeSourceURL (url, apiToken="") {
|
||||||
|
const matches = url.match(/^mapbox:\/\/(.*)/);
|
||||||
|
if (matches) {
|
||||||
|
// mapbox://mapbox.mapbox-streets-v7
|
||||||
|
return `https://api.mapbox.com/v4/${matches[1]}.json?secure&access_token=${apiToken}`
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setFetchAccessToken(url, mapStyle) {
|
function setFetchAccessToken(url, mapStyle) {
|
||||||
const matchesTilehosting = url.match(/\.tilehosting\.com/);
|
const matchesTilehosting = url.match(/\.tilehosting\.com/);
|
||||||
@@ -576,6 +588,11 @@ export default class App extends React.Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let url = val.url;
|
let url = val.url;
|
||||||
|
try {
|
||||||
|
url = normalizeSourceURL(url, MapboxGl.accessToken);
|
||||||
|
} catch(err) {
|
||||||
|
console.warn("Failed to normalizeSourceURL: ", err);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
url = setFetchAccessToken(url, this.state.mapStyle)
|
url = setFetchAccessToken(url, this.state.mapStyle)
|
||||||
@@ -680,7 +697,7 @@ export default class App extends React.Component {
|
|||||||
const elementStyle = {};
|
const elementStyle = {};
|
||||||
if (filterName) {
|
if (filterName) {
|
||||||
elementStyle.filter = `url('#${filterName}')`;
|
elementStyle.filter = `url('#${filterName}')`;
|
||||||
}
|
};
|
||||||
|
|
||||||
return <div style={elementStyle} className="maputnik-map__container">
|
return <div style={elementStyle} className="maputnik-map__container">
|
||||||
{mapElement}
|
{mapElement}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { Collapse as ReactCollapse } from 'react-collapse'
|
import Collapse as ReactCollapse from 'react-collapse'
|
||||||
import accessibility from '../../libs/accessibility'
|
import accessibility from '../../libs/accessibility'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import SpecProperty from './_SpecProperty'
|
|||||||
import DataProperty from './_DataProperty'
|
import DataProperty from './_DataProperty'
|
||||||
import ZoomProperty from './_ZoomProperty'
|
import ZoomProperty from './_ZoomProperty'
|
||||||
import ExpressionProperty from './_ExpressionProperty'
|
import ExpressionProperty from './_ExpressionProperty'
|
||||||
import {function as styleFunction} from '@maplibre/maplibre-gl-style-spec';
|
import {function as styleFunction} from '@mapbox/mapbox-gl-style-spec';
|
||||||
import {findDefaultFromSpec} from '../util/spec-helper';
|
import {findDefaultFromSpec} from '../util/spec-helper';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import InputString from './InputString'
|
import InputString from './InputString'
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import InputNumber from './InputNumber'
|
import InputNumber from './InputNumber'
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import InputNumber from './InputNumber'
|
import InputNumber from './InputNumber'
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import InputAutocomplete from './InputAutocomplete'
|
import InputAutocomplete from './InputAutocomplete'
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import InputAutocomplete from './InputAutocomplete'
|
import InputAutocomplete from './InputAutocomplete'
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import InputSelect from './InputSelect'
|
import InputSelect from './InputSelect'
|
||||||
import InputString from './InputString'
|
import InputString from './InputString'
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { combiningFilterOps } from '../libs/filterops.js'
|
|||||||
import {mdiTableRowPlusAfter} from '@mdi/js';
|
import {mdiTableRowPlusAfter} from '@mdi/js';
|
||||||
import {isEqual} from 'lodash';
|
import {isEqual} from 'lodash';
|
||||||
|
|
||||||
import {latest, migrate, convertFilter} from '@maplibre/maplibre-gl-style-spec'
|
import {latest, validate, migrate, convertFilter} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import InputSelect from './InputSelect'
|
import InputSelect from './InputSelect'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import SingleFilterEditor from './SingleFilterEditor'
|
import SingleFilterEditor from './SingleFilterEditor'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import ReactDOM from 'react-dom'
|
import ReactDOM from 'react-dom'
|
||||||
import MapLibreGl from 'maplibre-gl'
|
import MapboxGl from 'mapbox-gl'
|
||||||
import MapboxInspect from 'mapbox-gl-inspect'
|
import MapboxInspect from 'mapbox-gl-inspect'
|
||||||
import MapMapboxGlLayerPopup from './MapMapboxGlLayerPopup'
|
import MapMapboxGlLayerPopup from './MapMapboxGlLayerPopup'
|
||||||
import MapMapboxGlFeaturePropertyPopup from './MapMapboxGlFeaturePropertyPopup'
|
import MapMapboxGlFeaturePropertyPopup from './MapMapboxGlFeaturePropertyPopup'
|
||||||
@@ -10,12 +10,12 @@ import colors from 'mapbox-gl-inspect/lib/colors'
|
|||||||
import Color from 'color'
|
import Color from 'color'
|
||||||
import ZoomControl from '../libs/zoomcontrol'
|
import ZoomControl from '../libs/zoomcontrol'
|
||||||
import { colorHighlightedLayer } from '../libs/highlight'
|
import { colorHighlightedLayer } from '../libs/highlight'
|
||||||
import 'maplibre-gl/dist/maplibre-gl.css'
|
import 'mapbox-gl/dist/mapbox-gl.css'
|
||||||
import '../mapboxgl.css'
|
import '../mapboxgl.css'
|
||||||
import '../libs/mapbox-rtl'
|
import '../libs/mapbox-rtl'
|
||||||
|
|
||||||
|
|
||||||
const IS_SUPPORTED = MapLibreGl.supported();
|
const IS_SUPPORTED = MapboxGl.supported();
|
||||||
|
|
||||||
function renderPopup(popup, mountNode) {
|
function renderPopup(popup, mountNode) {
|
||||||
ReactDOM.render(popup, mountNode);
|
ReactDOM.render(popup, mountNode);
|
||||||
@@ -75,6 +75,7 @@ export default class MapMapboxGl extends React.Component {
|
|||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
|
MapboxGl.accessToken = tokens.mapbox
|
||||||
this.state = {
|
this.state = {
|
||||||
map: null,
|
map: null,
|
||||||
inspect: null,
|
inspect: null,
|
||||||
@@ -85,6 +86,8 @@ export default class MapMapboxGl extends React.Component {
|
|||||||
if(!IS_SUPPORTED) return;
|
if(!IS_SUPPORTED) return;
|
||||||
|
|
||||||
if(!this.state.map) return
|
if(!this.state.map) return
|
||||||
|
const metadata = props.mapStyle.metadata || {}
|
||||||
|
MapboxGl.accessToken = metadata['maputnik:mapbox_access_token'] || tokens.mapbox
|
||||||
|
|
||||||
//Mapbox GL now does diffing natively so we don't need to calculate
|
//Mapbox GL now does diffing natively so we don't need to calculate
|
||||||
//the necessary operations ourselves!
|
//the necessary operations ourselves!
|
||||||
@@ -104,7 +107,7 @@ export default class MapMapboxGl extends React.Component {
|
|||||||
return should;
|
return should;
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps, prevState, snapshot) {
|
componentDidUpdate(prevProps) {
|
||||||
if(!IS_SUPPORTED) return;
|
if(!IS_SUPPORTED) return;
|
||||||
|
|
||||||
const map = this.state.map;
|
const map = this.state.map;
|
||||||
@@ -146,7 +149,7 @@ export default class MapMapboxGl extends React.Component {
|
|||||||
maxZoom: 24
|
maxZoom: 24
|
||||||
}
|
}
|
||||||
|
|
||||||
const map = new MapLibreGl.Map(mapOpts);
|
const map = new MapboxGl.Map(mapOpts);
|
||||||
|
|
||||||
const mapViewChange = () => {
|
const mapViewChange = () => {
|
||||||
const center = map.getCenter();
|
const center = map.getCenter();
|
||||||
@@ -162,13 +165,13 @@ export default class MapMapboxGl extends React.Component {
|
|||||||
const zoomControl = new ZoomControl;
|
const zoomControl = new ZoomControl;
|
||||||
map.addControl(zoomControl, 'top-right');
|
map.addControl(zoomControl, 'top-right');
|
||||||
|
|
||||||
const nav = new MapLibreGl.NavigationControl({visualizePitch:true});
|
const nav = new MapboxGl.NavigationControl({visualizePitch:true});
|
||||||
map.addControl(nav, 'top-right');
|
map.addControl(nav, 'top-right');
|
||||||
|
|
||||||
const tmpNode = document.createElement('div');
|
const tmpNode = document.createElement('div');
|
||||||
|
|
||||||
const inspect = new MapboxInspect({
|
const inspect = new MapboxInspect({
|
||||||
popup: new MapLibreGl.Popup({
|
popup: new MapboxGl.Popup({
|
||||||
closeOnClick: false
|
closeOnClick: false
|
||||||
}),
|
}),
|
||||||
showMapPopup: true,
|
showMapPopup: true,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import IconLayer from './IconLayer'
|
import IconLayer from './IconLayer'
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest, expression, function as styleFunction} from '@mapbox/mapbox-gl-style-spec'
|
||||||
|
|
||||||
function groupFeaturesBySourceLayer(features) {
|
function groupFeaturesBySourceLayer(features) {
|
||||||
const sources = {}
|
const sources = {}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import InputButton from './InputButton'
|
import InputButton from './InputButton'
|
||||||
import Modal from './Modal'
|
import Modal from './Modal'
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import Slugify from 'slugify'
|
|||||||
import { saveAs } from 'file-saver'
|
import { saveAs } from 'file-saver'
|
||||||
import pkgLockJson from '../../package-lock.json'
|
import pkgLockJson from '../../package-lock.json'
|
||||||
|
|
||||||
import {format} from '@maplibre/maplibre-gl-style-spec'
|
import {format} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import FieldString from './FieldString'
|
import FieldString from './FieldString'
|
||||||
import FieldCheckbox from './FieldCheckbox'
|
import FieldCheckbox from './FieldCheckbox'
|
||||||
import InputButton from './InputButton'
|
import InputButton from './InputButton'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import FieldArray from './FieldArray'
|
import FieldArray from './FieldArray'
|
||||||
import FieldNumber from './FieldNumber'
|
import FieldNumber from './FieldNumber'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import Modal from './Modal'
|
import Modal from './Modal'
|
||||||
import InputButton from './InputButton'
|
import InputButton from './InputButton'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import FieldUrl from './FieldUrl'
|
import FieldUrl from './FieldUrl'
|
||||||
import FieldNumber from './FieldNumber'
|
import FieldNumber from './FieldNumber'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import {mdiFunctionVariant, mdiTableRowPlusAfter} from '@mdi/js';
|
import {mdiFunctionVariant, mdiTableRowPlusAfter} from '@mdi/js';
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
|
|
||||||
import InputButton from './InputButton'
|
import InputButton from './InputButton'
|
||||||
import InputSpec from './InputSpec'
|
import InputSpec from './InputSpec'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import FieldString from './FieldString'
|
import FieldString from './FieldString'
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import FieldNumber from './FieldNumber'
|
import FieldNumber from './FieldNumber'
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import FieldNumber from './FieldNumber'
|
import FieldNumber from './FieldNumber'
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import FieldAutocomplete from './FieldAutocomplete'
|
import FieldAutocomplete from './FieldAutocomplete'
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import FieldAutocomplete from './FieldAutocomplete'
|
import FieldAutocomplete from './FieldAutocomplete'
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
|
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import Block from './Block'
|
import Block from './Block'
|
||||||
import FieldSelect from './FieldSelect'
|
import FieldSelect from './FieldSelect'
|
||||||
import FieldString from './FieldString'
|
import FieldString from './FieldString'
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import {mdiFunctionVariant, mdiTableRowPlusAfter} from '@mdi/js';
|
import {mdiFunctionVariant, mdiTableRowPlusAfter} from '@mdi/js';
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
|
|
||||||
import InputButton from './InputButton'
|
import InputButton from './InputButton'
|
||||||
import InputSpec from './InputSpec'
|
import InputSpec from './InputSpec'
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import style from './style.js'
|
import style from './style.js'
|
||||||
import {format} from '@maplibre/maplibre-gl-style-spec'
|
import {format} from '@mapbox/mapbox-gl-style-spec'
|
||||||
import ReconnectingWebSocket from 'reconnecting-websocket'
|
import ReconnectingWebSocket from 'reconnecting-websocket'
|
||||||
|
|
||||||
export class ApiStyleStore {
|
export class ApiStyleStore {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {diff} from '@maplibre/maplibre-gl-style-spec'
|
import {diff} from '@mapbox/mapbox-gl-style-spec'
|
||||||
|
|
||||||
export function diffMessages(beforeStyle, afterStyle) {
|
export function diffMessages(beforeStyle, afterStyle) {
|
||||||
const changes = diff(beforeStyle, afterStyle)
|
const changes = diff(beforeStyle, afterStyle)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
export const combiningFilterOps = ['all', 'any', 'none']
|
export const combiningFilterOps = ['all', 'any', 'none']
|
||||||
export const setFilterOps = ['in', '!in']
|
export const setFilterOps = ['in', '!in']
|
||||||
export const otherFilterOps = Object
|
export const otherFilterOps = Object
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
|
|
||||||
export function changeType(layer, newType) {
|
export function changeType(layer, newType) {
|
||||||
const changedPaintProps = { ...layer.paint }
|
const changedPaintProps = { ...layer.paint }
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import MapLibreGl from "maplibre-gl"
|
import MapboxGl from 'mapbox-gl'
|
||||||
import {readFileSync} from 'fs'
|
import {readFileSync} from 'fs'
|
||||||
|
|
||||||
const data = readFileSync(__dirname+"/../../node_modules/@mapbox/mapbox-gl-rtl-text/mapbox-gl-rtl-text.js", "utf8");
|
const data = readFileSync(__dirname+"/../../node_modules/@mapbox/mapbox-gl-rtl-text/mapbox-gl-rtl-text.js", "utf8");
|
||||||
@@ -8,4 +8,4 @@ const blob = new window.Blob([data], {
|
|||||||
});
|
});
|
||||||
const objectUrl = window.URL.createObjectURL(blob);
|
const objectUrl = window.URL.createObjectURL(blob);
|
||||||
|
|
||||||
MapLibreGl.setRTLTextPlugin(objectUrl, () => {});
|
MapboxGl.setRTLTextPlugin(objectUrl);
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
function asBool(queryObj, key) {
|
function asBool(queryObj, key) {
|
||||||
if(queryObj.hasOwnProperty(key)) {
|
if(queryObj.hasOwnProperty(key)) {
|
||||||
return !queryObj[key].match(/^false|0$/);
|
if(queryObj[key].match(/^false|0$/)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
export default function(a, b) {
|
export default function(a, b) {
|
||||||
a = parseFloat(a);
|
a = parseFloat(a, 10);
|
||||||
b = parseFloat(b);
|
b = parseFloat(b, 10);
|
||||||
|
|
||||||
if(a < b) {
|
if(a < b) {
|
||||||
return -1
|
return -1
|
||||||
|
|||||||
+4
-2
@@ -1,10 +1,11 @@
|
|||||||
export function deleteSource(mapStyle, sourceId) {
|
export function deleteSource(mapStyle, sourceId) {
|
||||||
const remainingSources = { ...mapStyle.sources}
|
const remainingSources = { ...mapStyle.sources}
|
||||||
delete remainingSources[sourceId]
|
delete remainingSources[sourceId]
|
||||||
return {
|
const changedStyle = {
|
||||||
...mapStyle,
|
...mapStyle,
|
||||||
sources: remainingSources
|
sources: remainingSources
|
||||||
}
|
}
|
||||||
|
return changedStyle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -17,9 +18,10 @@ export function changeSource(mapStyle, sourceId, source) {
|
|||||||
...mapStyle.sources,
|
...mapStyle.sources,
|
||||||
[sourceId]: source
|
[sourceId]: source
|
||||||
}
|
}
|
||||||
return {
|
const changedStyle = {
|
||||||
...mapStyle,
|
...mapStyle,
|
||||||
sources: changedSources
|
sources: changedSources
|
||||||
}
|
}
|
||||||
|
return changedStyle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-4
@@ -1,4 +1,4 @@
|
|||||||
import {derefLayers} from '@maplibre/maplibre-gl-style-spec'
|
import deref from '@mapbox/mapbox-gl-style-spec/deref'
|
||||||
import tokens from '../config/tokens.json'
|
import tokens from '../config/tokens.json'
|
||||||
|
|
||||||
// Empty style is always used if no style could be restored or fetched
|
// Empty style is always used if no style could be restored or fetched
|
||||||
@@ -25,17 +25,19 @@ function ensureHasNoInteractive(style) {
|
|||||||
return changedLayer
|
return changedLayer
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
const nonInteractiveStyle = {
|
||||||
...style,
|
...style,
|
||||||
layers: changedLayers
|
layers: changedLayers
|
||||||
}
|
}
|
||||||
|
return nonInteractiveStyle
|
||||||
}
|
}
|
||||||
|
|
||||||
function ensureHasNoRefs(style) {
|
function ensureHasNoRefs(style) {
|
||||||
return {
|
const derefedStyle = {
|
||||||
...style,
|
...style,
|
||||||
layers: derefLayers(style.layers)
|
layers: deref(style.layers)
|
||||||
}
|
}
|
||||||
|
return derefedStyle
|
||||||
}
|
}
|
||||||
|
|
||||||
function ensureStyleValidity(style) {
|
function ensureStyleValidity(style) {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ function loadStoredStyles() {
|
|||||||
|
|
||||||
function isStyleKey(key) {
|
function isStyleKey(key) {
|
||||||
const parts = key.split(":")
|
const parts = key.split(":")
|
||||||
return parts.length === 3 && parts[0] === storagePrefix && parts[1] === stylePrefix
|
return parts.length == 3 && parts[0] === storagePrefix && parts[1] === stylePrefix
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load style id from key
|
// Load style id from key
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
/* TODO */
|
|
||||||
|
|
||||||
.mapboxgl-popup-anchor-top .mapboxgl-popup-tip {
|
.mapboxgl-popup-anchor-top .mapboxgl-popup-tip {
|
||||||
border-bottom-color: rgb(28, 31, 36);
|
border-bottom-color: rgb(28, 31, 36);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import jsonlint from 'jsonlint';
|
import jsonlint from 'jsonlint';
|
||||||
import CodeMirror from 'codemirror';
|
import CodeMirror from 'codemirror';
|
||||||
import jsonToAst from 'json-to-ast';
|
import jsonToAst from 'json-to-ast';
|
||||||
import {expression, validate} from '@maplibre/maplibre-gl-style-spec';
|
import {expression, validate, latest} from '@mapbox/mapbox-gl-style-spec';
|
||||||
|
|
||||||
|
|
||||||
CodeMirror.defineMode("mgl", function(config, parserConfig) {
|
CodeMirror.defineMode("mgl", function(config, parserConfig) {
|
||||||
@@ -115,7 +115,12 @@ CodeMirror.registerHelper("lint", "mgl", function(text, opts, doc) {
|
|||||||
value: errors
|
value: errors
|
||||||
.filter(err => {
|
.filter(err => {
|
||||||
// Remove missing 'layer source' errors, because we don't include them
|
// Remove missing 'layer source' errors, because we don't include them
|
||||||
return !err.message.match(/^layers\[0\]: source ".*" not found$/);
|
if (err.message.match(/^layers\[0\]: source ".*" not found$/)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
.map(err => {
|
.map(err => {
|
||||||
// Remove the 'layers[0].' as we're validating the layer only here
|
// Remove the 'layers[0].' as we're validating the layer only here
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import FieldFunction from '../src/components/FieldFunction';
|
|||||||
import {action} from '@storybook/addon-actions';
|
import {action} from '@storybook/addon-actions';
|
||||||
import {Wrapper} from './ui';
|
import {Wrapper} from './ui';
|
||||||
import {withA11y} from '@storybook/addon-a11y';
|
import {withA11y} from '@storybook/addon-a11y';
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import LayerEditor from '../src/components/LayerEditor';
|
import LayerEditor from '../src/components/LayerEditor';
|
||||||
import {action} from '@storybook/addon-actions';
|
import {action} from '@storybook/addon-actions';
|
||||||
import {withA11y} from '@storybook/addon-a11y';
|
import {withA11y} from '@storybook/addon-a11y';
|
||||||
import {latest} from '@maplibre/maplibre-gl-style-spec'
|
import {latest} from '@mapbox/mapbox-gl-style-spec'
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
Reference in New Issue
Block a user