mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Add the Data Library: live regional datasets, tiles and packs
DATA LAYERS keeps its curated core layers; regional and niche sources live in the Data Library, opened from Browse data library at the foot of the panel. Each entry is a JSON manifest in src/library/entries/ pointing at a live upstream (query API, provider-hosted file or tile endpoint), so nothing is bundled and a self-hosted instance hosts no data. Sources without CORS go through one allowlisted /api/library route. Kinds: dataset (GeoJSON, CSV, JSON records, ArcGIS, partitioned GeoParquet), tiles (XYZ, WMS/ArcGIS bbox export, terrarium relief) and pack. Selections persist and travel in share links as lib=, separate from the core layer tokens. Library rows get Zoom and Remove icon chips that work while the layer is off, rendered through RailChips. Strings are translated in every locale.
This commit is contained in:
1 parent
10a788db78
commit
db80d82b8d
182 files changed
+15805
-44
No files matched your search
@@ -33,6 +33,7 @@ defineProps({
|
||||
}"
|
||||
:data-layer-id="item.id"
|
||||
:data-layer-name="item.englishName"
|
||||
:data-library-entry="item.libraryEntry || undefined"
|
||||
><div class="data-toggle-top"
|
||||
><div class="data-toggle-left"
|
||||
><span class="data-icon" aria-hidden="true">{{ item.icon }}</span
|
||||
|
||||
@@ -218,3 +218,57 @@ test('a row range renders start and end pickers and reports which end moved', ()
|
||||
assert.deepEqual(picks, [['shipwrecks', 'period', 'to', '2007']]);
|
||||
render(null, container);
|
||||
});
|
||||
|
||||
const libraryRow = (chips) => ({
|
||||
...row(false),
|
||||
key: 'lib-night-lights',
|
||||
id: 'lib-night-lights',
|
||||
libraryEntry: 'nasa-black-marble',
|
||||
controls: { hidden: false, chips, legend: [], list: null },
|
||||
});
|
||||
|
||||
test('a Data Library row names its entry and draws icon action chips', () => {
|
||||
document.body.replaceChildren();
|
||||
const container = document.body.appendChild(document.createElement('div'));
|
||||
const zoom = {
|
||||
id: 'zoom',
|
||||
icon: 'zoom_in_map',
|
||||
action: true,
|
||||
label: 'Zoom to layer',
|
||||
};
|
||||
render(h(LayerRows, { items: [libraryRow([zoom])] }), container);
|
||||
const element = container.querySelector('[data-layer-id="lib-night-lights"]');
|
||||
assert.equal(element.dataset.libraryEntry, 'nasa-black-marble');
|
||||
const button = element.querySelector('[data-chip-id="zoom"]');
|
||||
const glyph = button.children[0];
|
||||
assert.equal(glyph.className, 'material-symbols-outlined');
|
||||
assert.equal(glyph.textContent, 'zoom_in_map');
|
||||
assert.equal(glyph.getAttribute('aria-hidden'), 'true');
|
||||
assert.equal(button.getAttribute('aria-label'), 'Zoom to layer');
|
||||
assert.equal(button.title, 'Zoom to layer');
|
||||
assert.equal(button.getAttribute('aria-pressed'), null);
|
||||
assert.ok(button.classList.contains('chip-icon'));
|
||||
|
||||
// The same id as a text toggle drops the icon semantics.
|
||||
render(
|
||||
h(LayerRows, {
|
||||
items: [libraryRow([{ id: 'zoom', label: 'ZOOM', active: true }])],
|
||||
}),
|
||||
container,
|
||||
);
|
||||
const toggle = element.querySelector('[data-chip-id="zoom"]');
|
||||
assert.equal(toggle.textContent, 'ZOOM');
|
||||
assert.equal(toggle.getAttribute('aria-label'), null);
|
||||
assert.equal(toggle.getAttribute('aria-pressed'), 'true');
|
||||
assert.equal(toggle.classList.contains('chip-icon'), false);
|
||||
render(null, container);
|
||||
});
|
||||
|
||||
test('a core row carries no library entry attribute', () => {
|
||||
document.body.replaceChildren();
|
||||
const container = document.body.appendChild(document.createElement('div'));
|
||||
render(h(LayerRows, { items: [row(false)] }), container);
|
||||
const element = container.querySelector('[data-layer-id="flights"]');
|
||||
assert.equal(element.hasAttribute('data-library-entry'), false);
|
||||
render(null, container);
|
||||
});
|
||||
Reference in new issue
Block a user