11import type { DevOverlayPlugin as DevOverlayPluginDefinition } from '../../../@types/astro.js' ;
22import { type AstroDevOverlay , type DevOverlayPlugin } from './overlay.js' ;
3+ import { settings } from './settings.js' ;
34
45let overlay : AstroDevOverlay ;
56
@@ -9,22 +10,26 @@ document.addEventListener('DOMContentLoaded', async () => {
910 { default : astroDevToolPlugin } ,
1011 { default : astroAuditPlugin } ,
1112 { default : astroXrayPlugin } ,
13+ { default : astroSettingsPlugin } ,
1214 { AstroDevOverlay, DevOverlayCanvas } ,
1315 { DevOverlayCard } ,
1416 { DevOverlayHighlight } ,
1517 { DevOverlayTooltip } ,
1618 { DevOverlayWindow } ,
19+ { DevOverlayToggle } ,
1720 ] = await Promise . all ( [
1821 // @ts -expect-error
1922 import ( 'astro:dev-overlay' ) ,
2023 import ( './plugins/astro.js' ) ,
2124 import ( './plugins/audit.js' ) ,
2225 import ( './plugins/xray.js' ) ,
26+ import ( './plugins/settings.js' ) ,
2327 import ( './overlay.js' ) ,
2428 import ( './ui-library/card.js' ) ,
2529 import ( './ui-library/highlight.js' ) ,
2630 import ( './ui-library/tooltip.js' ) ,
2731 import ( './ui-library/window.js' ) ,
32+ import ( './ui-library/toggle.js' ) ,
2833 ] ) ;
2934
3035 // Register custom elements
@@ -34,6 +39,7 @@ document.addEventListener('DOMContentLoaded', async () => {
3439 customElements . define ( 'astro-dev-overlay-tooltip' , DevOverlayTooltip ) ;
3540 customElements . define ( 'astro-dev-overlay-highlight' , DevOverlayHighlight ) ;
3641 customElements . define ( 'astro-dev-overlay-card' , DevOverlayCard ) ;
42+ customElements . define ( 'astro-dev-overlay-toggle' , DevOverlayToggle ) ;
3743
3844 overlay = document . createElement ( 'astro-dev-overlay' ) ;
3945
@@ -60,7 +66,9 @@ document.addEventListener('DOMContentLoaded', async () => {
6066 newState = evt . detail . state ?? true ;
6167 }
6268
63- target . querySelector ( '.notification' ) ?. toggleAttribute ( 'data-active' , newState ) ;
69+ if ( settings . config . showPluginNotifications === false ) {
70+ target . querySelector ( '.notification' ) ?. toggleAttribute ( 'data-active' , newState ) ;
71+ }
6472 } ) ;
6573
6674 eventTarget . addEventListener ( 'toggle-plugin' , async ( evt ) => {
@@ -77,8 +85,8 @@ document.addEventListener('DOMContentLoaded', async () => {
7785
7886 const customPluginsDefinitions = ( await loadDevOverlayPlugins ( ) ) as DevOverlayPluginDefinition [ ] ;
7987 const plugins : DevOverlayPlugin [ ] = [
80- ...[ astroDevToolPlugin , astroXrayPlugin , astroAuditPlugin ] . map ( ( pluginDef ) =>
81- preparePlugin ( pluginDef , true )
88+ ...[ astroDevToolPlugin , astroXrayPlugin , astroAuditPlugin , astroSettingsPlugin ] . map (
89+ ( pluginDef ) => preparePlugin ( pluginDef , true )
8290 ) ,
8391 ...customPluginsDefinitions . map ( ( pluginDef ) => preparePlugin ( pluginDef , false ) ) ,
8492 ] ;
0 commit comments