ogm-viewer 0.5.1 → 0.6.1

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.
Files changed (117) hide show
  1. package/dist/cjs/{lerc-IU-tWkVO.js → lerc-DQmE0Pfk.js} +1 -1
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/{ogm-alerts.ogm-attributes.ogm-image.ogm-map.ogm-menubar.ogm-metadata.ogm-preview.ogm-previews.ogm-settings.ogm-sidebar.ogm-viewer-BAGJpqMB.js → ogm-alerts.ogm-attributes.ogm-image.ogm-map.ogm-menubar.ogm-metadata.ogm-preview.ogm-previews.ogm-settings.ogm-sidebar.ogm-viewer-B_nGMI1e.js} +12000 -11333
  4. package/dist/cjs/ogm-alerts_11.cjs.entry.js +1 -1
  5. package/dist/cjs/ogm-viewer.cjs.js +1 -1
  6. package/dist/collection/components/ogm-attributes/ogm-attributes.js +1 -1
  7. package/dist/collection/components/ogm-attributes/ogm-attributes.test.js +24 -0
  8. package/dist/collection/components/ogm-image/ogm-image.js +14 -14
  9. package/dist/collection/components/ogm-map/ogm-map.js +135 -53
  10. package/dist/collection/components/ogm-preview/ogm-preview.js +13 -13
  11. package/dist/collection/components/ogm-preview/ogm-preview.test.js +5 -5
  12. package/dist/collection/components/ogm-previews/ogm-previews.js +29 -26
  13. package/dist/collection/components/ogm-previews/ogm-previews.test.js +1 -1
  14. package/dist/collection/lib/geometry.js +35 -1
  15. package/dist/collection/lib/geometry.test.js +90 -1
  16. package/dist/collection/lib/previewers/cog-deck.js +4 -4
  17. package/dist/collection/lib/previewers/cog.js +15 -11
  18. package/dist/collection/lib/previewers/cog.test.js +61 -0
  19. package/dist/collection/lib/previewers/geojson.js +15 -7
  20. package/dist/collection/lib/previewers/geojson.test.js +81 -0
  21. package/dist/collection/lib/previewers/map.js +51 -0
  22. package/dist/collection/lib/previewers/openindexmap.js +2 -2
  23. package/dist/collection/lib/previewers/pmtiles-raster.js +13 -9
  24. package/dist/collection/lib/previewers/pmtiles-vector.js +12 -51
  25. package/dist/collection/lib/previewers/pmtiles.test.js +62 -0
  26. package/dist/collection/lib/previewers/previewer.js +4 -3
  27. package/dist/collection/lib/previewers/raster.js +15 -11
  28. package/dist/collection/lib/previewers/tiled-vector.js +47 -0
  29. package/dist/collection/lib/previewers/tilejson-raster.js +27 -0
  30. package/dist/collection/lib/previewers/tilejson-vector.js +18 -0
  31. package/dist/collection/lib/previewers/tilejson.test.js +140 -0
  32. package/dist/collection/lib/previewers/vector.js +7 -4
  33. package/dist/collection/lib/previewers/wms.js +86 -6
  34. package/dist/collection/lib/previewers/wms.test.js +133 -0
  35. package/dist/collection/lib/previewers/wmts.js +31 -0
  36. package/dist/collection/lib/previewers/wmts.test.js +108 -0
  37. package/dist/collection/lib/{sources → resources}/cog.js +2 -2
  38. package/dist/collection/lib/{sources → resources}/geojson.js +3 -3
  39. package/dist/collection/lib/{sources → resources}/iiif-manifest.js +2 -2
  40. package/dist/collection/lib/{sources → resources}/iiif-manifest.test.js +3 -3
  41. package/dist/collection/lib/{sources → resources}/iiif.js +2 -2
  42. package/dist/collection/lib/{sources/maplibre.js → resources/map.js} +2 -2
  43. package/dist/collection/lib/{sources → resources}/openindexmap.js +2 -2
  44. package/dist/collection/lib/{sources → resources}/pmtiles.js +2 -2
  45. package/dist/collection/lib/{sources → resources}/raster.js +2 -2
  46. package/dist/collection/lib/{sources/source.js → resources/resource.js} +3 -3
  47. package/dist/collection/lib/{sources → resources}/tilejson.js +21 -4
  48. package/dist/collection/lib/{sources → resources}/tms.js +2 -2
  49. package/dist/collection/lib/{sources → resources}/vector.js +2 -2
  50. package/dist/collection/lib/{sources → resources}/wms.js +46 -6
  51. package/dist/collection/lib/resources/wms.test.js +63 -0
  52. package/dist/collection/lib/resources/wmts.js +317 -0
  53. package/dist/collection/lib/resources/wmts.test.js +235 -0
  54. package/dist/collection/lib/{sources → resources}/xyz.js +2 -2
  55. package/dist/esm/{lerc-yC3LNu-h.js → lerc-BQHa9iiK.js} +1 -1
  56. package/dist/esm/loader.js +1 -1
  57. package/dist/esm/{ogm-alerts.ogm-attributes.ogm-image.ogm-map.ogm-menubar.ogm-metadata.ogm-preview.ogm-previews.ogm-settings.ogm-sidebar.ogm-viewer-BpVupgSB.js → ogm-alerts.ogm-attributes.ogm-image.ogm-map.ogm-menubar.ogm-metadata.ogm-preview.ogm-previews.ogm-settings.ogm-sidebar.ogm-viewer-DSguoh85.js} +12000 -11333
  58. package/dist/esm/ogm-alerts_11.entry.js +1 -1
  59. package/dist/esm/ogm-viewer.js +1 -1
  60. package/dist/ogm-viewer/ogm-viewer.esm.js +1 -1
  61. package/dist/ogm-viewer/p-667JHO1P.js +2822 -0
  62. package/dist/ogm-viewer/{p-_eTjrSO2.js → p-9T5uP6M8.js} +1 -1
  63. package/dist/ogm-viewer/{p-11cf948e.entry.js → p-c95acce0.entry.js} +1 -1
  64. package/dist/types/components/ogm-image/ogm-image.d.ts +2 -2
  65. package/dist/types/components/ogm-map/ogm-map.d.ts +12 -9
  66. package/dist/types/components/ogm-preview/ogm-preview.d.ts +2 -2
  67. package/dist/types/components/ogm-previews/ogm-previews.d.ts +2 -2
  68. package/dist/types/components.d.ts +6 -6
  69. package/dist/types/lib/geometry.d.ts +5 -1
  70. package/dist/types/lib/previewers/cog-deck.d.ts +3 -3
  71. package/dist/types/lib/previewers/cog.d.ts +6 -5
  72. package/dist/types/lib/previewers/cog.test.d.ts +1 -0
  73. package/dist/types/lib/previewers/geojson.d.ts +8 -4
  74. package/dist/types/lib/previewers/geojson.test.d.ts +1 -0
  75. package/dist/types/lib/previewers/{maplibre.d.ts → map.d.ts} +10 -7
  76. package/dist/types/lib/previewers/openindexmap.d.ts +2 -2
  77. package/dist/types/lib/previewers/pmtiles-raster.d.ts +2 -2
  78. package/dist/types/lib/previewers/pmtiles-vector.d.ts +4 -11
  79. package/dist/types/lib/previewers/pmtiles.test.d.ts +1 -0
  80. package/dist/types/lib/previewers/previewer.d.ts +3 -3
  81. package/dist/types/lib/previewers/raster.d.ts +10 -7
  82. package/dist/types/lib/previewers/tiled-vector.d.ts +11 -0
  83. package/dist/types/lib/previewers/tilejson-raster.d.ts +8 -0
  84. package/dist/types/lib/previewers/tilejson-vector.d.ts +6 -0
  85. package/dist/types/lib/previewers/tilejson.test.d.ts +1 -0
  86. package/dist/types/lib/previewers/vector.d.ts +9 -5
  87. package/dist/types/lib/previewers/wms.d.ts +17 -5
  88. package/dist/types/lib/previewers/wms.test.d.ts +1 -0
  89. package/dist/types/lib/previewers/wmts.d.ts +11 -0
  90. package/dist/types/lib/previewers/wmts.test.d.ts +1 -0
  91. package/dist/types/lib/{sources → resources}/cog.d.ts +2 -2
  92. package/dist/types/lib/{sources → resources}/geojson.d.ts +2 -2
  93. package/dist/types/lib/{sources → resources}/iiif-manifest.d.ts +2 -2
  94. package/dist/types/lib/resources/iiif-manifest.test.d.ts +1 -0
  95. package/dist/types/lib/resources/iiif.d.ts +5 -0
  96. package/dist/types/lib/{sources/maplibre.d.ts → resources/map.d.ts} +2 -2
  97. package/dist/types/lib/resources/openindexmap.d.ts +5 -0
  98. package/dist/types/lib/{sources → resources}/pmtiles.d.ts +2 -2
  99. package/dist/types/lib/{sources → resources}/raster.d.ts +2 -2
  100. package/dist/types/lib/{sources/source.d.ts → resources/resource.d.ts} +1 -1
  101. package/dist/types/lib/{sources → resources}/tilejson.d.ts +5 -2
  102. package/dist/types/lib/resources/tms.d.ts +5 -0
  103. package/dist/types/lib/{sources → resources}/vector.d.ts +2 -2
  104. package/dist/types/lib/{sources → resources}/wms.d.ts +15 -5
  105. package/dist/types/lib/resources/wms.test.d.ts +1 -0
  106. package/dist/types/lib/resources/wmts.d.ts +59 -0
  107. package/dist/types/lib/resources/wmts.test.d.ts +1 -0
  108. package/dist/types/lib/resources/xyz.d.ts +5 -0
  109. package/package.json +1 -1
  110. package/readme.md +1 -1
  111. package/dist/collection/lib/previewers/maplibre.js +0 -56
  112. package/dist/ogm-viewer/p-DPOGJxir.js +0 -2822
  113. package/dist/types/lib/sources/iiif.d.ts +0 -5
  114. package/dist/types/lib/sources/openindexmap.d.ts +0 -5
  115. package/dist/types/lib/sources/tms.d.ts +0 -5
  116. package/dist/types/lib/sources/xyz.d.ts +0 -5
  117. /package/dist/types/{lib/sources/iiif-manifest.test.d.ts → components/ogm-attributes/ogm-attributes.test.d.ts} +0 -0
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var ogmAlerts_ogmAttributes_ogmImage_ogmMap_ogmMenubar_ogmMetadata_ogmPreview_ogmPreviews_ogmSettings_ogmSidebar_ogmViewer_entry = require('./ogm-alerts.ogm-attributes.ogm-image.ogm-map.ogm-menubar.ogm-metadata.ogm-preview.ogm-previews.ogm-settings.ogm-sidebar.ogm-viewer-BAGJpqMB.js');
3
+ var ogmAlerts_ogmAttributes_ogmImage_ogmMap_ogmMenubar_ogmMetadata_ogmPreview_ogmPreviews_ogmSettings_ogmSidebar_ogmViewer_entry = require('./ogm-alerts.ogm-attributes.ogm-image.ogm-map.ogm-menubar.ogm-metadata.ogm-preview.ogm-previews.ogm-settings.ogm-sidebar.ogm-viewer-B_nGMI1e.js');
4
4
  require('./index-mu9UK_Fb.js');
