icon.ts — astro Source File
Architecture documentation for icon.ts, a typescript file in the astro codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR ff7ec47a_abe9_4d9c_94f2_4252bbdc58c2["icon.ts"] af6796b7_df62_9b1f_c5fc_dbdce9fa2c50["../../runtime/client/dev-toolbar/ui-library/icons.js"] ff7ec47a_abe9_4d9c_94f2_4252bbdc58c2 --> af6796b7_df62_9b1f_c5fc_dbdce9fa2c50 style ff7ec47a_abe9_4d9c_94f2_4252bbdc58c2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { getIconElement, type Icon, isDefinedIcon } from './icons.js';
export class DevToolbarIcon extends HTMLElement {
_icon: Icon | undefined = undefined;
shadowRoot: ShadowRoot;
get icon() {
return this._icon;
}
set icon(name: Icon | undefined) {
this._icon = name;
this.buildTemplate();
}
constructor() {
super();
this.shadowRoot = this.attachShadow({ mode: 'open' });
if (this.hasAttribute('icon')) {
this.icon = this.getAttribute('icon') as Icon;
} else {
this.buildTemplate();
}
}
getIconHTML(icon: Icon | undefined) {
if (icon && isDefinedIcon(icon)) {
return getIconElement(icon)?.outerHTML ?? '';
}
// If the icon that was passed isn't one of the predefined one, assume that they're passing it in as a slot
return '<slot />';
}
buildTemplate() {
this.shadowRoot.innerHTML = `
<style>
svg {
width: 100%;
height: 100%;
}
@media (forced-colors: active) {
svg path[fill="#fff"] {
fill: black;
}
}
</style>\n${this.getIconHTML(this._icon)}`;
}
}
Domain
Subdomains
Classes
Dependencies
- ../../runtime/client/dev-toolbar/ui-library/icons.js
Source
Frequently Asked Questions
What does icon.ts do?
icon.ts is a source file in the astro codebase, written in typescript. It belongs to the DevToolbar domain, ToolbarClient subdomain.
What does icon.ts depend on?
icon.ts imports 1 module(s): ../../runtime/client/dev-toolbar/ui-library/icons.js.
Where is icon.ts in the architecture?
icon.ts is located at packages/astro/src/runtime/client/dev-toolbar/ui-library/icon.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