@ng-doc/app 22.0.0 → 22.1.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/fesm2022/ng-doc-app-classes-root-page.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-demo-frame.mjs +96 -0
- package/fesm2022/ng-doc-app-components-demo-frame.mjs.map +1 -0
- package/fesm2022/ng-doc-app-components-demo-pane.mjs +1 -1
- package/fesm2022/ng-doc-app-components-demo-pane.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-demo.mjs +54 -8
- package/fesm2022/ng-doc-app-components-demo.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-playground.mjs +109 -47
- package/fesm2022/ng-doc-app-components-playground.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.mjs +1 -0
- package/fesm2022/ng-doc-app-components.mjs.map +1 -1
- package/fesm2022/ng-doc-app-demo-app.mjs +176 -0
- package/fesm2022/ng-doc-app-demo-app.mjs.map +1 -0
- package/fesm2022/ng-doc-app-helpers.mjs +23 -2
- 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.map +1 -1
- 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 +1 -0
- package/fesm2022/ng-doc-app-providers.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services-highlighter.mjs +17 -13
- 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-type-controls-type-alias-control.mjs +43 -8
- package/fesm2022/ng-doc-app-type-controls-type-alias-control.mjs.map +1 -1
- package/package.json +17 -4
- package/styles/global.css +3 -0
- package/styles/main.css +3 -0
- package/styles/themes/dark.css +10 -0
- package/types/ng-doc-app-classes-root-page.d.ts +8 -0
- package/types/ng-doc-app-components-demo-frame.d.ts +48 -0
- package/types/ng-doc-app-components-demo.d.ts +20 -2
- package/types/ng-doc-app-components-playground.d.ts +24 -3
- package/types/ng-doc-app-components-tabs.d.ts +13 -3
- package/types/ng-doc-app-components.d.ts +1 -0
- package/types/ng-doc-app-demo-app.d.ts +89 -0
- package/types/ng-doc-app-helpers.d.ts +21 -3
- package/types/ng-doc-app-interfaces.d.ts +15 -4
- package/types/ng-doc-app-processors-processors.d.ts +5 -0
- package/types/ng-doc-app-providers-ng-doc-app.d.ts +1 -1
- package/types/ng-doc-app-providers-title.d.ts +59 -0
- package/types/ng-doc-app-providers.d.ts +1 -0
- package/types/ng-doc-app-services-highlighter.d.ts +12 -5
- package/types/ng-doc-app-services-route-preloader.d.ts +13 -1
- package/types/ng-doc-app-type-controls-type-alias-control.d.ts +26 -4
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { isPlatformBrowser, NgComponentOutlet } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, PLATFORM_ID, DOCUMENT, DestroyRef, ElementRef, ChangeDetectionStrategy, Component, provideZoneChangeDetection, provideZonelessChangeDetection } from '@angular/core';
|
|
4
|
+
import { RouterOutlet, ActivatedRoute, provideRouter } from '@angular/router';
|
|
5
|
+
import { NG_DOC_STORE_THEME_KEY } from '@ng-doc/app/constants';
|
|
6
|
+
import { provideClientHydration, withNoIncrementalHydration } from '@angular/platform-browser';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The `source` of every message the demo application sends to the page that embeds it.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
const ɵNG_DOC_DEMO_MESSAGE_SOURCE = 'ng-doc-demo';
|
|
13
|
+
/**
|
|
14
|
+
* Whether a message is a size message of the demo application.
|
|
15
|
+
* @param value - The data of a `message` event.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
function ɵisNgDocDemoSizeMessage(value) {
|
|
19
|
+
const message = value;
|
|
20
|
+
return (typeof message === 'object' &&
|
|
21
|
+
message !== null &&
|
|
22
|
+
message.source === ɵNG_DOC_DEMO_MESSAGE_SOURCE &&
|
|
23
|
+
message.version === 1 &&
|
|
24
|
+
message.type === 'size' &&
|
|
25
|
+
typeof message.height === 'number' &&
|
|
26
|
+
Number.isFinite(message.height) &&
|
|
27
|
+
message.height >= 0);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The root of the demo application, which shows one demo per page with only Angular and that
|
|
32
|
+
* demo loaded. In an iframe it reports the height of its content to the page that embeds it (a
|
|
33
|
+
* `ResizeObserver` on its border box), and it follows the theme the reader picks on the
|
|
34
|
+
* documentation site, which stores it in `localStorage`.
|
|
35
|
+
*/
|
|
36
|
+
class NgDocDemoAppComponent {
|
|
37
|
+
constructor() {
|
|
38
|
+
if (!isPlatformBrowser(inject(PLATFORM_ID)))
|
|
39
|
+
return;
|
|
40
|
+
const document = inject(DOCUMENT);
|
|
41
|
+
const window = document.defaultView;
|
|
42
|
+
const destroyRef = inject(DestroyRef);
|
|
43
|
+
if (!window)
|
|
44
|
+
return;
|
|
45
|
+
if (window.parent !== window) {
|
|
46
|
+
const host = inject(ElementRef).nativeElement;
|
|
47
|
+
let reported = -1;
|
|
48
|
+
const observer = new ResizeObserver(() => {
|
|
49
|
+
const height = Math.ceil(host.getBoundingClientRect().height);
|
|
50
|
+
if (height === reported)
|
|
51
|
+
return;
|
|
52
|
+
reported = height;
|
|
53
|
+
const message = {
|
|
54
|
+
source: ɵNG_DOC_DEMO_MESSAGE_SOURCE,
|
|
55
|
+
version: 1,
|
|
56
|
+
type: 'size',
|
|
57
|
+
height,
|
|
58
|
+
};
|
|
59
|
+
// Only a page of the same origin may receive it: the demo pages are part of the site.
|
|
60
|
+
window.parent.postMessage(message, window.location.origin);
|
|
61
|
+
});
|
|
62
|
+
observer.observe(host, { box: 'border-box' });
|
|
63
|
+
destroyRef.onDestroy(() => observer.disconnect());
|
|
64
|
+
}
|
|
65
|
+
// The documentation page and the demo page share the origin, so a theme the reader picks
|
|
66
|
+
// reaches this page as a storage event. An empty id is the light theme, as in the restore
|
|
67
|
+
// script that applies the stored theme before the application starts.
|
|
68
|
+
const onStorage = (event) => {
|
|
69
|
+
if (event.key !== NG_DOC_STORE_THEME_KEY || event.newValue === null)
|
|
70
|
+
return;
|
|
71
|
+
if (event.newValue) {
|
|
72
|
+
document.documentElement.setAttribute('data-theme', event.newValue);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
document.documentElement.removeAttribute('data-theme');
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
window.addEventListener('storage', onStorage);
|
|
79
|
+
destroyRef.onDestroy(() => window.removeEventListener('storage', onStorage));
|
|
80
|
+
}
|
|
81
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDemoAppComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
82
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "22.2.1", type: NgDocDemoAppComponent, isStandalone: true, selector: "ng-doc-demo-app", ngImport: i0, template: '<router-outlet />', isInline: true, styles: [":host{display:flow-root}\n"], dependencies: [{ kind: "directive", type: RouterOutlet, selector: "router-outlet", inputs: ["name", "routerOutletData"], outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
83
|
+
}
|
|
84
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDemoAppComponent, decorators: [{
|
|
85
|
+
type: Component,
|
|
86
|
+
args: [{ selector: 'ng-doc-demo-app', imports: [RouterOutlet], template: '<router-outlet />', changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:flow-root}\n"] }]
|
|
87
|
+
}], ctorParameters: () => [] });
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Shows the demo of a demo page: the component in the route's `ngDocDemo` data, with the inputs
|
|
91
|
+
* of the `inputs` query parameter (the JSON of the `inputs` option of the `demo` action).
|
|
92
|
+
*
|
|
93
|
+
* The demo application hydrates its server-rendered page, but not the demo: a demo is the user's
|
|
94
|
+
* component and need not be hydration-safe, and the server renders it without the inputs of the
|
|
95
|
+
* query, which only the browser has. So the host skips hydration, as documentation pages do for
|
|
96
|
+
* their content, and the browser renders the demo again.
|
|
97
|
+
*/
|
|
98
|
+
class NgDocDemoHostComponent {
|
|
99
|
+
constructor() {
|
|
100
|
+
this.route = inject(ActivatedRoute);
|
|
101
|
+
/** The demo component, or undefined on the page of a demo that does not exist. */
|
|
102
|
+
this.demo = this.route.snapshot.data['ngDocDemo'];
|
|
103
|
+
/** The inputs of the demo. */
|
|
104
|
+
this.inputs = demoInputs(this.route.snapshot.queryParamMap.get('inputs'));
|
|
105
|
+
}
|
|
106
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDemoHostComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
107
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.1", type: NgDocDemoHostComponent, isStandalone: true, selector: "ng-doc-demo-host", host: { attributes: { "ngSkipHydration": "true" } }, ngImport: i0, template: `
|
|
108
|
+
@if (demo) {
|
|
109
|
+
<ng-container *ngComponentOutlet="demo; inputs: inputs" />
|
|
110
|
+
} @else {
|
|
111
|
+
<p role="alert">This demo does not exist.</p>
|
|
112
|
+
}
|
|
113
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
114
|
+
}
|
|
115
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDemoHostComponent, decorators: [{
|
|
116
|
+
type: Component,
|
|
117
|
+
args: [{
|
|
118
|
+
selector: 'ng-doc-demo-host',
|
|
119
|
+
imports: [NgComponentOutlet],
|
|
120
|
+
template: `
|
|
121
|
+
@if (demo) {
|
|
122
|
+
<ng-container *ngComponentOutlet="demo; inputs: inputs" />
|
|
123
|
+
} @else {
|
|
124
|
+
<p role="alert">This demo does not exist.</p>
|
|
125
|
+
}
|
|
126
|
+
`,
|
|
127
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
128
|
+
host: { ngSkipHydration: 'true' },
|
|
129
|
+
}]
|
|
130
|
+
}] });
|
|
131
|
+
/**
|
|
132
|
+
* The inputs of the `inputs` query parameter: a JSON object, or none.
|
|
133
|
+
* @param value - The parameter.
|
|
134
|
+
*/
|
|
135
|
+
function demoInputs(value) {
|
|
136
|
+
if (!value)
|
|
137
|
+
return {};
|
|
138
|
+
try {
|
|
139
|
+
const parsed = JSON.parse(value);
|
|
140
|
+
return parsed && typeof parsed === 'object' && !Array.isArray(parsed)
|
|
141
|
+
? parsed
|
|
142
|
+
: {};
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return {};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* The configuration of the demo application: change detection, the router with the demo pages
|
|
151
|
+
* (and a page for unknown demos), hydration, and the providers of `demoProviders`. The generated entries of
|
|
152
|
+
* the demo application bootstrap `NgDocDemoAppComponent` with it, in the browser and on the server.
|
|
153
|
+
* @param routes - The generated demo routes.
|
|
154
|
+
* @param demoProviders - The generated import of the `demoProviders` module, if any.
|
|
155
|
+
* @param options - How the application starts.
|
|
156
|
+
* @internal
|
|
157
|
+
*/
|
|
158
|
+
async function ɵngDocDemoApplicationConfig(routes, demoProviders, options = {}) {
|
|
159
|
+
const providers = demoProviders ? (await demoProviders()).default : [];
|
|
160
|
+
return {
|
|
161
|
+
providers: [
|
|
162
|
+
options.zone ? provideZoneChangeDetection() : provideZonelessChangeDetection(),
|
|
163
|
+
...(options.hydration ? [provideClientHydration(withNoIncrementalHydration())] : []),
|
|
164
|
+
provideRouter([...routes, { path: '**', component: NgDocDemoHostComponent }]),
|
|
165
|
+
...providers,
|
|
166
|
+
...(options.providers ?? []),
|
|
167
|
+
],
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Generated bundle index. Do not edit.
|
|
173
|
+
*/
|
|
174
|
+
|
|
175
|
+
export { NgDocDemoAppComponent, NgDocDemoHostComponent, ɵNG_DOC_DEMO_MESSAGE_SOURCE, ɵisNgDocDemoSizeMessage, ɵngDocDemoApplicationConfig };
|
|
176
|
+
//# sourceMappingURL=ng-doc-app-demo-app.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ng-doc-app-demo-app.mjs","sources":["../../../../libs/app/demo-app/demo-message.ts","../../../../libs/app/demo-app/demo-app.component.ts","../../../../libs/app/demo-app/demo-host.component.ts","../../../../libs/app/demo-app/demo-application.ts","../../../../libs/app/demo-app/ng-doc-app-demo-app.ts"],"sourcesContent":["/**\n * The `source` of every message the demo application sends to the page that embeds it.\n * @internal\n */\nexport const ɵNG_DOC_DEMO_MESSAGE_SOURCE = 'ng-doc-demo';\n\n/**\n * The message an isolated demo sends to the page that shows it in an iframe whenever the height\n * of its content changes, so that the iframe takes that height.\n * @internal\n */\nexport interface ɵNgDocDemoSizeMessage {\n readonly source: typeof ɵNG_DOC_DEMO_MESSAGE_SOURCE;\n readonly version: 1;\n readonly type: 'size';\n /** The height of the demo's content, in CSS pixels, rounded up. */\n readonly height: number;\n}\n\n/**\n * Whether a message is a size message of the demo application.\n * @param value - The data of a `message` event.\n * @internal\n */\nexport function ɵisNgDocDemoSizeMessage(value: unknown): value is ɵNgDocDemoSizeMessage {\n const message = value as Partial<ɵNgDocDemoSizeMessage> | null;\n return (\n typeof message === 'object' &&\n message !== null &&\n message.source === ɵNG_DOC_DEMO_MESSAGE_SOURCE &&\n message.version === 1 &&\n message.type === 'size' &&\n typeof message.height === 'number' &&\n Number.isFinite(message.height) &&\n message.height >= 0\n );\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n DOCUMENT,\n ElementRef,\n inject,\n PLATFORM_ID,\n} from '@angular/core';\nimport { RouterOutlet } from '@angular/router';\nimport { NG_DOC_STORE_THEME_KEY } from '@ng-doc/app/constants';\n\nimport { ɵNG_DOC_DEMO_MESSAGE_SOURCE, ɵNgDocDemoSizeMessage } from './demo-message';\n\n/**\n * The root of the demo application, which shows one demo per page with only Angular and that\n * demo loaded. In an iframe it reports the height of its content to the page that embeds it (a\n * `ResizeObserver` on its border box), and it follows the theme the reader picks on the\n * documentation site, which stores it in `localStorage`.\n */\n@Component({\n selector: 'ng-doc-demo-app',\n imports: [RouterOutlet],\n template: '<router-outlet />',\n // `flow-root`: the margins of the demo stay inside the measured box.\n styles: ':host { display: flow-root; }',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class NgDocDemoAppComponent {\n constructor() {\n if (!isPlatformBrowser(inject(PLATFORM_ID))) return;\n const document = inject(DOCUMENT);\n const window = document.defaultView;\n const destroyRef = inject(DestroyRef);\n\n if (!window) return;\n if (window.parent !== window) {\n const host: HTMLElement = inject(ElementRef).nativeElement;\n let reported = -1;\n const observer = new ResizeObserver(() => {\n const height = Math.ceil(host.getBoundingClientRect().height);\n\n if (height === reported) return;\n reported = height;\n const message: ɵNgDocDemoSizeMessage = {\n source: ɵNG_DOC_DEMO_MESSAGE_SOURCE,\n version: 1,\n type: 'size',\n height,\n };\n // Only a page of the same origin may receive it: the demo pages are part of the site.\n window.parent.postMessage(message, window.location.origin);\n });\n\n observer.observe(host, { box: 'border-box' });\n destroyRef.onDestroy(() => observer.disconnect());\n }\n\n // The documentation page and the demo page share the origin, so a theme the reader picks\n // reaches this page as a storage event. An empty id is the light theme, as in the restore\n // script that applies the stored theme before the application starts.\n const onStorage = (event: StorageEvent) => {\n if (event.key !== NG_DOC_STORE_THEME_KEY || event.newValue === null) return;\n if (event.newValue) {\n document.documentElement.setAttribute('data-theme', event.newValue);\n } else {\n document.documentElement.removeAttribute('data-theme');\n }\n };\n\n window.addEventListener('storage', onStorage);\n destroyRef.onDestroy(() => window.removeEventListener('storage', onStorage));\n }\n}\n","import { NgComponentOutlet } from '@angular/common';\nimport { ChangeDetectionStrategy, Component, inject, Type } from '@angular/core';\nimport { ActivatedRoute } from '@angular/router';\n\n/**\n * Shows the demo of a demo page: the component in the route's `ngDocDemo` data, with the inputs\n * of the `inputs` query parameter (the JSON of the `inputs` option of the `demo` action).\n *\n * The demo application hydrates its server-rendered page, but not the demo: a demo is the user's\n * component and need not be hydration-safe, and the server renders it without the inputs of the\n * query, which only the browser has. So the host skips hydration, as documentation pages do for\n * their content, and the browser renders the demo again.\n */\n@Component({\n selector: 'ng-doc-demo-host',\n imports: [NgComponentOutlet],\n template: `\n @if (demo) {\n <ng-container *ngComponentOutlet=\"demo; inputs: inputs\" />\n } @else {\n <p role=\"alert\">This demo does not exist.</p>\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { ngSkipHydration: 'true' },\n})\nexport class NgDocDemoHostComponent {\n private readonly route = inject(ActivatedRoute);\n\n /** The demo component, or undefined on the page of a demo that does not exist. */\n protected readonly demo: Type<unknown> | undefined = this.route.snapshot.data['ngDocDemo'];\n\n /** The inputs of the demo. */\n protected readonly inputs: Record<string, unknown> = demoInputs(\n this.route.snapshot.queryParamMap.get('inputs'),\n );\n}\n\n/**\n * The inputs of the `inputs` query parameter: a JSON object, or none.\n * @param value - The parameter.\n */\nfunction demoInputs(value: string | null): Record<string, unknown> {\n if (!value) return {};\n try {\n const parsed: unknown = JSON.parse(value);\n\n return parsed && typeof parsed === 'object' && !Array.isArray(parsed)\n ? (parsed as Record<string, unknown>)\n : {};\n } catch {\n return {};\n }\n}\n","import {\n ApplicationConfig,\n EnvironmentProviders,\n Provider,\n provideZoneChangeDetection,\n provideZonelessChangeDetection,\n} from '@angular/core';\nimport { provideClientHydration, withNoIncrementalHydration } from '@angular/platform-browser';\nimport { provideRouter, Routes } from '@angular/router';\nimport type { NgDocDemoProvidersImport } from '@ng-doc/core/interfaces';\n\nimport { NgDocDemoHostComponent } from './demo-host.component';\n\n/**\n * How the demo application starts.\n * @internal\n */\nexport interface ɵNgDocDemoApplicationOptions {\n /** Change detection with zone.js, when the application's polyfills load it. */\n readonly zone?: boolean;\n /**\n * Hydration of the server-rendered page: always on the server, which then writes the hydration\n * data, and in the browser only for a page the server rendered (a page without it, such as the\n * page of a demo that failed to prerender or the development server's, has nothing to hydrate).\n */\n readonly hydration?: boolean;\n /** Providers added after the others, for example server rendering. */\n readonly providers?: Array<Provider | EnvironmentProviders>;\n}\n\n/**\n * The configuration of the demo application: change detection, the router with the demo pages\n * (and a page for unknown demos), hydration, and the providers of `demoProviders`. The generated entries of\n * the demo application bootstrap `NgDocDemoAppComponent` with it, in the browser and on the server.\n * @param routes - The generated demo routes.\n * @param demoProviders - The generated import of the `demoProviders` module, if any.\n * @param options - How the application starts.\n * @internal\n */\nexport async function ɵngDocDemoApplicationConfig(\n routes: Routes,\n demoProviders: NgDocDemoProvidersImport | undefined,\n options: ɵNgDocDemoApplicationOptions = {},\n): Promise<ApplicationConfig> {\n const providers = demoProviders ? (await demoProviders()).default : [];\n\n return {\n providers: [\n options.zone ? provideZoneChangeDetection() : provideZonelessChangeDetection(),\n ...(options.hydration ? [provideClientHydration(withNoIncrementalHydration())] : []),\n provideRouter([...routes, { path: '**', component: NgDocDemoHostComponent }]),\n ...providers,\n ...(options.providers ?? []),\n ],\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAAA;;;AAGG;AACI,MAAM,2BAA2B,GAAG;AAe3C;;;;AAIG;AACG,SAAU,uBAAuB,CAAC,KAAc,EAAA;IACpD,MAAM,OAAO,GAAG,KAA8C;AAC9D,IAAA,QACE,OAAO,OAAO,KAAK,QAAQ;AAC3B,QAAA,OAAO,KAAK,IAAI;QAChB,OAAO,CAAC,MAAM,KAAK,2BAA2B;QAC9C,OAAO,CAAC,OAAO,KAAK,CAAC;QACrB,OAAO,CAAC,IAAI,KAAK,MAAM;AACvB,QAAA,OAAO,OAAO,CAAC,MAAM,KAAK,QAAQ;AAClC,QAAA,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC;AAC/B,QAAA,OAAO,CAAC,MAAM,IAAI,CAAC;AAEvB;;ACrBA;;;;;AAKG;MASU,qBAAqB,CAAA;AAChC,IAAA,WAAA,GAAA;AACE,QAAA,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;YAAE;AAC7C,QAAA,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;AACjC,QAAA,MAAM,MAAM,GAAG,QAAQ,CAAC,WAAW;AACnC,QAAA,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAErC,QAAA,IAAI,CAAC,MAAM;YAAE;AACb,QAAA,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,EAAE;YAC5B,MAAM,IAAI,GAAgB,MAAM,CAAC,UAAU,CAAC,CAAC,aAAa;AAC1D,YAAA,IAAI,QAAQ,GAAG,CAAC,CAAC;AACjB,YAAA,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC,MAAK;AACvC,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ClE,cAAG;cACD,EAAE;IACR;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,EAAE;IACX;AACF;;ACvBA;;;;;;;;AAQG;AACI,eAAe,2BAA2B,CAC/C,MAAc,EACd,aAAmD,EACnD,OAAA,GAAwC,EAAE,EAAA;AAE1C,IAAA,MAAM,SAAS,GAAG,aAAa,GAAG,CAAC,MAAM,aAAa,EAAE,EAAE,OAAO,GAAG,EAAE;IAEtE,OAAO;AACL,QAAA,SAAS,EAAE;YACT,OAAO,CAAC,IAAI,GAAG,0BAA0B,EAAE,GAAG,8BAA8B,EAAE;AAC9E,YAAA,IAAI,OAAO,CAAC,SAAS,GAAG,CAAC,sBAAsB,CAAC,0BAA0B,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;AACpF,YAAA,aAAa,CAAC,CAAC,GAAG,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,sBAAsB,EAAE,CAAC,CAAC;AAC7E,YAAA,GAAG,SAAS;AACZ,YAAA,IAAI,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;AAC7B,SAAA;KACF;AACH;;ACvDA;;AAEG;;;;"}
|
|
@@ -2,6 +2,7 @@ import { InjectionToken, inject } from '@angular/core';
|
|
|
2
2
|
import { NgDocContentState } from '@ng-doc/app/services/content-state';
|
|
3
3
|
import { asArray } from '@ng-doc/core/helpers/as-array';
|
|
4
4
|
import { objectKeys } from '@ng-doc/core/helpers/object-keys';
|
|
5
|
+
import { extractValueOrThrow } from '@ng-doc/core/helpers/extract-value';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
*
|
|
@@ -223,7 +224,10 @@ async function formatHtml(html) {
|
|
|
223
224
|
*/
|
|
224
225
|
function generateToc(container) {
|
|
225
226
|
const headings = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
226
|
-
const headingElements = Array.from(container.querySelectorAll(headings.join(', ')))
|
|
227
|
+
const headingElements = Array.from(container.querySelectorAll(headings.join(', ')))
|
|
228
|
+
// Only the open tab of a tab group is on the page, so the headings inside tabs would come and
|
|
229
|
+
// go with it; they stay out of the table of contents.
|
|
230
|
+
.filter((heading) => heading.id && !heading.closest('ng-doc-tabs'));
|
|
227
231
|
const levels = asArray(new Set(headingElements.map(levelFromTagName).sort()));
|
|
228
232
|
return headingElements.reduce((map, heading) => {
|
|
229
233
|
const headingLevel = levelFromTagName(heading);
|
|
@@ -389,9 +393,26 @@ function ɵngDocPageUrl(locationStrategy, location, fragment) {
|
|
|
389
393
|
return new URL(external, location.href).href;
|
|
390
394
|
}
|
|
391
395
|
|
|
396
|
+
/**
|
|
397
|
+
* Resolves an option of a playground property. A named option (an enum member) carries its
|
|
398
|
+
* value; a plain value from the playground's `controls` is the value itself; any other option is
|
|
399
|
+
* the source text of a union member, such as `'small'`, and is evaluated; it throws when that
|
|
400
|
+
* text can't be evaluated.
|
|
401
|
+
* @param option - The option.
|
|
402
|
+
* @param isManual - Whether the options come from the playground's `controls`.
|
|
403
|
+
* @returns The value of the option and the text that shows it.
|
|
404
|
+
*/
|
|
405
|
+
function resolvePlaygroundOption(option, isManual) {
|
|
406
|
+
if (typeof option !== 'string') {
|
|
407
|
+
return { label: option.label, value: option.value };
|
|
408
|
+
}
|
|
409
|
+
const value = isManual ? option : extractValueOrThrow(option);
|
|
410
|
+
return { label: String(value), value };
|
|
411
|
+
}
|
|
412
|
+
|
|
392
413
|
/**
|
|
393
414
|
* Generated bundle index. Do not edit.
|
|
394
415
|
*/
|
|
395
416
|
|
|
396
|
-
export { asBoolean, createComponent, formatHtml, generateToc, isDarkOsTheme, isExternalLink, isPlaygroundProperty, withNgDocContentReady, ɵNG_DOC_ASYNC_CONTENT_ATTRIBUTE, ɵNG_DOC_CONTENT_WAIT, ɵcaptureNgDocHydrationSnapshots, ɵforgetNgDocContent, ɵngDocPageUrl, ɵngDocRouteContentSources, ɵngDocRouteUrl, ɵpeekNgDocContent, ɵpendingNgDocContent, ɵpreloadNgDocContent, ɵrestoreNgDocHydrationSnapshot, ɵwithNgDocContent };
|
|
417
|
+
export { asBoolean, createComponent, formatHtml, generateToc, isDarkOsTheme, isExternalLink, isPlaygroundProperty, resolvePlaygroundOption, withNgDocContentReady, ɵNG_DOC_ASYNC_CONTENT_ATTRIBUTE, ɵNG_DOC_CONTENT_WAIT, ɵcaptureNgDocHydrationSnapshots, ɵforgetNgDocContent, ɵngDocPageUrl, ɵngDocRouteContentSources, ɵngDocRouteUrl, ɵpeekNgDocContent, ɵpendingNgDocContent, ɵpreloadNgDocContent, ɵrestoreNgDocHydrationSnapshot, ɵwithNgDocContent };
|
|
397
418
|
//# sourceMappingURL=ng-doc-app-helpers.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-helpers.mjs","sources":["../../../../libs/app/helpers/as-boolean.ts","../../../../libs/app/helpers/content-preload.ts","../../../../libs/app/helpers/content-ready.ts","../../../../libs/app/helpers/create-component.ts","../../../../libs/app/helpers/format-html.ts","../../../../libs/app/helpers/generate-toc.ts","../../../../libs/app/helpers/hydration-snapshot.ts","../../../../libs/app/helpers/is-dark-os-theme.ts","../../../../libs/app/helpers/is-external-link.ts","../../../../libs/app/helpers/is-playground-property.ts","../../../../libs/app/helpers/page-url.ts","../../../../libs/app/helpers/ng-doc-app-helpers.ts"],"sourcesContent":["/**\n *\n * @param value\n */\nexport function asBoolean(value: unknown): boolean {\n if (typeof value === 'string') {\n return value.toLowerCase() === 'true'\n ? true\n : value.toLowerCase() === 'false'\n ? false\n : !!value;\n }\n return !!value;\n}\n","import { inject, InjectionToken } from '@angular/core';\nimport type { ActivatedRouteSnapshot, ResolveFn, Route } from '@angular/router';\nimport type { NgDocContentModule, NgDocContentSource } from '@ng-doc/core/interfaces';\n\n/** The key of the resolver that `ɵwithNgDocContent` adds to a generated page route. */\nconst RESOLVE_KEY = 'ɵngDocContent';\n\ninterface PreloadEntry {\n readonly promise: Promise<NgDocContentModule>;\n payload?: NgDocContentModule;\n}\n\n/** The loads started for each content source, so a source loads once however often it is asked. */\nconst preloads = new WeakMap<NgDocContentSource, PreloadEntry>();\n\n/**\n * The content source of each resolver made by `ɵwithNgDocContent`. The router copies route\n * objects when it loads them, but it keeps their `resolve` maps and functions, so the source is\n * found through the resolver.\n */\nconst routeSources = new WeakMap<ResolveFn<unknown>, NgDocContentSource>();\n\n/** The wait of each navigation, by its root snapshot. */\nconst navigationWaits = new WeakMap<ActivatedRouteSnapshot, Promise<void>>();\n\n/**\n * How long the router waits for the content of a page before it shows the page anyway, in\n * milliseconds. A stalled load must not freeze navigation: after this, the page opens and its\n * content renders when it arrives, as without the wait.\n * @internal\n */\nexport const ɵNG_DOC_CONTENT_WAIT = new InjectionToken<number>('ɵNG_DOC_CONTENT_WAIT', {\n factory: () => 8000,\n});\n\n/**\n * Loads a content source once and keeps its payload, so a page that renders it later shows it in\n * its first render. A failed load is forgotten, so the next request tries again.\n * @param source - The content source.\n * @returns The loaded payload.\n * @internal\n */\nexport function ɵpreloadNgDocContent(source: NgDocContentSource): Promise<NgDocContentModule> {\n const existing = preloads.get(source);\n\n if (existing) return existing.promise;\n\n // Preloads are shared between navigations, so no navigation may abort them.\n const promise = Promise.resolve()\n .then(() => source.load(new AbortController().signal))\n .then(\n (payload: NgDocContentModule) => {\n if (preloads.get(source) === entry) entry.payload = payload;\n return payload;\n },\n (error: unknown) => {\n if (preloads.get(source) === entry) preloads.delete(source);\n throw error;\n },\n );\n const entry: PreloadEntry = { promise };\n\n preloads.set(source, entry);\n\n return promise;\n}\n\n/**\n * Returns the payload of a source that `ɵpreloadNgDocContent` has loaded, without waiting.\n * @param source - The content source.\n * @returns The payload, or `undefined` when the source has not finished loading.\n * @internal\n */\nexport function ɵpeekNgDocContent(source: NgDocContentSource): NgDocContentModule | undefined {\n return preloads.get(source)?.payload;\n}\n\n/**\n * Returns the load of a source that `ɵpreloadNgDocContent` started and that has not finished,\n * so a page that opens before it finishes waits for the same load instead of starting another.\n * @param source - The content source.\n * @returns The pending load, or `undefined`.\n * @internal\n */\nexport function ɵpendingNgDocContent(\n source: NgDocContentSource,\n): Promise<NgDocContentModule> | undefined {\n const entry = preloads.get(source);\n\n return entry && !entry.payload ? entry.promise : undefined;\n}\n\n/**\n * Drops the preloaded payload of a source, for a source that reports a new revision.\n * @param source - The content source.\n * @internal\n */\nexport function ɵforgetNgDocContent(source: NgDocContentSource): void {\n preloads.delete(source);\n}\n\n/**\n * Makes the router wait for the content of a generated page before it shows the page. Without\n * it, the router removes the previous page as soon as the page's code has loaded, and an empty\n * page shows until its content arrives.\n *\n * The resolver loads the content of every route of the navigation that has some, all at once,\n * because the router runs the resolvers of nested routes one after another. A load that fails\n * still lets the navigation finish: the page shows the error. A load that takes longer than\n * `ɵNG_DOC_CONTENT_WAIT` lets it finish too: the page then renders its content when it arrives.\n * @param route - The route of the page.\n * @param source - The content source of the route's component.\n * @returns A copy of the route with the resolver added.\n * @internal\n */\nexport function ɵwithNgDocContent(route: Route, source: NgDocContentSource): Route {\n const resolver: ResolveFn<boolean> = async (snapshot: ActivatedRouteSnapshot) => {\n // The resolvers of one navigation share its root snapshot, and with it one wait: nested\n // resolvers run one after another, and each must not start a wait of its own.\n let wait = navigationWaits.get(snapshot.root);\n\n if (!wait) {\n const sources = new Set<NgDocContentSource>();\n const add = (item: ActivatedRouteSnapshot): void => {\n ɵngDocRouteContentSources(item.routeConfig).forEach((found) => sources.add(found));\n };\n\n snapshot.pathFromRoot.forEach(add);\n for (let child = snapshot.firstChild; child; child = child.firstChild) add(child);\n wait = waitFor([...sources], inject(ɵNG_DOC_CONTENT_WAIT));\n navigationWaits.set(snapshot.root, wait);\n }\n await wait;\n\n return true;\n };\n\n routeSources.set(resolver, source);\n\n return { ...route, resolve: { ...route.resolve, [RESOLVE_KEY]: resolver } };\n}\n\n/**\n * Waits until the sources have loaded or failed, or for at most `limit` milliseconds.\n * @param sources - The content sources.\n * @param limit - The longest wait, in milliseconds.\n * @returns A promise that settles when the wait is over; it never rejects.\n */\nasync function waitFor(sources: NgDocContentSource[], limit: number): Promise<void> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n try {\n await Promise.race([\n Promise.all(sources.map((item) => ɵpreloadNgDocContent(item).catch(() => undefined))),\n // The timer is cleared as soon as the content is in, so it never keeps a server render or\n // a zone application from becoming stable.\n new Promise<void>((resolve) => (timer = setTimeout(resolve, limit))),\n ]);\n } finally {\n clearTimeout(timer);\n }\n}\n\n/**\n * Returns the content sources that `ɵwithNgDocContent` attached to a route.\n * @param route - The route, as declared or as the router copied it.\n * @returns The content sources of the route.\n * @internal\n */\nexport function ɵngDocRouteContentSources(route: Route | null | undefined): NgDocContentSource[] {\n return Object.values(route?.resolve ?? {})\n .map((resolver: unknown) => routeSources.get(resolver as ResolveFn<unknown>))\n .filter((source): source is NgDocContentSource => source !== undefined);\n}\n","import { ApplicationRef } from '@angular/core';\nimport { NgDocContentState } from '@ng-doc/app/services/content-state';\n\nexport type NgDocBootstrap<\n TArguments extends unknown[],\n TApplication extends ApplicationRef = ApplicationRef,\n> = (...arguments_: TArguments) => Promise<TApplication>;\n\n/** Waits for content loading and processing before returning an SSR application. */\nexport function withNgDocContentReady<\n TArguments extends unknown[],\n TApplication extends ApplicationRef = ApplicationRef,\n>(bootstrap: NgDocBootstrap<TArguments, TApplication>): NgDocBootstrap<TArguments, TApplication> {\n return async (...arguments_: TArguments): Promise<TApplication> => {\n let application: TApplication | undefined;\n try {\n application = await bootstrap(...arguments_);\n await application.whenStable();\n application.injector.get(NgDocContentState).throwIfFailed();\n return application;\n } catch (error) {\n try {\n application?.destroy();\n } catch {\n // Preserve the load, processing, stability, or bootstrap failure.\n }\n throw error;\n }\n };\n}\n","import { Type, ViewContainerRef } from '@angular/core';\n\n/**\n *\n * @param viewContainer\n * @param component\n * @param inputs\n */\nexport function createComponent<T>(\n viewContainer: ViewContainerRef,\n component: Type<T>,\n inputs?: object,\n): void {\n viewContainer.clear();\n\n const componentRef = viewContainer.createComponent(component);\n\n if (inputs) {\n Object.entries(inputs).forEach(([key, value]) => {\n componentRef.setInput(key, value);\n });\n }\n}\n","/**\n *\n * @param html\n */\nexport async function formatHtml(html: string): Promise<string> {\n\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t// @ts-ignore\n\tconst formatter = await import('esthetic');\n\n\treturn formatter.default.html(html.trim(), {\n\t\twrap: 50,\n\t\tmarkup: {\n\t\t\tforceIndent: true,\n\t\t},\n\t});\n}\n","import { NgDocTocItem } from '@ng-doc/app/interfaces';\nimport { asArray } from '@ng-doc/core/helpers/as-array';\nimport { NgDocHeading } from '@ng-doc/core/types';\n\n/**\n * Generate table of contents, only for headings with id\n * @param container\n * @param headings\n */\nexport function generateToc(container: HTMLElement): NgDocTocItem[] {\n const headings: NgDocHeading[] = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];\n\n const headingElements: HTMLHeadingElement[] = Array.from(\n container.querySelectorAll<HTMLHeadingElement>(headings.join(', ')),\n ).filter((heading: HTMLHeadingElement) => heading.id);\n\n const levels: number[] = asArray(new Set(headingElements.map(levelFromTagName).sort()));\n\n return headingElements.reduce((map: NgDocTocItem[], heading: HTMLHeadingElement) => {\n const headingLevel: number = levelFromTagName(heading);\n const isHeadingLink = heading.getAttribute('headingLink') === 'true';\n\n if (isHeadingLink) {\n map.push({\n title: heading.textContent?.trim() ?? '',\n element: heading,\n path: heading.getAttribute('href') ?? '',\n hash: heading.id,\n level: levels.indexOf(headingLevel) + 1,\n });\n }\n\n return map;\n }, []);\n}\n\n/**\n *\n * @param heading\n */\nfunction levelFromTagName(heading: HTMLHeadingElement): number {\n return Number(heading.tagName.toLowerCase().replace(/[a-z]*/g, '') || 1);\n}\n","/**\n * The host attribute with which a component tells that its content loads asynchronously. The\n * server renders it, so only such hosts are copied: a page with inline content costs nothing.\n * @internal\n */\nexport const ɵNG_DOC_ASYNC_CONTENT_ATTRIBUTE = 'data-ng-doc-async-content';\n\n/** The NgDoc hosts that skip hydration and whose content loads asynchronously. */\nconst SKIPPED_ASYNC_HOSTS = ['ng-doc-page', 'ng-doc-page-header']\n .map((tag: string) => `${tag}[ngskiphydration][${ɵNG_DOC_ASYNC_CONTENT_ATTRIBUTE}]`)\n .join(', ');\n/** The class of the element that holds a server-rendered copy. */\nconst SNAPSHOT_CLASS = 'ng-doc-hydration-snapshot';\n/** The host attribute that hides the host's own content while the copy is shown. */\nconst SNAPSHOT_ATTRIBUTE = 'data-ng-doc-hydration-snapshot';\n\nconst snapshots = new WeakMap<Element, DocumentFragment>();\n\n/**\n * Copies the server-rendered content of the NgDoc hosts that skip hydration and load their\n * content asynchronously.\n *\n * Angular empties such a host when it creates its component in the browser, and the page would\n * stay blank until the content arrives, so the component shows this copy until its own content\n * renders (`ɵrestoreNgDocHydrationSnapshot`). Call it in the browser before the application\n * renders.\n * @param document - The document that holds the server-rendered application.\n * @internal\n */\nexport function ɵcaptureNgDocHydrationSnapshots(document: Document): void {\n for (const host of Array.from(document.querySelectorAll(SKIPPED_ASYNC_HOSTS))) {\n if (!host.childNodes.length || snapshots.has(host)) continue;\n\n const copy = document.createDocumentFragment();\n\n host.childNodes.forEach((node: ChildNode) => copy.appendChild(node.cloneNode(true)));\n snapshots.set(host, copy);\n }\n}\n\n/**\n * Shows the server-rendered copy of a host's content, taken by\n * `ɵcaptureNgDocHydrationSnapshots`, in place of the host's own content until the returned\n * function is called. Each copy is shown once; without one, nothing changes. The copy is inert\n * and the host is busy while it is shown.\n * @param host - The host element of the component.\n * @returns A function that removes the copy and shows the host's own content; later calls do\n * nothing.\n * @internal\n */\nexport function ɵrestoreNgDocHydrationSnapshot(host: Element): () => void {\n const copy = snapshots.get(host);\n\n if (!copy) return () => undefined;\n\n snapshots.delete(host);\n\n let wrapper: HTMLElement | undefined = host.ownerDocument.createElement('div');\n\n wrapper.className = SNAPSHOT_CLASS;\n // The copied nodes lay out as the host's own children did. Inline, because the wrapper has no\n // encapsulation attribute for a component style to match.\n wrapper.style.display = 'contents';\n // A static copy: its demos, buttons and links do nothing until the real content replaces it.\n wrapper.setAttribute('inert', '');\n wrapper.appendChild(copy);\n host.insertBefore(wrapper, host.firstChild);\n host.setAttribute(SNAPSHOT_ATTRIBUTE, '');\n host.setAttribute('aria-busy', 'true');\n\n return () => {\n if (!wrapper) return;\n wrapper.remove();\n wrapper = undefined;\n host.removeAttribute(SNAPSHOT_ATTRIBUTE);\n host.removeAttribute('aria-busy');\n };\n}\n","/**\n * Check if the OS theme is dark\n */\nexport function isDarkOsTheme(): boolean {\n\treturn window.matchMedia('(prefers-color-scheme: dark)').matches;\n}\n","/**\n *\n * @param url\n */\nexport function isExternalLink(url: string): boolean {\n\tconst anchorElement: HTMLAnchorElement = document.createElement('a');\n\n\tanchorElement.href = url;\n\n\treturn anchorElement.host !== window.location.host;\n}\n","import { objectKeys } from '@ng-doc/core/helpers/object-keys';\nimport { NgDocPlaygroundProperty } from '@ng-doc/core/interfaces';\n\n/**\n *\n * @param obj\n */\nexport function isPlaygroundProperty(obj: Record<string, any>): obj is NgDocPlaygroundProperty {\n return objectKeys(obj).includes('type');\n}\n","import type { LocationStrategy } from '@angular/common';\n\n/**\n * Returns the current route as an absolute URL in path form: the route's path, query and fragment\n * on the document's origin.\n *\n * With `PathLocationStrategy`, the default, it is the document's own URL. With\n * `HashLocationStrategy` the route lives in the document's fragment (`/#/docs/page#section`), so\n * `location.hash` and links resolved against `location.href` see the wrong part of the URL. This\n * URL carries the route's own fragment, and relative links resolve against the route.\n * @param locationStrategy - The location strategy of the application.\n * @param documentUrl - The URL of the document, `location.href`.\n * @returns The URL of the route.\n * @internal\n */\nexport function ɵngDocRouteUrl(locationStrategy: LocationStrategy, documentUrl: string): URL {\n // A path that starts with `//` would be read as another host.\n return new URL(locationStrategy.path(true).replace(/^\\/*/, '/'), documentUrl);\n}\n\n/**\n * Returns the absolute URL of the current page, without its query, as the reader shares it: the\n * route in the form the location strategy shows it (`/docs/page` or `/#/docs/page`).\n * @param locationStrategy - The location strategy of the application.\n * @param location - The location of the document.\n * @param fragment - The fragment to link to, without `#`.\n * @returns The URL of the page.\n * @internal\n */\nexport function ɵngDocPageUrl(\n locationStrategy: LocationStrategy,\n location: Pick<Location, 'href' | 'origin' | 'pathname'>,\n fragment?: string,\n): string {\n const route = ɵngDocRouteUrl(locationStrategy, location.href);\n // `path()` includes the base href and `prepareExternalUrl()` adds it, so it is removed in\n // between; the round trip gives back the document's own path with `PathLocationStrategy`.\n const base = new URL(locationStrategy.getBaseHref() || '/', route).pathname.replace(/\\/+$/, '');\n const path =\n base && (route.pathname === base || route.pathname.startsWith(`${base}/`))\n ? route.pathname.slice(base.length) || '/'\n : route.pathname;\n const external = locationStrategy.prepareExternalUrl(fragment ? `${path}#${fragment}` : path);\n\n if (external.startsWith('#')) {\n // The route is the document's fragment: it follows the document's path, without its query.\n return `${location.origin}${location.pathname}${external}`;\n }\n\n if (external.startsWith('/') && !external.startsWith('//')) {\n return `${location.origin}${external}`;\n }\n\n return new URL(external, location.href).href;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;AAAA;;;AAGG;AACG,SAAU,SAAS,CAAC,KAAc,EAAA;AACtC,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC7B,QAAA,OAAO,KAAK,CAAC,WAAW,EAAE,KAAK;AAC7B,cAAE;AACF,cAAE,KAAK,CAAC,WAAW,EAAE,KAAK;AACxB,kBAAE;AACF,kBAAE,CAAC,CAAC,KAAK;IACf;IACA,OAAO,CAAC,CAAC,KAAK;AAChB;;ACTA;AACA,MAAM,WAAW,GAAG,eAAe;AAOnC;AACA,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAoC;AAEhE;;;;AAIG;AACH,MAAM,YAAY,GAAG,IAAI,OAAO,EAA0C;AAE1E;AACA,MAAM,eAAe,GAAG,IAAI,OAAO,EAAyC;AAE5E;;;;;AAKG;MACU,oBAAoB,GAAG,IAAI,cAAc,CAAS,sBAAsB,EAAE;AACrF,IAAA,OAAO,EAAE,MAAM,IA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C;AACvE,UAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI;AACvC,UAAE,KAAK,CAAC,QAAQ;IACpB,MAAM,QAAQ,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,QAAQ,GAAG,GAAG,IAAI,CAAA,CAAA,EAAI,QAAQ,CAAA,CAAE,GAAG,IAAI,CAAC;AAE7F,IAAA,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;;QAE5B,OAAO,CAAA,EAAG,QAAQ,CAAC,MAAM,CAAA,EAAG,QAAQ,CAAC,QAAQ,CAAA,EAAG,QAAQ,CAAA,CAAE;IAC5D;AAEA,IAAA,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;AAC1D,QAAA,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAA,EAAG,QAAQ,EAAE;IACxC;IAEA,OAAO,IAAI,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI;AAC9C;;ACtDA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-doc-app-helpers.mjs","sources":["../../../../libs/app/helpers/as-boolean.ts","../../../../libs/app/helpers/content-preload.ts","../../../../libs/app/helpers/content-ready.ts","../../../../libs/app/helpers/create-component.ts","../../../../libs/app/helpers/format-html.ts","../../../../libs/app/helpers/generate-toc.ts","../../../../libs/app/helpers/hydration-snapshot.ts","../../../../libs/app/helpers/is-dark-os-theme.ts","../../../../libs/app/helpers/is-external-link.ts","../../../../libs/app/helpers/is-playground-property.ts","../../../../libs/app/helpers/page-url.ts","../../../../libs/app/helpers/playground-option.ts","../../../../libs/app/helpers/ng-doc-app-helpers.ts"],"sourcesContent":["/**\n *\n * @param value\n */\nexport function asBoolean(value: unknown): boolean {\n if (typeof value === 'string') {\n return value.toLowerCase() === 'true'\n ? true\n : value.toLowerCase() === 'false'\n ? false\n : !!value;\n }\n return !!value;\n}\n","import { inject, InjectionToken } from '@angular/core';\nimport type { ActivatedRouteSnapshot, ResolveFn, Route } from '@angular/router';\nimport type { NgDocContentModule, NgDocContentSource } from '@ng-doc/core/interfaces';\n\n/** The key of the resolver that `ɵwithNgDocContent` adds to a generated page route. */\nconst RESOLVE_KEY = 'ɵngDocContent';\n\ninterface PreloadEntry {\n readonly promise: Promise<NgDocContentModule>;\n payload?: NgDocContentModule;\n}\n\n/** The loads started for each content source, so a source loads once however often it is asked. */\nconst preloads = new WeakMap<NgDocContentSource, PreloadEntry>();\n\n/**\n * The content source of each resolver made by `ɵwithNgDocContent`. The router copies route\n * objects when it loads them, but it keeps their `resolve` maps and functions, so the source is\n * found through the resolver.\n */\nconst routeSources = new WeakMap<ResolveFn<unknown>, NgDocContentSource>();\n\n/** The wait of each navigation, by its root snapshot. */\nconst navigationWaits = new WeakMap<ActivatedRouteSnapshot, Promise<void>>();\n\n/**\n * How long the router waits for the content of a page before it shows the page anyway, in\n * milliseconds. A stalled load must not freeze navigation: after this, the page opens and its\n * content renders when it arrives, as without the wait.\n * @internal\n */\nexport const ɵNG_DOC_CONTENT_WAIT = new InjectionToken<number>('ɵNG_DOC_CONTENT_WAIT', {\n factory: () => 8000,\n});\n\n/**\n * Loads a content source once and keeps its payload, so a page that renders it later shows it in\n * its first render. A failed load is forgotten, so the next request tries again.\n * @param source - The content source.\n * @returns The loaded payload.\n * @internal\n */\nexport function ɵpreloadNgDocContent(source: NgDocContentSource): Promise<NgDocContentModule> {\n const existing = preloads.get(source);\n\n if (existing) return existing.promise;\n\n // Preloads are shared between navigations, so no navigation may abort them.\n const promise = Promise.resolve()\n .then(() => source.load(new AbortController().signal))\n .then(\n (payload: NgDocContentModule) => {\n if (preloads.get(source) === entry) entry.payload = payload;\n return payload;\n },\n (error: unknown) => {\n if (preloads.get(source) === entry) preloads.delete(source);\n throw error;\n },\n );\n const entry: PreloadEntry = { promise };\n\n preloads.set(source, entry);\n\n return promise;\n}\n\n/**\n * Returns the payload of a source that `ɵpreloadNgDocContent` has loaded, without waiting.\n * @param source - The content source.\n * @returns The payload, or `undefined` when the source has not finished loading.\n * @internal\n */\nexport function ɵpeekNgDocContent(source: NgDocContentSource): NgDocContentModule | undefined {\n return preloads.get(source)?.payload;\n}\n\n/**\n * Returns the load of a source that `ɵpreloadNgDocContent` started and that has not finished,\n * so a page that opens before it finishes waits for the same load instead of starting another.\n * @param source - The content source.\n * @returns The pending load, or `undefined`.\n * @internal\n */\nexport function ɵpendingNgDocContent(\n source: NgDocContentSource,\n): Promise<NgDocContentModule> | undefined {\n const entry = preloads.get(source);\n\n return entry && !entry.payload ? entry.promise : undefined;\n}\n\n/**\n * Drops the preloaded payload of a source, for a source that reports a new revision.\n * @param source - The content source.\n * @internal\n */\nexport function ɵforgetNgDocContent(source: NgDocContentSource): void {\n preloads.delete(source);\n}\n\n/**\n * Makes the router wait for the content of a generated page before it shows the page. Without\n * it, the router removes the previous page as soon as the page's code has loaded, and an empty\n * page shows until its content arrives.\n *\n * The resolver loads the content of every route of the navigation that has some, all at once,\n * because the router runs the resolvers of nested routes one after another. A load that fails\n * still lets the navigation finish: the page shows the error. A load that takes longer than\n * `ɵNG_DOC_CONTENT_WAIT` lets it finish too: the page then renders its content when it arrives.\n * @param route - The route of the page.\n * @param source - The content source of the route's component.\n * @returns A copy of the route with the resolver added.\n * @internal\n */\nexport function ɵwithNgDocContent(route: Route, source: NgDocContentSource): Route {\n const resolver: ResolveFn<boolean> = async (snapshot: ActivatedRouteSnapshot) => {\n // The resolvers of one navigation share its root snapshot, and with it one wait: nested\n // resolvers run one after another, and each must not start a wait of its own.\n let wait = navigationWaits.get(snapshot.root);\n\n if (!wait) {\n const sources = new Set<NgDocContentSource>();\n const add = (item: ActivatedRouteSnapshot): void => {\n ɵngDocRouteContentSources(item.routeConfig).forEach((found) => sources.add(found));\n };\n\n snapshot.pathFromRoot.forEach(add);\n for (let child = snapshot.firstChild; child; child = child.firstChild) add(child);\n wait = waitFor([...sources], inject(ɵNG_DOC_CONTENT_WAIT));\n navigationWaits.set(snapshot.root, wait);\n }\n await wait;\n\n return true;\n };\n\n routeSources.set(resolver, source);\n\n return { ...route, resolve: { ...route.resolve, [RESOLVE_KEY]: resolver } };\n}\n\n/**\n * Waits until the sources have loaded or failed, or for at most `limit` milliseconds.\n * @param sources - The content sources.\n * @param limit - The longest wait, in milliseconds.\n * @returns A promise that settles when the wait is over; it never rejects.\n */\nasync function waitFor(sources: NgDocContentSource[], limit: number): Promise<void> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n\n try {\n await Promise.race([\n Promise.all(sources.map((item) => ɵpreloadNgDocContent(item).catch(() => undefined))),\n // The timer is cleared as soon as the content is in, so it never keeps a server render or\n // a zone application from becoming stable.\n new Promise<void>((resolve) => (timer = setTimeout(resolve, limit))),\n ]);\n } finally {\n clearTimeout(timer);\n }\n}\n\n/**\n * Returns the content sources that `ɵwithNgDocContent` attached to a route.\n * @param route - The route, as declared or as the router copied it.\n * @returns The content sources of the route.\n * @internal\n */\nexport function ɵngDocRouteContentSources(route: Route | null | undefined): NgDocContentSource[] {\n return Object.values(route?.resolve ?? {})\n .map((resolver: unknown) => routeSources.get(resolver as ResolveFn<unknown>))\n .filter((source): source is NgDocContentSource => source !== undefined);\n}\n","import { ApplicationRef } from '@angular/core';\nimport { NgDocContentState } from '@ng-doc/app/services/content-state';\n\nexport type NgDocBootstrap<\n TArguments extends unknown[],\n TApplication extends ApplicationRef = ApplicationRef,\n> = (...arguments_: TArguments) => Promise<TApplication>;\n\n/** Waits for content loading and processing before returning an SSR application. */\nexport function withNgDocContentReady<\n TArguments extends unknown[],\n TApplication extends ApplicationRef = ApplicationRef,\n>(bootstrap: NgDocBootstrap<TArguments, TApplication>): NgDocBootstrap<TArguments, TApplication> {\n return async (...arguments_: TArguments): Promise<TApplication> => {\n let application: TApplication | undefined;\n try {\n application = await bootstrap(...arguments_);\n await application.whenStable();\n application.injector.get(NgDocContentState).throwIfFailed();\n return application;\n } catch (error) {\n try {\n application?.destroy();\n } catch {\n // Preserve the load, processing, stability, or bootstrap failure.\n }\n throw error;\n }\n };\n}\n","import { Type, ViewContainerRef } from '@angular/core';\n\n/**\n *\n * @param viewContainer\n * @param component\n * @param inputs\n */\nexport function createComponent<T>(\n viewContainer: ViewContainerRef,\n component: Type<T>,\n inputs?: object,\n): void {\n viewContainer.clear();\n\n const componentRef = viewContainer.createComponent(component);\n\n if (inputs) {\n Object.entries(inputs).forEach(([key, value]) => {\n componentRef.setInput(key, value);\n });\n }\n}\n","/**\n *\n * @param html\n */\nexport async function formatHtml(html: string): Promise<string> {\n\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t// @ts-ignore\n\tconst formatter = await import('esthetic');\n\n\treturn formatter.default.html(html.trim(), {\n\t\twrap: 50,\n\t\tmarkup: {\n\t\t\tforceIndent: true,\n\t\t},\n\t});\n}\n","import { NgDocTocItem } from '@ng-doc/app/interfaces';\nimport { asArray } from '@ng-doc/core/helpers/as-array';\nimport { NgDocHeading } from '@ng-doc/core/types';\n\n/**\n * Generate table of contents, only for headings with id\n * @param container\n * @param headings\n */\nexport function generateToc(container: HTMLElement): NgDocTocItem[] {\n const headings: NgDocHeading[] = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];\n\n const headingElements: HTMLHeadingElement[] = Array.from(\n container.querySelectorAll<HTMLHeadingElement>(headings.join(', ')),\n )\n // Only the open tab of a tab group is on the page, so the headings inside tabs would come and\n // go with it; they stay out of the table of contents.\n .filter((heading: HTMLHeadingElement) => heading.id && !heading.closest('ng-doc-tabs'));\n\n const levels: number[] = asArray(new Set(headingElements.map(levelFromTagName).sort()));\n\n return headingElements.reduce((map: NgDocTocItem[], heading: HTMLHeadingElement) => {\n const headingLevel: number = levelFromTagName(heading);\n const isHeadingLink = heading.getAttribute('headingLink') === 'true';\n\n if (isHeadingLink) {\n map.push({\n title: heading.textContent?.trim() ?? '',\n element: heading,\n path: heading.getAttribute('href') ?? '',\n hash: heading.id,\n level: levels.indexOf(headingLevel) + 1,\n });\n }\n\n return map;\n }, []);\n}\n\n/**\n *\n * @param heading\n */\nfunction levelFromTagName(heading: HTMLHeadingElement): number {\n return Number(heading.tagName.toLowerCase().replace(/[a-z]*/g, '') || 1);\n}\n","/**\n * The host attribute with which a component tells that its content loads asynchronously. The\n * server renders it, so only such hosts are copied: a page with inline content costs nothing.\n * @internal\n */\nexport const ɵNG_DOC_ASYNC_CONTENT_ATTRIBUTE = 'data-ng-doc-async-content';\n\n/** The NgDoc hosts that skip hydration and whose content loads asynchronously. */\nconst SKIPPED_ASYNC_HOSTS = ['ng-doc-page', 'ng-doc-page-header']\n .map((tag: string) => `${tag}[ngskiphydration][${ɵNG_DOC_ASYNC_CONTENT_ATTRIBUTE}]`)\n .join(', ');\n/** The class of the element that holds a server-rendered copy. */\nconst SNAPSHOT_CLASS = 'ng-doc-hydration-snapshot';\n/** The host attribute that hides the host's own content while the copy is shown. */\nconst SNAPSHOT_ATTRIBUTE = 'data-ng-doc-hydration-snapshot';\n\nconst snapshots = new WeakMap<Element, DocumentFragment>();\n\n/**\n * Copies the server-rendered content of the NgDoc hosts that skip hydration and load their\n * content asynchronously.\n *\n * Angular empties such a host when it creates its component in the browser, and the page would\n * stay blank until the content arrives, so the component shows this copy until its own content\n * renders (`ɵrestoreNgDocHydrationSnapshot`). Call it in the browser before the application\n * renders.\n * @param document - The document that holds the server-rendered application.\n * @internal\n */\nexport function ɵcaptureNgDocHydrationSnapshots(document: Document): void {\n for (const host of Array.from(document.querySelectorAll(SKIPPED_ASYNC_HOSTS))) {\n if (!host.childNodes.length || snapshots.has(host)) continue;\n\n const copy = document.createDocumentFragment();\n\n host.childNodes.forEach((node: ChildNode) => copy.appendChild(node.cloneNode(true)));\n snapshots.set(host, copy);\n }\n}\n\n/**\n * Shows the server-rendered copy of a host's content, taken by\n * `ɵcaptureNgDocHydrationSnapshots`, in place of the host's own content until the returned\n * function is called. Each copy is shown once; without one, nothing changes. The copy is inert\n * and the host is busy while it is shown.\n * @param host - The host element of the component.\n * @returns A function that removes the copy and shows the host's own content; later calls do\n * nothing.\n * @internal\n */\nexport function ɵrestoreNgDocHydrationSnapshot(host: Element): () => void {\n const copy = snapshots.get(host);\n\n if (!copy) return () => undefined;\n\n snapshots.delete(host);\n\n let wrapper: HTMLElement | undefined = host.ownerDocument.createElement('div');\n\n wrapper.className = SNAPSHOT_CLASS;\n // The copied nodes lay out as the host's own children did. Inline, because the wrapper has no\n // encapsulation attribute for a component style to match.\n wrapper.style.display = 'contents';\n // A static copy: its demos, buttons and links do nothing until the real content replaces it.\n wrapper.setAttribute('inert', '');\n wrapper.appendChild(copy);\n host.insertBefore(wrapper, host.firstChild);\n host.setAttribute(SNAPSHOT_ATTRIBUTE, '');\n host.setAttribute('aria-busy', 'true');\n\n return () => {\n if (!wrapper) return;\n wrapper.remove();\n wrapper = undefined;\n host.removeAttribute(SNAPSHOT_ATTRIBUTE);\n host.removeAttribute('aria-busy');\n };\n}\n","/**\n * Check if the OS theme is dark\n */\nexport function isDarkOsTheme(): boolean {\n\treturn window.matchMedia('(prefers-color-scheme: dark)').matches;\n}\n","/**\n *\n * @param url\n */\nexport function isExternalLink(url: string): boolean {\n\tconst anchorElement: HTMLAnchorElement = document.createElement('a');\n\n\tanchorElement.href = url;\n\n\treturn anchorElement.host !== window.location.host;\n}\n","import { objectKeys } from '@ng-doc/core/helpers/object-keys';\nimport { NgDocPlaygroundProperty } from '@ng-doc/core/interfaces';\n\n/**\n *\n * @param obj\n */\nexport function isPlaygroundProperty(obj: Record<string, any>): obj is NgDocPlaygroundProperty {\n return objectKeys(obj).includes('type');\n}\n","import type { LocationStrategy } from '@angular/common';\n\n/**\n * Returns the current route as an absolute URL in path form: the route's path, query and fragment\n * on the document's origin.\n *\n * With `PathLocationStrategy`, the default, it is the document's own URL. With\n * `HashLocationStrategy` the route lives in the document's fragment (`/#/docs/page#section`), so\n * `location.hash` and links resolved against `location.href` see the wrong part of the URL. This\n * URL carries the route's own fragment, and relative links resolve against the route.\n * @param locationStrategy - The location strategy of the application.\n * @param documentUrl - The URL of the document, `location.href`.\n * @returns The URL of the route.\n * @internal\n */\nexport function ɵngDocRouteUrl(locationStrategy: LocationStrategy, documentUrl: string): URL {\n // A path that starts with `//` would be read as another host.\n return new URL(locationStrategy.path(true).replace(/^\\/*/, '/'), documentUrl);\n}\n\n/**\n * Returns the absolute URL of the current page, without its query, as the reader shares it: the\n * route in the form the location strategy shows it (`/docs/page` or `/#/docs/page`).\n * @param locationStrategy - The location strategy of the application.\n * @param location - The location of the document.\n * @param fragment - The fragment to link to, without `#`.\n * @returns The URL of the page.\n * @internal\n */\nexport function ɵngDocPageUrl(\n locationStrategy: LocationStrategy,\n location: Pick<Location, 'href' | 'origin' | 'pathname'>,\n fragment?: string,\n): string {\n const route = ɵngDocRouteUrl(locationStrategy, location.href);\n // `path()` includes the base href and `prepareExternalUrl()` adds it, so it is removed in\n // between; the round trip gives back the document's own path with `PathLocationStrategy`.\n const base = new URL(locationStrategy.getBaseHref() || '/', route).pathname.replace(/\\/+$/, '');\n const path =\n base && (route.pathname === base || route.pathname.startsWith(`${base}/`))\n ? route.pathname.slice(base.length) || '/'\n : route.pathname;\n const external = locationStrategy.prepareExternalUrl(fragment ? `${path}#${fragment}` : path);\n\n if (external.startsWith('#')) {\n // The route is the document's fragment: it follows the document's path, without its query.\n return `${location.origin}${location.pathname}${external}`;\n }\n\n if (external.startsWith('/') && !external.startsWith('//')) {\n return `${location.origin}${external}`;\n }\n\n return new URL(external, location.href).href;\n}\n","import { extractValueOrThrow } from '@ng-doc/core/helpers/extract-value';\nimport { NgDocPlaygroundOption } from '@ng-doc/core/interfaces';\n\n/** An option of a playground property, resolved to the value it sets and the text it shows. */\nexport interface NgDocResolvedPlaygroundOption {\n /** The text shown for the option. */\n label: string;\n /** The value the option sets. */\n value: unknown;\n}\n\n/**\n * Resolves an option of a playground property. A named option (an enum member) carries its\n * value; a plain value from the playground's `controls` is the value itself; any other option is\n * the source text of a union member, such as `'small'`, and is evaluated; it throws when that\n * text can't be evaluated.\n * @param option - The option.\n * @param isManual - Whether the options come from the playground's `controls`.\n * @returns The value of the option and the text that shows it.\n */\nexport function resolvePlaygroundOption(\n option: string | NgDocPlaygroundOption,\n isManual?: boolean,\n): NgDocResolvedPlaygroundOption {\n if (typeof option !== 'string') {\n return { label: option.label, value: option.value };\n }\n\n const value: unknown = isManual ? option : extractValueOrThrow(option);\n\n return { label: String(value), value };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;AAAA;;;AAGG;AACG,SAAU,SAAS,CAAC,KAAc,EAAA;AACtC,IAAA,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;AAC7B,QAAA,OAAO,KAAK,CAAC,WAAW,EAAE,KAAK;AAC7B,cAAE;AACF,cAAE,KAAK,CAAC,WAAW,EAAE,KAAK;AACxB,kBAAE;AACF,kBAAE,CAAC,CAAC,KAAK;IACf;IACA,OAAO,CAAC,CAAC,KAAK;AAChB;;ACTA;AACA,MAAM,WAAW,GAAG,eAAe;AAOnC;AACA,MAAM,QAAQ,GAAG,IAAI,OAAO,EAAoC;AAEhE;;;;AAIG;AACH,MAAM,YAAY,GAAG,IAAI,OAAO,EAA0C;AAE1E;AACA,MAAM,eAAe,GAAG,IAAI,OAAO,EAAyC;AAE5E;;;;;AAKG;MACU,oBAAoB,GAAG,IAAI,cAAc,CAAS,sBAAsB,EAAE;AACrF,IAAA,OAAO,EAAE,MAAM,IAAI;AACpB,CAAA;AAED;;;;;;AAMG;AACG,SAAU,oBAAoB,CAAC,MAA0B,EAAA;IAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC;AAErC,IAAA,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC,OAAO;;AAGrC,IAAA,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO;AAC5B,SAAA,IAAI,CAAC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AQ,CAAA,CAAE,GAAG,IAAI,CAAC;AAE7F,IAAA,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;;QAE5B,OAAO,CAAA,EAAG,QAAQ,CAAC,MAAM,CAAA,EAAG,QAAQ,CAAC,QAAQ,CAAA,EAAG,QAAQ,CAAA,CAAE;IAC5D;AAEA,IAAA,IAAI,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;AAC1D,QAAA,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAA,EAAG,QAAQ,EAAE;IACxC;IAEA,OAAO,IAAI,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI;AAC9C;;AC3CA;;;;;;;;AAQG;AACG,SAAU,uBAAuB,CACrC,MAAsC,EACtC,QAAkB,EAAA;AAElB,IAAA,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AAC9B,QAAA,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE;IACrD;AAEA,IAAA,MAAM,KAAK,GAAY,QAAQ,GAAG,MAAM,GAAG,mBAAmB,CAAC,MAAM,CAAC;IAEtE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE;AACxC;;AC/BA;;AAEG;;;;"}
|
|
@@ -137,6 +137,11 @@ const playgroundProcessor = {
|
|
|
137
137
|
}),
|
|
138
138
|
};
|
|
139
139
|
|
|
140
|
+
/**
|
|
141
|
+
* Turns the `<ng-doc-tab group="…" name="…">` elements of a page into tabs: every tab of a group
|
|
142
|
+
* becomes one `NgDocTabsComponent`, where the first tab of the group was. Code groups are made of
|
|
143
|
+
* them, and Markdown can wrap any content in them.
|
|
144
|
+
*/
|
|
140
145
|
const tabsProcessor = {
|
|
141
146
|
component: NgDocTabsComponent,
|
|
142
147
|
selector: 'ng-doc-tab',
|
|
@@ -147,17 +152,33 @@ const tabsProcessor = {
|
|
|
147
152
|
},
|
|
148
153
|
extractOptions: (element, root) => {
|
|
149
154
|
const group = element.getAttribute('group') ?? '';
|
|
150
|
-
const tabs = Array.from(root.querySelectorAll(
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
tabs
|
|
155
|
+
const tabs = Array.from(root.querySelectorAll('ng-doc-tab')).filter((tab) => (tab.getAttribute('group') ?? '') === group);
|
|
156
|
+
if (!tabs.includes(element)) {
|
|
157
|
+
tabs.unshift(element);
|
|
158
|
+
}
|
|
159
|
+
// The tabs stay on the page until the component first renders (`NgDocTabsComponent`), so
|
|
160
|
+
// the processors after this one, the page's own included, still reach their content. The
|
|
161
|
+
// page processor skips elements that have left the page, so the other tabs of the group are
|
|
162
|
+
// swapped for copies that hold their content: otherwise each would get tabs of its own.
|
|
163
|
+
const contents = tabs.map((tab) => {
|
|
164
|
+
if (tab === element || !tab.parentNode) {
|
|
165
|
+
return tab;
|
|
166
|
+
}
|
|
167
|
+
const copy = tab.cloneNode(false);
|
|
168
|
+
while (tab.firstChild) {
|
|
169
|
+
copy.appendChild(tab.firstChild);
|
|
170
|
+
}
|
|
171
|
+
tab.parentNode.replaceChild(copy, tab);
|
|
172
|
+
return copy;
|
|
173
|
+
});
|
|
158
174
|
return {
|
|
159
175
|
inputs: {
|
|
160
|
-
tabs:
|
|
176
|
+
tabs: tabs.map((tab, index) => ({
|
|
177
|
+
title: tab.getAttribute('name') ?? '',
|
|
178
|
+
content: contents[index],
|
|
179
|
+
icon: tab.getAttribute('icon') || undefined,
|
|
180
|
+
active: tab.hasAttribute('active'),
|
|
181
|
+
})),
|
|
161
182
|
},
|
|
162
183
|
};
|
|
163
184
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-processors-processors.mjs","sources":["../../../../libs/app/processors/processors/blockquote.processor.ts","../../../../libs/app/processors/processors/code.processor.ts","../../../../libs/app/processors/processors/demo.processor.ts","../../../../libs/app/processors/processors/demo-pane.processor.ts","../../../../libs/app/processors/processors/heading-anchor.processor.ts","../../../../libs/app/processors/processors/icon.processor.ts","../../../../libs/app/processors/processors/image.processor.ts","../../../../libs/app/processors/processors/members.processor.ts","../../../../libs/app/processors/processors/mermaid.processor.ts","../../../../libs/app/processors/processors/playground.processor.ts","../../../../libs/app/processors/processors/tabs.processor.ts","../../../../libs/app/processors/processors/ng-doc-app-processors-processors.ts"],"sourcesContent":["import { NgDocPageProcessor } from '@ng-doc/app/interfaces';\nimport { NgDocBlockquoteComponent, NgDocBlockquoteType } from '@ng-doc/ui-kit';\n\nexport const blockquoteProcessor: NgDocPageProcessor<NgDocBlockquoteComponent> = {\n component: NgDocBlockquoteComponent,\n selector: 'ng-doc-blockquote',\n extractOptions: (element: Element) => ({\n content: [Array.from(element.childNodes)],\n inputs: {\n type: (element.getAttribute('type') as NgDocBlockquoteType) || 'default',\n icon: element.getAttribute('icon') ?? undefined,\n label: element.getAttribute('label') ?? undefined,\n },\n }),\n};\n","import { NgDocCodeComponent } from '@ng-doc/app/components/code';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const codeProcessor: NgDocPageProcessor<NgDocCodeComponent> = {\n component: NgDocCodeComponent,\n selector: 'pre code',\n nodeToReplace: (element: Element) => element.closest('pre') ?? element,\n extractOptions: (element: Element) => ({\n inputs: {\n name: element.parentElement?.getAttribute('name') || undefined,\n icon: element.parentElement?.getAttribute('icon') || undefined,\n },\n content: [[element.closest('pre') ?? element]],\n }),\n};\n","import { NgDocDemoComponent } from '@ng-doc/app/components/demo';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const demoProcessor: NgDocPageProcessor<NgDocDemoComponent> = {\n component: NgDocDemoComponent,\n selector: 'ng-doc-demo',\n extractOptions: (element: Element) => ({\n inputs: {\n componentName: element.getAttribute('componentName') || undefined,\n options: JSON.parse(element.querySelector('#options')?.textContent ?? '{}'),\n },\n }),\n};\n","import { NgDocDemoPaneComponent } from '@ng-doc/app/components/demo-pane';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const demoPaneProcessor: NgDocPageProcessor<NgDocDemoPaneComponent> = {\n\tcomponent: NgDocDemoPaneComponent,\n\tselector: 'ng-doc-demo-pane',\n\textractOptions: (element: Element) => ({\n\t\tinputs: {\n\t\t\tcomponentName: element.getAttribute('componentName') || undefined,\n\t\t\toptions: JSON.parse(element.querySelector('#options')?.textContent ?? '') || {},\n\t\t},\n\t}),\n};\n","import { NgDocHeadingAnchorComponent } from '@ng-doc/app/components/heading-anchor';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const headingAnchorProcessor: NgDocPageProcessor<NgDocHeadingAnchorComponent> = {\n component: NgDocHeadingAnchorComponent,\n selector: 'ng-doc-heading-anchor',\n extractOptions: (element: Element) => ({\n inputs: {\n classes: element.getAttribute('class')?.split(' ') || [],\n anchor: element.getAttribute('anchor') || '',\n },\n }),\n};\n","import { NgDocPageProcessor } from '@ng-doc/app/interfaces';\nimport { NgDocIconComponent, NgDocIconSize } from '@ng-doc/ui-kit';\n\nexport const iconProcessor: NgDocPageProcessor<NgDocIconComponent> = {\n\tcomponent: NgDocIconComponent,\n\tselector: 'ng-doc-icon',\n\textractOptions: (element: Element) => ({\n\t\tinputs: {\n\t\t\ticon: element.getAttribute('icon') ?? '',\n\t\t\tsize: (Number(element.getAttribute('size')) as NgDocIconSize) || 16,\n\t\t},\n\t}),\n};\n","import { Injector, Renderer2 } from '@angular/core';\nimport { NgDocImageViewerComponent } from '@ng-doc/app/components/image-viewer';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const imageProcessor: NgDocPageProcessor<NgDocImageViewerComponent> = {\n component: NgDocImageViewerComponent,\n selector: 'img:not([zoom=\"false\"])',\n nodeToReplace: (element: Element, injector: Injector) => {\n const renderer: Renderer2 = injector.get(Renderer2);\n const anchor: Element = renderer.createElement('div');\n\n return element.parentNode?.insertBefore(anchor, element) ?? element;\n },\n extractOptions: (element: Element) => ({\n inputs: {\n src: element.getAttribute('src') ?? '',\n alt: element.getAttribute('alt') ?? '',\n },\n content: [[element]],\n }),\n};\n","import { NgDocMembersComponent } from '@ng-doc/app/components/members';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\n/** Adds the member filter to the members table of an API page (`<ng-doc-members>`). */\nexport const membersProcessor: NgDocPageProcessor<NgDocMembersComponent> = {\n component: NgDocMembersComponent,\n selector: 'ng-doc-members',\n extractOptions: (element: Element) => ({\n content: [Array.from(element.childNodes)],\n }),\n};\n","import { NgDocMermaidViewerComponent } from '@ng-doc/app/components/mermaid-viewer';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const mermaidProcessor: NgDocPageProcessor<NgDocMermaidViewerComponent> = {\n component: NgDocMermaidViewerComponent,\n selector: 'pre.mermaid',\n extractOptions: (element: Element) => ({\n inputs: {\n graph: element.textContent ?? '',\n },\n }),\n};\n","import { NgDocPlaygroundComponent } from '@ng-doc/app/components/playground';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\nimport { isPresent } from '@ng-doc/core/helpers/is-present';\n\nexport const playgroundProcessor: NgDocPageProcessor<NgDocPlaygroundComponent> = {\n component: NgDocPlaygroundComponent,\n selector: 'ng-doc-playground',\n extractOptions: (element: Element) => ({\n inputs: {\n id: element.getAttribute('id') || undefined,\n properties:\n JSON.parse(element.querySelector('#data')?.textContent?.replace(/\\n/g, '\\\\n') ?? '') ||\n undefined,\n pipeName: element.querySelector('#pipeName')?.textContent || undefined,\n selectors: (element.querySelector('#selectors')?.textContent || '')\n .split(',')\n .map((selector: string) => selector.trim())\n .filter(isPresent),\n options: JSON.parse(element.querySelector('#options')?.textContent ?? '') || {},\n },\n }),\n};\n","import { Injector, Renderer2 } from '@angular/core';\nimport { NgDocTabsComponent } from '@ng-doc/app/components/tabs';\nimport { NgDocPageProcessor, NgDocTab } from '@ng-doc/app/interfaces';\n\nexport const tabsProcessor: NgDocPageProcessor<NgDocTabsComponent> = {\n\tcomponent: NgDocTabsComponent,\n\tselector: 'ng-doc-tab',\n\tnodeToReplace: (element: Element, injector: Injector) => {\n\t\tconst renderer: Renderer2 = injector.get(Renderer2);\n\t\tconst anchor: Element = renderer.createElement('div');\n\n\t\treturn element.parentNode?.insertBefore(anchor, element) ?? element;\n\t},\n\textractOptions: (element: Element, root: Element) => {\n\t\tconst group: string | null = element.getAttribute('group') ?? '';\n\t\tconst tabs: Element[] = Array.from(root.querySelectorAll(`ng-doc-tab[group=\"${group}\"]`));\n\t\tconst mappedTabs: NgDocTab[] = tabs.map((tab: Element) => ({\n\t\t\ttitle: tab.getAttribute('name') ?? '',\n\t\t\tcontent: tab,\n\t\t\ticon: tab.getAttribute('icon') || undefined,\n\t\t\tactive: tab.hasAttribute('active'),\n\t\t}));\n\n\t\ttabs.forEach((tab: Element) => tab.remove());\n\n\t\treturn {\n\t\t\tinputs: {\n\t\t\t\ttabs: mappedTabs,\n\t\t\t},\n\t\t};\n\t},\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGO,MAAM,mBAAmB,GAAiD;AAC/E,IAAA,SAAS,EAAE,wBAAwB;AACnC,IAAA,QAAQ,EAAE,mBAAmB;AAC7B,IAAA,cAAc,EAAE,CAAC,OAAgB,MAAM;QACrC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AACzC,QAAA,MAAM,EAAE;YACN,IAAI,EAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAyB,IAAI,SAAS;YACxE,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,SAAS;YAC/C,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,SAAS;AAClD,SAAA;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CAAC,GAAY,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC;QAE5C,OAAO;AACN,YAAA,MAAM,EAAE;AACP,gBAAA,IAAI,EAAE,UAAU;AAChB,aAAA;SACD;IACF,CAAC;;;AC9BF;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ng-doc-app-processors-processors.mjs","sources":["../../../../libs/app/processors/processors/blockquote.processor.ts","../../../../libs/app/processors/processors/code.processor.ts","../../../../libs/app/processors/processors/demo.processor.ts","../../../../libs/app/processors/processors/demo-pane.processor.ts","../../../../libs/app/processors/processors/heading-anchor.processor.ts","../../../../libs/app/processors/processors/icon.processor.ts","../../../../libs/app/processors/processors/image.processor.ts","../../../../libs/app/processors/processors/members.processor.ts","../../../../libs/app/processors/processors/mermaid.processor.ts","../../../../libs/app/processors/processors/playground.processor.ts","../../../../libs/app/processors/processors/tabs.processor.ts","../../../../libs/app/processors/processors/ng-doc-app-processors-processors.ts"],"sourcesContent":["import { NgDocPageProcessor } from '@ng-doc/app/interfaces';\nimport { NgDocBlockquoteComponent, NgDocBlockquoteType } from '@ng-doc/ui-kit';\n\nexport const blockquoteProcessor: NgDocPageProcessor<NgDocBlockquoteComponent> = {\n component: NgDocBlockquoteComponent,\n selector: 'ng-doc-blockquote',\n extractOptions: (element: Element) => ({\n content: [Array.from(element.childNodes)],\n inputs: {\n type: (element.getAttribute('type') as NgDocBlockquoteType) || 'default',\n icon: element.getAttribute('icon') ?? undefined,\n label: element.getAttribute('label') ?? undefined,\n },\n }),\n};\n","import { NgDocCodeComponent } from '@ng-doc/app/components/code';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const codeProcessor: NgDocPageProcessor<NgDocCodeComponent> = {\n component: NgDocCodeComponent,\n selector: 'pre code',\n nodeToReplace: (element: Element) => element.closest('pre') ?? element,\n extractOptions: (element: Element) => ({\n inputs: {\n name: element.parentElement?.getAttribute('name') || undefined,\n icon: element.parentElement?.getAttribute('icon') || undefined,\n },\n content: [[element.closest('pre') ?? element]],\n }),\n};\n","import { NgDocDemoComponent } from '@ng-doc/app/components/demo';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const demoProcessor: NgDocPageProcessor<NgDocDemoComponent> = {\n component: NgDocDemoComponent,\n selector: 'ng-doc-demo',\n extractOptions: (element: Element) => ({\n inputs: {\n componentName: element.getAttribute('componentName') || undefined,\n options: JSON.parse(element.querySelector('#options')?.textContent ?? '{}'),\n },\n }),\n};\n","import { NgDocDemoPaneComponent } from '@ng-doc/app/components/demo-pane';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const demoPaneProcessor: NgDocPageProcessor<NgDocDemoPaneComponent> = {\n\tcomponent: NgDocDemoPaneComponent,\n\tselector: 'ng-doc-demo-pane',\n\textractOptions: (element: Element) => ({\n\t\tinputs: {\n\t\t\tcomponentName: element.getAttribute('componentName') || undefined,\n\t\t\toptions: JSON.parse(element.querySelector('#options')?.textContent ?? '') || {},\n\t\t},\n\t}),\n};\n","import { NgDocHeadingAnchorComponent } from '@ng-doc/app/components/heading-anchor';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const headingAnchorProcessor: NgDocPageProcessor<NgDocHeadingAnchorComponent> = {\n component: NgDocHeadingAnchorComponent,\n selector: 'ng-doc-heading-anchor',\n extractOptions: (element: Element) => ({\n inputs: {\n classes: element.getAttribute('class')?.split(' ') || [],\n anchor: element.getAttribute('anchor') || '',\n },\n }),\n};\n","import { NgDocPageProcessor } from '@ng-doc/app/interfaces';\nimport { NgDocIconComponent, NgDocIconSize } from '@ng-doc/ui-kit';\n\nexport const iconProcessor: NgDocPageProcessor<NgDocIconComponent> = {\n\tcomponent: NgDocIconComponent,\n\tselector: 'ng-doc-icon',\n\textractOptions: (element: Element) => ({\n\t\tinputs: {\n\t\t\ticon: element.getAttribute('icon') ?? '',\n\t\t\tsize: (Number(element.getAttribute('size')) as NgDocIconSize) || 16,\n\t\t},\n\t}),\n};\n","import { Injector, Renderer2 } from '@angular/core';\nimport { NgDocImageViewerComponent } from '@ng-doc/app/components/image-viewer';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const imageProcessor: NgDocPageProcessor<NgDocImageViewerComponent> = {\n component: NgDocImageViewerComponent,\n selector: 'img:not([zoom=\"false\"])',\n nodeToReplace: (element: Element, injector: Injector) => {\n const renderer: Renderer2 = injector.get(Renderer2);\n const anchor: Element = renderer.createElement('div');\n\n return element.parentNode?.insertBefore(anchor, element) ?? element;\n },\n extractOptions: (element: Element) => ({\n inputs: {\n src: element.getAttribute('src') ?? '',\n alt: element.getAttribute('alt') ?? '',\n },\n content: [[element]],\n }),\n};\n","import { NgDocMembersComponent } from '@ng-doc/app/components/members';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\n/** Adds the member filter to the members table of an API page (`<ng-doc-members>`). */\nexport const membersProcessor: NgDocPageProcessor<NgDocMembersComponent> = {\n component: NgDocMembersComponent,\n selector: 'ng-doc-members',\n extractOptions: (element: Element) => ({\n content: [Array.from(element.childNodes)],\n }),\n};\n","import { NgDocMermaidViewerComponent } from '@ng-doc/app/components/mermaid-viewer';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\n\nexport const mermaidProcessor: NgDocPageProcessor<NgDocMermaidViewerComponent> = {\n component: NgDocMermaidViewerComponent,\n selector: 'pre.mermaid',\n extractOptions: (element: Element) => ({\n inputs: {\n graph: element.textContent ?? '',\n },\n }),\n};\n","import { NgDocPlaygroundComponent } from '@ng-doc/app/components/playground';\nimport { NgDocPageProcessor } from '@ng-doc/app/interfaces';\nimport { isPresent } from '@ng-doc/core/helpers/is-present';\n\nexport const playgroundProcessor: NgDocPageProcessor<NgDocPlaygroundComponent> = {\n component: NgDocPlaygroundComponent,\n selector: 'ng-doc-playground',\n extractOptions: (element: Element) => ({\n inputs: {\n id: element.getAttribute('id') || undefined,\n properties:\n JSON.parse(element.querySelector('#data')?.textContent?.replace(/\\n/g, '\\\\n') ?? '') ||\n undefined,\n pipeName: element.querySelector('#pipeName')?.textContent || undefined,\n selectors: (element.querySelector('#selectors')?.textContent || '')\n .split(',')\n .map((selector: string) => selector.trim())\n .filter(isPresent),\n options: JSON.parse(element.querySelector('#options')?.textContent ?? '') || {},\n },\n }),\n};\n","import { Injector, Renderer2 } from '@angular/core';\nimport { NgDocTabsComponent } from '@ng-doc/app/components/tabs';\nimport { NgDocPageProcessor, NgDocTab } from '@ng-doc/app/interfaces';\n\n/**\n * Turns the `<ng-doc-tab group=\"…\" name=\"…\">` elements of a page into tabs: every tab of a group\n * becomes one `NgDocTabsComponent`, where the first tab of the group was. Code groups are made of\n * them, and Markdown can wrap any content in them.\n */\nexport const tabsProcessor: NgDocPageProcessor<NgDocTabsComponent> = {\n component: NgDocTabsComponent,\n selector: 'ng-doc-tab',\n nodeToReplace: (element: Element, injector: Injector) => {\n const renderer: Renderer2 = injector.get(Renderer2);\n const anchor: Element = renderer.createElement('div');\n\n return element.parentNode?.insertBefore(anchor, element) ?? element;\n },\n extractOptions: (element: Element, root: Element) => {\n const group: string = element.getAttribute('group') ?? '';\n const tabs: Element[] = Array.from(root.querySelectorAll('ng-doc-tab')).filter(\n (tab: Element) => (tab.getAttribute('group') ?? '') === group,\n );\n\n if (!tabs.includes(element)) {\n tabs.unshift(element);\n }\n\n // The tabs stay on the page until the component first renders (`NgDocTabsComponent`), so\n // the processors after this one, the page's own included, still reach their content. The\n // page processor skips elements that have left the page, so the other tabs of the group are\n // swapped for copies that hold their content: otherwise each would get tabs of its own.\n const contents: Element[] = tabs.map((tab: Element) => {\n if (tab === element || !tab.parentNode) {\n return tab;\n }\n\n const copy: Element = tab.cloneNode(false) as Element;\n\n while (tab.firstChild) {\n copy.appendChild(tab.firstChild);\n }\n tab.parentNode.replaceChild(copy, tab);\n\n return copy;\n });\n\n return {\n inputs: {\n tabs: tabs.map((tab: Element, index: number) => ({\n title: tab.getAttribute('name') ?? '',\n content: contents[index],\n icon: tab.getAttribute('icon') || undefined,\n active: tab.hasAttribute('active'),\n })) satisfies NgDocTab[],\n },\n };\n },\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGO,MAAM,mBAAmB,GAAiD;AAC/E,IAAA,SAAS,EAAE,wBAAwB;AACnC,IAAA,QAAQ,EAAE,mBAAmB;AAC7B,IAAA,cAAc,EAAE,CAAC,OAAgB,MAAM;QACrC,OAAO,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AACzC,QAAA,MAAM,EAAE;YACN,IAAI,EAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAyB,IAAI,SAAS;YACxE,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,SAAS;YAC/C,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,SAAS;AAClD,SAAA;KACF,CAAC;;;ACVG,MAAM,aAAa,GAA2C;AACnE,IAAA,SAAS,EAAE,kBAAkB;AAC7B,IAAA,QAAQ,EAAE,UAAU;AACpB,IAAA,aAAa,EAAE,CAAC,OAAgB,KAAK,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO;AACtE,IAAA,cAAc,EAAE,CAAC,OAAgB,MAAM;AACrC,QAAA,MAAM,EAAE;YACN,IAAI,EAAE,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,MAAM,CAAC,IAAI,SAAS;YAC9D,IAAI,EAAE,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,MAAM,CAAC,IAAI,SAAS;AAC/D,SAAA;AACD,QAAA,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,CAAC;KAC/C,CAAC;;;ACVG,MAAM,aAAa,GAA2C;AACnE,IAAA,SAAS,EAAE,kBAAkB;AAC7B,IAAA,QAAQ,EAAE,aAAa;AACvB,IAAA,cA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AAC,QAAQ,CAAC;AACnC,iBAAA,CAAC,CAAsB;AACzB,aAAA;SACF;IACH,CAAC;;;ACzDH;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-providers-ng-doc-app.mjs","sources":["../../../../libs/app/providers/ng-doc-app/provide-ng-doc-app.ts","../../../../libs/app/providers/ng-doc-app/ng-doc-app-providers-ng-doc-app.ts"],"sourcesContent":["import { isPlatformBrowser, ViewportScroller } from '@angular/common';\nimport {\n DOCUMENT,\n EnvironmentProviders,\n inject,\n PLATFORM_ID,\n provideAppInitializer,\n Provider,\n} from '@angular/core';\nimport { ɵcaptureNgDocHydrationSnapshots } from '@ng-doc/app/helpers';\nimport { NgDocContentScrollIntent } from '@ng-doc/app/services/content-scroll-intent';\nimport type { NgDocHighlighterConfig } from '@ng-doc/app/services/highlighter';\nimport { NgDocHighlighterService } from '@ng-doc/app/services/highlighter';\nimport { NG_DOC_SHORTCUTS, NgDocShortcutsService } from '@ng-doc/app/services/shortcuts';\nimport type { NgDocContentScrollPositionRestoration } from '@ng-doc/app/tokens';\nimport {\n NG_DOC_CONTENT_ANCHOR_SCROLLING,\n NG_DOC_CONTENT_SCROLL_POSITION_RESTORATION,\n} from '@ng-doc/app/tokens';\nimport type { NgDocUiConfig } from '@ng-doc/ui-kit';\nimport { provideNgDocUiKitConfig } from '@ng-doc/ui-kit';\n\n/**\n * NgDoc application config.\n */\nexport interface NgDocApplicationConfig {\n /**\n * Replays a router anchor scroll once asynchronous NgDoc content has been processed.\n * Enable this beside Angular router anchor scrolling.\n */\n contentAnchorScrolling?: boolean;\n /**\n * Replays a saved router position after asynchronous NgDoc content is processed.\n * Select the same intent as Angular router scroll position restoration.\n */\n contentScrollPositionRestoration?: NgDocContentScrollPositionRestoration;\n /**\n * UI Kit configuration.\n */\n uiKit?: NgDocUiConfig;\n /**\n * Shiki
|
|
1
|
+
{"version":3,"file":"ng-doc-app-providers-ng-doc-app.mjs","sources":["../../../../libs/app/providers/ng-doc-app/provide-ng-doc-app.ts","../../../../libs/app/providers/ng-doc-app/ng-doc-app-providers-ng-doc-app.ts"],"sourcesContent":["import { isPlatformBrowser, ViewportScroller } from '@angular/common';\nimport {\n DOCUMENT,\n EnvironmentProviders,\n inject,\n PLATFORM_ID,\n provideAppInitializer,\n Provider,\n} from '@angular/core';\nimport { ɵcaptureNgDocHydrationSnapshots } from '@ng-doc/app/helpers';\nimport { NgDocContentScrollIntent } from '@ng-doc/app/services/content-scroll-intent';\nimport type { NgDocHighlighterConfig } from '@ng-doc/app/services/highlighter';\nimport { NgDocHighlighterService } from '@ng-doc/app/services/highlighter';\nimport { NG_DOC_SHORTCUTS, NgDocShortcutsService } from '@ng-doc/app/services/shortcuts';\nimport type { NgDocContentScrollPositionRestoration } from '@ng-doc/app/tokens';\nimport {\n NG_DOC_CONTENT_ANCHOR_SCROLLING,\n NG_DOC_CONTENT_SCROLL_POSITION_RESTORATION,\n} from '@ng-doc/app/tokens';\nimport type { NgDocUiConfig } from '@ng-doc/ui-kit';\nimport { provideNgDocUiKitConfig } from '@ng-doc/ui-kit';\n\n/**\n * NgDoc application config.\n */\nexport interface NgDocApplicationConfig {\n /**\n * Replays a router anchor scroll once asynchronous NgDoc content has been processed.\n * Enable this beside Angular router anchor scrolling.\n */\n contentAnchorScrolling?: boolean;\n /**\n * Replays a saved router position after asynchronous NgDoc content is processed.\n * Select the same intent as Angular router scroll position restoration.\n */\n contentScrollPositionRestoration?: NgDocContentScrollPositionRestoration;\n /**\n * UI Kit configuration.\n */\n uiKit?: NgDocUiConfig;\n /**\n * Extra Shiki themes and languages for the code that the browser highlights.\n */\n shiki?: NgDocHighlighterConfig;\n /**\n * Whether single-key shortcuts (slash, the square brackets, F, L and T) are on for readers who\n * have not turned them on or off themselves. Readers can always change it with the switch in\n * the search palette. Command+K (Control+K) opens the search either way. Defaults to true.\n */\n shortcuts?: boolean;\n}\n\n/**\n * Provides the NgDoc application configuration.\n * @param config - The optional application configuration.\n */\nexport function provideNgDocApp(\n config?: NgDocApplicationConfig,\n): Array<EnvironmentProviders | Provider> {\n return [\n { provide: NG_DOC_CONTENT_ANCHOR_SCROLLING, useValue: config?.contentAnchorScrolling ?? false },\n {\n provide: NG_DOC_CONTENT_SCROLL_POSITION_RESTORATION,\n useValue: config?.contentScrollPositionRestoration ?? 'disabled',\n },\n ...(config?.contentAnchorScrolling || config?.contentScrollPositionRestoration === 'enabled'\n ? [\n provideAppInitializer(() => {\n inject(NgDocContentScrollIntent).start();\n }),\n ]\n : []),\n\n /* --- Hydration --- */\n // Before the application renders: the pages and headers that skip hydration show their\n // server-rendered content until their own is rendered, instead of a blank page.\n provideAppInitializer(() => {\n if (isPlatformBrowser(inject(PLATFORM_ID))) ɵcaptureNgDocHydrationSnapshots(inject(DOCUMENT));\n }),\n\n /* --- Keyboard shortcuts --- */\n { provide: NG_DOC_SHORTCUTS, useValue: config?.shortcuts ?? true },\n // Created at start-up so the built-in shortcuts work on every page.\n provideAppInitializer(() => {\n inject(NgDocShortcutsService);\n }),\n\n /* --- Viewport Scroller --- */\n provideAppInitializer(() => {\n inject(ViewportScroller).setOffset([0, 120]);\n }),\n\n /* --- Shiki --- */\n provideAppInitializer(async () => {\n await inject(NgDocHighlighterService).initialize(config?.shiki);\n }),\n\n /* --- UiKit --- */\n ...provideNgDocUiKitConfig(config?.uiKit),\n ];\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ɵcaptureNgDocHydrationSnapshots"],"mappings":";;;;;;;;;AAoDA;;;AAGG;AACG,SAAU,eAAe,CAC7B,MAA+B,EAAA;IAE/B,OAAO;QACL,EAAE,OAAO,EAAE,+BAA+B,EAAE,QAAQ,EAAE,MAAM,EAAE,sBAAsB,IAAI,KAAK,EAAE;AAC/F,QAAA;AACE,YAAA,OAAO,EAAE,0CAA0C;AACnD,YAAA,QAAQ,EAAE,MAAM,EAAE,gCAAgC,IAAI,UAAU;AACjE,SAAA;QACD,IAAI,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