From 51e41b7bcebe0b6022d4becdc972d2db2309b999 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Tue, 12 Nov 2024 15:28:05 +0100 Subject: [PATCH] chore: remove unused imports from global.js --- umap/static/umap/js/modules/global.js | 59 ++------------------ umap/static/umap/js/modules/help.js | 3 +- umap/static/umap/js/modules/rendering/map.js | 3 +- umap/static/umap/js/modules/rules.js | 3 +- umap/static/umap/js/modules/umap.js | 3 +- 5 files changed, 12 insertions(+), 59 deletions(-) diff --git a/umap/static/umap/js/modules/global.js b/umap/static/umap/js/modules/global.js index 55064251..8f56d3b5 100644 --- a/umap/static/umap/js/modules/global.js +++ b/umap/static/umap/js/modules/global.js @@ -1,37 +1,13 @@ -import { - uMapAlert as Alert, - uMapAlertCreation as AlertCreation, -} from '../components/alerts/alert.js' -import { - AjaxAutocomplete, - AjaxAutocompleteMultiple, - AutocompleteDatalist, -} from './autocomplete.js' -import Browser from './browser.js' -import Caption from './caption.js' -import ContextMenu from './ui/contextmenu.js' -import Facets from './facets.js' -import { Formatter } from './formatter.js' +import { uMapAlert as Alert } from '../components/alerts/alert.js' +import { AjaxAutocomplete, AjaxAutocompleteMultiple } from './autocomplete.js' import Help from './help.js' -import Importer from './importer.js' -import Orderable from './orderable.js' -import { HTTPError, NOKError, Request, RequestError, ServerRequest } from './request.js' -import Rules from './rules.js' +import { ServerRequest } from './request.js' import { SCHEMA } from './schema.js' -import Share from './share.js' -import Slideshow from './slideshow.js' -import { SyncEngine } from './sync/engine.js' -import Dialog from './ui/dialog.js' -import { EditPanel, FullPanel, Panel } from './ui/panel.js' -import Tooltip from './ui/tooltip.js' -import URLs from './urls.js' import * as Utils from './utils.js' import * as Icon from './rendering/icon.js' -import { DataLayer, LAYER_TYPES } from './data/layer.js' -import { DataLayerPermissions, MapPermissions } from './permissions.js' +import { LAYER_TYPES } from './data/layer.js' import { Point, LineString, Polygon } from './data/features.js' import { LeafletMarker, LeafletPolyline, LeafletPolygon } from './rendering/ui.js' -import * as SAVEMANAGER from './saving.js' // Import modules and export them to the global scope. // For the not yet module-compatible JS out there. @@ -39,45 +15,18 @@ import * as SAVEMANAGER from './saving.js' // By alphabetic order window.U = { Alert, - AlertCreation, AjaxAutocomplete, AjaxAutocompleteMultiple, - AutocompleteDatalist, - Browser, - Caption, - ContextMenu, - DataLayer, - DataLayerPermissions, - Dialog, - EditPanel, - Facets, - Formatter, - FullPanel, Help, - HTTPError, Icon, - Importer, LAYER_TYPES, LeafletMarker, LeafletPolygon, LeafletPolyline, LineString, - MapPermissions, - NOKError, - Orderable, - Panel, Point, Polygon, - Request, - RequestError, - Rules, - SAVEMANAGER, SCHEMA, ServerRequest, - Share, - Slideshow, - SyncEngine, - Tooltip, - URLs, Utils, } diff --git a/umap/static/umap/js/modules/help.js b/umap/static/umap/js/modules/help.js index 281138d4..0530dd1d 100644 --- a/umap/static/umap/js/modules/help.js +++ b/umap/static/umap/js/modules/help.js @@ -1,6 +1,7 @@ import { DomEvent, DomUtil } from '../../vendors/leaflet/leaflet-src.esm.js' import { translate } from './i18n.js' import * as Utils from './utils.js' +import Dialog from './ui/dialog.js' const SHORTCUTS = { DRAW_MARKER: { @@ -166,7 +167,7 @@ const ENTRIES = { export default class Help { constructor(umap) { this.umap = umap - this.dialog = new U.Dialog({ className: 'dark', accept: false, cancel: false }) + this.dialog = new Dialog({ className: 'dark', accept: false, cancel: false }) this.isMacOS = /mac/i.test( // eslint-disable-next-line compat/compat -- Fallback available. navigator.userAgentData ? navigator.userAgentData.platform : navigator.platform diff --git a/umap/static/umap/js/modules/rendering/map.js b/umap/static/umap/js/modules/rendering/map.js index f4f5b573..b50b0275 100644 --- a/umap/static/umap/js/modules/rendering/map.js +++ b/umap/static/umap/js/modules/rendering/map.js @@ -12,6 +12,7 @@ import { translate } from '../i18n.js' import { uMapAlert as Alert } from '../../components/alerts/alert.js' import * as Utils from '../utils.js' import * as Icon from './icon.js' +import ContextMenu from '../ui/contextmenu.js' // Those options are not saved on the server, so they can live here // instead of in umap.properties @@ -203,7 +204,7 @@ const ControlsMixin = { `) rightContainer.appendChild(button) - const menu = new U.ContextMenu({ className: 'dark', fixed: true }) + const menu = new ContextMenu({ className: 'dark', fixed: true }) const actions = [ { label: translate('New map'), diff --git a/umap/static/umap/js/modules/rules.js b/umap/static/umap/js/modules/rules.js index 21a0e06c..38c81274 100644 --- a/umap/static/umap/js/modules/rules.js +++ b/umap/static/umap/js/modules/rules.js @@ -2,6 +2,7 @@ import { DomEvent, DomUtil, stamp } from '../../vendors/leaflet/leaflet-src.esm. import { translate } from './i18n.js' import * as Utils from './utils.js' import { AutocompleteDatalist } from './autocomplete.js' +import Orderable from './orderable.js' const EMPTY_VALUES = ['', undefined, null] @@ -236,7 +237,7 @@ export default class Rules { rule.renderToolbox(DomUtil.create('li', 'orderable', ul)) } - const orderable = new U.Orderable(ul, this.onReorder.bind(this)) + const orderable = new Orderable(ul, this.onReorder.bind(this)) } DomUtil.createButton('umap-add', body, translate('Add rule'), this.addRule, this) diff --git a/umap/static/umap/js/modules/umap.js b/umap/static/umap/js/modules/umap.js index b104d97b..8895e068 100644 --- a/umap/static/umap/js/modules/umap.js +++ b/umap/static/umap/js/modules/umap.js @@ -32,6 +32,7 @@ import { uMapAlertCreation as AlertCreation, uMapAlert as Alert, } from '../components/alerts/alert.js' +import Orderable from './orderable.js' export default class Umap extends ServerStored { constructor(element, geojson) { @@ -1382,7 +1383,7 @@ export default class Umap extends ServerStored { }) this.indexDatalayers() } - const orderable = new U.Orderable(ul, onReorder) + const orderable = new Orderable(ul, onReorder) const bar = DomUtil.create('div', 'button-bar', container) DomUtil.createButton(