badge.ts — astro Source File
Architecture documentation for badge.ts, a typescript file in the astro codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR ccf99a0e_00b7_53c3_725a_7ede4ad7cb4c["badge.ts"] 844d479d_bd2c_31dd_1673_36b5e7e8016a["../settings.js"] ccf99a0e_00b7_53c3_725a_7ede4ad7cb4c --> 844d479d_bd2c_31dd_1673_36b5e7e8016a style ccf99a0e_00b7_53c3_725a_7ede4ad7cb4c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { settings } from '../settings.js';
const sizes = ['small', 'large'] as const;
const styles = ['purple', 'gray', 'red', 'green', 'yellow', 'blue'] as const;
type BadgeSize = (typeof sizes)[number];
type BadgeStyle = (typeof styles)[number];
export class DevToolbarBadge extends HTMLElement {
_size: BadgeSize = 'small';
_badgeStyle: BadgeStyle = 'purple';
get size() {
return this._size;
}
set size(value) {
if (!sizes.includes(value)) {
settings.logger.error(
`Invalid size: ${value}, expected one of ${sizes.join(', ')}, got ${value}.`,
);
return;
}
this._size = value;
this.updateStyle();
}
get badgeStyle() {
return this._badgeStyle;
}
set badgeStyle(value) {
if (!styles.includes(value)) {
settings.logger.error(
`Invalid style: ${value}, expected one of ${styles.join(', ')}, got ${value}.`,
);
return;
}
this._badgeStyle = value;
this.updateStyle();
}
shadowRoot: ShadowRoot;
static observedAttributes = ['badge-style', 'size'];
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);
// ... (61 more lines)
Domain
Subdomains
Classes
Types
Dependencies
- ../settings.js
Source
Frequently Asked Questions
What does badge.ts do?
badge.ts is a source file in the astro codebase, written in typescript. It belongs to the DevToolbar domain, ToolbarClient subdomain.
What does badge.ts depend on?
badge.ts imports 1 module(s): ../settings.js.
Where is badge.ts in the architecture?
badge.ts is located at packages/astro/src/runtime/client/dev-toolbar/ui-library/badge.ts (domain: DevToolbar, subdomain: ToolbarClient, directory: packages/astro/src/runtime/client/dev-toolbar/ui-library).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free