ol-stac 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +2 -0
- package/.github/workflows/deploy.yml +67 -0
- package/.github/workflows/publish.yml +32 -0
- package/.github/workflows/release.yml +21 -0
- package/.github/workflows/test.yml +85 -0
- package/CHANGELOG.md +14 -0
- package/DEVELOPING.md +104 -0
- package/LICENSE.md +201 -0
- package/README.md +43 -0
- package/config/jsdoc/api/conf.json +38 -0
- package/config/jsdoc/api/index.md +1 -0
- package/config/jsdoc/api/readme.md +65 -0
- package/config/jsdoc/api/template/README.md +3 -0
- package/config/jsdoc/api/template/publish.js +743 -0
- package/config/jsdoc/api/template/static/scripts/linenumber.js +11 -0
- package/config/jsdoc/api/template/static/scripts/main.js +305 -0
- package/config/jsdoc/api/template/static/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/config/jsdoc/api/template/static/scripts/prettify/lang-css.js +2 -0
- package/config/jsdoc/api/template/static/scripts/prettify/prettify.js +28 -0
- package/config/jsdoc/api/template/static/styles/carbon.css +65 -0
- package/config/jsdoc/api/template/static/styles/jaguar.css +512 -0
- package/config/jsdoc/api/template/static/styles/prettify-jsdoc.css +111 -0
- package/config/jsdoc/api/template/static/styles/prettify-tomorrow.css +132 -0
- package/config/jsdoc/api/template/static/theme +1 -0
- package/config/jsdoc/api/template/tmpl/container.tmpl +205 -0
- package/config/jsdoc/api/template/tmpl/details.tmpl +84 -0
- package/config/jsdoc/api/template/tmpl/example.tmpl +2 -0
- package/config/jsdoc/api/template/tmpl/examples.tmpl +16 -0
- package/config/jsdoc/api/template/tmpl/exceptions.tmpl +30 -0
- package/config/jsdoc/api/template/tmpl/layout.tmpl +92 -0
- package/config/jsdoc/api/template/tmpl/mainpage.tmpl +14 -0
- package/config/jsdoc/api/template/tmpl/members.tmpl +38 -0
- package/config/jsdoc/api/template/tmpl/method.tmpl +132 -0
- package/config/jsdoc/api/template/tmpl/navigation.tmpl +59 -0
- package/config/jsdoc/api/template/tmpl/observables.tmpl +39 -0
- package/config/jsdoc/api/template/tmpl/params.tmpl +109 -0
- package/config/jsdoc/api/template/tmpl/properties.tmpl +85 -0
- package/config/jsdoc/api/template/tmpl/returns.tmpl +72 -0
- package/config/jsdoc/api/template/tmpl/source.tmpl +8 -0
- package/config/jsdoc/api/template/tmpl/stability.tmpl +7 -0
- package/config/jsdoc/api/template/tmpl/tutorial.tmpl +19 -0
- package/config/jsdoc/api/template/tmpl/type.tmpl +7 -0
- package/config/jsdoc/info/conf.json +22 -0
- package/config/jsdoc/info/publish.js +175 -0
- package/config/jsdoc/package.json +4 -0
- package/config/jsdoc/plugins/api.cjs +181 -0
- package/config/jsdoc/plugins/default-export.cjs +35 -0
- package/config/jsdoc/plugins/define-plugin.cjs +33 -0
- package/config/jsdoc/plugins/events.cjs +39 -0
- package/config/jsdoc/plugins/inline-options.cjs +102 -0
- package/config/jsdoc/plugins/markdown.cjs +119 -0
- package/config/jsdoc/plugins/observable.cjs +69 -0
- package/config/jsdoc/plugins/virtual-plugin.cjs +16 -0
- package/config/rollup-full-build.js +24 -0
- package/config/tsconfig-build.json +25 -0
- package/examples/.eslintrc +29 -0
- package/examples/index.html +100 -0
- package/examples/index.js +109 -0
- package/examples/planetary-computer.html +14 -0
- package/examples/planetary-computer.js +53 -0
- package/examples/resources/Jugl.js +15 -0
- package/examples/resources/common.js +111 -0
- package/examples/stac-collection-webmaplinks.html +9 -0
- package/examples/stac-collection-webmaplinks.js +55 -0
- package/examples/stac-item-from-object.html +9 -0
- package/examples/stac-item-from-object.js +102 -0
- package/examples/stac-item-tileserver.html +9 -0
- package/examples/stac-item-tileserver.js +34 -0
- package/examples/stac-item.html +9 -0
- package/examples/stac-item.js +45 -0
- package/examples/stac-itemcollection.html +11 -0
- package/examples/stac-itemcollection.js +39 -0
- package/examples/templates/example.html +206 -0
- package/examples/templates/readme.md +3 -0
- package/examples/webpack/config.mjs +69 -0
- package/examples/webpack/example-builder.js +410 -0
- package/package.json +107 -0
- package/site/build.js +26 -0
- package/site/layouts/default.hbs +78 -0
- package/site/src/doc/faq.md +8 -0
- package/site/src/doc/index.md +22 -0
- package/site/src/doc/quickstart.md +121 -0
- package/site/src/doc/tutorials/index.md +8 -0
- package/site/src/download/index.hbs +62 -0
- package/site/src/favicon.ico +0 -0
- package/site/src/index.hbs +71 -0
- package/site/src/theme/index.css +26 -0
- package/site/src/theme/site.css +531 -0
- package/src/ol/events/ErrorEvent.js +25 -0
- package/src/ol/layer/STAC.js +780 -0
- package/src/ol/layer/stacUtil.js +169 -0
- package/src/ol/source/GeoTIFF2.js +47 -0
- package/tasks/.eslintrc +5 -0
- package/tasks/build-website.sh +90 -0
- package/tasks/create-release.js +107 -0
- package/tasks/generate-index.js +125 -0
- package/tasks/generate-info.js +189 -0
- package/tasks/get-latest-release.js +36 -0
- package/tasks/newest-tag.js +52 -0
- package/tasks/prepare-package.js +46 -0
- package/tasks/publish.sh +90 -0
- package/test/README.md +56 -0
- package/test/browser/.eslintrc +14 -0
- package/test/browser/karma.config.cjs +94 -0
- package/test/browser/spec/ol/layer/STAC.test.js +18 -0
- package/test/browser/test-extensions.js +419 -0
- package/tsconfig.json +62 -0
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import {setLevel as setLogLevel} from 'ol/console.js';
|
|
2
|
+
|
|
3
|
+
setLogLevel('error');
|
|
4
|
+
|
|
5
|
+
(function (global) {
|
|
6
|
+
function afterLoad(type, path, next) {
|
|
7
|
+
const client = new XMLHttpRequest();
|
|
8
|
+
client.open('GET', path, true);
|
|
9
|
+
client.onload = function () {
|
|
10
|
+
let data;
|
|
11
|
+
if (type === 'xml') {
|
|
12
|
+
data = client.responseXML;
|
|
13
|
+
} else {
|
|
14
|
+
data = client.responseText;
|
|
15
|
+
}
|
|
16
|
+
if (!data) {
|
|
17
|
+
throw new Error(path + ' loading failed: ' + client.status);
|
|
18
|
+
}
|
|
19
|
+
next(data);
|
|
20
|
+
};
|
|
21
|
+
client.send();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {string} path Relative path to file (e.g. 'spec/ol/foo.json').
|
|
26
|
+
* @param {function(Object)} next Function to call with response object on
|
|
27
|
+
* success. On failure, an error is thrown with the reason.
|
|
28
|
+
*/
|
|
29
|
+
global.afterLoadJson = function (path, next) {
|
|
30
|
+
afterLoad('json', path, next);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @param {string} path Relative path to file (e.g. 'spec/ol/foo.txt').
|
|
35
|
+
* @param {function(string)} next Function to call with response text on
|
|
36
|
+
* success. On failure, an error is thrown with the reason.
|
|
37
|
+
*/
|
|
38
|
+
global.afterLoadText = function (path, next) {
|
|
39
|
+
afterLoad('text', path, next);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @param {string} path Relative path to file (e.g. 'spec/ol/foo.xml').
|
|
44
|
+
* @param {function(Document)} next Function to call with response xml on
|
|
45
|
+
* success. On failure, an error is thrown with the reason.
|
|
46
|
+
*/
|
|
47
|
+
global.afterLoadXml = function (path, next) {
|
|
48
|
+
afterLoad('xml', path, next);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// extensions to expect.js
|
|
52
|
+
const expect = global.expect;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Assert value is within some tolerance of a number.
|
|
56
|
+
* @param {number} n Number.
|
|
57
|
+
* @param {number} tol Tolerance.
|
|
58
|
+
* @return {expect.Assertion} The assertion.
|
|
59
|
+
*/
|
|
60
|
+
expect.Assertion.prototype.roughlyEqual = function (n, tol) {
|
|
61
|
+
this.assert(
|
|
62
|
+
Math.abs(this.obj - n) <= tol,
|
|
63
|
+
function () {
|
|
64
|
+
return (
|
|
65
|
+
'expected ' +
|
|
66
|
+
expect.stringify(this.obj) +
|
|
67
|
+
' to be within ' +
|
|
68
|
+
tol +
|
|
69
|
+
' of ' +
|
|
70
|
+
n
|
|
71
|
+
);
|
|
72
|
+
},
|
|
73
|
+
function () {
|
|
74
|
+
return (
|
|
75
|
+
'expected ' +
|
|
76
|
+
expect.stringify(this.obj) +
|
|
77
|
+
' not to be within ' +
|
|
78
|
+
tol +
|
|
79
|
+
' of ' +
|
|
80
|
+
n
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
return this;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
function getChildNodes(node, options) {
|
|
88
|
+
// check whitespace
|
|
89
|
+
if (options && options.includeWhiteSpace) {
|
|
90
|
+
return node.childNodes;
|
|
91
|
+
}
|
|
92
|
+
const nodes = [];
|
|
93
|
+
for (let i = 0, ii = node.childNodes.length; i < ii; i++) {
|
|
94
|
+
const child = node.childNodes[i];
|
|
95
|
+
if (child.nodeType == 1) {
|
|
96
|
+
// element node, add it
|
|
97
|
+
nodes.push(child);
|
|
98
|
+
} else if (child.nodeType == 3) {
|
|
99
|
+
// text node, add if non empty
|
|
100
|
+
if (
|
|
101
|
+
child.nodeValue &&
|
|
102
|
+
child.nodeValue.replace(/^\s*(.*?)\s*$/, '$1') !== ''
|
|
103
|
+
) {
|
|
104
|
+
nodes.push(child);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
if (options && options.ignoreElementOrder) {
|
|
109
|
+
nodes.sort(function (a, b) {
|
|
110
|
+
return a.nodeName > b.nodeName ? 1 : a.nodeName < b.nodeName ? -1 : 0;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
return nodes;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function assertElementNodesEqual(node1, node2, options, errors) {
|
|
117
|
+
const testPrefix = options && options.prefix === true;
|
|
118
|
+
if (node1.nodeType !== node2.nodeType) {
|
|
119
|
+
errors.push(
|
|
120
|
+
'nodeType test failed for: ' +
|
|
121
|
+
node1.nodeName +
|
|
122
|
+
' | ' +
|
|
123
|
+
node2.nodeName +
|
|
124
|
+
' | expected ' +
|
|
125
|
+
node1.nodeType +
|
|
126
|
+
' to equal ' +
|
|
127
|
+
node2.nodeType
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
if (testPrefix) {
|
|
131
|
+
if (node1.nodeName !== node2.nodeName) {
|
|
132
|
+
errors.push(
|
|
133
|
+
'nodeName test failed for: ' +
|
|
134
|
+
node1.nodeName +
|
|
135
|
+
' | ' +
|
|
136
|
+
node2.nodeName +
|
|
137
|
+
' | expected ' +
|
|
138
|
+
node1.nodeName +
|
|
139
|
+
' to equal ' +
|
|
140
|
+
node2.nodeName
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
} else {
|
|
144
|
+
const n1 = node1.nodeName.split(':').pop();
|
|
145
|
+
const n2 = node2.nodeName.split(':').pop();
|
|
146
|
+
if (n1 !== n2) {
|
|
147
|
+
errors.push(
|
|
148
|
+
'nodeName test failed for: ' +
|
|
149
|
+
node1.nodeName +
|
|
150
|
+
' | ' +
|
|
151
|
+
node2.nodeName +
|
|
152
|
+
' | expected ' +
|
|
153
|
+
n1 +
|
|
154
|
+
' to equal ' +
|
|
155
|
+
n2
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// for text nodes compare value
|
|
160
|
+
if (node1.nodeType === 3) {
|
|
161
|
+
const nv1 = node1.nodeValue.replace(/\s/g, '');
|
|
162
|
+
const nv2 = node2.nodeValue.replace(/\s/g, '');
|
|
163
|
+
if (nv1 !== nv2) {
|
|
164
|
+
errors.push(
|
|
165
|
+
'nodeValue test failed | expected ' + nv1 + ' to equal ' + nv2
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
} else if (node1.nodeType === 1) {
|
|
169
|
+
// for element type nodes compare namespace, attributes, and children
|
|
170
|
+
// test namespace alias and uri
|
|
171
|
+
if (node1.prefix || node2.prefix) {
|
|
172
|
+
if (testPrefix) {
|
|
173
|
+
if (node1.prefix !== node2.prefix) {
|
|
174
|
+
errors.push(
|
|
175
|
+
'Prefix test failed for: ' +
|
|
176
|
+
node1.nodeName +
|
|
177
|
+
' | expected ' +
|
|
178
|
+
node1.prefix +
|
|
179
|
+
' to equal ' +
|
|
180
|
+
node2.prefix
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (node1.namespaceURI || node2.namespaceURI) {
|
|
186
|
+
if (node1.namespaceURI !== node2.namespaceURI) {
|
|
187
|
+
errors.push(
|
|
188
|
+
'namespaceURI test failed for: ' +
|
|
189
|
+
node1.nodeName +
|
|
190
|
+
' | expected ' +
|
|
191
|
+
node1.namespaceURI +
|
|
192
|
+
' to equal ' +
|
|
193
|
+
node2.namespaceURI
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// compare attributes - disregard xmlns given namespace handling above
|
|
198
|
+
let node1AttrLen = 0;
|
|
199
|
+
const node1Attr = {};
|
|
200
|
+
let node2AttrLen = 0;
|
|
201
|
+
const node2Attr = {};
|
|
202
|
+
let ga, ea, gn, en;
|
|
203
|
+
let i, ii;
|
|
204
|
+
if (node1.attributes) {
|
|
205
|
+
for (i = 0, ii = node1.attributes.length; i < ii; ++i) {
|
|
206
|
+
ga = node1.attributes[i];
|
|
207
|
+
if (ga.specified === undefined || ga.specified === true) {
|
|
208
|
+
if (ga.name.split(':').shift() != 'xmlns') {
|
|
209
|
+
gn = testPrefix ? ga.name : ga.name.split(':').pop();
|
|
210
|
+
node1Attr[gn] = ga;
|
|
211
|
+
++node1AttrLen;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
if (node2.attributes) {
|
|
217
|
+
for (i = 0, ii = node2.attributes.length; i < ii; ++i) {
|
|
218
|
+
ea = node2.attributes[i];
|
|
219
|
+
if (ea.specified === undefined || ea.specified === true) {
|
|
220
|
+
if (ea.name.split(':').shift() != 'xmlns') {
|
|
221
|
+
en = testPrefix ? ea.name : ea.name.split(':').pop();
|
|
222
|
+
node2Attr[en] = ea;
|
|
223
|
+
++node2AttrLen;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if (node1AttrLen !== node2AttrLen) {
|
|
229
|
+
errors.push(
|
|
230
|
+
'Number of attributes test failed for: ' +
|
|
231
|
+
node1.nodeName +
|
|
232
|
+
' | expected ' +
|
|
233
|
+
node1AttrLen +
|
|
234
|
+
' to equal ' +
|
|
235
|
+
node2AttrLen
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
for (const name in node1Attr) {
|
|
239
|
+
if (node2Attr[name] === undefined) {
|
|
240
|
+
errors.push(
|
|
241
|
+
'Attribute name ' +
|
|
242
|
+
node1Attr[name].name +
|
|
243
|
+
' expected for element ' +
|
|
244
|
+
node1.nodeName
|
|
245
|
+
);
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
// test attribute namespace
|
|
249
|
+
if (node1Attr[name].namespaceURI !== node2Attr[name].namespaceURI) {
|
|
250
|
+
errors.push(
|
|
251
|
+
'namespaceURI attribute test failed for: ' +
|
|
252
|
+
node1.nodeName +
|
|
253
|
+
' | expected ' +
|
|
254
|
+
node1Attr[name].namespaceURI +
|
|
255
|
+
' to equal ' +
|
|
256
|
+
node2Attr[name].namespaceURI
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
if (node1Attr[name].value !== node2Attr[name].value) {
|
|
260
|
+
errors.push(
|
|
261
|
+
'Attribute value test failed for: ' +
|
|
262
|
+
node1.nodeName +
|
|
263
|
+
' | expected ' +
|
|
264
|
+
node1Attr[name].value +
|
|
265
|
+
' to equal ' +
|
|
266
|
+
node2Attr[name].value
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
// compare children
|
|
271
|
+
const node1ChildNodes = getChildNodes(node1, options);
|
|
272
|
+
const node2ChildNodes = getChildNodes(node2, options);
|
|
273
|
+
if (node1ChildNodes.length !== node2ChildNodes.length) {
|
|
274
|
+
// check if all child nodes are text, they could be split up in
|
|
275
|
+
// 4096 chunks
|
|
276
|
+
// if so, ignore the childnode count error
|
|
277
|
+
let allText = true;
|
|
278
|
+
let c, cc;
|
|
279
|
+
for (c = 0, cc = node1ChildNodes.length; c < cc; ++c) {
|
|
280
|
+
if (node1ChildNodes[c].nodeType !== 3) {
|
|
281
|
+
allText = false;
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
for (c = 0, cc = node2ChildNodes.length; c < cc; ++c) {
|
|
286
|
+
if (node2ChildNodes[c].nodeType !== 3) {
|
|
287
|
+
allText = false;
|
|
288
|
+
break;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (!allText) {
|
|
292
|
+
errors.push(
|
|
293
|
+
'Number of childNodes test failed for: ' +
|
|
294
|
+
node1.nodeName +
|
|
295
|
+
' | expected ' +
|
|
296
|
+
node1ChildNodes.length +
|
|
297
|
+
' to equal ' +
|
|
298
|
+
node2ChildNodes.length
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
// only compare if they are equal
|
|
303
|
+
if (node1ChildNodes.length === node2ChildNodes.length) {
|
|
304
|
+
for (let j = 0, jj = node1ChildNodes.length; j < jj; ++j) {
|
|
305
|
+
assertElementNodesEqual(
|
|
306
|
+
node1ChildNodes[j],
|
|
307
|
+
node2ChildNodes[j],
|
|
308
|
+
options,
|
|
309
|
+
errors
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* @typedef {Object} XMLEqlOptions
|
|
318
|
+
* @property {boolean} [includeWhiteSpace] IncludeWhiteSpace.
|
|
319
|
+
* @property {boolean} [ignoreElementOrder] IgnoreElementOrder.
|
|
320
|
+
*/
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Checks if the XML document sort of equals another XML document.
|
|
324
|
+
* @param {Object} obj The other object.
|
|
325
|
+
* @param {XMLEqlOptions} [options] The options.
|
|
326
|
+
* @return {expect.Assertion} The assertion.
|
|
327
|
+
*/
|
|
328
|
+
expect.Assertion.prototype.xmleql = function (obj, options) {
|
|
329
|
+
if (obj && obj.nodeType == 9) {
|
|
330
|
+
obj = obj.documentElement;
|
|
331
|
+
}
|
|
332
|
+
if (this.obj && this.obj.nodeType == 9) {
|
|
333
|
+
this.obj = this.obj.documentElement;
|
|
334
|
+
}
|
|
335
|
+
const errors = [];
|
|
336
|
+
assertElementNodesEqual(obj, this.obj, options, errors);
|
|
337
|
+
const result = errors.length === 0;
|
|
338
|
+
this.assert(
|
|
339
|
+
!!result,
|
|
340
|
+
function () {
|
|
341
|
+
return (
|
|
342
|
+
'expected ' +
|
|
343
|
+
expect.stringify(this.obj) +
|
|
344
|
+
' to sort of equal ' +
|
|
345
|
+
expect.stringify(obj) +
|
|
346
|
+
'\n' +
|
|
347
|
+
errors.join('\n')
|
|
348
|
+
);
|
|
349
|
+
},
|
|
350
|
+
function () {
|
|
351
|
+
return (
|
|
352
|
+
'expected ' +
|
|
353
|
+
expect.stringify(this.obj) +
|
|
354
|
+
' to sort of not equal ' +
|
|
355
|
+
expect.stringify(obj) +
|
|
356
|
+
'\n' +
|
|
357
|
+
errors.join('\n')
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
);
|
|
361
|
+
return this;
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
global.createMapDiv = function (width, height) {
|
|
365
|
+
const target = document.createElement('div');
|
|
366
|
+
const style = target.style;
|
|
367
|
+
style.position = 'absolute';
|
|
368
|
+
style.left = '-1000px';
|
|
369
|
+
style.top = '-1000px';
|
|
370
|
+
style.width = width + 'px';
|
|
371
|
+
style.height = height + 'px';
|
|
372
|
+
document.body.appendChild(target);
|
|
373
|
+
|
|
374
|
+
return target;
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
global.disposeMap = function (map) {
|
|
378
|
+
const target = map.getTarget();
|
|
379
|
+
map.setTarget(null);
|
|
380
|
+
if (target && target.parentNode) {
|
|
381
|
+
target.parentNode.removeChild(target);
|
|
382
|
+
}
|
|
383
|
+
map.dispose();
|
|
384
|
+
};
|
|
385
|
+
|
|
386
|
+
const features = {
|
|
387
|
+
ArrayBuffer: 'ArrayBuffer' in global,
|
|
388
|
+
'ArrayBuffer.isView': 'ArrayBuffer' in global && !!ArrayBuffer.isView,
|
|
389
|
+
FileReader: 'FileReader' in global,
|
|
390
|
+
Uint8ClampedArray: 'Uint8ClampedArray' in global,
|
|
391
|
+
WebGL: false,
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Allow tests to be skipped where certain features are not available. The
|
|
396
|
+
* provided key must be in the above `features` lookup. Keys should
|
|
397
|
+
* correspond to the feature that is required, but can be any string.
|
|
398
|
+
* @param {string} key The required feature name.
|
|
399
|
+
* @return {Object} An object with a `describe` function that will run tests
|
|
400
|
+
* if the required feature is available and skip them otherwise.
|
|
401
|
+
*/
|
|
402
|
+
global.where = function (key) {
|
|
403
|
+
if (!(key in features)) {
|
|
404
|
+
throw new Error('where() called with unknown key: ' + key);
|
|
405
|
+
}
|
|
406
|
+
return {
|
|
407
|
+
describe: features[key] ? global.describe : global.xdescribe,
|
|
408
|
+
it: features[key] ? global.it : global.xit,
|
|
409
|
+
};
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
// throw if anybody appends a div to the body and doesn't remove it
|
|
413
|
+
afterEach(function () {
|
|
414
|
+
const garbage = document.body.getElementsByTagName('div');
|
|
415
|
+
if (garbage.length) {
|
|
416
|
+
throw new Error('Found extra <div> elements in the body');
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
})(window);
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Basic Options */
|
|
4
|
+
"target": "ES2017", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
|
|
5
|
+
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
|
6
|
+
"lib": ["es2019", "dom", "webworker"], /* Specify library files to be included in the compilation. */
|
|
7
|
+
"allowJs": true, /* Allow javascript files to be compiled. */
|
|
8
|
+
"checkJs": true, /* Report errors in .js files. */
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
|
11
|
+
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
12
|
+
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
|
13
|
+
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
14
|
+
// "outDir": "./", /* Redirect output structure to the directory. */
|
|
15
|
+
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
16
|
+
// "removeComments": true, /* Do not emit comments to output. */
|
|
17
|
+
"noEmit": true, /* Do not emit outputs. */
|
|
18
|
+
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
19
|
+
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
20
|
+
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
21
|
+
|
|
22
|
+
/* Strict Type-Checking Options */
|
|
23
|
+
"strict": false, /* Enable all strict type-checking options. */
|
|
24
|
+
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
|
25
|
+
// "strictNullChecks": true, /* Enable strict null checks. */
|
|
26
|
+
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
|
27
|
+
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
|
28
|
+
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
|
29
|
+
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
|
30
|
+
|
|
31
|
+
/* Additional Checks */
|
|
32
|
+
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
|
33
|
+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
34
|
+
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
35
|
+
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
36
|
+
|
|
37
|
+
/* Module Resolution Options */
|
|
38
|
+
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
|
39
|
+
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
|
40
|
+
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
|
41
|
+
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
42
|
+
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
43
|
+
// "types": ["node"], /* Type declaration files to be included in compilation. */
|
|
44
|
+
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
45
|
+
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
46
|
+
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
|
47
|
+
|
|
48
|
+
/* Source Map Options */
|
|
49
|
+
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
|
50
|
+
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
51
|
+
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
|
52
|
+
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
|
53
|
+
|
|
54
|
+
/* Experimental Options */
|
|
55
|
+
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
56
|
+
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
57
|
+
},
|
|
58
|
+
"include": [
|
|
59
|
+
"types/**/*.ts",
|
|
60
|
+
"src/ol/**/*.js"
|
|
61
|
+
]
|
|
62
|
+
}
|