Home / Function/ constructor() — astro Function Reference

constructor() — astro Function Reference

Architecture documentation for the constructor() function in badge.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  0e123ba1_4088_b675_4c6b_fe51a26d57f5["constructor()"]
  bc3405ae_fd18_8ad9_3e21_98219f1338ab["DevToolbarBadge"]
  0e123ba1_4088_b675_4c6b_fe51a26d57f5 -->|defined in| bc3405ae_fd18_8ad9_3e21_98219f1338ab
  style 0e123ba1_4088_b675_4c6b_fe51a26d57f5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/runtime/client/dev-toolbar/ui-library/badge.ts lines 47–95

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

		this.shadowRoot.innerHTML = `
			<style>
				.badge {
					box-sizing: border-box;
					border-radius: 4px;
					border: 1px solid transparent;
					padding: 8px;
					font-size: 12px;
					color: var(--text-color);
					height: var(--size);
					border: 1px solid var(--border-color);
					display: flex;
					align-items: center;
					justify-content: center;
					font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

					--purple-text: rgba(224, 204, 250, 1);
					--purple-border: rgba(113, 24, 226, 1);

					--gray-text: rgba(191, 193, 201, 1);
					--gray-border:rgba(191, 193, 201, 1);

					--red-text: rgba(249, 196, 215, 1);
					--red-border: rgba(179, 62, 102, 1);

					--green-text: rgba(213, 249, 196, 1);
					--green-border: rgba(61, 125, 31, 1);

					--yellow-text: rgba(249, 233, 196, 1);
					--yellow-border: rgba(181, 138, 45, 1);

					--blue-text: rgba(189, 195, 255, 1);
					--blue-border: rgba(54, 69, 217, 1);

					--large: 24px;
					--small: 20px;
				}
			</style>
			<style id="selected-style"></style>

			<div class="badge">
				<slot></slot>
			</div>
			`;
	}

Domain

Subdomains

Frequently Asked Questions

What does constructor() do?
constructor() is a function in the astro codebase, defined in packages/astro/src/runtime/client/dev-toolbar/ui-library/badge.ts.
Where is constructor() defined?
constructor() is defined in packages/astro/src/runtime/client/dev-toolbar/ui-library/badge.ts at line 47.

Analyze Your Own Codebase

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

Try Supermodel Free