Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {Component, inject, input, signal} from '@angular/core';
import {MatTooltip} from '@angular/material/tooltip';
import {IconComponent} from '../icon/icon.component';

export const CONFIRMATION_DISPLAY_TIME_MS = 1000;
const CONFIRMATION_DISPLAY_TIME_MS = 1000;

@Component({
selector: 'docs-copy-link-button',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,11 @@ import {TabGroup} from '../../tab-group/tab-group.component';
import {ExampleViewer} from '../example-viewer/example-viewer.component';

const TOC_HOST_ELEMENT_NAME = 'docs-table-of-contents';
export const ASSETS_EXAMPLES_PATH = 'assets/content/examples';
export const DOCS_VIEWER_SELECTOR = 'docs-viewer, main[docsViewer]';
export const DOCS_CODE_SELECTOR = '.docs-code';
export const DOCS_CODE_MUTLIFILE_SELECTOR = '.docs-code-multifile';
export const DOCS_CODE_TAB_GROUP_SELECTOR = '.docs-tab-group';
export const DOCS_CODE_TAB_SELECTOR = '.docs-tab';
const DOCS_CODE_SELECTOR = '.docs-code';
const DOCS_CODE_MUTLIFILE_SELECTOR = '.docs-code-multifile';
const DOCS_CODE_TAB_GROUP_SELECTOR = '.docs-tab-group';
const DOCS_CODE_TAB_SELECTOR = '.docs-tab';
const GITHUB_CONTENT_URL = 'https://github.com/angular/angular/blob/{{BUILD_SCM_ABBREV_HASH}}';

@Component({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ import {EXAMPLE_VIEWER_CONTENT_LOADER} from '../../../providers/index';
import {CopySourceCodeButton} from '../../copy-source-code-button/copy-source-code-button.component';
import {IconComponent} from '../../icon/icon.component';

export const CODE_LINE_NUMBER_CLASS_NAME = 'shiki-ln-number';
export const CODE_LINE_CLASS_NAME = 'line';
export const GAP_CODE_LINE_CLASS_NAME = 'gap';
export const HIDDEN_CLASS_NAME = 'hidden';
const CODE_LINE_NUMBER_CLASS_NAME = 'shiki-ln-number';
const CODE_LINE_CLASS_NAME = 'line';
const GAP_CODE_LINE_CLASS_NAME = 'gap';
const HIDDEN_CLASS_NAME = 'hidden';

@Component({
selector: 'docs-example-viewer',
Expand Down
2 changes: 1 addition & 1 deletion adev/shared-docs/interfaces/search-results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface SearchResult {
}

/* The hierarchy of the item */
export interface Hierarchy {
interface Hierarchy {
/* It's kind of the page i.e `Docs`, `Tutorials`, `Reference` etc. */
lvl0: string | null;
/* Typicaly it's the content of H1 of the page */
Expand Down
31 changes: 5 additions & 26 deletions adev/shared-docs/interfaces/tutorial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.dev/license
*/

import type {FileSystemTree} from '@webcontainer/api';
import {NavigationItem} from './navigation-item';

/** the step is used only in this function to sort the nav items */
Expand All @@ -16,23 +15,6 @@ export type TutorialNavigationItemWithStep = TutorialNavigationItem & {
};
};

/**
* Represents the contents of the tutorial files to be generated by the build script
*/
export type TutorialFiles = {
sourceCode?: FileSystemTree;
metadata?: TutorialMetadata;
sourceCodeZip?: Uint8Array;
route?: Omit<TutorialNavigationItemWithStep, 'path'>;
};

export type PlaygroundFiles = {
sourceCode?: FileSystemTree;
metadata?: TutorialMetadata;
sourceCodeZip?: undefined;
route?: PlaygroundRouteData;
};

/** Represents the contents of the tutorial config file */
export type TutorialMetadata = {
type: TutorialConfig['type'];
Expand All @@ -58,7 +40,7 @@ export type TutorialMetadata = {
dependencies?: Record<string, string>;
};

export type TutorialStep = {
type TutorialStep = {
step: number;
name: string;
path: string;
Expand All @@ -69,12 +51,9 @@ export type TutorialStep = {
};

export type TutorialConfig =
| EditorTutorialConfig
| LocalTutorialConfig
| CliTutorialConfig
| EditorOnlyTutorialConfig;
EditorTutorialConfig | LocalTutorialConfig | CliTutorialConfig | EditorOnlyTutorialConfig;

export interface TutorialConfigBase {
interface TutorialConfigBase {
type: TutorialType;

/** The tutorial title */
Expand Down Expand Up @@ -111,11 +90,11 @@ export interface LocalTutorialConfig extends TutorialConfigBase {
}

/** Represents a tutorial config that supports only the interactive terminal for the Angular CLI */
export type CliTutorialConfig = Omit<LocalTutorialConfig, 'type'> & {
type CliTutorialConfig = Omit<LocalTutorialConfig, 'type'> & {
type: TutorialType.CLI;
};

export type EditorOnlyTutorialConfig = Omit<EditorTutorialConfig, 'type'> & {
type EditorOnlyTutorialConfig = Omit<EditorTutorialConfig, 'type'> & {
type: TutorialType.EDITOR_ONLY;
};

Expand Down
4 changes: 2 additions & 2 deletions adev/shared-docs/services/search.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import {
import type {Environment, SearchResult, SearchResultItem, SnippetResult} from '../interfaces/index';
import {ENVIRONMENT} from '../providers/index';

export const SEARCH_DELAY = 200;
const SEARCH_DELAY = 200;
// Maximum number of facet values to return for each facet during a regular search.
export const MAX_VALUE_PER_FACET = 5;
const MAX_VALUE_PER_FACET = 5;

export const ALGOLIA_CLIENT: InjectionToken<LiteClient> = new InjectionToken<LiteClient>(
'Search service',
Expand Down
2 changes: 1 addition & 1 deletion adev/shared-docs/utils/device.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const isApple =
typeof window !== 'undefined' &&
(/iPad|iPhone/.test(window.navigator.userAgent) || window.navigator.userAgent.includes('Mac'));

export const isIpad =
const isIpad =
typeof window !== 'undefined' &&
isApple &&
!!window.navigator.maxTouchPoints &&
Expand Down
2 changes: 1 addition & 1 deletion adev/shared-docs/utils/url.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function getRelativeUrl(
return `${removeTrailingSlash(normalizePath(url.pathname))}${url.hash ?? ''}`;
}

export const removeTrailingSlash = (url: string): string => {
const removeTrailingSlash = (url: string): string => {
if (url.endsWith('/')) {
return url.slice(0, -1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {SUB_NAVIGATION_DATA} from '../../../routing/sub-navigation-data';
import {PRIMARY_NAV_ID, SEARCH_DIALOG_ID, SECONDARY_NAV_ID} from '../../constants/element-ids';
import {PAGE_PREFIX} from '../../constants/pages';

export const ANIMATION_DURATION = 500;
const ANIMATION_DURATION = 500;

@Component({
selector: 'adev-secondary-navigation',
Expand Down
8 changes: 3 additions & 5 deletions adev/src/app/core/services/a-dev-title-strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ import {NavigationItem} from '@angular/docs';
import {Meta, Title} from '@angular/platform-browser';
import {ActivatedRouteSnapshot, RouterStateSnapshot, TitleStrategy} from '@angular/router';

export const ROUTE_TITLE_PROPERTY = 'label';
export const ROUTE_PARENT_PROPERTY = 'parent';
export const TITLE_SUFFIX = 'Angular';
export const TITLE_SEPARATOR = ' • ';
const TITLE_SEPARATOR = ' • ';
export const DEFAULT_PAGE_TITLE = 'Overview';

export const TITLE_OG_META_TAG = 'og:title';
export const TITLE_TWITTER_META_TAG = 'twitter:title';
const TITLE_OG_META_TAG = 'og:title';
const TITLE_TWITTER_META_TAG = 'twitter:title';

export const ALL_TITLE_META_TAGS = [TITLE_OG_META_TAG, TITLE_TWITTER_META_TAG];

Expand Down
11 changes: 1 addition & 10 deletions adev/src/app/core/services/version-manager.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,7 @@ import {DOCUMENT, Service, VERSION, computed, inject} from '@angular/core';
import versionJson from '../../../assets/others/versions.json';
import {ANGULAR_DEV} from '../constants/links';

export interface Version {
displayName: string;
url: string;
}

export type VersionMode = 'stable' | 'deprecated' | 'rc' | 'next' | number;

export const INITIAL_ADEV_DOCS_VERSION = 18;
export const VERSION_PLACEHOLDER = '{{version}}';
export const MODE_PLACEHOLDER = '{{prefix}}';
type VersionMode = 'stable' | 'deprecated' | 'rc' | 'next' | number;

type VersionJson = {version: string; url: string};

Expand Down
2 changes: 1 addition & 1 deletion adev/src/app/editor/alert-manager.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from '../core/services/errors-handling/error-snack-bar';

export const MAX_RECOMMENDED_WEBCONTAINERS_INSTANCES = 3;
export const WEBCONTAINERS_COUNTER_KEY = 'numberOfWebcontainers';
const WEBCONTAINERS_COUNTER_KEY = 'numberOfWebcontainers';

export enum AlertReason {
OUT_OF_MEMORY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const TYPESCRIPT_VFS_WORKER_FACTORY = new InjectionToken<TypescriptVfsWor
'TYPESCRIPT_VFS_WORKER_FACTORY',
);

export function createTypescriptVfsWorker(): Worker {
function createTypescriptVfsWorker(): Worker {
return new Worker(new URL('./typescript-vfs.worker.ts', import.meta.url), {
type: 'module',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface DiagnosticsRequest {
file: string;
}

export interface DiagnosticsResult {
interface DiagnosticsResult {
from?: number;
to?: number;
message: string;
Expand Down
4 changes: 2 additions & 2 deletions adev/src/app/editor/code-editor/workers/utils/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {VirtualTypeScriptEnvironment} from '@typescript/vfs';

// Note: use a comment in empty files to avoid error in vfs
// See: https://github.com/microsoft/TypeScript-Website/issues/2713
export const EMPTY_FILE_CONTENT = '// empty file';
const EMPTY_FILE_CONTENT = '// empty file';

export function updateOrCreateFile(
env: VirtualTypeScriptEnvironment,
Expand All @@ -28,7 +28,7 @@ export function updateFile(env: VirtualTypeScriptEnvironment, file: string, cont
env.updateFile(normalizeFileName(file), normalizeFileContent(content));
}

export function createFile(env: VirtualTypeScriptEnvironment, file: string, content: string) {
function createFile(env: VirtualTypeScriptEnvironment, file: string, content: string) {
env.createFile(normalizeFileName(file), normalizeFileContent(content));
}

Expand Down
8 changes: 0 additions & 8 deletions adev/src/app/editor/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,3 @@
* found in the LICENSE file at https://angular.dev/license
*/
export const TUTORIALS_ASSETS_WEB_PATH = '/assets/tutorials';

export const TUTORIALS_ASSETS_SOURCE_CODE_DIRECTORY = 'source-code';
export const TUTORIALS_ASSETS_METADATA_DIRECTORY = 'metadata';

export const TUTORIALS_SOURCE_CODE_WEB_PATH = `${TUTORIALS_ASSETS_WEB_PATH}/${TUTORIALS_ASSETS_SOURCE_CODE_DIRECTORY}`;
export const TUTORIALS_METADATA_WEB_PATH = `${TUTORIALS_ASSETS_WEB_PATH}/${TUTORIALS_ASSETS_METADATA_DIRECTORY}`;

export const TUTORIALS_COMMON_DIRECTORY = 'common';
4 changes: 2 additions & 2 deletions adev/src/app/editor/embedded-editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ import {TerminalType} from './terminal/terminal-handler.service';
import {Terminal} from './terminal/terminal.component';

export const EMBEDDED_EDITOR_SELECTOR = 'embedded-editor';
export const LARGE_EDITOR_WIDTH_BREAKPOINT = 950;
export const LARGE_EDITOR_HEIGHT_BREAKPOINT = 550;
const LARGE_EDITOR_WIDTH_BREAKPOINT = 950;
const LARGE_EDITOR_HEIGHT_BREAKPOINT = 550;

@Component({
selector: EMBEDDED_EDITOR_SELECTOR,
Expand Down
3 changes: 0 additions & 3 deletions adev/src/app/editor/node-runtime-state.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ import {isIos} from '@angular/docs';
import {LoadingStep} from './enums/loading-steps';
import {OUT_OF_MEMORY_MSG} from './node-runtime-errors';

export const MAX_RECOMMENDED_WEBCONTAINERS_INSTANCES = 3;
export const WEBCONTAINERS_COUNTER_KEY = 'numberOfWebcontainers';

export type NodeRuntimeError = {
message: string | undefined;
type: ErrorType | undefined;
Expand Down
4 changes: 2 additions & 2 deletions adev/src/app/editor/terminal/interactive-terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {Terminal, ITerminalOptions, ITerminalInitOnlyOptions} from '@xterm/xterm

import {CommandValidator} from './command-validator.service';

export const NOT_VALID_COMMAND_MSG = 'Angular Documentation - Not allowed command!';
export const ALLOWED_KEYS: Array<KeyboardEvent['key']> = [
const NOT_VALID_COMMAND_MSG = 'Angular Documentation - Not allowed command!';
const ALLOWED_KEYS: Array<KeyboardEvent['key']> = [
// Allow Backspace to delete what was typed
'Backspace',
// Allow ArrowUp to interact with CLI
Expand Down
21 changes: 1 addition & 20 deletions adev/src/app/features/references/helpers/manifest.helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import {Route} from '@angular/router';
import API_MANIFEST_JSON from '../../../../../src/assets/api/manifest.json';
import {ApiManifest, ApiManifestEntry, ApiManifestPackage} from '../interfaces/api-manifest';
import {NavigationItem, contentResolver} from '@angular/docs';
import {contentResolver} from '@angular/docs';
import {PAGE_PREFIX} from '../../../core/constants/pages';

const manifest = API_MANIFEST_JSON as ApiManifest;
Expand Down Expand Up @@ -37,25 +37,6 @@ export function mapApiManifestToRoutes(): Route[] {
return apiRoutes;
}

export function getApiNavigationItems(): NavigationItem[] {
const apiNavigationItems: NavigationItem[] = [];

for (const packageEntry of manifest) {
const packageNavigationItem: NavigationItem = {
label: packageEntry.moduleLabel,
children: packageEntry.entries.map((api) => ({
path: getApiUrl(packageEntry, api.name),
label: api.name,
category: api.category,
})),
};

apiNavigationItems.push(packageNavigationItem);
}

return apiNavigationItems;
}

export function getApiUrl(packageEntry: ApiManifestPackage, apiName: string): string {
const packageName = packageEntry.normalizedModuleName
// packages like `angular_core` should be `core`
Expand Down
2 changes: 1 addition & 1 deletion adev/src/app/features/references/pipes/api-label.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const shortLabelsMap: Record<ApiItemType, string> = {
[ApiItemType.INITIALIZER_API_FUNCTION]: 'IA',
};

export const fullLabelsMap: Record<ApiItemType, string> = {
const fullLabelsMap: Record<ApiItemType, string> = {
[ApiItemType.BLOCK]: 'Block',
[ApiItemType.CLASS]: 'Class',
[ApiItemType.CONST]: 'Const',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import {ActivatedRouteSnapshot, BaseRouteReuseStrategy} from '@angular/router';

// Match tutorial pages, apart of /tutorials.
export const IS_TUTORIAL_PAGE_RULE = /(^tutorials)\/(\S*)/s;
const IS_TUTORIAL_PAGE_RULE = /(^tutorials)\/(\S*)/s;

export class ReuseTutorialsRouteStrategy extends BaseRouteReuseStrategy {
// reuse route when not navigating to a new one or when navigating between tutorial pages
Expand Down
7 changes: 0 additions & 7 deletions adev/src/app/routing/navigation-entries/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,6 @@ import SIGNAL_FORMS_TUTORIAL_NAV_DATA from '../../../content/tutorials/signal-fo
// @ts-ignore
import API_MANIFEST_JSON from '../../../assets/manifest.json' with {type: 'json'};

interface SubNavigationData {
docs: NavigationItem[];
reference: NavigationItem[];
tutorials: NavigationItem[];
footer: NavigationItem[];
}

export const DOCS_SUB_NAVIGATION_DATA: NavigationItem[] = [
{
label: 'Introduction',
Expand Down
Loading