@@ -86,7 +86,7 @@ export const exportMapToHTML = (options, version = KEPLER_GL_VERSION) => {
8686 // native loader (which fails under file://).
8787 window.esmsInitOptions = {shimMode: true};
8888 </script>
89- <script src="https://unpkg.com/es-module-shims@${ ES_MODULE_SHIMS_VERSION } /dist/es-module-shims.js" crossorigin="anonymous"></script>
89+ <script async src="https://unpkg.com/es-module-shims@${ ES_MODULE_SHIMS_VERSION } /dist/es-module-shims.js" crossorigin="anonymous"></script>
9090
9191 <script type="importmap-shim">
9292 {
@@ -155,10 +155,52 @@ export const exportMapToHTML = (options, version = KEPLER_GL_VERSION) => {
155155 })
156156 .catch(function(error) {
157157 console.error('kepler.gl: failed to load UMD bundle', error);
158+ var screen = document.getElementById('kepler-load-screen');
159+ if (screen) {
160+ screen.querySelector('.kepler-spinner').style.display = 'none';
161+ screen.querySelector('.kepler-load-label').style.display = 'none';
162+ var msg = document.createElement('div');
163+ msg.className = 'kepler-load-error';
164+ msg.textContent = 'Failed to load the map bundle. Check your internet connection and reload the page.';
165+ screen.appendChild(msg);
166+ }
158167 });
159168 </script>
160169 <style type="text/css">
161170 body {margin: 0; padding: 0; overflow: hidden;}
171+ #kepler-load-screen {
172+ position: fixed;
173+ top: 0; left: 0;
174+ width: 100%; height: 100%;
175+ background: #29323c;
176+ display: flex;
177+ flex-direction: column;
178+ align-items: center;
179+ justify-content: center;
180+ gap: 20px;
181+ z-index: 9999;
182+ font-family: ff-clan-web-pro, 'Helvetica Neue', Helvetica, sans-serif;
183+ color: #a0a7b4;
184+ }
185+ #kepler-load-screen .kepler-spinner {
186+ width: 48px; height: 48px;
187+ border: 4px solid rgba(255,255,255,0.08);
188+ border-top-color: #1fbad6;
189+ border-radius: 50%;
190+ animation: kepler-spin 0.8s linear infinite;
191+ }
192+ #kepler-load-screen .kepler-load-label {
193+ font-size: 13px;
194+ letter-spacing: 0.5px;
195+ }
196+ #kepler-load-screen .kepler-load-error {
197+ font-size: 13px;
198+ color: #f05e45;
199+ max-width: 360px;
200+ text-align: center;
201+ line-height: 1.5;
202+ }
203+ @keyframes kepler-spin { to { transform: rotate(360deg); } }
162204 </style>
163205
164206 <!--MapBox token-->
@@ -199,7 +241,10 @@ export const exportMapToHTML = (options, version = KEPLER_GL_VERSION) => {
199241 <body>
200242 <!-- We will put our React component inside this div. -->
201243 <div id="app">
202- <!-- Kepler.gl map will be placed here-->
244+ <div id="kepler-load-screen">
245+ <div class="kepler-spinner"></div>
246+ <div class="kepler-load-label">Loading map…</div>
247+ </div>
203248 </div>
204249
205250 <!--
0 commit comments