mirror of
https://github.com/maputnik/editor.git
synced 2025-12-29 01:20:01 +00:00
Vite + TypeScript (#836)
Resolves #803 This is an initial commit to allow migrating to typescript bit by bit. It introduces vite. It removes all the webpack configuration (which I have no clue what all the profiling are needed for, and couldn't find anything in the readme). It also changes a single file from javascript to typescript: `urlopen.js` -> `urlopen.ts` Which was done manually, later on I'll see if I can automate most of the migration. For now, everything seems to work as expected. I also upgrades storybook to use vite and renames the stories to jsx (I honestly don't know why this complexity is needed here, but I'll keep it for now). cc: @damianstasik
This commit is contained in:
@@ -4,9 +4,6 @@ import classnames from 'classnames'
|
||||
import {detect} from 'detect-browser';
|
||||
|
||||
import {MdFileDownload, MdOpenInBrowser, MdSettings, MdLayers, MdHelpOutline, MdFindInPage, MdAssignmentTurnedIn} from 'react-icons/md'
|
||||
|
||||
|
||||
import logoImage from 'maputnik-design/logos/logo-color.svg'
|
||||
import pkgJson from '../../package.json'
|
||||
|
||||
|
||||
@@ -217,7 +214,7 @@ export default class AppToolbar extends React.Component {
|
||||
rel="noreferrer noopener"
|
||||
href="https://github.com/maputnik/editor"
|
||||
>
|
||||
<span dangerouslySetInnerHTML={{__html: logoImage}} />
|
||||
<img src="node_modules/maputnik-design/logos/logo-color.svg" />
|
||||
<h1>
|
||||
<span className="maputnik-toolbar-name">{pkgJson.name}</span>
|
||||
<span className="maputnik-toolbar-version">v{pkgJson.version}</span>
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import React from 'react'
|
||||
import {throttle} from 'lodash';
|
||||
import PropTypes from 'prop-types'
|
||||
import { loadJSON } from '../libs/urlopen'
|
||||
|
||||
import MapMaplibreGlLayerPopup from './MapMaplibreGlLayerPopup';
|
||||
|
||||
import 'ol/ol.css'
|
||||
import {apply} from 'ol-mapbox-style';
|
||||
import {Map, View, Proj, Overlay} from 'ol';
|
||||
import {Map, View, Overlay} from 'ol';
|
||||
|
||||
import {toLonLat} from 'ol/proj';
|
||||
import {toStringHDMS} from 'ol/coordinate';
|
||||
|
||||
@@ -27,9 +27,9 @@ export default class Modal extends React.Component {
|
||||
document.activeElement.blur();
|
||||
}
|
||||
|
||||
setImmediate(() => {
|
||||
setTimeout(() => {
|
||||
this.props.onOpenToggle(false);
|
||||
});
|
||||
}, 0);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import Slugify from 'slugify'
|
||||
import { saveAs } from 'file-saver'
|
||||
import pkgLockJson from '../../package-lock.json'
|
||||
|
||||
import {saveAs} from 'file-saver'
|
||||
import {version} from 'maplibre-gl'
|
||||
import {format} from '@maplibre/maplibre-gl-style-spec'
|
||||
import FieldString from './FieldString'
|
||||
import FieldCheckbox from './FieldCheckbox'
|
||||
import InputButton from './InputButton'
|
||||
import Modal from './Modal'
|
||||
import {MdFileDownload} from 'react-icons/md'
|
||||
@@ -14,7 +12,7 @@ import style from '../libs/style'
|
||||
import fieldSpecAdditional from '../libs/field-spec-additional'
|
||||
|
||||
|
||||
const MAPLIBRE_GL_VERSION = pkgLockJson.dependencies["maplibre-gl"].version;
|
||||
const MAPLIBRE_GL_VERSION = version;
|
||||
|
||||
|
||||
export default class ModalExport extends React.Component {
|
||||
|
||||
@@ -8,7 +8,6 @@ import Fieldset from './Fieldset'
|
||||
const typeMap = {
|
||||
color: () => Block,
|
||||
enum: ({fieldSpec}) => (Object.keys(fieldSpec.values).length <= 3 ? Fieldset : Block),
|
||||
number: () => Block,
|
||||
boolean: () => Block,
|
||||
array: () => Fieldset,
|
||||
resolvedImage: () => Block,
|
||||
|
||||
Reference in New Issue
Block a user