diff --git a/API.md b/API.md
index b31ead90d..ef19df429 100644
--- a/API.md
+++ b/API.md
@@ -144,11 +144,11 @@ iD is used to edit data outside of the OpenStreetMap environment. There are some
### Presets
-iD can use external presets exclusively or along with the default OpenStreetMap presets. This is configured using the `iD().presets` accessor. To use external presets alone, initialize iD in index.html with the Presets object.
+iD can use external presets exclusively or along with the default OpenStreetMap presets. This is configured using the `context.presets` accessor. To use external presets alone, initialize the iD context with a custom `Presets` object:
```js
-var iD = iD()
+var id = iD.Context(window)
.presets(customPresets)
.taginfo(iD.services.taginfo())
.imagery(iD.data.imagery);
@@ -159,11 +159,11 @@ The format of the Preset object is [documented here](https://github.com/openstre
### Imagery
-Just like Presets, Imagery can be configured using the `iD().imagery` accessor.
+Just like Presets, Imagery can be configured using the `context.imagery` accessor:
```js
-var iD = iD()
+var id = iD.Context(window)
.presets(customPresets)
.taginfo(iD.services.taginfo())
.imagery(customImagery);
@@ -175,11 +175,11 @@ The Imagery object should follow the structure defined by [editor-layer-index](h
### Taginfo
-[Taginfo](http://taginfo.openstreetmap.org/) is a service that provides comprehensive documentation about the tags used in OpenStreetMap. iD uses Taginfo to display description and also autocomplete keys and values. This can be completely disabled by removing the `iD().taginfo` accessor. To point iD to a different instance of Taginfo other than the default OpenStreetMap instance
+[Taginfo](http://taginfo.openstreetmap.org/) is a service that provides comprehensive documentation about the tags used in OpenStreetMap. iD uses Taginfo to display description and also autocomplete keys and values. This can be completely disabled by removing the `context.taginfo` accessor. To point iD to a different instance of Taginfo other than the default OpenStreetMap instance:
```js
-var iD = iD()
+var id = iD.Context(window)
.presets(customPresets)
.taginfo(iD.services.taginfo().endpoint('url'))
.imagery(customImagery);
@@ -188,11 +188,11 @@ var iD = iD()
### Minimum Editable Zoom
-The minimum zoom at which iD enters the edit mode is configured using the `iD().minEditableZoom()` accessor. The default value is 16. To change this initialise iD as
+The minimum zoom at which iD enters the edit mode is configured using the `context.minEditableZoom()` accessor. The default value is 16. To change this initialise the iD context as:
```js
-var iD = iD().
+var id = iD.Context(window).
.minEditableZoom(zoom_level)
```
diff --git a/Makefile b/Makefile
index 95e83cb49..b2d284ded 100644
--- a/Makefile
+++ b/Makefile
@@ -62,7 +62,6 @@ dist/iD.js: \
js/lib/d3.curtain.js \
js/lib/d3.value.js \
js/lib/lodash.js \
- js/id/id.js \
$(MODULE_TARGETS) \
js/lib/locale.js \
data/introGraph.js
diff --git a/data/presets/README.md b/data/presets/README.md
index 9f2e59f08..60a01ba78 100644
--- a/data/presets/README.md
+++ b/data/presets/README.md
@@ -97,7 +97,7 @@ iD supports deployments which use a custom set of presets. You can supply preset
the `presets` accessor:
```js
-var id = iD().presets({
+var id = iD.Context(window).presets({
presets: { ... },
fields: { ... },
defaults: { ... },
diff --git a/dist/index.html b/dist/index.html
index d3fb15a1f..f9ac02e4e 100644
--- a/dist/index.html
+++ b/dist/index.html
@@ -39,10 +39,10 @@
document.getElementById('id-container').innerHTML = 'Sorry, your browser is not currently supported. Please use Potlatch 2 to edit the map.';
document.getElementById('id-container').className = 'unsupported';
} else {
- var id = iD()
+ var id = iD.Context(window)
.presets(iD.data.presets)
.imagery(iD.data.imagery)
- .taginfo(iD.services.taginfo());
+ .taginfo(iD.services.taginfo.init());
d3.select('#id-container')
.call(id.ui());
diff --git a/index.html b/index.html
index 959f46be4..8297031f8 100644
--- a/index.html
+++ b/index.html
@@ -25,8 +25,6 @@
-
-
@@ -37,7 +35,7 @@
-
-
diff --git a/test/spec/actions/split.js b/test/spec/actions/split.js
index 90aecf231..850343356 100644
--- a/test/spec/actions/split.js
+++ b/test/spec/actions/split.js
@@ -1,7 +1,8 @@
describe('iD.actions.Split', function () {
beforeEach(function () {
- iD.areaKeys = iD().presets(iD.data.presets).presets().areaKeys();
+ iD.areaKeys = iD.Context(window)
+ .presets(iD.data.presets).presets().areaKeys();
});
describe('#disabled', function () {
diff --git a/test/spec/behavior/hash.js b/test/spec/behavior/hash.js
index dce4c2fb6..7800d9c7f 100644
--- a/test/spec/behavior/hash.js
+++ b/test/spec/behavior/hash.js
@@ -4,7 +4,8 @@ describe('iD.behavior.Hash', function () {
var hash, context;
beforeEach(function () {
- context = iD().imagery(iD.data.imagery);
+ context = iD.Context(window)
+ .imagery(iD.data.imagery);
context.container(d3.select(document.createElement('div')));
// Neuter connection
diff --git a/test/spec/behavior/lasso.js b/test/spec/behavior/lasso.js
index aca4137b3..f04b8d5f2 100644
--- a/test/spec/behavior/lasso.js
+++ b/test/spec/behavior/lasso.js
@@ -2,7 +2,7 @@ describe('iD.behavior.Lasso', function () {
var lasso, context;
beforeEach(function () {
- context = iD().imagery(iD.data.imagery);
+ context = iD.Context(window).imagery(iD.data.imagery);
context.container(d3.select(document.createElement('div')));
// Neuter connection
diff --git a/test/spec/behavior/select.js b/test/spec/behavior/select.js
index bb801ec9d..10fa1640e 100644
--- a/test/spec/behavior/select.js
+++ b/test/spec/behavior/select.js
@@ -3,8 +3,7 @@ describe('iD.behavior.Select', function() {
beforeEach(function() {
container = d3.select('body').append('div');
-
- context = iD().imagery(iD.data.imagery).container(container);
+ context = iD.Context(window).imagery(iD.data.imagery).container(container);
a = iD.Node({loc: [0, 0]});
b = iD.Node({loc: [0, 0]});
diff --git a/test/spec/core/connection.js b/test/spec/core/connection.js
index 718707598..991174a2e 100644
--- a/test/spec/core/connection.js
+++ b/test/spec/core/connection.js
@@ -254,7 +254,7 @@ describe('iD.Connection', function () {
changesetsXML = '' +
'' +
'' +
- '' +
+ '' +
'' +
'';
@@ -275,7 +275,7 @@ describe('iD.Connection', function () {
expect(changesets).to.deep.equal([{
tags: {
comment: 'Caprice Court has been extended',
- created_by: 'iD 1.8.5'
+ created_by: 'iD 2.0.0'
}
}]);
done();
@@ -289,7 +289,7 @@ describe('iD.Connection', function () {
describe('#changesetTags', function() {
it('omits comment when empty', function() {
- expect(c.changesetTags('', [])).not.to.have.property('comment');
+ expect(c.changesetTags('2.0.0', '', [])).not.to.have.property('comment');
});
});
});
diff --git a/test/spec/core/history.js b/test/spec/core/history.js
index 7e3ee1d32..455b86cda 100644
--- a/test/spec/core/history.js
+++ b/test/spec/core/history.js
@@ -3,7 +3,7 @@ describe('iD.History', function () {
action = function() { return iD.Graph(); };
beforeEach(function () {
- context = iD();
+ context = iD.Context(window);
history = context.history();
spy = sinon.spy();
// clear lock
diff --git a/test/spec/id.js b/test/spec/id.js
index e232f28ae..098a5d61e 100644
--- a/test/spec/id.js
+++ b/test/spec/id.js
@@ -5,7 +5,7 @@ describe('iD', function() {
describe('#assetPath', function() {
it('sets and gets assetPath', function() {
- var context = iD();
+ var context = iD.Context(window);
expect(context.assetPath()).to.eql('');
context.assetPath('iD/');
@@ -15,7 +15,7 @@ describe('iD', function() {
describe('#assetMap', function() {
it('sets and gets assetMap', function() {
- var context = iD();
+ var context = iD.Context(window);
expect(context.assetMap()).to.eql({});
context.assetMap(assets);
@@ -25,8 +25,8 @@ describe('iD', function() {
describe('#asset', function() {
var context;
- beforeEach(function () {
- context = iD().assetPath('iD/').assetMap(assets);
+ beforeEach(function() {
+ context = iD.Context(window).assetPath('iD/').assetMap(assets);
});
it('looks first in assetMap', function() {
@@ -39,8 +39,8 @@ describe('iD', function() {
describe('#imagePath', function() {
var context;
- beforeEach(function () {
- context = iD().assetPath('iD/').assetMap(assets);
+ beforeEach(function() {
+ context = iD.Context(window).assetPath('iD/').assetMap(assets);
});
it('looks first in assetMap', function() {
@@ -58,9 +58,7 @@ describe('iD', function() {
'mines': {
geometry: ['point', 'area'],
name: 'Mining Concession',
- tags: {
- 'concession': 'mining'
- }
+ tags: { 'concession': 'mining' }
},
'area': {
'name': 'Area',
@@ -93,7 +91,7 @@ describe('iD', function() {
}
};
- var context = iD().presets(presetsCollection),
+ var context = iD.Context(window).presets(presetsCollection),
way = iD.Way({tags: {concession: 'mining', area: 'yes'}}),
graph = iD.Graph([way]);
@@ -103,7 +101,7 @@ describe('iD', function() {
describe('#debug', function() {
it('sets and gets debug flags', function() {
- var context = iD(),
+ var context = iD.Context(window),
flags = {
tile: false,
collision: false,
diff --git a/test/spec/modes/add_point.js b/test/spec/modes/add_point.js
index 516dc56f8..281435037 100644
--- a/test/spec/modes/add_point.js
+++ b/test/spec/modes/add_point.js
@@ -4,7 +4,7 @@ describe('iD.modes.AddPoint', function() {
beforeEach(function() {
var container = d3.select(document.createElement('div'));
- context = iD()
+ context = iD.Context(window)
.presets(iD.data.presets)
.imagery([])
.container(container);
diff --git a/test/spec/renderer/features.js b/test/spec/renderer/features.js
index df16f52f2..9b4c837f5 100644
--- a/test/spec/renderer/features.js
+++ b/test/spec/renderer/features.js
@@ -4,7 +4,7 @@ describe('iD.Features', function() {
features;
beforeEach(function() {
- context = iD();
+ context = iD.Context(window);
context.map().zoom(16);
features = iD.Features(context);
});
diff --git a/test/spec/renderer/map.js b/test/spec/renderer/map.js
index 9e57f24fe..0ac4b05e4 100644
--- a/test/spec/renderer/map.js
+++ b/test/spec/renderer/map.js
@@ -2,7 +2,7 @@ describe('iD.Map', function() {
var context, map;
beforeEach(function() {
- context = iD().imagery(iD.data.imagery);
+ context = iD.Context(window).imagery(iD.data.imagery);
context.container(d3.select(document.createElement('div')));
map = context.map();
d3.select(document.createElement('div'))
diff --git a/test/spec/renderer/tile_layer.js b/test/spec/renderer/tile_layer.js
index 66b225292..f937deea9 100644
--- a/test/spec/renderer/tile_layer.js
+++ b/test/spec/renderer/tile_layer.js
@@ -2,7 +2,7 @@ describe('iD.TileLayer', function() {
var context, d, c;
beforeEach(function() {
- context = iD();
+ context = iD.Context(window);
d = d3.select(document.createElement('div'));
c = iD.TileLayer(context).projection(d3.geo.mercator());
});
diff --git a/test/spec/services/mapillary.js b/test/spec/services/mapillary.js
index 6896cda6b..4ed11e73f 100644
--- a/test/spec/services/mapillary.js
+++ b/test/spec/services/mapillary.js
@@ -3,7 +3,7 @@ describe('iD.services.mapillary', function() {
context, server, mapillary;
beforeEach(function() {
- context = iD().assetPath('../dist/');
+ context = iD.Context(window).assetPath('../dist/');
context.projection.scale(667544.214430109); // z14
context.projection.translate([-116508, 0]); // 10,0
diff --git a/test/spec/svg/areas.js b/test/spec/svg/areas.js
index ee0a289f0..880ec0b88 100644
--- a/test/spec/svg/areas.js
+++ b/test/spec/svg/areas.js
@@ -7,7 +7,7 @@ describe('iD.svg.Areas', function () {
beforeEach(function () {
surface = d3.select(document.createElementNS('http://www.w3.org/2000/svg', 'svg'))
- .call(iD.svg.Layers(projection, iD()));
+ .call(iD.svg.Layers(projection, iD.Context(window)));
});
it('adds way and area classes', function () {
diff --git a/test/spec/svg/lines.js b/test/spec/svg/lines.js
index 75cd97522..d1b914b03 100644
--- a/test/spec/svg/lines.js
+++ b/test/spec/svg/lines.js
@@ -7,7 +7,7 @@ describe('iD.svg.Lines', function () {
beforeEach(function () {
surface = d3.select(document.createElementNS('http://www.w3.org/2000/svg', 'svg'))
- .call(iD.svg.Layers(projection, iD()));
+ .call(iD.svg.Layers(projection, iD.Context(window)));
});
it('adds way and line classes', function () {
diff --git a/test/spec/svg/midpoints.js b/test/spec/svg/midpoints.js
index 12d52b67e..6bd250983 100644
--- a/test/spec/svg/midpoints.js
+++ b/test/spec/svg/midpoints.js
@@ -5,7 +5,7 @@ describe('iD.svg.Midpoints', function () {
context;
beforeEach(function () {
- context = iD();
+ context = iD.Context(window);
surface = d3.select(document.createElementNS('http://www.w3.org/2000/svg', 'svg'))
.call(iD.svg.Layers(projection, context));
});
diff --git a/test/spec/svg/points.js b/test/spec/svg/points.js
index 10ceaccb3..6ea1a9259 100644
--- a/test/spec/svg/points.js
+++ b/test/spec/svg/points.js
@@ -4,7 +4,7 @@ describe('iD.svg.Points', function () {
context;
beforeEach(function () {
- context = iD().presets(iD.data.presets);
+ context = iD.Context(window).presets(iD.data.presets);
surface = d3.select(document.createElementNS('http://www.w3.org/2000/svg', 'svg'))
.call(iD.svg.Layers(projection, context));
});
diff --git a/test/spec/svg/vertices.js b/test/spec/svg/vertices.js
index 8899fc6d0..9d48be59e 100644
--- a/test/spec/svg/vertices.js
+++ b/test/spec/svg/vertices.js
@@ -4,7 +4,7 @@ describe('iD.svg.Vertices', function () {
context;
beforeEach(function () {
- context = iD();
+ context = iD.Context(window);
surface = d3.select(document.createElementNS('http://www.w3.org/2000/svg', 'svg'))
.call(iD.svg.Layers(projection, context));
});
diff --git a/test/spec/ui/fields/access.js b/test/spec/ui/fields/access.js
index 84dce3b3f..3226f7c91 100644
--- a/test/spec/ui/fields/access.js
+++ b/test/spec/ui/fields/access.js
@@ -2,7 +2,8 @@ describe('access', function() {
var selection, field;
beforeEach(function() {
selection = d3.select(document.createElement('div'));
- field = iD().presets(iD.data.presets).presets().field('access');
+ field = iD.Context(window)
+ .presets(iD.data.presets).presets().field('access');
});
it('creates inputs for a variety of modes of access', function() {
diff --git a/test/spec/ui/fields/wikipedia.js b/test/spec/ui/fields/wikipedia.js
index 3f0adc35d..bd268260d 100644
--- a/test/spec/ui/fields/wikipedia.js
+++ b/test/spec/ui/fields/wikipedia.js
@@ -25,7 +25,7 @@ describe('wikipedia', function() {
beforeEach(function() {
entity = iD.Node({id: 'n12345'});
selectedId = entity.id;
- context = iD();
+ context = iD.Context(window);
context.history().merge([entity]);
selection = d3.select(document.createElement('div'));
field = context.presets(iD.data.presets).presets().field('wikipedia');
diff --git a/test/spec/ui/raw_tag_editor.js b/test/spec/ui/raw_tag_editor.js
index da9b1f7e9..afcd3405b 100644
--- a/test/spec/ui/raw_tag_editor.js
+++ b/test/spec/ui/raw_tag_editor.js
@@ -15,7 +15,7 @@ describe('iD.ui.RawTagEditor', function() {
beforeEach(function () {
entity = iD.Node({id: 'n12345'});
- context = iD();
+ context = iD.Context(window);
context.history().merge([entity]);
render({highway: 'residential'});
});