5
5
 
6
6
 
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["ogm-alerts_11.cjs",[[513,"ogm-viewer",{"recordUrl":[1,"record-url"],"theme":[1],"hideTitle":[4,"hide-title"],"record":[32],"error":[32],"previewOpacity":[32],"sidebarOpen":[32],"loading":[32],"loadRecord":[64]},[[0,"sidebarToggled","toggleSidebar"],[0,"opacityChange","adjustPreviewOpacity"],[0,"mapLoading","setLoadingStarted"],[0,"imageLoading","setLoadingStarted"],[0,"mapIdle","setLoadingFinished"],[0,"imageLoaded","setLoadingFinished"]],{"recordUrl":[{"updateRecord":0}],"record":[{"resetLoading":0}]}],[513,"ogm-previews",{"theme":[1],"record":[16],"previewOpacity":[2,"preview-opacity"],"sidebarPadding":[2,"sidebar-padding"],"sources":[32]},null,{"record":[{"getSources":0}]}],[513,"ogm-sidebar",{"record":[16],"theme":[1],"open":[4]}],[513,"ogm-menubar",{"record":[16],"theme":[1],"loading":[4],"hideTitle":[4,"hide-title"]}],[513,"ogm-preview",{"theme":[1],"source":[16],"previewOpacity":[2,"preview-opacity"],"sidebarPadding":[2,"sidebar-padding"],"error":[32]},[[0,"previewError","handlePreviewError"]],{"source":[{"resetError":0}]}],[513,"ogm-metadata",{"record":[16],"theme":[1],"fieldNames":[16],"filteredRecord":[32]}],[513,"ogm-settings",{"record":[16]},[[0,"input","handleOpacityChange"]]],[513,"ogm-map",{"source":[16],"theme":[1],"padding":[2],"easeMapTo":[64]},[[16,"featureSelected","handleFeatureSelected"]],{"source":[{"previewSource":0}],"theme":[{"onThemeChange":0}],"padding":[{"onPaddingChange":0}]}],[513,"ogm-alerts",{"theme":[1],"error":[16]}],[513,"ogm-image",{"source":[16],"theme":[1],"padding":[2]},null,{"source":[{"onSourceChange":0}],"padding":[{"onPaddingChange":0}]}],[513,"ogm-attributes",{"features":[16],"currentIndex":[32]},null,{"features":[{"onFeaturesChange":0}],"currentIndex":[{"onCurrentIndexChange":0}]}]]]], options);
22
+ return index.bootstrapLazy([["ogm-alerts_11.cjs",[[513,"ogm-viewer",{"recordUrl":[1,"record-url"],"theme":[1],"hideTitle":[4,"hide-title"],"record":[32],"error":[32],"previewOpacity":[32],"sidebarOpen":[32],"loading":[32],"loadRecord":[64]},[[0,"sidebarToggled","toggleSidebar"],[0,"opacityChange","adjustPreviewOpacity"],[0,"mapLoading","setLoadingStarted"],[0,"imageLoading","setLoadingStarted"],[0,"mapIdle","setLoadingFinished"],[0,"imageLoaded","setLoadingFinished"]],{"recordUrl":[{"updateRecord":0}],"record":[{"resetLoading":0}]}],[513,"ogm-previews",{"theme":[1],"record":[16],"previewOpacity":[2,"preview-opacity"],"sidebarPadding":[2,"sidebar-padding"],"resources":[32]},null,{"record":[{"getSources":0}]}],[513,"ogm-sidebar",{"record":[16],"theme":[1],"open":[4]}],[513,"ogm-menubar",{"record":[16],"theme":[1],"loading":[4],"hideTitle":[4,"hide-title"]}],[513,"ogm-preview",{"theme":[1],"previewResource":[16],"previewOpacity":[2,"preview-opacity"],"sidebarPadding":[2,"sidebar-padding"],"error":[32]},[[0,"previewError","handlePreviewError"]],{"previewResource":[{"resetError":0}]}],[513,"ogm-metadata",{"record":[16],"theme":[1],"fieldNames":[16],"filteredRecord":[32]}],[513,"ogm-settings",{"record":[16]},[[0,"input","handleOpacityChange"]]],[513,"ogm-map",{"previewResource":[16],"theme":[1],"padding":[2],"easeMapTo":[64]},[[16,"featureSelected","handleFeatureSelected"]],{"previewResource":[{"loadResource":0}],"theme":[{"onThemeChange":0}],"padding":[{"onPaddingChange":0}]}],[513,"ogm-alerts",{"theme":[1],"error":[16]}],[513,"ogm-image",{"previewResource":[16],"theme":[1],"padding":[2]},null,{"previewResource":[{"onSourceChange":0}],"padding":[{"onPaddingChange":0}]}],[513,"ogm-attributes",{"features":[16],"currentIndex":[32]},null,{"features":[{"onFeaturesChange":0}],"currentIndex":[{"onCurrentIndexChange":0}]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -27,7 +27,7 @@ export class OgmAttributes {
27
27
  const feature = this.features[this.currentIndex];
28
28
  const multiple = this.features.length > 1;
29
29
  const label = getFeatureLabel(feature);
30
- return (h("wa-scroller", { orientation: "vertical" }, h("table", { class: "attribute-table" }, multiple && label ? (h("thead", null, h("tr", { class: "header" }, h("td", { colSpan: 2 }, h("div", { class: "pagination" }, h("wa-button", { appearance: "plain", disabled: this.currentIndex === 0, onClick: () => this.currentIndex-- }, h("wa-icon", { name: "arrow-left", label: "Previous feature", canvas: "auto" })), label && (h("div", { class: "label" }, h("div", null, label))), h("div", { class: "count" }, ' ', "(", this.currentIndex + 1, "/", this.features.length, ")"), h("wa-button", { appearance: "plain", disabled: this.currentIndex === this.features.length - 1, onClick: () => this.currentIndex++ }, h("wa-icon", { name: "arrow-right", label: "Next feature", canvas: "auto" }))))))) : (label && (h("thead", null, h("tr", { class: "header" }, h("td", { colSpan: 2 }, h("div", { class: "label" }, h("div", null, label))))))), h("tbody", null, Object.entries(feature.properties || {}).map(([key, value]) => (h("tr", { key: key }, h("td", { class: "key" }, key), h("td", { class: "value", innerHTML: Autolinker.link(value.toString(), { hashtag: false, mention: false, phone: false }) }))))))));
30
+ return (h("wa-scroller", { orientation: "vertical" }, h("table", { class: "attribute-table" }, multiple && label ? (h("thead", null, h("tr", { class: "header" }, h("td", { colSpan: 2 }, h("div", { class: "pagination" }, h("wa-button", { appearance: "plain", disabled: this.currentIndex === 0, onClick: () => this.currentIndex-- }, h("wa-icon", { name: "arrow-left", label: "Previous feature", canvas: "auto" })), label && (h("div", { class: "label" }, h("div", null, label))), h("div", { class: "count" }, ' ', "(", this.currentIndex + 1, "/", this.features.length, ")"), h("wa-button", { appearance: "plain", disabled: this.currentIndex === this.features.length - 1, onClick: () => this.currentIndex++ }, h("wa-icon", { name: "arrow-right", label: "Next feature", canvas: "auto" }))))))) : (label && (h("thead", null, h("tr", { class: "header" }, h("td", { colSpan: 2 }, h("div", { class: "label" }, h("div", null, label))))))), h("tbody", null, Object.entries(feature.properties || {}).map(([key, value]) => (h("tr", { key: key }, h("td", { class: "key" }, key), h("td", { class: "value", innerHTML: Autolinker.link(value?.toString() ?? '', { hashtag: false, mention: false, phone: false }) }))))))));
31
31
  }
32
32
  static get is() { return "ogm-attributes"; }
33
33
  static get encapsulation() { return "shadow"; }
@@ -0,0 +1,24 @@
1
+ import { render, describe, it, expect, h } from "@stencil/vitest";
2
+ // A WMS GetFeatureInfo response, where attributes that don't apply to the feature come back null
3
+ const feature = {
4
+ type: 'Feature',
5
+ id: 'cugir007741.1',
6
+ geometry: { type: 'Point', coordinates: [-73.903384, 44.365321] },
7
+ properties: { region: 5, stat_name: 'EMN - WHITEFACE MT. SMT', ozone: 'Y', pm_2_5: null },
8
+ };
9
+ const rows = (root) => Array.from(root.shadowRoot.querySelectorAll('tbody tr')).map(tr => Array.from(tr.querySelectorAll('td')).map(td => td.textContent));
10
+ describe('ogm-attributes', () => {
11
+ it('renders nothing without features', async () => {
12
+ const { root } = await render(h("ogm-attributes", { features: [] }));
13
+ expect(root.shadowRoot.querySelector('table')).toBeNull();
14
+ });
15
+ it('renders a row per attribute, leaving the value empty for a null', async () => {
16
+ const { root } = await render(h("ogm-attributes", { features: [feature] }));
17
+ expect(rows(root)).toEqual([
18
+ ['region', '5'],
19
+ ['stat_name', 'EMN - WHITEFACE MT. SMT'],
20
+ ['ozone', 'Y'],
21
+ ['pm_2_5', ''],
22
+ ]);
23
+ });
24
+ });
@@ -4,7 +4,7 @@ import { getElement, findElement } from "../../lib/elements";
4
4
  import { referenceError } from "../../lib/errors";
5
5
  export class OgmImage {
6
6
  el;
7
- source;
7
+ previewResource;
8
8
  theme;
9
9
  padding = 0;
10
10
  imageLoaded;
@@ -38,7 +38,7 @@ export class OgmImage {
38
38
  this.reportError(new Error(event.message));
39
39
  });
40
40
  // If we do have a source, load the images
41
- if (this.source)
41
+ if (this.previewResource)
42
42
  await this.loadImages();
43
43
  }
44
44
  // Destroy the viewer when we are removed from the DOM
@@ -47,7 +47,7 @@ export class OgmImage {
47
47
  }
48
48
  // Update preview when source changes
49
49
  async onSourceChange() {
50
- if (this.source)
50
+ if (this.previewResource)
51
51
  await this.loadImages();
52
52
  }
53
53
  async onPaddingChange() {
@@ -64,26 +64,26 @@ export class OgmImage {
64
64
  this.errorReported = false;
65
65
  this.imageLoading.emit();
66
66
  try {
67
- const images = await this.source.getIIIFImageUrls();
67
+ const images = await this.previewResource.getIIIFImageUrls();
68
68
  if (!images)
69
69
  throw new Error('No IIIF images found for source');
70
70
  this.viewer.open(images);
71
71
  }
72
72
  catch (error) {
73
- console.error(`Error loading IIIF images for ${this.source.url}:`, error);
73
+ console.error(`Error loading IIIF images for ${this.previewResource.url}:`, error);
74
74
  this.imageLoaded.emit();
75
75
  this.reportError(error);
76
76
  }
77
77
  }
78
78
  // Emit a single preview error per load attempt
79
79
  reportError(error) {
80
- if (this.errorReported || !this.source)
80
+ if (this.errorReported || !this.previewResource)
81
81
  return;
82
82
  this.errorReported = true;
83
- this.previewError.emit(referenceError(error, this.source.label(), this.source.url));
83
+ this.previewError.emit(referenceError(error, this.previewResource.label(), this.previewResource.url));
84
84
  }
85
85
  render() {
86
- return (h(Host, { key: 'ebbebaddac72024a3b311e0e0e501267a83d1e95' }, h("div", { key: '4f171256535cfd11430e2269fda389ffae3cedae', id: "openseadragon" }, h("div", { key: 'c308186a13fd6b8e0b1fadbf1fd1e6924631f9d6', class: "controls" }, h("wa-button", { key: '1f9e0c4c6d881bf09d7ceb160f470992d71ebe07', class: "zoom-in", size: "s", appearance: "filled-outlined", pill: true }, h("wa-icon", { key: 'cbacb0a388de2c7f349e25172027874a0224a678', name: "zoom-in", label: "Zoom In", canvas: "auto" })), h("wa-button", { key: 'dd8d7e9c5584b124ae105b2187100964f5e3a02a', class: "zoom-out", size: "s", appearance: "filled-outlined", pill: true }, h("wa-icon", { key: '2b5acf2e07c99df9556692bf534bb3847506e4d4', name: "zoom-out", label: "Zoom Out", canvas: "auto" })), h("wa-button", { key: '5534a5c77ea20a1f77544e5acd99d4247dd3d287', class: "home", size: "s", appearance: "filled-outlined", pill: true }, h("wa-icon", { key: 'faadb8ea57bf1b831b292eaf66bcea39b7e215d1', name: "house", label: "Reset View", canvas: "auto" })), h("wa-button", { key: '8979cf58a94da89e0e2d132a92fe45323f07de01', class: "full-page", size: "s", appearance: "filled-outlined", pill: true }, h("wa-icon", { key: '12cb3224e7f14258376c1c0bf6ffc5abda5c2252', name: "arrows-fullscreen", label: "Full Screen", canvas: "auto" })), h("wa-button", { key: 'e79c37f27ff14d5c4991ff30ff88aada467214ec', class: "next", size: "s", appearance: "filled-outlined", pill: true }, h("wa-icon", { key: 'ee10870ace583257393c53ba12b73ab3b015371b', name: "arrow-right", label: "Next", canvas: "auto" })), h("wa-button", { key: '9d8999e199b7b6338261eb16a655d2199520cf22', class: "prev", size: "s", appearance: "filled-outlined", pill: true }, h("wa-icon", { key: 'fde1a9022b9e5f90e269c75ce87943808031e021', name: "arrow-left", label: "Previous", canvas: "auto" }))))));
86
+ return (h(Host, { key: 'e07b96ecb9eb9aba4f4e21a8bff4a997158afa67' }, h("div", { key: '3f8147685a9cf58023c52aeb19863235cfbee3d0', id: "openseadragon" }, h("div", { key: 'ced3713b0dff0dfb9ec0c9b7d7ec2a30e44da450', class: "controls" }, h("wa-button", { key: '2c8463949482dc421636231391bffe3d7007a540', class: "zoom-in", size: "s", appearance: "filled-outlined", pill: true }, h("wa-icon", { key: 'f6b8b16f2bb4702f443a6550bcb4fa3b2ee96fff', name: "zoom-in", label: "Zoom In", canvas: "auto" })), h("wa-button", { key: 'db4dd4dc34fbbb1730d0f65738a8dda14cdbd1e7', class: "zoom-out", size: "s", appearance: "filled-outlined", pill: true }, h("wa-icon", { key: '7226b94f0cdd071d0b1b6eb76a2102a7f2eaaff8', name: "zoom-out", label: "Zoom Out", canvas: "auto" })), h("wa-button", { key: 'ea03e501c4666cd37721776de8f8e9ddb21b0e54', class: "home", size: "s", appearance: "filled-outlined", pill: true }, h("wa-icon", { key: 'e6f9ae3ec07ad9123dbc1597798a9df2f38362f3', name: "house", label: "Reset View", canvas: "auto" })), h("wa-button", { key: 'ac38b067eb7f001430996ecfaf1e2570c3e99861', class: "full-page", size: "s", appearance: "filled-outlined", pill: true }, h("wa-icon", { key: '03d9e1d0e70f053b413cf116d1e70754b64ade40', name: "arrows-fullscreen", label: "Full Screen", canvas: "auto" })), h("wa-button", { key: 'e580f1b08944d541f7527f97183971b644112a72', class: "next", size: "s", appearance: "filled-outlined", pill: true }, h("wa-icon", { key: '6272934579ad6654a557dbc44d2f3021034acb81', name: "arrow-right", label: "Next", canvas: "auto" })), h("wa-button", { key: '80927b9c68dd16ac3ae8e68b405a11b2f8740843', class: "prev", size: "s", appearance: "filled-outlined", pill: true }, h("wa-icon", { key: 'd4f2fc257287be5d4f473328c8daf3e4b445cee8', name: "arrow-left", label: "Previous", canvas: "auto" }))))));
87
87
  }
88
88
  static get is() { return "ogm-image"; }
89
89
  static get encapsulation() { return "shadow"; }
@@ -99,16 +99,16 @@ export class OgmImage {
99
99
  }
100
100
  static get properties() {
101
101
  return {
102
- "source": {
102
+ "previewResource": {
103
103
  "type": "unknown",
104
104
  "mutable": false,
105
105
  "complexType": {
106
- "original": "IIIFSource",
107
- "resolved": "IIIFSource",
106
+ "original": "IIIFResource",
107
+ "resolved": "IIIFResource",
108
108
  "references": {
109
- "IIIFSource": {
109
+ "IIIFResource": {
110
110
  "location": "global",
111
- "id": "global::IIIFSource"
111
+ "id": "global::IIIFResource"
112
112
  }
113
113
  }
114
114
  },
@@ -220,7 +220,7 @@ export class OgmImage {
220
220
  static get elementRef() { return "el"; }
221
221
  static get watchers() {
222
222
  return [{
223
- "propName": "source",
223
+ "propName": "previewResource",
224
224
  "methodName": "onSourceChange"
225
225
  }, {
226
226
  "propName": "padding",
@@ -1,28 +1,41 @@
1
1
  import { h } from "@stencil/core";
2
2
  import maplibregl from "maplibre-gl";
3
3
  import { Protocol as PMTilesProtocol } from "pmtiles";
4
- import CogSource from "../../lib/sources/cog";
5
- import GeoJSONSource from "../../lib/sources/geojson";
6
- import OpenIndexMapSource from "../../lib/sources/openindexmap";
7
- import PMTilesSource from "../../lib/sources/pmtiles";
8
- import RasterSource from "../../lib/sources/raster";
9
- import WmsSource from "../../lib/sources/wms";
4
+ import CogResource from "../../lib/resources/cog";
5
+ import GeoJsonResource from "../../lib/resources/geojson";
6
+ import OpenIndexMapResource from "../../lib/resources/openindexmap";
7
+ import PMTilesResource from "../../lib/resources/pmtiles";
8
+ import RasterResource from "../../lib/resources/raster";
9
+ import TileJsonResource from "../../lib/resources/tilejson";
10
+ import WmsResource from "../../lib/resources/wms";
11
+ import WmtsResource from "../../lib/resources/wmts";
10
12
  import { getElement } from "../../lib/elements";
11
- import { referenceError } from "../../lib/errors";
13
+ import { referenceError, PreviewError } from "../../lib/errors";
14
+ import { mercatorBbox, mercatorGeomToLngLat } from "../../lib/geometry";
12
15
  import CogPreviewer from "../../lib/previewers/cog";
13
- import GeoJSONPreviewer from "../../lib/previewers/geojson";
16
+ import GeoJsonPreviewer from "../../lib/previewers/geojson";
14
17
  import OpenIndexMapPreviewer from "../../lib/previewers/openindexmap";
15
18
  import PMTilesRasterPreviewer from "../../lib/previewers/pmtiles-raster";
16
19
  import PMTilesVectorPreviewer from "../../lib/previewers/pmtiles-vector";
17
20
  import RasterPreviewer from "../../lib/previewers/raster";
21
+ import TileJsonRasterPreviewer from "../../lib/previewers/tilejson-raster";
22
+ import TileJsonVectorPreviewer from "../../lib/previewers/tilejson-vector";
23
+ import WmtsPreviewer from "../../lib/previewers/wmts";
18
24
  import WmsPreviewer from "../../lib/previewers/wms";
19
25
  import MapLibreTheme from "../../lib/themes/maplibre";
20
26
  // Register PMTiles protocol
21
27
  const protocol = new PMTilesProtocol();
22
28
  maplibregl.addProtocol('pmtiles', protocol.tile);
29
+ // Size in CSS pixels of the window we ask a WMS about when inspecting. GetFeatureInfo
30
+ // locates a click by mapping a pixel grid onto a bbox, which assumes the view is a
31
+ // flat, north-up rectangle - but ours can be rotated, pitched, or drawn as a globe. So
32
+ // we describe a small window around the click rather than the whole viewport, which
33
+ // keeps that assumption true to within a fraction of a pixel. Odd, so the clicked pixel
34
+ // is the exact center of the window.
35
+ const WMS_QUERY_WINDOW = 51;
23
36
  export class OgmMap {
24
37
  el;
25
- source;
38
+ previewResource;
26
39
  theme;
27
40
  padding = 0;
28
41
  mapIdle;
@@ -38,7 +51,7 @@ export class OgmMap {
38
51
  hoveredFeature = undefined;
39
52
  // Container element reference for fullscreen
40
53
  containerEl;
41
- // Previewer for the currently previewed source
54
+ // Previewer for the currently previewed resource
42
55
  previewer = undefined;
43
56
  // Set up the mapLibre map and event bindings on load
44
57
  componentDidLoad() {
@@ -54,7 +67,7 @@ export class OgmMap {
54
67
  });
55
68
  this.getContainer();
56
69
  this.addControls();
57
- this.map.on('load', () => this.previewSource(this.source));
70
+ this.map.on('load', () => this.loadResource(this.previewResource));
58
71
  this.map.on('mousemove', this.handleHover.bind(this));
59
72
  this.map.on('click', this.handleClick.bind(this));
60
73
  this.map.on('error', this.handleMapError.bind(this));
@@ -98,29 +111,37 @@ export class OgmMap {
98
111
  },
99
112
  }));
100
113
  }
101
- // Get the appropriate previewer for our source
114
+ // Get the appropriate previewer for our resource
102
115
  async getMapPreviewer(map) {
103
116
  const style = this.mapTheme.getStyle();
104
- if (this.source instanceof OpenIndexMapSource)
105
- return new OpenIndexMapPreviewer(this.source, map, style);
106
- else if (this.source instanceof GeoJSONSource)
107
- return new GeoJSONPreviewer(this.source, map, style);
108
- else if (this.source instanceof PMTilesSource) {
109
- if (await this.source.isVector())
110
- return new PMTilesVectorPreviewer(this.source, map, style);
117
+ if (this.previewResource instanceof OpenIndexMapResource)
118
+ return new OpenIndexMapPreviewer(this.previewResource, map, style);
119
+ else if (this.previewResource instanceof GeoJsonResource)
120
+ return new GeoJsonPreviewer(this.previewResource, map, style);
121
+ else if (this.previewResource instanceof PMTilesResource) {
122
+ if (await this.previewResource.isVector())
123
+ return new PMTilesVectorPreviewer(this.previewResource, map, style);
111
124
  else
112
- return new PMTilesRasterPreviewer(this.source, map, style);
125
+ return new PMTilesRasterPreviewer(this.previewResource, map, style);
113
126
  }
114
- else if (this.source instanceof WmsSource)
115
- return new WmsPreviewer(this.source, map, style);
116
- else if (this.source instanceof CogSource)
117
- return new CogPreviewer(this.source, map, style);
118
- else if (this.source instanceof RasterSource)
119
- return new RasterPreviewer(this.source, map, style);
127
+ else if (this.previewResource instanceof TileJsonResource) {
128
+ if (await this.previewResource.isVector())
129
+ return new TileJsonVectorPreviewer(this.previewResource, map, style);
130
+ else
131
+ return new TileJsonRasterPreviewer(this.previewResource, map, style);
132
+ }
133
+ else if (this.previewResource instanceof WmsResource)
134
+ return new WmsPreviewer(this.previewResource, map, style);
135
+ else if (this.previewResource instanceof CogResource)
136
+ return new CogPreviewer(this.previewResource, map, style);
137
+ else if (this.previewResource instanceof WmtsResource)
138
+ return new WmtsPreviewer(this.previewResource, map, style);
139
+ else if (this.previewResource instanceof RasterResource)
140
+ return new RasterPreviewer(this.previewResource, map, style);
120
141
  }
121
- async previewSource(source) {
122
- // Do nothing if we didn't get passed a source
123
- if (!source)
142
+ async loadResource(resource) {
143
+ // Do nothing if we didn't get passed a resource
144
+ if (!resource)
124
145
  return;
125
146
  // Fresh load attempt: allow one error to be reported again for this source
126
147
  this.errorReported = false;
@@ -135,21 +156,21 @@ export class OgmMap {
135
156
  await this.previewer.clearPreview();
136
157
  this.previewer = undefined;
137
158
  }
138
- // Get the appropriate previewer for our source and preview it
159
+ // Get the appropriate previewer for our resource and preview it
139
160
  this.previewer = await this.getMapPreviewer(this.map);
140
161
  if (!this.previewer)
141
- throw new Error(`No previewer found for source: ${source.constructor.name}`);
162
+ throw new Error(`No previewer found for resource: ${resource.constructor.name}`);
142
163
  await this.previewer.preview();
143
164
  // Fit to bounds from the record; the spinner stays up until the map finishes moving
144
- const bounds = await this.source.getBounds();
165
+ const bounds = await this.previewResource.getBounds();
145
166
  if (bounds)
146
167
  await this.fitMapBounds(bounds);
147
168
  }
148
169
  catch (error) {
149
- console.error(`Error previewing source ${source.url}:`, error);
170
+ console.error(`Error previewing resource ${resource.url}:`, error);
150
171
  if (!this.errorReported) {
151
172
  this.errorReported = true;
152
- this.previewError.emit(referenceError(error, source.label(), source.url));
173
+ this.previewError.emit(referenceError(error, resource.label(), resource.url));
153
174
  }
154
175
  }
155
176
  finally {
@@ -161,17 +182,17 @@ export class OgmMap {
161
182
  if (!this.map)
162
183
  return;
163
184
  this.map.setStyle(this.mapTheme.getBaseMapStyle());
164
- this.map.once('style.load', async () => await this.previewSource(this.source));
185
+ this.map.once('style.load', async () => await this.loadResource(this.previewResource));
165
186
  }
166
- // Surface MapLibre errors tied to the current preview source, skipping the
187
+ // Surface MapLibre errors tied to the current previewed resource, skipping the
167
188
  // noise from basemap/glyph/sprite loads, and deduped to a single alert per load attempt.
168
189
  handleMapError(event) {
169
- if (this.errorReported || !this.source || !this.previewer)
190
+ if (this.errorReported || !this.previewResource || !this.previewer)
170
191
  return;
171
- if (event.sourceId !== this.previewer.sourceId)
192
+ if (!this.previewer.sourceIds.includes(event.sourceId ?? ''))
172
193
  return;
173
194
  this.errorReported = true;
174
- this.previewError.emit(referenceError(event.error, this.source.label(), this.source.url));
195
+ this.previewError.emit(referenceError(event.error, this.previewResource.label(), this.previewResource.url));
175
196
  }
176
197
  // Fit the map to the given bounds; resolve once the move finishes. Guard the case where the bounds
177
198
  // can't produce a camera - e.g. sidebar padding wider than the viewport, or a hidden, zero-size
@@ -195,6 +216,11 @@ export class OgmMap {
195
216
  }
196
217
  // Use the crosshair cursor if there's something to inspect
197
218
  handleHover(event) {
219
+ // Always use it for WMS, since we don't know until we make the request
220
+ if (this.previewer instanceof WmsPreviewer) {
221
+ this.map.getCanvas().style.cursor = 'crosshair';
222
+ return;
223
+ }
198
224
  const features = this.map.queryRenderedFeatures(event.point, { layers: this.previewLayers });
199
225
  if (features.length > 0) {
200
226
  this.map.getCanvas().style.cursor = 'crosshair';
@@ -206,12 +232,12 @@ export class OgmMap {
206
232
  }
207
233
  }
208
234
  // Show the attributes popup on click
209
- handleClick(event) {
235
+ async handleClick(event) {
210
236
  // Clear any existing popup and feature selection
211
237
  this.clearFeatureSelection();
212
238
  this.destroyPopup();
213
- // Check if we have feature(s) to inspect at the clicked point
214
- const features = this.map.queryRenderedFeatures(event.point, { layers: this.previewLayers });
239
+ // Get the features, if any, at the clicked point. If none, do nothing.
240
+ const features = await this.handleInspection(event.point);
215
241
  if (features.length === 0)
216
242
  return;
217
243
  // Create and populate the attributes popup and select the first feature if multiple
@@ -219,6 +245,51 @@ export class OgmMap {
219
245
  this.createPopup(event.lngLat);
220
246
  this.selectFeature(features[0]);
221
247
  }
248
+ // Handle inspection of features, delegating to previewer if WMS
249
+ async handleInspection(point) {
250
+ if (!this.previewer)
251
+ return [];
252
+ let features = [];
253
+ if (this.previewer instanceof WmsPreviewer) {
254
+ features = await this.handleWmsInspection(point);
255
+ }
256
+ else {
257
+ features = this.map.queryRenderedFeatures(point, { layers: this.previewLayers });
258
+ }
259
+ return features;
260
+ }
261
+ // Special handling for WMS inspection, which requires a GetFeatureInfo request
262
+ async handleWmsInspection(point) {
263
+ if (!(this.previewer instanceof WmsPreviewer))
264
+ return [];
265
+ // Corners of the query window, in the same CSS pixel space as the click. Let
266
+ // MapLibre unproject them so the geography stays right under any projection, then
267
+ // take their EPSG:3857 envelope, since that is the CRS we request.
268
+ const half = (WMS_QUERY_WINDOW - 1) / 2;
269
+ const corners = [
270
+ [point.x - half, point.y - half],
271
+ [point.x + half, point.y - half],
272
+ [point.x + half, point.y + half],
273
+ [point.x - half, point.y + half],
274
+ ].map(([x, y]) => this.map.unproject([x, y]));
275
+ const response = await this.previewer.inspect({
276
+ bbox: mercatorBbox(corners),
277
+ width: WMS_QUERY_WINDOW,
278
+ height: WMS_QUERY_WINDOW,
279
+ x: half,
280
+ y: half,
281
+ });
282
+ if (!response.ok)
283
+ throw new PreviewError(`WMS GetFeatureInfo request failed with status ${response.status}`);
284
+ const data = await response.json();
285
+ if (!data || !data.features || !Array.isArray(data.features))
286
+ return [];
287
+ return data.features.map((feature) => ({
288
+ ...feature,
289
+ geometry: feature.geometry && mercatorGeomToLngLat(feature.geometry),
290
+ source: this.previewer.getSourceId(),
291
+ }));
292
+ }
222
293
  // Listen to selection events from the popup and highlight the selected feature
223
294
  handleFeatureSelected(event) {
224
295
  this.clearFeatureSelection();
@@ -227,13 +298,24 @@ export class OgmMap {
227
298
  }
228
299
  // Reset styling of all features to unselected state
229
300
  clearFeatureSelection() {
230
- this.attributesEl.features.forEach(feature => {
231
- this.map.setFeatureState({ source: feature.source, id: feature.id, sourceLayer: feature.sourceLayer }, { selected: false });
232
- });
301
+ if (this.previewer instanceof WmsPreviewer) {
302
+ this.previewer.clearHighlight();
303
+ }
304
+ else {
305
+ this.attributesEl.features.forEach(feature => {
306
+ this.map.setFeatureState({ source: feature.source, id: feature.id, sourceLayer: feature.sourceLayer }, { selected: false });
307
+ });
308
+ }
233
309
  this.attributesEl.features = [];
234
310
  }
235
311
  // Set styling of a single feature to selected state
236
312
  selectFeature(feature) {
313
+ // A WMS raster has no client-side features to restyle, so the previewer outlines the
314
+ // geometry that GetFeatureInfo returned instead
315
+ if (this.previewer instanceof WmsPreviewer) {
316
+ this.previewer.highlightFeatures([feature]);
317
+ return;
318
+ }
237
319
  this.map.setFeatureState({ source: feature.source, id: feature.id, sourceLayer: feature.sourceLayer }, { selected: true });
238
320
  }
239
321
  // Set styling of a single feature to hovered state
@@ -266,7 +348,7 @@ export class OgmMap {
266
348
  return this.previewer?.layerIds || [];
267
349
  }
268
350
  render() {
269
- return h("div", { key: 'c683bc9d81e84caa58d4575d0812c5fcdb096e28', id: "map", class: `wa-${this.theme}` });
351
+ return h("div", { key: '9bcace1eb20c7f5e096c18b816b7810b1edad330', id: "map", class: `wa-${this.theme}` });
270
352
  }
271
353
  static get is() { return "ogm-map"; }
272
354
  static get encapsulation() { return "shadow"; }
@@ -282,16 +364,16 @@ export class OgmMap {
282
364
  }
283
365
  static get properties() {
284
366
  return {
285
- "source": {
367
+ "previewResource": {
286
368
  "type": "unknown",
287
369
  "mutable": false,
288
370
  "complexType": {
289
- "original": "Source",
290
- "resolved": "Source",
371
+ "original": "Resource",
372
+ "resolved": "Resource",
291
373
  "references": {
292
- "Source": {
374
+ "Resource": {
293
375
  "location": "global",
294
- "id": "global::Source"
376
+ "id": "global::Resource"
295
377
  }
296
378
  }
297
379
  },
@@ -432,8 +514,8 @@ export class OgmMap {
432
514
  static get elementRef() { return "el"; }
433
515
  static get watchers() {
434
516
  return [{
435
- "propName": "source",
436
- "methodName": "previewSource"
517
+ "propName": "previewResource",
518
+ "methodName": "loadResource"
437
519
  }, {
438
520
  "propName": "theme",
439
521
  "methodName": "onThemeChange"
@@ -1,13 +1,13 @@
1
1
  import { h, Host } from "@stencil/core";
2
- import IIIFSource from "../../lib/sources/iiif";
2
+ import IIIFResource from "../../lib/resources/iiif";
3
3
  // Wraps a single source's preview and surfaces error(s) during the preview.
4
4
  export class OgmPreview {
5
5
  theme;
6
- source;
6
+ previewResource;
7
7
  previewOpacity;
8
8
  sidebarPadding;
9
9
  error;
10
- // A new source is a fresh load attempt, so clear any error left over from the previous one.
10
+ // A new resource is a fresh load attempt, so clear any error left over from the previous one.
11
11
  resetError() {
12
12
  this.error = undefined;
13
13
  }
@@ -18,13 +18,13 @@ export class OgmPreview {
18
18
  }
19
19
  // IIIF sources use the image viewer; every other source type is previewed on the map.
20
20
  renderPreview() {
21
- if (this.source instanceof IIIFSource) {
22
- return h("ogm-image", { theme: this.theme, source: this.source, padding: this.sidebarPadding });
21
+ if (this.previewResource instanceof IIIFResource) {
22
+ return h("ogm-image", { theme: this.theme, previewResource: this.previewResource, padding: this.sidebarPadding });
23
23
  }
24
- return h("ogm-map", { "preview-opacity": this.previewOpacity, theme: this.theme, source: this.source, padding: this.sidebarPadding });
24
+ return h("ogm-map", { "preview-opacity": this.previewOpacity, theme: this.theme, previewResource: this.previewResource, padding: this.sidebarPadding });
25
25
  }
26
26
  render() {
27
- return (h(Host, { key: 'c962bdcbebdebb1abde8900b0d0811be218fca46' }, this.renderPreview(), this.error && h("ogm-alerts", { key: '87b8217bbb7d5101d9f306f2492326d3f9f92429', theme: this.theme, error: this.error })));
27
+ return (h(Host, { key: '6105ad9ba75013fcbbdb69f37f2485a86e72f1a2' }, this.renderPreview(), this.error && h("ogm-alerts", { key: '6f5351cc5d06f95c5b5192c6918c0fb2904603c3', theme: this.theme, error: this.error })));
28
28
  }
29
29
  static get is() { return "ogm-preview"; }
30
30
  static get encapsulation() { return "shadow"; }
@@ -59,16 +59,16 @@ export class OgmPreview {
59
59
  "reflect": false,
60
60
  "attribute": "theme"
61
61
  },
62
- "source": {
62
+ "previewResource": {
63
63
  "type": "unknown",
64
64
  "mutable": false,
65
65
  "complexType": {
66
- "original": "Source",
67
- "resolved": "Source",
66
+ "original": "Resource",
67
+ "resolved": "Resource",
68
68
  "references": {
69
- "Source": {
69
+ "Resource": {
70
70
  "location": "global",
71
- "id": "global::Source"
71
+ "id": "global::Resource"
72
72
  }
73
73
  }
74
74
  },
@@ -128,7 +128,7 @@ export class OgmPreview {
128
128
  }
129
129
  static get watchers() {
130
130
  return [{
131
- "propName": "source",
131
+ "propName": "previewResource",
132
132
  "methodName": "resetError"
133
133
  }];
134
134
  }
@@ -3,15 +3,15 @@ import { describe, it, expect, h, vi } from "@stencil/vitest";
3
3
  // wrapper re-throws lifecycle errors, and the <ogm-map>/<ogm-image> mounted inside a preview throw
4
4
  // when they try to initialize WebGL/OpenSeadragon (unavailable in the test DOM).
5
5
  import { render as stencilRender } from "@stencil/core";
6
- import GeoJSONSource from "../../lib/sources/geojson";
6
+ import GeoJsonResource from "../../lib/resources/geojson";
7
7
  import { referenceError } from "../../lib/errors";
8
8
  // Let Stencil's RAF-based update cycle flush after a state change (mirrors the vitest waitForChanges).
9
9
  const flush = () => new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(() => resolve())));
10
- const renderPreview = async (source) => {
10
+ const renderPreview = async (resource) => {
11
11
  const container = document.createElement('div');
12
12
  document.body.appendChild(container);
13
13
  const consoleError = vi.spyOn(console, 'error').mockImplementation(() => { });
14
- await stencilRender(h("ogm-preview", { source: source }), container);
14
+ await stencilRender(h("ogm-preview", { previewResource: resource }), container);
15
15
  const el = container.firstElementChild;
16
16
  await el.componentOnReady?.();
17
17
  consoleError.mockRestore();
@@ -19,13 +19,13 @@ const renderPreview = async (source) => {
19
19
  };
20
20
  describe('ogm-preview', () => {
21
21
  it('renders a preview for a source', async () => {
22
- const el = await renderPreview(new GeoJSONSource('id', 'http://example.com/data.json'));
22
+ const el = await renderPreview(new GeoJsonResource('id', 'http://example.com/data.json'));
23
23
  const shadowRoot = el.shadowRoot;
24
24
  expect(shadowRoot.querySelector('ogm-map')).not.toBeNull();
25
25
  expect(shadowRoot.querySelector('ogm-alerts')).toBeNull();
26
26
  });
27
27
  it('shows the error over the preview when a previewError is reported', async () => {
28
- const el = await renderPreview(new GeoJSONSource('id', 'http://example.com/data.json'));
28
+ const el = await renderPreview(new GeoJsonResource('id', 'http://example.com/data.json'));
29
29
  const error = referenceError(new TypeError('Failed to fetch'), 'GeoJSON', 'http://example.com/data.json');
30
30
  el.dispatchEvent(new CustomEvent('previewError', { detail: error, bubbles: true }));
31
31
  await flush();