astro 4.1.2 → 4.1.3

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 (72) hide show
  1. package/components/ViewTransitions.astro +6 -1
  2. package/dist/@types/astro.d.ts +26 -25
  3. package/dist/assets/internal.js +3 -2
  4. package/dist/assets/services/noop.js +1 -4
  5. package/dist/assets/types.d.ts +1 -1
  6. package/dist/assets/utils/emitAsset.js +1 -1
  7. package/dist/assets/utils/proxy.d.ts +2 -1
  8. package/dist/assets/utils/proxy.js +5 -1
  9. package/dist/assets/vite-plugin-assets.js +21 -14
  10. package/dist/content/runtime-assets.d.ts +1 -1
  11. package/dist/content/runtime-assets.js +1 -1
  12. package/dist/content/vite-plugin-content-imports.js +1 -0
  13. package/dist/core/config/vite-load.js +1 -1
  14. package/dist/core/constants.js +1 -1
  15. package/dist/core/create-vite.js +3 -3
  16. package/dist/core/dev/dev.js +1 -1
  17. package/dist/core/errors/errors-data.d.ts +5 -0
  18. package/dist/core/errors/errors-data.js +7 -0
  19. package/dist/core/messages.js +2 -2
  20. package/dist/core/routing/manifest/create.js +15 -0
  21. package/dist/core/sync/index.js +1 -1
  22. package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/astro.js +2 -2
  23. package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/audit/index.js +3 -3
  24. package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/settings.js +7 -7
  25. package/dist/runtime/client/dev-toolbar/apps/utils/highlight.d.ts +8 -0
  26. package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/window.d.ts +1 -1
  27. package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/xray.js +4 -4
  28. package/dist/runtime/client/{dev-overlay → dev-toolbar}/entrypoint.js +64 -68
  29. package/dist/runtime/client/{dev-overlay → dev-toolbar}/settings.d.ts +2 -2
  30. package/dist/runtime/client/{dev-overlay → dev-toolbar}/settings.js +10 -5
  31. package/dist/runtime/client/dev-toolbar/toolbar.d.ts +45 -0
  32. package/dist/runtime/client/{dev-overlay/overlay.js → dev-toolbar/toolbar.js} +99 -103
  33. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/badge.d.ts +1 -1
  34. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/badge.js +2 -2
  35. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/button.d.ts +1 -1
  36. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/button.js +3 -2
  37. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/card.d.ts +1 -1
  38. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/card.js +2 -2
  39. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/highlight.d.ts +1 -1
  40. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/highlight.js +2 -2
  41. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/icon.d.ts +1 -1
  42. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/icon.js +2 -2
  43. package/dist/runtime/client/dev-toolbar/ui-library/index.d.ts +8 -0
  44. package/dist/runtime/client/dev-toolbar/ui-library/index.js +18 -0
  45. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/toggle.d.ts +1 -1
  46. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/toggle.js +2 -2
  47. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/tooltip.d.ts +3 -3
  48. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/tooltip.js +2 -2
  49. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/window.d.ts +1 -1
  50. package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/window.js +3 -3
  51. package/dist/vite-plugin-astro/index.js +12 -2
  52. package/dist/vite-plugin-astro-server/route.js +3 -3
  53. package/dist/{vite-plugin-dev-overlay/vite-plugin-dev-overlay.d.ts → vite-plugin-dev-toolbar/vite-plugin-dev-toolbar.d.ts} +1 -1
  54. package/dist/{vite-plugin-dev-overlay/vite-plugin-dev-overlay.js → vite-plugin-dev-toolbar/vite-plugin-dev-toolbar.js} +5 -5
  55. package/package.json +1 -1
  56. package/dist/runtime/client/dev-overlay/overlay.d.ts +0 -45
  57. package/dist/runtime/client/dev-overlay/plugins/utils/highlight.d.ts +0 -8
  58. package/dist/runtime/client/dev-overlay/ui-library/index.d.ts +0 -8
  59. package/dist/runtime/client/dev-overlay/ui-library/index.js +0 -18
  60. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/astro.d.ts +0 -0
  61. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/audit/a11y.d.ts +0 -0
  62. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/audit/a11y.js +0 -0
  63. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/audit/index.d.ts +0 -0
  64. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/settings.d.ts +0 -0
  65. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/highlight.js +0 -0
  66. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/icons.d.ts +0 -0
  67. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/icons.js +0 -0
  68. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/utils/window.js +0 -0
  69. /package/dist/runtime/client/{dev-overlay/plugins → dev-toolbar/apps}/xray.d.ts +0 -0
  70. /package/dist/runtime/client/{dev-overlay → dev-toolbar}/entrypoint.d.ts +0 -0
  71. /package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/icons.d.ts +0 -0
  72. /package/dist/runtime/client/{dev-overlay → dev-toolbar}/ui-library/icons.js +0 -0
