Skip to content

Commit

Permalink
Move the final few things from modules/svg folder
Browse files Browse the repository at this point in the history
- svgIcon -> uiIcon (and remove unused 3rd useklass argument)
- svgDefs -> uiDefs
  • Loading branch information
bhousel committed Apr 18, 2023
1 parent 549d1d0 commit 05f2f34
Show file tree
Hide file tree
Showing 81 changed files with 228 additions and 230 deletions.
12 changes: 0 additions & 12 deletions modules/svg/icon.js

This file was deleted.

2 changes: 0 additions & 2 deletions modules/svg/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export { svgDefs } from './defs.js';
export { svgIcon } from './icon.js';
export { svgTagClasses } from './tag_classes.js';
4 changes: 2 additions & 2 deletions modules/ui/account.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { t } from '../core/localizer';
import { svgIcon } from '../svg/icon';
import { uiIcon } from './icon';


export function uiAccount(context) {
Expand Down Expand Up @@ -38,7 +38,7 @@ export function uiAccount(context) {
.attr('src', user.image_url);
} else {
userLink
.call(svgIcon('#rapid-icon-avatar', 'pre-text light'));
.call(uiIcon('#rapid-icon-avatar', 'pre-text light'));
}

// Add user name
Expand Down
4 changes: 2 additions & 2 deletions modules/ui/changeset_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { utilArrayUniqBy } from '@rapid-sdk/util';

import { presetManager } from '../presets';
import { t } from '../core/localizer';
import { svgIcon } from '../svg/icon';
import { uiIcon } from './icon';
import { uiCombobox} from './combobox';
import { uiField } from './field';
import { uiFormFields } from './form_fields';
Expand Down Expand Up @@ -105,7 +105,7 @@ export function uiChangesetEditor(context) {
commentEnter
.append('a')
.attr('target', '_blank')
.call(svgIcon('#rapid-icon-alert', 'inline'))
.call(uiIcon('#rapid-icon-alert', 'inline'))
.attr('href', t('commit.google_warning_link'))
.append('span')
.html(t.html('commit.google_warning'));
Expand Down
4 changes: 2 additions & 2 deletions modules/ui/commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import deepEqual from 'fast-deep-equal';
import { prefs } from '../core/preferences';
import { t, localizer } from '../core/localizer';
import { osmChangeset } from '../osm';
import { svgIcon } from '../svg/icon';
import { uiIcon } from './icon';
import { services } from '../services';
import { uiTooltip } from './tooltip';
import { uiChangesetEditor } from './changeset_editor';
Expand Down Expand Up @@ -243,7 +243,7 @@ export function uiCommit(context) {
.on('click', function() {
dispatch.call('cancel', this);
})
.call(svgIcon('#rapid-icon-close'));
.call(uiIcon('#rapid-icon-close'));

var body = selection.selectAll('.body')
.data([0]);
Expand Down
4 changes: 2 additions & 2 deletions modules/ui/commit_warnings.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { utilEntityOrMemberSelector } from '@rapid-sdk/util';

import { t } from '../core/localizer';
import { svgIcon } from '../svg/icon';
import { uiIcon } from './icon';
import { uiTooltip } from './tooltip';


Expand Down Expand Up @@ -74,7 +74,7 @@ export function uiCommitWarnings(context) {
});

buttons
.call(svgIcon('#rapid-icon-alert', 'pre-text'));
.call(uiIcon('#rapid-icon-alert', 'pre-text'));

buttons
.append('strong')
Expand Down
6 changes: 3 additions & 3 deletions modules/ui/conflicts.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { utilEntityOrMemberSelector } from '@rapid-sdk/util';
import { t } from '../core/localizer';
import { JXON } from '../util/jxon';
import { osmChangeset } from '../osm';
import { svgIcon } from '../svg/icon';
import { uiIcon } from './icon';
import { utilDetect, utilKeybinding, utilRebind, utilWrap } from '../util';


Expand Down Expand Up @@ -52,7 +52,7 @@ export function uiConflicts(context) {
.append('button')
.attr('class', 'fr')
.on('click', cancel)
.call(svgIcon('#rapid-icon-close'));
.call(uiIcon('#rapid-icon-close'));

headerEnter
.append('h3')
Expand Down Expand Up @@ -98,7 +98,7 @@ export function uiConflicts(context) {
}

linkEnter
.call(svgIcon('#rapid-icon-load', 'inline'))
.call(uiIcon('#rapid-icon-load', 'inline'))
.append('span')
.html(t.html('save.conflict.download_changes'));

Expand Down
4 changes: 2 additions & 2 deletions modules/ui/contributors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import _debounce from 'lodash-es/debounce';
import { select as d3_select } from 'd3-selection';

import { t } from '../core/localizer';
import { svgIcon } from '../svg/icon';
import { uiIcon } from './icon';


export function uiContributors(context) {
Expand All @@ -27,7 +27,7 @@ export function uiContributors(context) {
subset = u.slice(0, u.length > limit ? limit - 1 : limit);

wrap.html('')
.call(svgIcon('#rapid-icon-nearby', 'pre-text light'));
.call(uiIcon('#rapid-icon-nearby', 'pre-text light'));

var userList = d3_select(document.createElement('span'));

Expand Down
4 changes: 2 additions & 2 deletions modules/ui/data_editor.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { t } from '../core/localizer';
import { svgIcon } from '../svg/icon';
import { uiIcon } from './icon';

import { uiDataHeader } from './data_header';
import { uiSectionRawTagEditor } from './sections/raw_tag_editor';
Expand Down Expand Up @@ -28,7 +28,7 @@ export function uiDataEditor(context) {
.on('click', function() {
context.enter('browse');
})
.call(svgIcon('#rapid-icon-close'));
.call(uiIcon('#rapid-icon-close'));

headerEnter
.append('h3')
Expand Down
4 changes: 2 additions & 2 deletions modules/ui/data_header.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { t } from '../core/localizer';
import { svgIcon } from '../svg/icon';
import { uiIcon } from './icon';


export function uiDataHeader() {
Expand All @@ -26,7 +26,7 @@ export function uiDataHeader() {

iconEnter
.append('div')
.call(svgIcon('#rapid-icon-data', 'note-fill'));
.call(uiIcon('#rapid-icon-data', 'note-fill'));

headerEnter
.append('div')
Expand Down
2 changes: 1 addition & 1 deletion modules/svg/defs.js → modules/ui/defs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { select as d3_select } from 'd3-selection';
/*
* A standalone SVG `defs` element that contains the icon spritesheets for the user interface
*/
export function svgDefs(context) {
export function uiDefs(context) {
const spritesheetIDs = ['rapid-sprite', 'maki-sprite', 'temaki-sprite', 'fa-sprite', 'community-sprite'];

function render(selection) {
Expand Down
4 changes: 2 additions & 2 deletions modules/ui/disclosure.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { dispatch as d3_dispatch } from 'd3-dispatch';

import { localizer } from '../core/localizer';
import { prefs } from '../core/preferences';
import { svgIcon } from '../svg/icon';
import { uiIcon } from './icon';
import { utilFunctor } from '../util';
import { utilRebind } from '../util/rebind';
import { uiToggle } from './toggle';
Expand Down Expand Up @@ -31,7 +31,7 @@ export function uiDisclosure(context, key, expandedDefault) {
.append('a')
.attr('href', '#')
.attr('class', `hide-toggle hide-toggle-${key}`)
.call(svgIcon('', 'pre-text', 'hide-toggle-icon'));
.call(uiIcon('', 'pre-text', 'hide-toggle-icon'));

hideToggleEnter
.append('span')
Expand Down
4 changes: 2 additions & 2 deletions modules/ui/edit_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { localizer } from '../core/localizer';
import { uiTooltip } from './tooltip';
import { utilRebind } from '../util/rebind';
import { utilHighlightEntities } from '../util/util';
import { svgIcon } from '../svg/icon';
import { uiIcon } from './icon';


export function uiEditMenu(context) {
Expand Down Expand Up @@ -106,7 +106,7 @@ export function uiEditMenu(context) {
.call(tooltip)
.append('div')
.attr('class', 'icon-wrap')
.call(svgIcon(`#rapid-operation-${d.id}`, 'operation'));
.call(uiIcon(`#rapid-operation-${d.id}`, 'operation'));
});

if (showLabels) {
Expand Down
6 changes: 3 additions & 3 deletions modules/ui/entity_editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import deepEqual from 'fast-deep-equal';
import { presetManager } from '../presets';
import { t, localizer } from '../core/localizer';
import { actionChangeTags } from '../actions/change_tags';
import { svgIcon } from '../svg/icon';
import { uiIcon } from './icon';
import { utilRebind } from '../util';

import { uiSectionEntityIssues } from './sections/entity_issues';
Expand Down Expand Up @@ -131,13 +131,13 @@ export function uiEntityEditor(context) {
headerEnter
.append('button')
.attr('class', 'preset-reset preset-choose')
.call(svgIcon((localizer.textDirection() === 'rtl') ? '#rapid-icon-forward' : '#rapid-icon-backward'));
.call(uiIcon((localizer.textDirection() === 'rtl') ? '#rapid-icon-forward' : '#rapid-icon-backward'));

headerEnter
.append('button')
.attr('class', 'close')
.on('click', function() { context.enter('browse'); })
.call(svgIcon(_modified ? '#rapid-icon-apply' : '#rapid-icon-close'));
.call(uiIcon(_modified ? '#rapid-icon-apply' : '#rapid-icon-close'));

headerEnter
.append('h3');
Expand Down
8 changes: 4 additions & 4 deletions modules/ui/feature_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Graph } from '../core/Graph';
import { modeSelect } from '../modes/select';
import { osmEntity } from '../osm/entity';
import { services } from '../services';
import { svgIcon } from '../svg/icon';
import { uiIcon } from './icon';
import { uiCmd } from './cmd';

import {
Expand Down Expand Up @@ -38,7 +38,7 @@ export function uiFeatureList(context) {
.attr('class', 'search-header');

searchWrap
.call(svgIcon('#rapid-icon-search', 'pre-text'));
.call(uiIcon('#rapid-icon-search', 'pre-text'));

var search = searchWrap
.append('input')
Expand Down Expand Up @@ -254,7 +254,7 @@ export function uiFeatureList(context) {
.append('button')
.property('disabled', true)
.attr('class', 'no-results-item')
.call(svgIcon('#rapid-icon-alert', 'pre-text'));
.call(uiIcon('#rapid-icon-alert', 'pre-text'));

resultsIndicator.append('span')
.attr('class', 'entity-name');
Expand Down Expand Up @@ -303,7 +303,7 @@ export function uiFeatureList(context) {
label
.each(function(d) {
d3_select(this)
.call(svgIcon('#rapid-icon-' + d.geometry, 'pre-text'));
.call(uiIcon('#rapid-icon-' + d.geometry, 'pre-text'));
});

label
Expand Down
6 changes: 3 additions & 3 deletions modules/ui/field.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { utilUniqueString } from '@rapid-sdk/util';

import { t, localizer } from '../core/localizer';
import { locationManager } from '../core/LocationManager';
import { svgIcon } from '../svg/icon';
import { uiIcon } from './icon';
import { uiTooltip } from './tooltip';
// import { uiFieldHelp } from './field_help';
import { uiFields } from './fields';
Expand Down Expand Up @@ -160,15 +160,15 @@ export function uiField(context, presetField, entityIDs, options) {
.append('button')
.attr('class', 'remove-icon')
.attr('title', t('icons.remove'))
.call(svgIcon('#rapid-operation-delete'));
.call(uiIcon('#rapid-operation-delete'));
}

if (options.revert) {
labelEnter
.append('button')
.attr('class', 'modified-icon')
.attr('title', t('icons.undo'))
.call(svgIcon((localizer.textDirection() === 'rtl') ? '#rapid-icon-redo' : '#rapid-icon-undo'));
.call(uiIcon((localizer.textDirection() === 'rtl') ? '#rapid-icon-redo' : '#rapid-icon-undo'));
}
}

Expand Down
6 changes: 3 additions & 3 deletions modules/ui/field_help.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
//import { marked } from 'marked';
//import { t, localizer } from '../core/localizer';
//import { svgIcon } from '../svg/icon';
//import { uiIcon } from './icon';
//import { icon } from './intro/helper';
//
//
Expand Down Expand Up @@ -146,7 +146,7 @@
// button.enter()
// .append('button')
// .attr('class', 'field-help-button')
// .call(svgIcon('#rapid-icon-help'))
// .call(uiIcon('#rapid-icon-help'))
// .merge(button)
// .on('click', function (d3_event) {
// d3_event.stopPropagation();
Expand Down Expand Up @@ -204,7 +204,7 @@
// d3_event.preventDefault();
// hide();
// })
// .call(svgIcon('#rapid-icon-close'));
// .call(uiIcon('#rapid-icon-close'));
//
// var navEnter = enter
// .append('div')
Expand Down
4 changes: 2 additions & 2 deletions modules/ui/fields/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { utilRebind } from '../../util/rebind';
import { t } from '../../core/localizer';
import { actionReverse } from '../../actions/reverse';
import { osmOneWayTags } from '../../osm';
import { svgIcon } from '../../svg/icon';
import { uiIcon } from '../icon';

export { uiFieldCheck as uiFieldDefaultCheck };
export { uiFieldCheck as uiFieldOnewayCheck };
Expand Down Expand Up @@ -84,7 +84,7 @@ export function uiFieldCheck(field, context) {

selection.selectAll('.reverser-span')
.html(t.html('inspector.check.reverser'))
.call(svgIcon(icon, 'inline'));
.call(uiIcon(icon, 'inline'));

return selection;
}
Expand Down
6 changes: 3 additions & 3 deletions modules/ui/fields/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { presetManager } from '../../presets';
import { fileFetcher } from '../../core/file_fetcher';
import { t, localizer } from '../../core/localizer';
import { utilGetSetValue, utilNoAuto, utilRebind, utilTotalExtent } from '../../util';
import { svgIcon } from '../../svg/icon';
import { uiIcon } from '../icon';

export {
uiFieldText as uiFieldUrl,
Expand Down Expand Up @@ -129,7 +129,7 @@ export function uiFieldText(field, context) {

outlinkButton.enter()
.append('button')
.call(svgIcon('#rapid-icon-out-link'))
.call(uiIcon('#rapid-icon-out-link'))
.attr('class', 'form-field-button foreign-id-permalink')
.attr('title', function() {
var domainResults = /^https?:\/\/(.{1,}?)\//.exec(field.urlFormat);
Expand Down Expand Up @@ -157,7 +157,7 @@ export function uiFieldText(field, context) {

outlinkButton.enter()
.append('button')
.call(svgIcon('#rapid-icon-out-link'))
.call(uiIcon('#rapid-icon-out-link'))
.attr('class', 'form-field-button foreign-id-permalink')
.attr('title', () => t('icons.visit_website'))
.on('click', function(d3_event) {
Expand Down
6 changes: 3 additions & 3 deletions modules/ui/fields/localized.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { presetManager } from '../../presets';
import { fileFetcher } from '../../core/file_fetcher';
import { t, localizer } from '../../core/localizer';
import { services } from '../../services';
import { svgIcon } from '../../svg/icon';
import { uiIcon } from '../icon';
import { uiTooltip } from '../tooltip';
import { uiCombobox } from '../combobox';
import { utilGetSetValue, utilNoAuto, utilRebind, utilTotalExtent } from '../../util';
Expand Down Expand Up @@ -190,7 +190,7 @@ export function uiFieldLocalized(field, context) {
translateButton = translateButton.enter()
.append('button')
.attr('class', 'localized-add form-field-button')
.call(svgIcon('#rapid-icon-plus'))
.call(uiIcon('#rapid-icon-plus'))
.merge(translateButton);

translateButton
Expand Down Expand Up @@ -405,7 +405,7 @@ export function uiFieldLocalized(field, context) {

renderMultilingual(selection);
})
.call(svgIcon('#rapid-operation-delete'));
.call(uiIcon('#rapid-operation-delete'));

wrap
.append('input')
Expand Down
Loading

0 comments on commit 05f2f34

Please sign in to comment.