Home / File/ settings.ts — astro Source File

settings.ts — astro Source File

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

File typescript DevToolbar ToolbarClient 4 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  95a9c0e4_71a0_d1e2_1096_f5f3741dbee9["settings.ts"]
  6e91fe0d_c6ce_0cca_abd3_06b774edbe23["./toolbar.js"]
  95a9c0e4_71a0_d1e2_1096_f5f3741dbee9 --> 6e91fe0d_c6ce_0cca_abd3_06b774edbe23
  844d479d_bd2c_31dd_1673_36b5e7e8016a["../settings.js"]
  95a9c0e4_71a0_d1e2_1096_f5f3741dbee9 --> 844d479d_bd2c_31dd_1673_36b5e7e8016a
  09fa95e1_0f5f_b352_8674_9da4b245b83b["./ui-library/window.js"]
  95a9c0e4_71a0_d1e2_1096_f5f3741dbee9 --> 09fa95e1_0f5f_b352_8674_9da4b245b83b
  2c2fd83a_a206_7736_5927_a82639572edb["./utils/window.js"]
  95a9c0e4_71a0_d1e2_1096_f5f3741dbee9 --> 2c2fd83a_a206_7736_5927_a82639572edb
  style 95a9c0e4_71a0_d1e2_1096_f5f3741dbee9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { ResolvedDevToolbarApp } from '../../../../types/public/toolbar.js';
import { type Settings, settings } from '../settings.js';
import { isValidPlacement, placements } from '../ui-library/window.js';
import {
	closeOnOutsideClick,
	createWindowElement,
	synchronizePlacementOnUpdate,
} from './utils/window.js';

interface SettingRow {
	name: string;
	description: string;
	input: 'checkbox' | 'text' | 'number' | 'select';
	settingKey: keyof Settings;
	changeEvent: (evt: Event) => void;
}

const settingsRows = [
	{
		name: 'Disable notifications',
		description: 'Hide notification badges in the toolbar.',
		input: 'checkbox',
		settingKey: 'disableAppNotification',
		changeEvent: (evt: Event) => {
			if (evt.currentTarget instanceof HTMLInputElement) {
				const devToolbar = document.querySelector('astro-dev-toolbar');

				if (devToolbar) {
					devToolbar.setNotificationVisible(!evt.currentTarget.checked);
				}

				settings.updateSetting('disableAppNotification', evt.currentTarget.checked);
				const action = evt.currentTarget.checked ? 'disabled' : 'enabled';
				settings.logger.verboseLog(`App notification badges ${action}`);
			}
		},
	},
	{
		name: 'Verbose logging',
		description: 'Logs dev toolbar events in the browser console.',
		input: 'checkbox',
		settingKey: 'verbose',
		changeEvent: (evt: Event) => {
			if (evt.currentTarget instanceof HTMLInputElement) {
				settings.updateSetting('verbose', evt.currentTarget.checked);
				const action = evt.currentTarget.checked ? 'enabled' : 'disabled';
				settings.logger.verboseLog(`Verbose logging ${action}`);
			}
		},
	},
	{
		name: 'Placement',
		description: 'Adjust the placement of the dev toolbar.',
		input: 'select',
		settingKey: 'placement',
		changeEvent: (evt: Event) => {
			if (evt.currentTarget instanceof HTMLSelectElement) {
				const placement = evt.currentTarget.value;
				if (isValidPlacement(placement)) {
					document.querySelector('astro-dev-toolbar')?.setToolbarPlacement(placement);
// ... (163 more lines)

Domain

Subdomains

Types

Dependencies

  • ../settings.js
  • ./toolbar.js
  • ./ui-library/window.js
  • ./utils/window.js

Frequently Asked Questions

What does settings.ts do?
settings.ts is a source file in the astro codebase, written in typescript. It belongs to the DevToolbar domain, ToolbarClient subdomain.
What functions are defined in settings.ts?
settings.ts defines 2 function(s): default.init, evt.
What does settings.ts depend on?
settings.ts imports 4 module(s): ../settings.js, ./toolbar.js, ./ui-library/window.js, ./utils/window.js.
Where is settings.ts in the architecture?
settings.ts is located at packages/astro/src/runtime/client/dev-toolbar/apps/settings.ts (domain: DevToolbar, subdomain: ToolbarClient, directory: packages/astro/src/runtime/client/dev-toolbar/apps).

Analyze Your Own Codebase

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

Try Supermodel Free