@@ -4,14 +4,14 @@ const WS_EVENT_NAME = "astro-dev-toolbar";
4
4
  const WS_EVENT_NAME_DEPRECATED = "astro-dev-overlay";
5
5
  const HOVER_DELAY = 2 * 1e3;
6
6
  const DEVBAR_HITBOX_ABOVE = 42;
7
- class AstroDevOverlay extends HTMLElement {
7
+ class AstroDevToolbar extends HTMLElement {
8
8
  shadowRoot;
9
9
  delayedHideTimeout;
10
- devOverlay;
11
- plugins = [];
10
+ devToolbarContainer;
11
+ apps = [];
12
12
  hasBeenInitialized = false;
13
13
  // TODO: This should be dynamic based on the screen size or at least configurable, erika - 2023-11-29
14
- customPluginsToShow = 3;
14
+ customAppsToShow = 3;
15
15
  constructor() {
16
16
  super();
17
17
  this.shadowRoot = this.attachShadow({ mode: "open" });
@@ -36,7 +36,7 @@ class AstroDevOverlay extends HTMLElement {
36
36
  animation: none;
37
37
  }
38
38
 
39
- #dev-overlay {
39
+ #dev-toolbar-root {
40
40
  position: fixed;
41
41
  bottom: 0px;
42
42
  left: 50%;
@@ -49,11 +49,11 @@ class AstroDevOverlay extends HTMLElement {
49
49
  pointer-events: none;
50
50
  }
51
51
 
52
- #dev-overlay[data-hidden] {
52
+ #dev-toolbar-root[data-hidden] {
53
53
  bottom: -40px;
54
54
  }
55
55
 
56
- #dev-overlay[data-hidden] #dev-bar .item {
56
+ #dev-toolbar-root[data-hidden] #dev-bar .item {
57
57
  opacity: 0.2;
58
58
  }
59
59
 
@@ -197,7 +197,7 @@ class AstroDevOverlay extends HTMLElement {
197
197
  background: #B33E66;
198
198
  }
199
199
 
200
- #dev-overlay:not([data-no-notification]) #dev-bar .item .notification[data-active] {
200
+ #dev-toolbar-root:not([data-no-notification]) #dev-bar .item .notification[data-active] {
201
201
  display: block;
202
202
  }
203
203
 
@@ -211,44 +211,40 @@ class AstroDevOverlay extends HTMLElement {
211
211
  width: 1px;
212
212
  }
213
213
  </style>
214
- <div id="dev-overlay" data-hidden ${settings.config.disablePluginNotification ? "data-no-notification" : ""}>
214
+ <div id="dev-toolbar-root" data-hidden ${settings.config.disableAppNotification ? "data-no-notification" : ""}>
215
215
  <div id="dev-bar-hitbox-above"></div>
216
216
  <div id="dev-bar">
217
217
  <div id="bar-container">
