Home / File/ toolbar.ts — astro Source File

toolbar.ts — astro Source File

Architecture documentation for toolbar.ts, a typescript file in the astro codebase. 5 imports, 0 dependents.

File typescript DevToolbar ToolbarClient 5 imports 1 functions 2 classes

Entity Profile

Dependency Diagram

graph LR
  6a1a8bab_1e39_a18b_630a_7bc4ee8ce93a["toolbar.ts"]
  6e91fe0d_c6ce_0cca_abd3_06b774edbe23["./toolbar.js"]
  6a1a8bab_1e39_a18b_630a_7bc4ee8ce93a --> 6e91fe0d_c6ce_0cca_abd3_06b774edbe23
  ec98291d_da42_0350_bc9f_3b52b09b5112["../../runtime/client/dev-toolbar/helpers.js"]
  6a1a8bab_1e39_a18b_630a_7bc4ee8ce93a --> ec98291d_da42_0350_bc9f_3b52b09b5112
  844d479d_bd2c_31dd_1673_36b5e7e8016a["../settings.js"]
  6a1a8bab_1e39_a18b_630a_7bc4ee8ce93a --> 844d479d_bd2c_31dd_1673_36b5e7e8016a
  af6796b7_df62_9b1f_c5fc_dbdce9fa2c50["../../runtime/client/dev-toolbar/ui-library/icons.js"]
  6a1a8bab_1e39_a18b_630a_7bc4ee8ce93a --> af6796b7_df62_9b1f_c5fc_dbdce9fa2c50
  09fa95e1_0f5f_b352_8674_9da4b245b83b["./ui-library/window.js"]
  6a1a8bab_1e39_a18b_630a_7bc4ee8ce93a --> 09fa95e1_0f5f_b352_8674_9da4b245b83b
  style 6a1a8bab_1e39_a18b_630a_7bc4ee8ce93a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { ResolvedDevToolbarApp as DevToolbarAppDefinition } from '../../../types/public/toolbar.js';
import { serverHelpers, type ToolbarAppEventTarget } from './helpers.js';
import { settings } from './settings.js';
import { getIconElement, type Icon, isDefinedIcon } from './ui-library/icons.js';
import type { Placement } from './ui-library/window.js';

export type DevToolbarApp = DevToolbarAppDefinition & {
	builtIn: boolean;
	active: boolean;
	status: 'ready' | 'loading' | 'error';
	notification: {
		state: boolean;
		level?: 'error' | 'warning' | 'info';
	};
	eventTarget: ToolbarAppEventTarget;
};
const WS_EVENT_NAME = 'astro-dev-toolbar';

const HOVER_DELAY = 2 * 1000;
const DEVBAR_HITBOX_ABOVE = 42;

export class AstroDevToolbar extends HTMLElement {
	shadowRoot: ShadowRoot;
	delayedHideTimeout: number | undefined;
	devToolbarContainer: HTMLDivElement | undefined;
	apps: DevToolbarApp[] = [];
	hasBeenInitialized = false;
	// TODO: This should be dynamic based on the screen size or at least configurable, erika - 2023-11-29
	customAppsToShow = 3;

	constructor() {
		super();
		this.shadowRoot = this.attachShadow({ mode: 'open' });
	}

	/**
	 * All one-time DOM setup runs through here. Only ever call this once,
	 * in connectedCallback(), and protect it from being called again.
	 */
	init() {
		this.shadowRoot.innerHTML = `
		<style>
			:host {
				/* Important! Reset all inherited styles to initial */
				all: initial;
				z-index: 999999;
				view-transition-name: astro-dev-toolbar;
				display: contents;

				/* Hide the dev toolbar on window.print() (CTRL + P) */
				@media print {
					display: none;
				}
			}

			::view-transition-old(astro-dev-toolbar),
			::view-transition-new(astro-dev-toolbar) {
				animation: none;
			}

// ... (545 more lines)

Domain

Subdomains

Functions

Dependencies

  • ../../runtime/client/dev-toolbar/helpers.js
  • ../../runtime/client/dev-toolbar/ui-library/icons.js
  • ../settings.js
  • ./toolbar.js
  • ./ui-library/window.js

Frequently Asked Questions

What does toolbar.ts do?
toolbar.ts is a source file in the astro codebase, written in typescript. It belongs to the DevToolbar domain, ToolbarClient subdomain.
What functions are defined in toolbar.ts?
toolbar.ts defines 1 function(s): getAppIcon.
What does toolbar.ts depend on?
toolbar.ts imports 5 module(s): ../../runtime/client/dev-toolbar/helpers.js, ../../runtime/client/dev-toolbar/ui-library/icons.js, ../settings.js, ./toolbar.js, ./ui-library/window.js.
Where is toolbar.ts in the architecture?
toolbar.ts is located at packages/astro/src/runtime/client/dev-toolbar/toolbar.ts (domain: DevToolbar, subdomain: ToolbarClient, directory: packages/astro/src/runtime/client/dev-toolbar).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free