Home / File/ button.ts — astro Source File

button.ts — astro Source File

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

File typescript DevToolbar ToolbarClient 1 imports 1 classes

Entity Profile

Dependency Diagram

graph LR
  d3ab98c0_1cb3_eac7_2f6c_9333e92bd196["button.ts"]
  844d479d_bd2c_31dd_1673_36b5e7e8016a["../settings.js"]
  d3ab98c0_1cb3_eac7_2f6c_9333e92bd196 --> 844d479d_bd2c_31dd_1673_36b5e7e8016a
  style d3ab98c0_1cb3_eac7_2f6c_9333e92bd196 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { settings } from '../settings.js';

const sizes = ['small', 'medium', 'large'] as const;
const styles = ['ghost', 'outline', 'purple', 'gray', 'red', 'green', 'yellow', 'blue'] as const;
const borderRadii = ['normal', 'rounded'] as const;

type ButtonSize = (typeof sizes)[number];
type ButtonStyle = (typeof styles)[number];
type ButtonBorderRadius = (typeof borderRadii)[number];

export class DevToolbarButton extends HTMLElement {
	_size: ButtonSize = 'small';
	_buttonStyle: ButtonStyle = 'purple';
	_buttonBorderRadius: ButtonBorderRadius = 'normal';

	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 buttonStyle() {
		return this._buttonStyle;
	}

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

	get buttonBorderRadius() {
		return this._buttonBorderRadius;
	}

	set buttonBorderRadius(value) {
		if (!borderRadii.includes(value)) {
			settings.logger.error(
				`Invalid border-radius: ${value}, expected one of ${borderRadii.join(', ')}, got ${value}.`,
			);
			return;
		}
		this._buttonBorderRadius = value;
		this.updateStyle();
	}

// ... (120 more lines)

Domain

Subdomains

Dependencies

  • ../settings.js

Frequently Asked Questions

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