218
- ${this.plugins.filter(
219
- (plugin) => plugin.builtIn && !["astro:settings", "astro:more"].includes(plugin.id)
220
- ).map((plugin) => this.getPluginTemplate(plugin)).join("")}
221
- ${this.plugins.filter((plugin) => !plugin.builtIn).length > 0 ? `<div class="separator"></div>${this.plugins.filter((plugin) => !plugin.builtIn).slice(0, this.customPluginsToShow).map((plugin) => this.getPluginTemplate(plugin)).join("")}` : ""}
222
- ${this.plugins.filter((plugin) => !plugin.builtIn).length > this.customPluginsToShow ? this.getPluginTemplate(
223
- this.plugins.find((plugin) => plugin.builtIn && plugin.id === "astro:more")
218
+ ${this.apps.filter((app) => app.builtIn && !["astro:settings", "astro:more"].includes(app.id)).map((app) => this.getAppTemplate(app)).join("")}
219
+ ${this.apps.filter((app) => !app.builtIn).length > 0 ? `<div class="separator"></div>${this.apps.filter((app) => !app.builtIn).slice(0, this.customAppsToShow).map((app) => this.getAppTemplate(app)).join("")}` : ""}
220
+ ${this.apps.filter((app) => !app.builtIn).length > this.customAppsToShow ? this.getAppTemplate(
221
+ this.apps.find((app) => app.builtIn && app.id === "astro:more")
224
222
  ) : ""}
225
223
  <div class="separator"></div>
226
- ${this.getPluginTemplate(
227
- this.plugins.find((plugin) => plugin.builtIn && plugin.id === "astro:settings")
228
- )}
224
+ ${this.getAppTemplate(this.apps.find((app) => app.builtIn && app.id === "astro:settings"))}
229
225
  </div>
230
226
  </div>
231
227
  <div id="dev-bar-hitbox-below"></div>
232
228
  </div>`;
233
- this.devOverlay = this.shadowRoot.querySelector("#dev-overlay");
229
+ this.devToolbarContainer = this.shadowRoot.querySelector("#dev-toolbar-root");
234
230
  this.attachEvents();
235
- this.plugins.forEach(async (plugin) => {
231
+ this.apps.forEach(async (app) => {
236
232
  if (settings.config.verbose)
237
- console.log(`Creating plugin canvas for ${plugin.id}`);
238
- const pluginCanvas = document.createElement("astro-dev-toolbar-plugin-canvas");
239
- pluginCanvas.dataset.pluginId = plugin.id;
240
- this.shadowRoot?.append(pluginCanvas);
233
+ console.log(`Creating app canvas for ${app.id}`);
234
+ const appCanvas = document.createElement("astro-dev-toolbar-app-canvas");
235
+ appCanvas.dataset.appId = app.id;
236
+ this.shadowRoot?.append(appCanvas);
241
237
  });
242
238
  if ("requestIdleCallback" in window) {
243
239
  window.requestIdleCallback(
244
240
  async () => {
245
- this.plugins.map((plugin) => this.initPlugin(plugin));
241
+ this.apps.map((app) => this.initApp(app));
246
242
  },
247
243
  { timeout: 300 }
248
244
  );
249
245
  } else {
250
246
  setTimeout(async () => {
251
- this.plugins.map((plugin) => this.initPlugin(plugin));
247
+ this.apps.map((app) => this.initApp(app));
252
248
  }, 300);
253
249
  }
254
250
  }
@@ -260,8 +256,8 @@ class AstroDevOverlay extends HTMLElement {
260
256
  this.init();
261
257
  this.hasBeenInitialized = true;
262
258
  }
263
- this.plugins.forEach(async (plugin) => {
264
- await this.setPluginStatus(plugin, plugin.active);
259
+ this.apps.forEach(async (app) => {
260
+ await this.setAppStatus(app, app.active);
265
261
  });
266
262
  }
267
263
  attachEvents() {
@@ -271,28 +267,28 @@ class AstroDevOverlay extends HTMLElement {
271
267
  const target = event.currentTarget;
272
268
  if (!target || !(target instanceof HTMLElement))
273
269
  return;
274
- const id = target.dataset.pluginId;
270
+ const id = target.dataset.appId;
275
271
  if (!id)
276
272
  return;
277
- const plugin = this.getPluginById(id);
278
- if (!plugin)
273
+ const app = this.getAppById(id);
274
+ if (!app)
279
275
  return;
280
276
  event.stopPropagation();
281
- await this.togglePluginStatus(plugin);
277
+ await this.toggleAppStatus(app);
282
278
  });
283
279
  });
284
280
  ["mouseenter", "focusin"].forEach((event) => {
285
- this.devOverlay.addEventListener(event, () => {
281
+ this.devToolbarContainer.addEventListener(event, () => {
286
282
  this.clearDelayedHide();
287
283
  if (this.isHidden()) {
288
- this.setOverlayVisible(true);
284
+ this.setToolbarVisible(true);
289
285
  }
290
286
  });
291
287
  });
292
288
  ["mouseleave", "focusout"].forEach((event) => {
293
- this.devOverlay.addEventListener(event, () => {
289
+ this.devToolbarContainer.addEventListener(event, () => {
294
290
  this.clearDelayedHide();
295
- if (this.getActivePlugin() || this.isHidden()) {
291
+ if (this.getActiveApp() || this.isHidden()) {
296
292
  return;
297
293
  }
298
294
  this.triggerDelayedHide();
@@ -303,112 +299,113 @@ class AstroDevOverlay extends HTMLElement {
303
299
  return;
304
300
  if (this.isHidden())
305
301
  return;
306
- const activePlugin = this.getActivePlugin();
307
- if (activePlugin) {
308
- this.togglePluginStatus(activePlugin);
302
+ const activeApp = this.getActiveApp();
303
+ if (activeApp) {
304
+ this.toggleAppStatus(activeApp);
309
305
  } else {
310
- this.setOverlayVisible(false);
306
+ this.setToolbarVisible(false);
311
307
  }
312
308
  });
313
309
  }
314
- async initPlugin(plugin) {
315
- const shadowRoot = this.getPluginCanvasById(plugin.id).shadowRoot;
316
- plugin.status = "loading";
310
+ async initApp(app) {
311
+ const shadowRoot = this.getAppCanvasById(app.id).shadowRoot;
312
+ app.status = "loading";
317
313
  try {
318
314
  if (settings.config.verbose)
319
- console.info(`Initializing plugin ${plugin.id}`);
320
- await plugin.init?.(shadowRoot, plugin.eventTarget);
321
- plugin.status = "ready";
315
+ console.info(`Initializing app ${app.id}`);
316
+ await app.init?.(shadowRoot, app.eventTarget);
317
+ app.status = "ready";
322
318
  if (import.meta.hot) {
323
- import.meta.hot.send(`${WS_EVENT_NAME}:${plugin.id}:initialized`);
324
- import.meta.hot.send(`${WS_EVENT_NAME_DEPRECATED}:${plugin.id}:initialized`);
319
+ import.meta.hot.send(`${WS_EVENT_NAME}:${app.id}:initialized`);
320
+ import.meta.hot.send(`${WS_EVENT_NAME_DEPRECATED}:${app.id}:initialized`);
325
321
  }
326
322
  } catch (e) {
327
- console.error(`Failed to init plugin ${plugin.id}, error: ${e}`);
328
- plugin.status = "error";
323
+ console.error(`Failed to init app ${app.id}, error: ${e}`);
324
+ app.status = "error";
329
325
  }
330
326
  }
331
- getPluginTemplate(plugin) {
332
- return `<button class="item" data-plugin-id="${plugin.id}">
333
- <div class="icon">${getPluginIcon(plugin.icon)}<div class="notification"></div></div>
334
- <span class="item-tooltip">${plugin.name}</span>
327
+ getAppTemplate(app) {
328
+ return `<button class="item" data-app-id="${app.id}">
329
+ <div class="icon">${getAppIcon(app.icon)}<div class="notification"></div></div>
330
+ <span class="item-tooltip">${app.name}</span>
335
331
  </button>`;
336
332
  }
337
- getPluginById(id) {
338
- return this.plugins.find((plugin) => plugin.id === id);
333
+ getAppById(id) {
334
+ return this.apps.find((app) => app.id === id);
339
335
  }
340
- getPluginCanvasById(id) {
336
+ getAppCanvasById(id) {
341
337
  return this.shadowRoot.querySelector(
342
- `astro-dev-toolbar-plugin-canvas[data-plugin-id="${id}"]`
338
+ `astro-dev-toolbar-app-canvas[data-app-id="${id}"]`
343
339
  );
344
340
  }
345
- async togglePluginStatus(plugin) {
346
- const activePlugin = this.getActivePlugin();
347
- if (activePlugin) {
348
- const closePlugin = await this.setPluginStatus(activePlugin, false);
349
- if (!closePlugin)
341
+ async toggleAppStatus(app) {
342
+ const activeApp = this.getActiveApp();
343
+ if (activeApp) {
344
+ const closeApp = await this.setAppStatus(activeApp, false);
345
+ if (!closeApp)
350
346
  return;
351
347
  }
352
- if (plugin.status !== "ready")
348
+ if (app.status !== "ready")
353
349
  return;
354
- if (plugin !== activePlugin) {
355
- await this.setPluginStatus(plugin, true);
350
+ if (app !== activeApp) {
351
+ await this.setAppStatus(app, true);
356
352
  }
357
353
  }
358
- async setPluginStatus(plugin, newStatus) {
359
- const pluginCanvas = this.getPluginCanvasById(plugin.id);
360
- if (!pluginCanvas)
354
+ async setAppStatus(app, newStatus) {
355
+ const appCanvas = this.getAppCanvasById(app.id);
356
+ if (!appCanvas)
361
357
  return false;
362
- if (plugin.active && !newStatus && plugin.beforeTogglingOff) {
363
- const shouldToggleOff = await plugin.beforeTogglingOff(pluginCanvas.shadowRoot);
358
+ if (app.active && !newStatus && app.beforeTogglingOff) {
359
+ const shouldToggleOff = await app.beforeTogglingOff(appCanvas.shadowRoot);
364
360
  if (!shouldToggleOff)
365
361
  return false;
366
362
  }
367
- plugin.active = newStatus ?? !plugin.active;
368
- const mainBarButton = this.shadowRoot.querySelector(`[data-plugin-id="${plugin.id}"]`);
369
- const moreBarButton = this.getPluginCanvasById("astro:more")?.shadowRoot?.querySelector(
370
- `[data-plugin-id="${plugin.id}"]`
363
+ app.active = newStatus ?? !app.active;
364
+ const mainBarButton = this.shadowRoot.querySelector(`[data-app-id="${app.id}"]`);
365
+ const moreBarButton = this.getAppCanvasById("astro:more")?.shadowRoot?.querySelector(
366
+ `[data-app-id="${app.id}"]`
371
367
  );
372
368
  if (mainBarButton) {
373
- mainBarButton.classList.toggle("active", plugin.active);
369
+ mainBarButton.classList.toggle("active", app.active);
374
370
  }
375
371
  if (moreBarButton) {
376
- moreBarButton.classList.toggle("active", plugin.active);
372
+ moreBarButton.classList.toggle("active", app.active);
377
373
  }
378
- if (plugin.active) {
379
- pluginCanvas.style.display = "block";
380
- pluginCanvas.setAttribute("data-active", "");
374
+ if (app.active) {
375
+ appCanvas.style.display = "block";
376
+ appCanvas.setAttribute("data-active", "");
381
377
  } else {
382
- pluginCanvas.style.display = "none";
383
- pluginCanvas.removeAttribute("data-active");
378
+ appCanvas.style.display = "none";
379
+ appCanvas.removeAttribute("data-active");
384
380
  }
385
381
  [
386
382
  "app-toggled",
387
383
  // Deprecated
384
+ // TODO: Remove in Astro 5.0
388
385
  "plugin-toggled"
389
386
  ].forEach((eventName) => {
390
- plugin.eventTarget.dispatchEvent(
387
+ app.eventTarget.dispatchEvent(
391
388
  new CustomEvent(eventName, {
392
389
  detail: {
393
- state: plugin.active,
394
- plugin
390
+ state: app.active,
391
+ app
395
392
  }
396
393
  })
397
394
  );
398
395
  });
399
396
  if (import.meta.hot) {
400
- import.meta.hot.send(`${WS_EVENT_NAME}:${plugin.id}:toggled`, { state: plugin.active });
401
- import.meta.hot.send(`${WS_EVENT_NAME_DEPRECATED}:${plugin.id}:toggled`, {
402
- state: plugin.active
397
+ import.meta.hot.send(`${WS_EVENT_NAME}:${app.id}:toggled`, { state: app.active });
398
+ import.meta.hot.send(`${WS_EVENT_NAME_DEPRECATED}:${app.id}:toggled`, {
399
+ state: app.active
403
400
  });
404
401
  }
405
402
  return true;
406
403
  }
407
404
  isHidden() {
408
- return this.devOverlay?.hasAttribute("data-hidden") ?? true;
405
+ return this.devToolbarContainer?.hasAttribute("data-hidden") ?? true;
409
406
  }
410
- getActivePlugin() {
411
- return this.plugins.find((plugin) => plugin.active);
407
+ getActiveApp() {
408
+ return this.apps.find((app) => app.active);
412
409
  }
413
410
  clearDelayedHide() {
414
411
  window.clearTimeout(this.delayedHideTimeout);
@@ -417,16 +414,16 @@ class AstroDevOverlay extends HTMLElement {
417
414
  triggerDelayedHide() {
418
415
  this.clearDelayedHide();
419
416
  this.delayedHideTimeout = window.setTimeout(() => {
420
- this.setOverlayVisible(false);
417
+ this.setToolbarVisible(false);
421
418
  this.delayedHideTimeout = void 0;
422
419
  }, HOVER_DELAY);
423
420
  }
424
- setOverlayVisible(newStatus) {
421
+ setToolbarVisible(newStatus) {
425
422
  const barContainer = this.shadowRoot.querySelector("#bar-container");
426
423
  const devBar = this.shadowRoot.querySelector("#dev-bar");
427
424
  const devBarHitboxAbove = this.shadowRoot.querySelector("#dev-bar-hitbox-above");
428
425
  if (newStatus === true) {
429
- this.devOverlay?.removeAttribute("data-hidden");
426
+ this.devToolbarContainer?.removeAttribute("data-hidden");
430
427
  barContainer?.removeAttribute("inert");
431
428
  devBar?.removeAttribute("tabindex");
432
429
  if (devBarHitboxAbove)
@@ -434,7 +431,7 @@ class AstroDevOverlay extends HTMLElement {
434
431
  return;
435
432
  }
436
433
  if (newStatus === false) {
437
- this.devOverlay?.setAttribute("data-hidden", "");
434
+ this.devToolbarContainer?.setAttribute("data-hidden", "");
438
435
  barContainer?.setAttribute("inert", "");
439
436
  devBar?.setAttribute("tabindex", "0");
440
437
  if (devBarHitboxAbove)
@@ -443,13 +440,12 @@ class AstroDevOverlay extends HTMLElement {
443
440
  }
444
441
  }
445
442
  setNotificationVisible(newStatus) {
446
- const devOverlayElement = this.shadowRoot.querySelector("#dev-overlay");
447
- devOverlayElement?.toggleAttribute("data-no-notification", !newStatus);
448
- const moreCanvas = this.getPluginCanvasById("astro:more");
443
+ this.devToolbarContainer?.toggleAttribute("data-no-notification", !newStatus);
444
+ const moreCanvas = this.getAppCanvasById("astro:more");
449
445
  moreCanvas?.shadowRoot?.querySelector("#dropdown")?.toggleAttribute("data-no-notification", !newStatus);
450
446
  }
451
447
  }
452
- class DevOverlayCanvas extends HTMLElement {
448
+ class DevToolbarCanvas extends HTMLElement {
453
449
  shadowRoot;
454
450
  constructor() {
455
451
  super();
@@ -466,14 +462,14 @@ class DevOverlayCanvas extends HTMLElement {
466
462
  </style>`;
467
463
  }
468
464
  }
469
- function getPluginIcon(icon) {
465
+ function getAppIcon(icon) {
470
466
  if (isDefinedIcon(icon)) {
471
467
  return getIconElement(icon).outerHTML;
472
468
  }
473
469
  return icon;
474
470
  }
475
471
  export {
476
- AstroDevOverlay,
477
- DevOverlayCanvas,
478
- getPluginIcon
472
+ AstroDevToolbar,
473
+ DevToolbarCanvas,
474
+ getAppIcon
479
475
  };
@@ -1,6 +1,6 @@
1
1
  type BadgeSize = 'small' | 'large';
2
2
  type BadgeStyle = 'purple' | 'gray' | 'red' | 'green' | 'yellow';
3
- export declare class DevOverlayBadge extends HTMLElement {
3
+ export declare class DevToolbarBadge extends HTMLElement {
4
4
  size: BadgeSize;
5
5
  badgeStyle: BadgeStyle;
6
6
  shadowRoot: ShadowRoot;
@@ -1,4 +1,4 @@
1
- class DevOverlayBadge extends HTMLElement {
1
+ class DevToolbarBadge extends HTMLElement {
2
2
  size = "small";
3
3
  badgeStyle = "purple";
4
4
  shadowRoot;
@@ -63,5 +63,5 @@ class DevOverlayBadge extends HTMLElement {
63
63
  }
64
64
  }
65
65
  export {
66
- DevOverlayBadge
66
+ DevToolbarBadge
67
67
  };
@@ -1,6 +1,6 @@
1
1
  type ButtonSize = 'small' | 'medium' | 'large';
2
2
  type ButtonStyle = 'ghost' | 'outline' | 'purple' | 'gray' | 'red';
3
- export declare class DevOverlayButton extends HTMLElement {
3
+ export declare class DevToolbarButton extends HTMLElement {
4
4
  size: ButtonSize;
5
5
  buttonStyle: ButtonStyle;
6
6
  shadowRoot: ShadowRoot;
@@ -1,4 +1,4 @@
1
- class DevOverlayButton extends HTMLElement {
1
+ class DevToolbarButton extends HTMLElement {
2
2
  size = "small";
3
3
  buttonStyle = "purple";
4
4
  shadowRoot;
@@ -64,6 +64,7 @@ class DevOverlayButton extends HTMLElement {
64
64
  border-color: rgba(249, 196, 215, 0.33);
65
65
  }
66
66
 
67
+ /* TODO: Remove "astro-dev-overlay-icon" in Astro 5.0 */
67
68
  ::slotted(astro-dev-overlay-icon),
68
69
  ::slotted(astro-dev-toolbar-icon) {
69
70
  display: inline-block;
@@ -80,5 +81,5 @@ class DevOverlayButton extends HTMLElement {
80
81
  }
81
82
  }
82
83
  export {
83
- DevOverlayButton
84
+ DevToolbarButton
84
85
  };
@@ -1,4 +1,4 @@
1
- export declare class DevOverlayCard extends HTMLElement {
1
+ export declare class DevToolbarCard extends HTMLElement {
2
2
  link?: string | undefined | null;
3
3
  clickAction?: () => void | (() => Promise<void>);
4
4
  shadowRoot: ShadowRoot;
@@ -1,4 +1,4 @@
1
- class DevOverlayCard extends HTMLElement {
1
+ class DevToolbarCard extends HTMLElement {
2
2
  link;
3
3
  clickAction;
4
4
  shadowRoot;
@@ -57,5 +57,5 @@ class DevOverlayCard extends HTMLElement {
57
57
  }
58
58
  }
59
59
  export {
60
- DevOverlayCard
60
+ DevToolbarCard
61
61
  };
@@ -1,5 +1,5 @@
1
1
  import { type Icon } from './icons.js';
2
- export declare class DevOverlayHighlight extends HTMLElement {
2
+ export declare class DevToolbarHighlight extends HTMLElement {
3
3
  icon?: Icon | undefined | null;
4
4
  shadowRoot: ShadowRoot;
5
5
  constructor();
@@ -1,5 +1,5 @@
1
1
  import { getIconElement, isDefinedIcon } from "./icons.js";
2
- class DevOverlayHighlight extends HTMLElement {
2
+ class DevToolbarHighlight extends HTMLElement {
3
3
  icon;
4
4
  shadowRoot;
5
5
  constructor() {
@@ -58,5 +58,5 @@ class DevOverlayHighlight extends HTMLElement {
58
58
  }
59
59
  }
60
60
  export {
61
- DevOverlayHighlight
61
+ DevToolbarHighlight
62
62
  };
@@ -1,5 +1,5 @@
1
1
  import { type Icon } from './icons.js';
2
- export declare class DevOverlayIcon extends HTMLElement {
2
+ export declare class DevToolbarIcon extends HTMLElement {
3
3
  _icon: Icon | undefined;
4
4
  shadowRoot: ShadowRoot;
5
5
  get icon(): Icon | undefined;
@@ -1,5 +1,5 @@
1
1
  import { getIconElement, isDefinedIcon } from "./icons.js";
2
- class DevOverlayIcon extends HTMLElement {
2
+ class DevToolbarIcon extends HTMLElement {
3
3
  _icon = void 0;
4
4
  shadowRoot;
5
5
  get icon() {
@@ -42,5 +42,5 @@ ${this.getIconHTML(this._icon)}`;
42
42
  }
43
43
  }
44
44
  export {
45
- DevOverlayIcon
45
+ DevToolbarIcon
46
46
  };
@@ -0,0 +1,8 @@
1
+ export { DevToolbarBadge } from './badge.js';
2
+ export { DevToolbarButton } from './button.js';
3
+ export { DevToolbarCard } from './card.js';
4
+ export { DevToolbarHighlight } from './highlight.js';
5
+ export { DevToolbarIcon } from './icon.js';
6
+ export { DevToolbarToggle } from './toggle.js';
7
+ export { DevToolbarTooltip } from './tooltip.js';
8
+ export { DevToolbarWindow } from './window.js';
@@ -0,0 +1,18 @@
1
+ import { DevToolbarBadge } from "./badge.js";
2
+ import { DevToolbarButton } from "./button.js";
3
+ import { DevToolbarCard } from "./card.js";
4
+ import { DevToolbarHighlight } from "./highlight.js";
5
+ import { DevToolbarIcon } from "./icon.js";
6
+ import { DevToolbarToggle } from "./toggle.js";
7
+ import { DevToolbarTooltip } from "./tooltip.js";
8
+ import { DevToolbarWindow } from "./window.js";
9
+ export {
10
+ DevToolbarBadge,
11
+ DevToolbarButton,
12
+ DevToolbarCard,
13
+ DevToolbarHighlight,
14
+ DevToolbarIcon,
15
+ DevToolbarToggle,
16
+ DevToolbarTooltip,
17
+ DevToolbarWindow
18
+ };
@@ -1,4 +1,4 @@
1
- export declare class DevOverlayToggle extends HTMLElement {
1
+ export declare class DevToolbarToggle extends HTMLElement {
2
2
  shadowRoot: ShadowRoot;
3
3
  input: HTMLInputElement;
4
4
  constructor();
@@ -1,4 +1,4 @@
1
- class DevOverlayToggle extends HTMLElement {
1
+ class DevToolbarToggle extends HTMLElement {
2
2
  shadowRoot;
3
3
  input;
4
4
  constructor() {
@@ -61,5 +61,5 @@ class DevOverlayToggle extends HTMLElement {
61
61
  }
62
62
  }
63
63
  export {
64
- DevOverlayToggle
64
+ DevToolbarToggle
65
65
  };
@@ -1,5 +1,5 @@
1
1
  import { type Icon } from './icons.js';
2
- export interface DevOverlayTooltipSection {
2
+ export interface DevToolbarTooltipSection {
3
3
  title?: string;
4
4
  inlineTitle?: string;
5
5
  icon?: Icon;
@@ -7,8 +7,8 @@ export interface DevOverlayTooltipSection {
7
7
  clickAction?: () => void | Promise<void>;
8
8
  clickDescription?: string;
9
9
  }
10
- export declare class DevOverlayTooltip extends HTMLElement {
11
- sections: DevOverlayTooltipSection[];
10
+ export declare class DevToolbarTooltip extends HTMLElement {
11
+ sections: DevToolbarTooltipSection[];
12
12
  shadowRoot: ShadowRoot;
13
13
  constructor();
14
14
  connectedCallback(): void;
@@ -1,5 +1,5 @@
1
1
  import { getIconElement, isDefinedIcon } from "./icons.js";
2
- class DevOverlayTooltip extends HTMLElement {
2
+ class DevToolbarTooltip extends HTMLElement {
3
3
  sections = [];
4
4
  shadowRoot;
5
5
  constructor() {
@@ -139,5 +139,5 @@ class DevOverlayTooltip extends HTMLElement {
139
139
  }
140
140
  }
141
141
  export {
142
- DevOverlayTooltip
142
+ DevToolbarTooltip
143
143
  };
@@ -1,4 +1,4 @@
1
- export declare class DevOverlayWindow extends HTMLElement {
1
+ export declare class DevToolbarWindow extends HTMLElement {
2
2
  shadowRoot: ShadowRoot;
3
3
  constructor();
4
4
  connectedCallback(): Promise<void>;
@@ -1,4 +1,4 @@
1
- class DevOverlayWindow extends HTMLElement {
1
+ class DevToolbarWindow extends HTMLElement {
2
2
  shadowRoot;
3
3
  constructor() {
4
4
  super();
@@ -32,7 +32,7 @@ class DevOverlayWindow extends HTMLElement {
32
32
  background: white;
33
33
  }
34
34
  }
35
-
35
+
36
36
  @media (max-width: 640px) {
37
37
  :host {
38
38
  border-radius: 0;
@@ -79,5 +79,5 @@ class DevOverlayWindow extends HTMLElement {
79
79
  }
80
80
  }
81
81
  export {
82
- DevOverlayWindow
82
+ DevToolbarWindow
83
83
  };
@@ -12,6 +12,7 @@ import { getAstroMetadata } from "./metadata.js";
12
12
  function astro({ settings, logger }) {
13
13
  const { config } = settings;
14
14
  let resolvedConfig;
15
+ let server;
15
16
  const srcRootWeb = config.srcDir.pathname.slice(config.root.pathname.length - 1);
16
17
  const isBrowserPath = (path) => path.startsWith(srcRootWeb) && srcRootWeb !== "/";
17
18
  const prePlugin = {
@@ -21,6 +22,9 @@ function astro({ settings, logger }) {
21
22
  configResolved(_resolvedConfig) {
22
23
  resolvedConfig = _resolvedConfig;
23
24
  },
25
+ configureServer(_server) {
26
+ server = _server;
27
+ },
24
28
  async load(id, opts) {
25
29
  const parsedId = parseAstroRequest(id);
26
30
  const query = parsedId.query;
@@ -28,9 +32,15 @@ function astro({ settings, logger }) {
28
32
  return null;
29
33
  }
30
34
  const filename = normalizePath(normalizeFilename(parsedId.filename, config.root));
31
- const compileResult = getCachedCompileResult(config, filename);
35
+ let compileResult = getCachedCompileResult(config, filename);
32
36
  if (!compileResult) {
33
- return null;
37
+ if (server) {
38
+ await server.transformRequest("/@fs" + filename);
39
+ compileResult = getCachedCompileResult(config, filename);
40
+ }
41
+ if (!compileResult) {
42
+ throw new Error("No cached compile result found for " + id);
43
+ }
34
44
  }
35
45
  switch (query.type) {
36
46
  case "style": {