Home / File/ highlight.ts — astro Source File

highlight.ts — astro Source File

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

File typescript DevToolbar ToolbarClient 2 imports 1 classes

Entity Profile

Dependency Diagram

graph LR
  542b8124_ad12_067d_82d7_526ad0a69372["highlight.ts"]
  844d479d_bd2c_31dd_1673_36b5e7e8016a["../settings.js"]
  542b8124_ad12_067d_82d7_526ad0a69372 --> 844d479d_bd2c_31dd_1673_36b5e7e8016a
  af6796b7_df62_9b1f_c5fc_dbdce9fa2c50["../../runtime/client/dev-toolbar/ui-library/icons.js"]
  542b8124_ad12_067d_82d7_526ad0a69372 --> af6796b7_df62_9b1f_c5fc_dbdce9fa2c50
  style 542b8124_ad12_067d_82d7_526ad0a69372 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { settings } from '../settings.js';
import { getIconElement, type Icon, isDefinedIcon } from './icons.js';

const styles = ['purple', 'gray', 'red', 'green', 'yellow', 'blue'] as const;

type HighlightStyle = (typeof styles)[number];

export class DevToolbarHighlight extends HTMLElement {
	icon?: Icon | undefined | null;
	_highlightStyle: HighlightStyle = 'purple';

	get highlightStyle() {
		return this._highlightStyle;
	}

	set highlightStyle(value) {
		if (!styles.includes(value)) {
			settings.logger.error(
				`Invalid style: ${value}, expected one of ${styles.join(', ')}, got ${value}.`,
			);
			return;
		}
		this._highlightStyle = value;
		this.updateStyle();
	}

	static observedAttributes = ['highlight-style'];

	shadowRoot: ShadowRoot;

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

		this.icon = this.hasAttribute('icon') ? (this.getAttribute('icon') as Icon) : undefined;

		this.shadowRoot.innerHTML = `
			<style>
				:host {
					--purple-background: linear-gradient(180deg, rgba(224, 204, 250, 0.33) 0%, rgba(224, 204, 250, 0.0825) 100%);
					--purple-border: 1px solid rgba(113, 24, 226, 1);

					--gray-background: linear-gradient(180deg, rgba(191, 193, 201, 0.33) 0%, rgba(191, 193, 201, 0.0825) 100%);
					--gray-border: 1px solid rgba(191, 193, 201, 1);

					--red-background: linear-gradient(180deg, rgba(249, 196, 215, 0.33) 0%, rgba(249, 196, 215, 0.0825) 100%);
					--red-border: 1px solid rgba(179, 62, 102, 1);

					--green-background: linear-gradient(180deg, rgba(213, 249, 196, 0.33) 0%, rgba(213, 249, 196, 0.0825) 100%);
					--green-border: 1px solid rgba(61, 125, 31, 1);

					--yellow-background: linear-gradient(180deg, rgba(255, 236, 179, 0.33) 0%, rgba(255, 236, 179, 0.0825) 100%);
					--yellow-border: 1px solid rgba(181, 138, 45, 1);

					--blue-background: linear-gradient(180deg, rgba(189, 195, 255, 0.33) 0%, rgba(189, 195, 255, 0.0825) 100%);
					--blue-border: 1px solid rgba(54, 69, 217, 1);

					border-radius: 4px;
					display: block;
					width: 100%;
// ... (71 more lines)

Domain

Subdomains

Dependencies

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

Frequently Asked Questions

What does highlight.ts do?
highlight.ts is a source file in the astro codebase, written in typescript. It belongs to the DevToolbar domain, ToolbarClient subdomain.
What does highlight.ts depend on?
highlight.ts imports 2 module(s): ../../runtime/client/dev-toolbar/ui-library/icons.js, ../settings.js.
Where is highlight.ts in the architecture?
highlight.ts is located at packages/astro/src/runtime/client/dev-toolbar/ui-library/highlight.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