forked from angular/angular
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode-example.ts
More file actions
47 lines (42 loc) · 1.42 KB
/
code-example.ts
File metadata and controls
47 lines (42 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*!
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {Type} from '@angular/core';
import {SafeHtml} from '@angular/platform-browser';
/**
* Map of the examples, values are functions which returns the promise of the component type, which will be displayed as preview in the ExampleViewer component
*/
export interface CodeExamplesMap {
[id: string]: () => Promise<Type<unknown>>;
}
export interface Snippet {
/** Title of the code snippet */
title?: string;
/** Name of the file. */
name: string;
/** Content of code snippet */
sanitizedContent: SafeHtml;
/** Text in following format `start-end`. Start and end are numbers, based on them provided range of lines will be displayed in collapsed mode */
visibleLinesRange?: string;
shell?: boolean;
}
export interface ExampleMetadata {
/** Numeric id of example, used to generate unique link to the example */
id: number;
/** Title of the example. */
title?: string;
/** Path to the preview component */
path?: string;
/** List of files which are part of the example. */
files: Snippet[];
/** True when ExampleViewer should have preview */
preview: boolean;
/** Whether to hide code example by default. */
hideCode: boolean;
/** Visual style for the code example */
style?: 'prefer' | 'avoid';
}