@ng-doc/app 22.0.0 → 22.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/fesm2022/ng-doc-app-classes-content-controller.mjs +22 -4
- package/fesm2022/ng-doc-app-classes-content-controller.mjs.map +1 -1
- package/fesm2022/ng-doc-app-classes-default-search-engine.mjs +36 -12
- package/fesm2022/ng-doc-app-classes-default-search-engine.mjs.map +1 -1
- package/fesm2022/ng-doc-app-classes-root-page.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-api-list.mjs +7 -5
- package/fesm2022/ng-doc-app-components-api-list.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-breadcrumb.mjs +5 -3
- package/fesm2022/ng-doc-app-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-code.mjs +6 -4
- package/fesm2022/ng-doc-app-components-code.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-command-palette.mjs +35 -27
- package/fesm2022/ng-doc-app-components-command-palette.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-copy-button.mjs +6 -4
- package/fesm2022/ng-doc-app-components-copy-button.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-demo-displayer.mjs +19 -4
- package/fesm2022/ng-doc-app-components-demo-displayer.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-demo-frame.mjs +279 -0
- package/fesm2022/ng-doc-app-components-demo-frame.mjs.map +1 -0
- package/fesm2022/ng-doc-app-components-demo-pane.mjs +2 -2
- package/fesm2022/ng-doc-app-components-demo-pane.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-demo.mjs +97 -14
- package/fesm2022/ng-doc-app-components-demo.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-fullscreen-button.mjs +5 -3
- package/fesm2022/ng-doc-app-components-fullscreen-button.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-fullscreen-toggle.mjs +4 -2
- package/fesm2022/ng-doc-app-components-fullscreen-toggle.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-heading-anchor.mjs +5 -3
- package/fesm2022/ng-doc-app-components-heading-anchor.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-image-viewer.mjs +5 -3
- package/fesm2022/ng-doc-app-components-image-viewer.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-navbar.mjs +4 -2
- package/fesm2022/ng-doc-app-components-navbar.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-page-navigation.mjs +5 -3
- package/fesm2022/ng-doc-app-components-page-navigation.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-page-wrapper.mjs +2 -2
- package/fesm2022/ng-doc-app-components-page-wrapper.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-page.mjs +83 -16
- package/fesm2022/ng-doc-app-components-page.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-playground.mjs +838 -141
- package/fesm2022/ng-doc-app-components-playground.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-root.mjs +51 -4
- package/fesm2022/ng-doc-app-components-root.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-search-result.mjs +8 -6
- package/fesm2022/ng-doc-app-components-search-result.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-search.mjs +7 -5
- package/fesm2022/ng-doc-app-components-search.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-sidebar.mjs +4 -3
- package/fesm2022/ng-doc-app-components-sidebar.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-tabs.mjs +21 -3
- package/fesm2022/ng-doc-app-components-tabs.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-theme-toggle.mjs +7 -5
- package/fesm2022/ng-doc-app-components-theme-toggle.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-toc.mjs +4 -2
- package/fesm2022/ng-doc-app-components-toc.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components.mjs +1 -0
- package/fesm2022/ng-doc-app-components.mjs.map +1 -1
- package/fesm2022/ng-doc-app-constants.mjs +11 -1
- package/fesm2022/ng-doc-app-constants.mjs.map +1 -1
- package/fesm2022/ng-doc-app-demo-app.mjs +779 -0
- package/fesm2022/ng-doc-app-demo-app.mjs.map +1 -0
- package/fesm2022/ng-doc-app-helpers.mjs +147 -7
- package/fesm2022/ng-doc-app-helpers.mjs.map +1 -1
- package/fesm2022/ng-doc-app-processors-processors.mjs +30 -9
- package/fesm2022/ng-doc-app-processors-processors.mjs.map +1 -1
- package/fesm2022/ng-doc-app-providers-ng-doc-app.mjs +29 -18
- package/fesm2022/ng-doc-app-providers-ng-doc-app.mjs.map +1 -1
- package/fesm2022/ng-doc-app-providers-texts.mjs +53 -0
- package/fesm2022/ng-doc-app-providers-texts.mjs.map +1 -0
- package/fesm2022/ng-doc-app-providers-title.mjs +129 -0
- package/fesm2022/ng-doc-app-providers-title.mjs.map +1 -0
- package/fesm2022/ng-doc-app-providers.mjs +2 -0
- package/fesm2022/ng-doc-app-providers.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services-content-scroll-intent.mjs +27 -2
- package/fesm2022/ng-doc-app-services-content-scroll-intent.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services-highlighter.mjs +23 -16
- package/fesm2022/ng-doc-app-services-highlighter.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services-route-preloader.mjs +34 -10
- package/fesm2022/ng-doc-app-services-route-preloader.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services-shortcuts.mjs +38 -4
- package/fesm2022/ng-doc-app-services-shortcuts.mjs.map +1 -1
- package/fesm2022/ng-doc-app-texts-ar.mjs +238 -0
- package/fesm2022/ng-doc-app-texts-ar.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-de.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-de.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-es.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-es.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-fr.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-fr.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-hi.mjs +219 -0
- package/fesm2022/ng-doc-app-texts-hi.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-ja.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-ja.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-ko.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-ko.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-pt-br.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-pt-br.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-ru.mjs +231 -0
- package/fesm2022/ng-doc-app-texts-ru.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-uk.mjs +231 -0
- package/fesm2022/ng-doc-app-texts-uk.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-zh.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-zh.mjs.map +1 -0
- package/fesm2022/ng-doc-app-tokens.mjs +214 -1
- package/fesm2022/ng-doc-app-tokens.mjs.map +1 -1
- package/fesm2022/ng-doc-app-type-controls-json-control.mjs +90 -0
- package/fesm2022/ng-doc-app-type-controls-json-control.mjs.map +1 -0
- package/fesm2022/ng-doc-app-type-controls-list-control.mjs +792 -0
- package/fesm2022/ng-doc-app-type-controls-list-control.mjs.map +1 -0
- package/fesm2022/ng-doc-app-type-controls-type-alias-control.mjs +45 -8
- package/fesm2022/ng-doc-app-type-controls-type-alias-control.mjs.map +1 -1
- package/fesm2022/ng-doc-app-type-controls.mjs +2 -0
- package/fesm2022/ng-doc-app-type-controls.mjs.map +1 -1
- package/package.json +73 -4
- package/styles/global.css +4 -0
- package/styles/main.css +4 -0
- package/styles/themes/dark.css +10 -0
- package/types/ng-doc-app-classes-default-search-engine.d.ts +11 -0
- package/types/ng-doc-app-classes-root-page.d.ts +13 -0
- package/types/ng-doc-app-components-api-list.d.ts +3 -1
- package/types/ng-doc-app-components-breadcrumb.d.ts +2 -1
- package/types/ng-doc-app-components-code.d.ts +2 -0
- package/types/ng-doc-app-components-command-palette.d.ts +3 -1
- package/types/ng-doc-app-components-copy-button.d.ts +3 -1
- package/types/ng-doc-app-components-demo-displayer.d.ts +13 -1
- package/types/ng-doc-app-components-demo-frame.d.ts +107 -0
- package/types/ng-doc-app-components-demo.d.ts +47 -10
- package/types/ng-doc-app-components-fullscreen-button.d.ts +2 -0
- package/types/ng-doc-app-components-fullscreen-toggle.d.ts +2 -0
- package/types/ng-doc-app-components-heading-anchor.d.ts +2 -0
- package/types/ng-doc-app-components-image-viewer.d.ts +2 -0
- package/types/ng-doc-app-components-navbar.d.ts +2 -0
- package/types/ng-doc-app-components-page-navigation.d.ts +2 -1
- package/types/ng-doc-app-components-page.d.ts +10 -1
- package/types/ng-doc-app-components-playground.d.ts +260 -42
- package/types/ng-doc-app-components-root.d.ts +18 -0
- package/types/ng-doc-app-components-search-result.d.ts +2 -0
- package/types/ng-doc-app-components-search.d.ts +2 -0
- package/types/ng-doc-app-components-sidebar.d.ts +2 -1
- package/types/ng-doc-app-components-tabs.d.ts +13 -3
- package/types/ng-doc-app-components-theme-toggle.d.ts +4 -1
- package/types/ng-doc-app-components-toc.d.ts +2 -1
- package/types/ng-doc-app-components.d.ts +1 -0
- package/types/ng-doc-app-constants.d.ts +11 -1
- package/types/ng-doc-app-demo-app.d.ts +297 -0
- package/types/ng-doc-app-helpers.d.ts +75 -4
- package/types/ng-doc-app-interfaces.d.ts +635 -6
- package/types/ng-doc-app-processors-processors.d.ts +5 -0
- package/types/ng-doc-app-providers-ng-doc-app.d.ts +7 -1
- package/types/ng-doc-app-providers-texts.d.ts +28 -0
- package/types/ng-doc-app-providers-title.d.ts +59 -0
- package/types/ng-doc-app-providers.d.ts +2 -0
- package/types/ng-doc-app-services-content-scroll-intent.d.ts +11 -1
- package/types/ng-doc-app-services-highlighter.d.ts +15 -6
- package/types/ng-doc-app-services-route-preloader.d.ts +13 -1
- package/types/ng-doc-app-services-shortcuts.d.ts +16 -0
- package/types/ng-doc-app-texts-ar.d.ts +13 -0
- package/types/ng-doc-app-texts-de.d.ts +12 -0
- package/types/ng-doc-app-texts-es.d.ts +12 -0
- package/types/ng-doc-app-texts-fr.d.ts +12 -0
- package/types/ng-doc-app-texts-hi.d.ts +12 -0
- package/types/ng-doc-app-texts-ja.d.ts +12 -0
- package/types/ng-doc-app-texts-ko.d.ts +12 -0
- package/types/ng-doc-app-texts-pt-br.d.ts +12 -0
- package/types/ng-doc-app-texts-ru.d.ts +12 -0
- package/types/ng-doc-app-texts-uk.d.ts +12 -0
- package/types/ng-doc-app-texts-zh.d.ts +12 -0
- package/types/ng-doc-app-tokens.d.ts +21 -2
- package/types/ng-doc-app-type-controls-json-control.d.ts +38 -0
- package/types/ng-doc-app-type-controls-list-control.d.ts +313 -0
- package/types/ng-doc-app-type-controls-type-alias-control.d.ts +28 -5
- package/types/ng-doc-app-type-controls.d.ts +2 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Provider, EnvironmentProviders, ApplicationConfig, Type } from '@angular/core';
|
|
3
|
+
import { Routes } from '@angular/router';
|
|
4
|
+
import { NgDocDemoProvidersImport } from '@ng-doc/core/interfaces';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The root of the demo application, which shows one demo per page with only Angular and that
|
|
8
|
+
* demo loaded. In an iframe it reports the height of its content to the page that embeds it (a
|
|
9
|
+
* `ResizeObserver` on its border box), and it follows the theme the reader picks on the
|
|
10
|
+
* documentation site, which stores it in `localStorage`, unless its URL fragment sets a theme
|
|
11
|
+
* (`~theme=dark`, the `theme` option of a demo or a playground, or the theme button beside it).
|
|
12
|
+
* In an iframe its page is transparent, so the canvas of the documentation page shows through, and
|
|
13
|
+
* it reports its theme's background, dots and color scheme whenever they change, so that the
|
|
14
|
+
* embedding page can paint the canvas in the demo's own theme.
|
|
15
|
+
*/
|
|
16
|
+
declare class NgDocDemoAppComponent {
|
|
17
|
+
constructor();
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgDocDemoAppComponent, never>;
|
|
19
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NgDocDemoAppComponent, "ng-doc-demo-app", never, {}, {}, never, never, true, never>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* How the demo application starts.
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
interface ɵNgDocDemoApplicationOptions {
|
|
27
|
+
/** Change detection with zone.js, when the application's polyfills load it. */
|
|
28
|
+
readonly zone?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Hydration of the server-rendered page: always on the server, which then writes the hydration
|
|
31
|
+
* data, and in the browser only for a page the server rendered (a page without it, such as the
|
|
32
|
+
* page of a demo that failed to prerender or the development server's, has nothing to hydrate).
|
|
33
|
+
*/
|
|
34
|
+
readonly hydration?: boolean;
|
|
35
|
+
/** Providers added after the others, for example server rendering. */
|
|
36
|
+
readonly providers?: Array<Provider | EnvironmentProviders>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The configuration of the demo application: change detection, the router with the demo pages
|
|
40
|
+
* (and a page for unknown demos), hydration, and the providers of `demoProviders`. The generated entries of
|
|
41
|
+
* the demo application bootstrap `NgDocDemoAppComponent` with it, in the browser and on the server.
|
|
42
|
+
* @param routes - The generated demo routes.
|
|
43
|
+
* @param demoProviders - The generated import of the `demoProviders` module, if any.
|
|
44
|
+
* @param options - How the application starts.
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
declare function ɵngDocDemoApplicationConfig(routes: Routes, demoProviders: NgDocDemoProvidersImport | undefined, options?: ɵNgDocDemoApplicationOptions): Promise<ApplicationConfig>;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Shows the demo of a demo page: the component in the route's `ngDocDemo` data, with the inputs
|
|
51
|
+
* of the `inputs` query parameter (the JSON of the `inputs` option of the `demo` action).
|
|
52
|
+
*
|
|
53
|
+
* The demo application hydrates its server-rendered page, but not the demo: a demo is the user's
|
|
54
|
+
* component and need not be hydration-safe, and the server renders it without the inputs of the
|
|
55
|
+
* query, which only the browser has. So the host skips hydration, as documentation pages do for
|
|
56
|
+
* their content, and the browser renders the demo again.
|
|
57
|
+
*/
|
|
58
|
+
declare class NgDocDemoHostComponent {
|
|
59
|
+
private readonly route;
|
|
60
|
+
/** The demo component, or undefined on the page of a demo that does not exist. */
|
|
61
|
+
protected readonly demo: Type<unknown> | undefined;
|
|
62
|
+
/** The inputs of the demo. */
|
|
63
|
+
protected readonly inputs: Record<string, unknown>;
|
|
64
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NgDocDemoHostComponent, never>;
|
|
65
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NgDocDemoHostComponent, "ng-doc-demo-host", never, {}, {}, never, never, true, never>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The `source` of every message the demo application sends to the page that embeds it.
|
|
70
|
+
* @internal
|
|
71
|
+
*/
|
|
72
|
+
declare const ɵNG_DOC_DEMO_MESSAGE_SOURCE = "ng-doc-demo";
|
|
73
|
+
/**
|
|
74
|
+
* The message an isolated demo sends to the page that shows it in an iframe whenever the height
|
|
75
|
+
* of its content changes, so that the iframe takes that height.
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
interface ɵNgDocDemoSizeMessage {
|
|
79
|
+
readonly source: typeof ɵNG_DOC_DEMO_MESSAGE_SOURCE;
|
|
80
|
+
readonly version: 1;
|
|
81
|
+
readonly type: 'size';
|
|
82
|
+
/** The height of the demo's content, in CSS pixels, rounded up. */
|
|
83
|
+
readonly height: number;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Whether a message is a size message of the demo application.
|
|
87
|
+
* @param value - The data of a `message` event.
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
declare function ɵisNgDocDemoSizeMessage(value: unknown): value is ɵNgDocDemoSizeMessage;
|
|
91
|
+
/**
|
|
92
|
+
* The message an isolated demo sends to the page that shows it in an iframe whenever the background
|
|
93
|
+
* of its page changes, such as when its theme changes, so that the page can paint the canvas
|
|
94
|
+
* around the iframe in it.
|
|
95
|
+
* @internal
|
|
96
|
+
*/
|
|
97
|
+
interface ɵNgDocDemoBackgroundMessage {
|
|
98
|
+
readonly source: typeof ɵNG_DOC_DEMO_MESSAGE_SOURCE;
|
|
99
|
+
readonly version: 1;
|
|
100
|
+
readonly type: 'background';
|
|
101
|
+
/** The computed background color of the demo's page, such as `rgb(24, 24, 27)`. */
|
|
102
|
+
readonly color: string;
|
|
103
|
+
/** The color of the dots of the demo canvas in the demo's theme, if the theme sets one. */
|
|
104
|
+
readonly dots?: string;
|
|
105
|
+
/** The color scheme of the demo's page (`dark`, for example), if it sets one. */
|
|
106
|
+
readonly scheme?: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Whether a message is a background message of the demo application.
|
|
110
|
+
* @param value - The data of a `message` event.
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
declare function ɵisNgDocDemoBackgroundMessage(value: unknown): value is ɵNgDocDemoBackgroundMessage;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The theme that the URL fragment of a demo page sets, or `undefined` when it sets none and the
|
|
117
|
+
* page follows the theme of the site.
|
|
118
|
+
* @param fragment - The fragment, with or without the leading `#`.
|
|
119
|
+
* @internal
|
|
120
|
+
*/
|
|
121
|
+
declare function ɵdemoThemeFromFragment(fragment: string): string | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* A fragment (without `#`) with the theme parameter set, after the other parameters, or without it
|
|
124
|
+
* when there is no theme. `undefined` when nothing is left.
|
|
125
|
+
* @param fragment - The fragment without the theme, or none.
|
|
126
|
+
* @param theme - The theme of the demo page, or none to follow the site.
|
|
127
|
+
* @internal
|
|
128
|
+
*/
|
|
129
|
+
declare function ɵwithDemoTheme(fragment: string | undefined, theme: string | undefined): string | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* Whether a parameter of a fragment is the theme of the demo page, which the state of a
|
|
132
|
+
* playground leaves to the demo application.
|
|
133
|
+
* @param name - The decoded name of the parameter.
|
|
134
|
+
* @internal
|
|
135
|
+
*/
|
|
136
|
+
declare function ɵisDemoThemeParameter(name: string): boolean;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* The state of an isolated playground that its documentation page passes to the frame.
|
|
140
|
+
* @internal
|
|
141
|
+
*/
|
|
142
|
+
interface ɵNgDocPlaygroundState {
|
|
143
|
+
/** The names of the target's inputs, in order: a pipe's parameters are positional. */
|
|
144
|
+
readonly inputs: readonly string[];
|
|
145
|
+
/** The value of each input, by name. */
|
|
146
|
+
readonly properties: Readonly<Record<string, unknown>>;
|
|
147
|
+
/** The content slots that are shown. */
|
|
148
|
+
readonly content: readonly string[];
|
|
149
|
+
/** Whether the frame creates the target again for this state. */
|
|
150
|
+
readonly recreate: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* The `data` option of the playground action, which the template of the target reads; the
|
|
153
|
+
* frame has the configuration's own `data`.
|
|
154
|
+
*/
|
|
155
|
+
readonly data?: Readonly<Record<string, unknown>>;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* A state written as a URL fragment, or why it can't be: the input whose value can't be encoded,
|
|
159
|
+
* or an empty `path` when the fragment would be too long.
|
|
160
|
+
* @internal
|
|
161
|
+
*/
|
|
162
|
+
type ɵNgDocPlaygroundFragment = {
|
|
163
|
+
readonly ok: true;
|
|
164
|
+
readonly fragment: string;
|
|
165
|
+
} | {
|
|
166
|
+
readonly ok: false;
|
|
167
|
+
readonly path: string;
|
|
168
|
+
readonly reason: string;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Writes a state as a URL fragment (without `#`). A string, a finite number or a boolean is its
|
|
172
|
+
* own readable parameter (`label=Save&size=2&disabled=true`; a string that would read as another
|
|
173
|
+
* type is quoted as JSON). Every other value goes into one `~v` parameter, encoded by
|
|
174
|
+
* {@link ɵencodePlaygroundValue}. The frame reads the fragment with
|
|
175
|
+
* {@link ɵplaygroundStateFromFragment}, and the same fragment opens the page in a new tab.
|
|
176
|
+
* @param state - The state of the playground.
|
|
177
|
+
* @internal
|
|
178
|
+
*/
|
|
179
|
+
declare function ɵplaygroundStateToFragment(state: ɵNgDocPlaygroundState): ɵNgDocPlaygroundFragment;
|
|
180
|
+
/**
|
|
181
|
+
* Reads a state that {@link ɵplaygroundStateToFragment} wrote. Throws on a fragment it can't
|
|
182
|
+
* have written, so a malformed URL never reaches the target half-read.
|
|
183
|
+
* @param fragment - The fragment, with or without the leading `#`.
|
|
184
|
+
* @internal
|
|
185
|
+
*/
|
|
186
|
+
declare function ɵplaygroundStateFromFragment(fragment: string): ɵNgDocPlaygroundState;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* A value as it crosses from a documentation page to the frame of an isolated playground: JSON
|
|
190
|
+
* that both `postMessage` and a URL carry unchanged.
|
|
191
|
+
* @internal
|
|
192
|
+
*/
|
|
193
|
+
type ɵNgDocPlaygroundEncodedValue = string | number | boolean | null | ɵNgDocPlaygroundEncodedValue[] | {
|
|
194
|
+
[key: string]: ɵNgDocPlaygroundEncodedValue;
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* The result of encoding a value: the encoded value, or the path of the first part that can't be
|
|
198
|
+
* encoded and why.
|
|
199
|
+
* @internal
|
|
200
|
+
*/
|
|
201
|
+
type ɵNgDocPlaygroundEncoding = {
|
|
202
|
+
readonly ok: true;
|
|
203
|
+
readonly value: ɵNgDocPlaygroundEncodedValue;
|
|
204
|
+
} | {
|
|
205
|
+
readonly ok: false;
|
|
206
|
+
readonly path: string;
|
|
207
|
+
readonly reason: string;
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* The longest encoded state an "Open in a new tab" URL carries; a longer one is left out.
|
|
211
|
+
* @internal
|
|
212
|
+
*/
|
|
213
|
+
declare const ɵNG_DOC_PLAYGROUND_STATE_URL_LIMIT = 8192;
|
|
214
|
+
/**
|
|
215
|
+
* Encodes a value for the frame of an isolated playground. Only plain data is accepted:
|
|
216
|
+
* strings, numbers (`NaN`, the infinities and `-0` included), booleans, `null`, `undefined`, `Date`s,
|
|
217
|
+
* arrays and plain objects (prototype `Object.prototype` or `null`, own enumerable data
|
|
218
|
+
* properties). Anything else (a function, a symbol, a `bigint`, a class instance such as a
|
|
219
|
+
* `TemplateRef`, a `Map` or a signal, a getter, a cycle) is refused rather than sent changed: a
|
|
220
|
+
* structured clone would turn a class instance into a plain object without its behaviour, and
|
|
221
|
+
* the demo would then run with a value that isn't the one the inspector shows.
|
|
222
|
+
* @param value - The value of a playground input.
|
|
223
|
+
* @internal
|
|
224
|
+
*/
|
|
225
|
+
declare function ɵencodePlaygroundValue(value: unknown): ɵNgDocPlaygroundEncoding;
|
|
226
|
+
/**
|
|
227
|
+
* Decodes a value that {@link ɵencodePlaygroundValue} encoded. Throws on anything it can't have
|
|
228
|
+
* produced, so a malformed message or URL never reaches the demo half-decoded.
|
|
229
|
+
* @param value - An encoded value.
|
|
230
|
+
* @internal
|
|
231
|
+
*/
|
|
232
|
+
declare function ɵdecodePlaygroundValue(value: unknown): unknown;
|
|
233
|
+
/**
|
|
234
|
+
* The encoded values of an "Open in a new tab" URL: base64url of their JSON, or `undefined`
|
|
235
|
+
* when it would be longer than {@link ɵNG_DOC_PLAYGROUND_STATE_URL_LIMIT}.
|
|
236
|
+
* @param values - Encoded values, by input name.
|
|
237
|
+
* @internal
|
|
238
|
+
*/
|
|
239
|
+
declare function ɵplaygroundStateToUrl(values: Record<string, ɵNgDocPlaygroundEncodedValue>): string | undefined;
|
|
240
|
+
/**
|
|
241
|
+
* The encoded values of an "Open in a new tab" URL, or `undefined` when the parameter isn't one
|
|
242
|
+
* that {@link ɵplaygroundStateToUrl} wrote.
|
|
243
|
+
* @param text - The `state` query parameter.
|
|
244
|
+
* @internal
|
|
245
|
+
*/
|
|
246
|
+
declare function ɵplaygroundStateFromUrl(text: string): Record<string, ɵNgDocPlaygroundEncodedValue> | undefined;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* The message the frame of an isolated playground sends once its target exists: the target's
|
|
250
|
+
* default input values, encoded, and the inputs whose default can't be encoded.
|
|
251
|
+
* @internal
|
|
252
|
+
*/
|
|
253
|
+
interface ɵNgDocPlaygroundReadyMessage {
|
|
254
|
+
readonly source: typeof ɵNG_DOC_DEMO_MESSAGE_SOURCE;
|
|
255
|
+
readonly version: 1;
|
|
256
|
+
readonly type: 'playground-ready';
|
|
257
|
+
readonly defaults: Readonly<Record<string, ɵNgDocPlaygroundEncodedValue>>;
|
|
258
|
+
readonly uncloneable: readonly string[];
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* The message the frame of an isolated playground sends once it has applied the state of its URL
|
|
262
|
+
* fragment.
|
|
263
|
+
* @internal
|
|
264
|
+
*/
|
|
265
|
+
interface ɵNgDocPlaygroundAppliedMessage {
|
|
266
|
+
readonly source: typeof ɵNG_DOC_DEMO_MESSAGE_SOURCE;
|
|
267
|
+
readonly version: 1;
|
|
268
|
+
readonly type: 'playground-applied';
|
|
269
|
+
/** The URL fragment of the state it applied, without `#`. */
|
|
270
|
+
readonly fragment: string;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* The message the frame of an isolated playground sends when its target throws while it is
|
|
274
|
+
* created or while it takes a state, or when its URL fragment is malformed.
|
|
275
|
+
* @internal
|
|
276
|
+
*/
|
|
277
|
+
interface ɵNgDocPlaygroundErrorMessage {
|
|
278
|
+
readonly source: typeof ɵNG_DOC_DEMO_MESSAGE_SOURCE;
|
|
279
|
+
readonly version: 1;
|
|
280
|
+
readonly type: 'playground-error';
|
|
281
|
+
readonly phase: 'create' | 'apply';
|
|
282
|
+
readonly message: string;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* A message from the frame of an isolated playground to its documentation page.
|
|
286
|
+
* @internal
|
|
287
|
+
*/
|
|
288
|
+
type ɵNgDocPlaygroundFrameMessage = ɵNgDocPlaygroundReadyMessage | ɵNgDocPlaygroundAppliedMessage | ɵNgDocPlaygroundErrorMessage;
|
|
289
|
+
/**
|
|
290
|
+
* Whether a message comes from the frame of an isolated playground, and is one it sends.
|
|
291
|
+
* @param value - The data of a `message` event.
|
|
292
|
+
* @internal
|
|
293
|
+
*/
|
|
294
|
+
declare function ɵisNgDocPlaygroundFrameMessage(value: unknown): value is ɵNgDocPlaygroundFrameMessage;
|
|
295
|
+
|
|
296
|
+
export { NgDocDemoAppComponent, NgDocDemoHostComponent, ɵNG_DOC_DEMO_MESSAGE_SOURCE, ɵNG_DOC_PLAYGROUND_STATE_URL_LIMIT, ɵdecodePlaygroundValue, ɵdemoThemeFromFragment, ɵencodePlaygroundValue, ɵisDemoThemeParameter, ɵisNgDocDemoBackgroundMessage, ɵisNgDocDemoSizeMessage, ɵisNgDocPlaygroundFrameMessage, ɵngDocDemoApplicationConfig, ɵplaygroundStateFromFragment, ɵplaygroundStateFromUrl, ɵplaygroundStateToFragment, ɵplaygroundStateToUrl, ɵwithDemoTheme };
|
|
297
|
+
export type { ɵNgDocDemoApplicationOptions, ɵNgDocDemoBackgroundMessage, ɵNgDocDemoSizeMessage, ɵNgDocPlaygroundAppliedMessage, ɵNgDocPlaygroundEncodedValue, ɵNgDocPlaygroundEncoding, ɵNgDocPlaygroundErrorMessage, ɵNgDocPlaygroundFragment, ɵNgDocPlaygroundFrameMessage, ɵNgDocPlaygroundReadyMessage, ɵNgDocPlaygroundState };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InjectionToken, ApplicationRef, ViewContainerRef, Type } from '@angular/core';
|
|
2
2
|
import { Route } from '@angular/router';
|
|
3
|
-
import { NgDocContentSource, NgDocContentModule, NgDocPlaygroundProperty } from '@ng-doc/core/interfaces';
|
|
3
|
+
import { NgDocContentSource, NgDocContentModule, NgDocPlaygroundProperty, NgDocPlaygroundOption } from '@ng-doc/core/interfaces';
|
|
4
4
|
import { NgDocTocItem } from '@ng-doc/app/interfaces';
|
|
5
5
|
import { LocationStrategy } from '@angular/common';
|
|
6
6
|
|
|
@@ -26,7 +26,8 @@ declare const ɵNG_DOC_CONTENT_WAIT: InjectionToken<number>;
|
|
|
26
26
|
*/
|
|
27
27
|
declare function ɵpreloadNgDocContent(source: NgDocContentSource): Promise<NgDocContentModule>;
|
|
28
28
|
/**
|
|
29
|
-
* Returns the payload of a source that `ɵpreloadNgDocContent` has loaded,
|
|
29
|
+
* Returns the payload of a source that `ɵpreloadNgDocContent` has loaded, or that a development
|
|
30
|
+
* content update delivered, without waiting.
|
|
30
31
|
* @param source - The content source.
|
|
31
32
|
* @returns The payload, or `undefined` when the source has not finished loading.
|
|
32
33
|
* @internal
|
|
@@ -73,6 +74,58 @@ type NgDocBootstrap<TArguments extends unknown[], TApplication extends Applicati
|
|
|
73
74
|
/** Waits for content loading and processing before returning an SSR application. */
|
|
74
75
|
declare function withNgDocContentReady<TArguments extends unknown[], TApplication extends ApplicationRef = ApplicationRef>(bootstrap: NgDocBootstrap<TArguments, TApplication>): NgDocBootstrap<TArguments, TApplication>;
|
|
75
76
|
|
|
77
|
+
/**
|
|
78
|
+
* The detail of an `ɵNG_DOC_CONTENT_UPDATE_EVENT` (`@ng-doc/app/constants`).
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
interface ɵNgDocContentUpdate {
|
|
82
|
+
/** The new payload of every changed content module the page may have loaded. */
|
|
83
|
+
readonly payloads: readonly unknown[];
|
|
84
|
+
/** Whether the search index changed too. */
|
|
85
|
+
readonly search: boolean;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* What an update tells the code that shows content.
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
interface ɵNgDocContentChange {
|
|
92
|
+
/** The ids of the content modules that changed. */
|
|
93
|
+
readonly ids: ReadonlySet<string>;
|
|
94
|
+
/** Whether the search index changed. */
|
|
95
|
+
readonly search: boolean;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Applies the content updates of the Vite development host in this window. Every NgDoc content
|
|
99
|
+
* controller calls it in the browser; it listens once per window. Nothing dispatches the event
|
|
100
|
+
* outside the development host, so it is inert in production builds, and Angular's production
|
|
101
|
+
* mode (`ngDevMode` false) skips it altogether.
|
|
102
|
+
* @param view - The window, if any (none on the server).
|
|
103
|
+
* @internal
|
|
104
|
+
*/
|
|
105
|
+
declare function ɵlistenNgDocContentUpdates(view: Window | null | undefined): void;
|
|
106
|
+
/**
|
|
107
|
+
* Calls `listener` with every content update applied in this window.
|
|
108
|
+
* @param listener - The listener.
|
|
109
|
+
* @returns A function that stops it.
|
|
110
|
+
* @internal
|
|
111
|
+
*/
|
|
112
|
+
declare function ɵwatchNgDocContentUpdates(listener: (change: ɵNgDocContentChange) => void): () => void;
|
|
113
|
+
/**
|
|
114
|
+
* The newest payload an update delivered for a content module.
|
|
115
|
+
* @param id - The content module id.
|
|
116
|
+
* @returns The payload, or `undefined` when no update changed the module.
|
|
117
|
+
* @internal
|
|
118
|
+
*/
|
|
119
|
+
declare function ɵupdatedNgDocContent(id: string): NgDocContentModule | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* Loads a content source: its newest updated payload, if an update delivered one, or the source.
|
|
122
|
+
* @param source - The content source.
|
|
123
|
+
* @param signal - Aborts the load.
|
|
124
|
+
* @returns The payload.
|
|
125
|
+
* @internal
|
|
126
|
+
*/
|
|
127
|
+
declare function ɵloadNgDocContent(source: NgDocContentSource, signal: AbortSignal): Promise<NgDocContentModule>;
|
|
128
|
+
|
|
76
129
|
/**
|
|
77
130
|
*
|
|
78
131
|
* @param viewContainer
|
|
@@ -166,5 +219,23 @@ declare function ɵngDocRouteUrl(locationStrategy: LocationStrategy, documentUrl
|
|
|
166
219
|
*/
|
|
167
220
|
declare function ɵngDocPageUrl(locationStrategy: LocationStrategy, location: Pick<Location, 'href' | 'origin' | 'pathname'>, fragment?: string): string;
|
|
168
221
|
|
|
169
|
-
|
|
170
|
-
|
|
222
|
+
/** An option of a playground property, resolved to the value it sets and the text it shows. */
|
|
223
|
+
interface NgDocResolvedPlaygroundOption {
|
|
224
|
+
/** The text shown for the option. */
|
|
225
|
+
label: string;
|
|
226
|
+
/** The value the option sets. */
|
|
227
|
+
value: unknown;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Resolves an option of a playground property. A named option (an enum member) carries its
|
|
231
|
+
* value; a plain value from the playground's `controls` is the value itself; any other option is
|
|
232
|
+
* the source text of a union member, such as `'small'`, and is evaluated; it throws when that
|
|
233
|
+
* text can't be evaluated.
|
|
234
|
+
* @param option - The option.
|
|
235
|
+
* @param isManual - Whether the options come from the playground's `controls`.
|
|
236
|
+
* @returns The value of the option and the text that shows it.
|
|
237
|
+
*/
|
|
238
|
+
declare function resolvePlaygroundOption(option: string | NgDocPlaygroundOption, isManual?: boolean): NgDocResolvedPlaygroundOption;
|
|
239
|
+
|
|
240
|
+
export { asBoolean, createComponent, formatHtml, generateToc, isDarkOsTheme, isExternalLink, isPlaygroundProperty, resolvePlaygroundOption, withNgDocContentReady, ɵNG_DOC_ASYNC_CONTENT_ATTRIBUTE, ɵNG_DOC_CONTENT_WAIT, ɵcaptureNgDocHydrationSnapshots, ɵforgetNgDocContent, ɵlistenNgDocContentUpdates, ɵloadNgDocContent, ɵngDocPageUrl, ɵngDocRouteContentSources, ɵngDocRouteUrl, ɵpeekNgDocContent, ɵpendingNgDocContent, ɵpreloadNgDocContent, ɵrestoreNgDocHydrationSnapshot, ɵupdatedNgDocContent, ɵwatchNgDocContentUpdates, ɵwithNgDocContent };
|
|
241
|
+
export type { NgDocBootstrap, NgDocResolvedPlaygroundOption, ɵNgDocContentChange, ɵNgDocContentUpdate };
|