@ng-doc/app 22.0.0 → 22.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/fesm2022/ng-doc-app-classes-content-controller.mjs +22 -4
- package/fesm2022/ng-doc-app-classes-content-controller.mjs.map +1 -1
- package/fesm2022/ng-doc-app-classes-default-search-engine.mjs +36 -12
- package/fesm2022/ng-doc-app-classes-default-search-engine.mjs.map +1 -1
- package/fesm2022/ng-doc-app-classes-root-page.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-api-list.mjs +7 -5
- package/fesm2022/ng-doc-app-components-api-list.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-breadcrumb.mjs +5 -3
- package/fesm2022/ng-doc-app-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-code.mjs +6 -4
- package/fesm2022/ng-doc-app-components-code.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-command-palette.mjs +35 -27
- package/fesm2022/ng-doc-app-components-command-palette.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-copy-button.mjs +6 -4
- package/fesm2022/ng-doc-app-components-copy-button.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-demo-displayer.mjs +19 -4
- package/fesm2022/ng-doc-app-components-demo-displayer.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-demo-frame.mjs +279 -0
- package/fesm2022/ng-doc-app-components-demo-frame.mjs.map +1 -0
- package/fesm2022/ng-doc-app-components-demo-pane.mjs +2 -2
- package/fesm2022/ng-doc-app-components-demo-pane.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-demo.mjs +97 -14
- package/fesm2022/ng-doc-app-components-demo.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-fullscreen-button.mjs +5 -3
- package/fesm2022/ng-doc-app-components-fullscreen-button.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-fullscreen-toggle.mjs +4 -2
- package/fesm2022/ng-doc-app-components-fullscreen-toggle.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-heading-anchor.mjs +5 -3
- package/fesm2022/ng-doc-app-components-heading-anchor.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-image-viewer.mjs +5 -3
- package/fesm2022/ng-doc-app-components-image-viewer.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-navbar.mjs +4 -2
- package/fesm2022/ng-doc-app-components-navbar.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-page-navigation.mjs +5 -3
- package/fesm2022/ng-doc-app-components-page-navigation.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-page-wrapper.mjs +2 -2
- package/fesm2022/ng-doc-app-components-page-wrapper.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-page.mjs +83 -16
- package/fesm2022/ng-doc-app-components-page.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-playground.mjs +838 -141
- package/fesm2022/ng-doc-app-components-playground.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-root.mjs +51 -4
- package/fesm2022/ng-doc-app-components-root.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-search-result.mjs +8 -6
- package/fesm2022/ng-doc-app-components-search-result.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-search.mjs +7 -5
- package/fesm2022/ng-doc-app-components-search.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-sidebar.mjs +4 -3
- package/fesm2022/ng-doc-app-components-sidebar.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-tabs.mjs +21 -3
- package/fesm2022/ng-doc-app-components-tabs.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-theme-toggle.mjs +7 -5
- package/fesm2022/ng-doc-app-components-theme-toggle.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components-toc.mjs +4 -2
- package/fesm2022/ng-doc-app-components-toc.mjs.map +1 -1
- package/fesm2022/ng-doc-app-components.mjs +1 -0
- package/fesm2022/ng-doc-app-components.mjs.map +1 -1
- package/fesm2022/ng-doc-app-constants.mjs +11 -1
- package/fesm2022/ng-doc-app-constants.mjs.map +1 -1
- package/fesm2022/ng-doc-app-demo-app.mjs +779 -0
- package/fesm2022/ng-doc-app-demo-app.mjs.map +1 -0
- package/fesm2022/ng-doc-app-helpers.mjs +147 -7
- package/fesm2022/ng-doc-app-helpers.mjs.map +1 -1
- package/fesm2022/ng-doc-app-processors-processors.mjs +30 -9
- package/fesm2022/ng-doc-app-processors-processors.mjs.map +1 -1
- package/fesm2022/ng-doc-app-providers-ng-doc-app.mjs +29 -18
- package/fesm2022/ng-doc-app-providers-ng-doc-app.mjs.map +1 -1
- package/fesm2022/ng-doc-app-providers-texts.mjs +53 -0
- package/fesm2022/ng-doc-app-providers-texts.mjs.map +1 -0
- package/fesm2022/ng-doc-app-providers-title.mjs +129 -0
- package/fesm2022/ng-doc-app-providers-title.mjs.map +1 -0
- package/fesm2022/ng-doc-app-providers.mjs +2 -0
- package/fesm2022/ng-doc-app-providers.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services-content-scroll-intent.mjs +27 -2
- package/fesm2022/ng-doc-app-services-content-scroll-intent.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services-highlighter.mjs +23 -16
- package/fesm2022/ng-doc-app-services-highlighter.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services-route-preloader.mjs +34 -10
- package/fesm2022/ng-doc-app-services-route-preloader.mjs.map +1 -1
- package/fesm2022/ng-doc-app-services-shortcuts.mjs +38 -4
- package/fesm2022/ng-doc-app-services-shortcuts.mjs.map +1 -1
- package/fesm2022/ng-doc-app-texts-ar.mjs +238 -0
- package/fesm2022/ng-doc-app-texts-ar.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-de.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-de.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-es.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-es.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-fr.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-fr.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-hi.mjs +219 -0
- package/fesm2022/ng-doc-app-texts-hi.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-ja.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-ja.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-ko.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-ko.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-pt-br.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-pt-br.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-ru.mjs +231 -0
- package/fesm2022/ng-doc-app-texts-ru.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-uk.mjs +231 -0
- package/fesm2022/ng-doc-app-texts-uk.mjs.map +1 -0
- package/fesm2022/ng-doc-app-texts-zh.mjs +205 -0
- package/fesm2022/ng-doc-app-texts-zh.mjs.map +1 -0
- package/fesm2022/ng-doc-app-tokens.mjs +214 -1
- package/fesm2022/ng-doc-app-tokens.mjs.map +1 -1
- package/fesm2022/ng-doc-app-type-controls-json-control.mjs +90 -0
- package/fesm2022/ng-doc-app-type-controls-json-control.mjs.map +1 -0
- package/fesm2022/ng-doc-app-type-controls-list-control.mjs +792 -0
- package/fesm2022/ng-doc-app-type-controls-list-control.mjs.map +1 -0
- package/fesm2022/ng-doc-app-type-controls-type-alias-control.mjs +45 -8
- package/fesm2022/ng-doc-app-type-controls-type-alias-control.mjs.map +1 -1
- package/fesm2022/ng-doc-app-type-controls.mjs +2 -0
- package/fesm2022/ng-doc-app-type-controls.mjs.map +1 -1
- package/package.json +73 -4
- package/styles/global.css +4 -0
- package/styles/main.css +4 -0
- package/styles/themes/dark.css +10 -0
- package/types/ng-doc-app-classes-default-search-engine.d.ts +11 -0
- package/types/ng-doc-app-classes-root-page.d.ts +13 -0
- package/types/ng-doc-app-components-api-list.d.ts +3 -1
- package/types/ng-doc-app-components-breadcrumb.d.ts +2 -1
- package/types/ng-doc-app-components-code.d.ts +2 -0
- package/types/ng-doc-app-components-command-palette.d.ts +3 -1
- package/types/ng-doc-app-components-copy-button.d.ts +3 -1
- package/types/ng-doc-app-components-demo-displayer.d.ts +13 -1
- package/types/ng-doc-app-components-demo-frame.d.ts +107 -0
- package/types/ng-doc-app-components-demo.d.ts +47 -10
- package/types/ng-doc-app-components-fullscreen-button.d.ts +2 -0
- package/types/ng-doc-app-components-fullscreen-toggle.d.ts +2 -0
- package/types/ng-doc-app-components-heading-anchor.d.ts +2 -0
- package/types/ng-doc-app-components-image-viewer.d.ts +2 -0
- package/types/ng-doc-app-components-navbar.d.ts +2 -0
- package/types/ng-doc-app-components-page-navigation.d.ts +2 -1
- package/types/ng-doc-app-components-page.d.ts +10 -1
- package/types/ng-doc-app-components-playground.d.ts +260 -42
- package/types/ng-doc-app-components-root.d.ts +18 -0
- package/types/ng-doc-app-components-search-result.d.ts +2 -0
- package/types/ng-doc-app-components-search.d.ts +2 -0
- package/types/ng-doc-app-components-sidebar.d.ts +2 -1
- package/types/ng-doc-app-components-tabs.d.ts +13 -3
- package/types/ng-doc-app-components-theme-toggle.d.ts +4 -1
- package/types/ng-doc-app-components-toc.d.ts +2 -1
- package/types/ng-doc-app-components.d.ts +1 -0
- package/types/ng-doc-app-constants.d.ts +11 -1
- package/types/ng-doc-app-demo-app.d.ts +297 -0
- package/types/ng-doc-app-helpers.d.ts +75 -4
- package/types/ng-doc-app-interfaces.d.ts +635 -6
- package/types/ng-doc-app-processors-processors.d.ts +5 -0
- package/types/ng-doc-app-providers-ng-doc-app.d.ts +7 -1
- package/types/ng-doc-app-providers-texts.d.ts +28 -0
- package/types/ng-doc-app-providers-title.d.ts +59 -0
- package/types/ng-doc-app-providers.d.ts +2 -0
- package/types/ng-doc-app-services-content-scroll-intent.d.ts +11 -1
- package/types/ng-doc-app-services-highlighter.d.ts +15 -6
- package/types/ng-doc-app-services-route-preloader.d.ts +13 -1
- package/types/ng-doc-app-services-shortcuts.d.ts +16 -0
- package/types/ng-doc-app-texts-ar.d.ts +13 -0
- package/types/ng-doc-app-texts-de.d.ts +12 -0
- package/types/ng-doc-app-texts-es.d.ts +12 -0
- package/types/ng-doc-app-texts-fr.d.ts +12 -0
- package/types/ng-doc-app-texts-hi.d.ts +12 -0
- package/types/ng-doc-app-texts-ja.d.ts +12 -0
- package/types/ng-doc-app-texts-ko.d.ts +12 -0
- package/types/ng-doc-app-texts-pt-br.d.ts +12 -0
- package/types/ng-doc-app-texts-ru.d.ts +12 -0
- package/types/ng-doc-app-texts-uk.d.ts +12 -0
- package/types/ng-doc-app-texts-zh.d.ts +12 -0
- package/types/ng-doc-app-tokens.d.ts +21 -2
- package/types/ng-doc-app-type-controls-json-control.d.ts +38 -0
- package/types/ng-doc-app-type-controls-list-control.d.ts +313 -0
- package/types/ng-doc-app-type-controls-type-alias-control.d.ts +28 -5
- package/types/ng-doc-app-type-controls.d.ts +2 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, input, output, signal, computed, viewChild, afterNextRender, untracked, DestroyRef, effect, ChangeDetectionStrategy, Component, model } from '@angular/core';
|
|
3
|
+
import { DomSanitizer } from '@angular/platform-browser';
|
|
4
|
+
import { ɵisNgDocPlaygroundFrameMessage as _isNgDocPlaygroundFrameMessage, ɵisNgDocDemoBackgroundMessage as _isNgDocDemoBackgroundMessage, ɵisNgDocDemoSizeMessage as _isNgDocDemoSizeMessage } from '@ng-doc/app/demo-app';
|
|
5
|
+
import { NG_DOC_TEXTS } from '@ng-doc/app/tokens';
|
|
6
|
+
import { NgDocButtonIconComponent, NgDocTooltipDirective } from '@ng-doc/ui-kit';
|
|
7
|
+
|
|
8
|
+
/** How long a loaded demo page may take to report its size before the frame reports a failure. */
|
|
9
|
+
const READY_TIMEOUT_MS = 10_000;
|
|
10
|
+
/**
|
|
11
|
+
* Shows a demo page of the demo application in an iframe, as tall as the demo's content: the demo
|
|
12
|
+
* page reports its height with `postMessage`, and only messages from this iframe's window and
|
|
13
|
+
* origin are accepted. The iframe is created in the browser after the first render (the server
|
|
14
|
+
* renders a placeholder with a link to the demo page) and loads lazily. Until the demo reports its
|
|
15
|
+
* size, a placeholder tells that it is loading; a demo page that loads without reporting it within
|
|
16
|
+
* 10 seconds is reported as failed, with the link.
|
|
17
|
+
*/
|
|
18
|
+
class NgDocDemoFrameComponent {
|
|
19
|
+
constructor() {
|
|
20
|
+
this.texts = inject(NG_DOC_TEXTS).demo;
|
|
21
|
+
/** The URL of the demo page, relative to the document or absolute on its origin. */
|
|
22
|
+
this.src = input.required(/* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [{ debugName: "src" }] : /* istanbul ignore next */ []));
|
|
24
|
+
/** The accessible title of the iframe. */
|
|
25
|
+
this.frameTitle = input.required(/* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [{ debugName: "frameTitle" }] : /* istanbul ignore next */ []));
|
|
27
|
+
/** Whether the iframe fills its container instead of taking the demo's height (fullscreen). */
|
|
28
|
+
this.fill = input(false, /* @ts-ignore */
|
|
29
|
+
...(ngDevMode ? [{ debugName: "fill" }] : /* istanbul ignore next */ []));
|
|
30
|
+
/**
|
|
31
|
+
* The URL fragment of the demo page, without `#`: the state of an isolated playground, and the
|
|
32
|
+
* theme the page shows (`~theme=dark`). The iframe loads with the fragment it has when the
|
|
33
|
+
* iframe is created; a later fragment replaces the page's location (`location.replace`), which
|
|
34
|
+
* reloads nothing and adds no history entry.
|
|
35
|
+
*/
|
|
36
|
+
this.fragment = input(undefined, /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "fragment" }] : /* istanbul ignore next */ []));
|
|
38
|
+
/** Whether the page is the page of an isolated playground, which reports the target. */
|
|
39
|
+
this.playground = input(false, /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "playground" }] : /* istanbul ignore next */ []));
|
|
41
|
+
/** The messages of an isolated playground's page, from this iframe only. */
|
|
42
|
+
this.playgroundMessage = output();
|
|
43
|
+
/**
|
|
44
|
+
* The page of an isolated playground (`playground`) loaded but sent no message of the playground
|
|
45
|
+
* within 10 seconds, such as a page the build didn't make.
|
|
46
|
+
*/
|
|
47
|
+
this.playgroundSilent = output();
|
|
48
|
+
/** The height the demo reported, in pixels. */
|
|
49
|
+
this.height = signal(undefined, /* @ts-ignore */
|
|
50
|
+
...(ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []));
|
|
51
|
+
/**
|
|
52
|
+
* The background color the demo's page reported, so that the canvas around the iframe can take
|
|
53
|
+
* it when the demo shows a theme of its own.
|
|
54
|
+
*/
|
|
55
|
+
this.background = signal(undefined, /* @ts-ignore */
|
|
56
|
+
...(ngDevMode ? [{ debugName: "background" }] : /* istanbul ignore next */ []));
|
|
57
|
+
/** The color of the dots of the demo canvas in the demo's theme, which its page reported. */
|
|
58
|
+
this.dots = signal(undefined, /* @ts-ignore */
|
|
59
|
+
...(ngDevMode ? [{ debugName: "dots" }] : /* istanbul ignore next */ []));
|
|
60
|
+
/**
|
|
61
|
+
* The color scheme of the demo's page, which the iframe takes: the page is transparent, and a
|
|
62
|
+
* browser paints an opaque backdrop behind an iframe whose color scheme differs from its page's.
|
|
63
|
+
*/
|
|
64
|
+
this.scheme = signal(undefined, /* @ts-ignore */
|
|
65
|
+
...(ngDevMode ? [{ debugName: "scheme" }] : /* istanbul ignore next */ []));
|
|
66
|
+
/** `loading` until the demo reports its size, then `ready`; `failed` when it never does. */
|
|
67
|
+
this.state = computed(() => this.height() !== undefined ? 'ready' : this.failed() ? 'failed' : 'loading', /* @ts-ignore */
|
|
68
|
+
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
69
|
+
/** Whether the iframe exists: only in the browser, after the first render. */
|
|
70
|
+
this.created = signal(false, /* @ts-ignore */
|
|
71
|
+
...(ngDevMode ? [{ debugName: "created" }] : /* istanbul ignore next */ []));
|
|
72
|
+
/** The demo page's URL for the iframe, with the fragment the iframe was created with. */
|
|
73
|
+
this.frameSrc = computed(() =>
|
|
74
|
+
// The URL comes from the generated demo route and the demo's name: a page of this site.
|
|
75
|
+
this.sanitizer.bypassSecurityTrustResourceUrl(withFragment(this.src(), this.initialFragment)), /* @ts-ignore */
|
|
76
|
+
...(ngDevMode ? [{ debugName: "frameSrc" }] : /* istanbul ignore next */ []));
|
|
77
|
+
this.sanitizer = inject(DomSanitizer);
|
|
78
|
+
this.frame = viewChild('frame', /* @ts-ignore */
|
|
79
|
+
...(ngDevMode ? [{ debugName: "frame" }] : /* istanbul ignore next */ []));
|
|
80
|
+
this.failed = signal(false, /* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [{ debugName: "failed" }] : /* istanbul ignore next */ []));
|
|
82
|
+
this.loaded = signal(false, /* @ts-ignore */
|
|
83
|
+
...(ngDevMode ? [{ debugName: "loaded" }] : /* istanbul ignore next */ []));
|
|
84
|
+
this.answered = false;
|
|
85
|
+
afterNextRender(() => {
|
|
86
|
+
// Read once: a fragment that changes later must not change the iframe's `src`, which would
|
|
87
|
+
// navigate it and add a history entry.
|
|
88
|
+
this.initialFragment = this.shownFragment = untracked(this.fragment);
|
|
89
|
+
this.created.set(true);
|
|
90
|
+
});
|
|
91
|
+
inject(DestroyRef).onDestroy(() => {
|
|
92
|
+
clearTimeout(this.timer);
|
|
93
|
+
clearTimeout(this.silenceTimer);
|
|
94
|
+
});
|
|
95
|
+
effect(() => {
|
|
96
|
+
const fragment = this.fragment();
|
|
97
|
+
const window = this.loaded() ? this.frame()?.nativeElement.contentWindow : undefined;
|
|
98
|
+
if (!window || fragment === this.shownFragment)
|
|
99
|
+
return;
|
|
100
|
+
this.shownFragment = fragment;
|
|
101
|
+
// Always with `#`: going from a fragment to none would load the page again.
|
|
102
|
+
window.location.replace(`${withFragment(this.src(), undefined)}#${fragment ?? ''}`);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Waits for the demo's size once its page has loaded.
|
|
107
|
+
* @internal
|
|
108
|
+
*/
|
|
109
|
+
onLoad() {
|
|
110
|
+
this.loaded.set(true);
|
|
111
|
+
clearTimeout(this.timer);
|
|
112
|
+
clearTimeout(this.silenceTimer);
|
|
113
|
+
if (untracked(this.playground) && !this.answered) {
|
|
114
|
+
this.silenceTimer = setTimeout(() => this.answered || this.playgroundSilent.emit(), READY_TIMEOUT_MS);
|
|
115
|
+
}
|
|
116
|
+
if (this.height() !== undefined)
|
|
117
|
+
return;
|
|
118
|
+
this.timer = setTimeout(() => this.failed.set(this.height() === undefined), READY_TIMEOUT_MS);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Takes the height a demo page reports, from this iframe only.
|
|
122
|
+
* @param event - A message to the window.
|
|
123
|
+
* @internal
|
|
124
|
+
*/
|
|
125
|
+
onMessage(event) {
|
|
126
|
+
const frame = this.frame()?.nativeElement;
|
|
127
|
+
if (!frame?.contentWindow ||
|
|
128
|
+
event.source !== frame.contentWindow ||
|
|
129
|
+
event.origin !== new URL(frame.src, frame.baseURI).origin) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
if (_isNgDocPlaygroundFrameMessage(event.data)) {
|
|
133
|
+
this.answered = true;
|
|
134
|
+
clearTimeout(this.silenceTimer);
|
|
135
|
+
this.playgroundMessage.emit(event.data);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (_isNgDocDemoBackgroundMessage(event.data)) {
|
|
139
|
+
this.background.set(event.data.color);
|
|
140
|
+
this.dots.set(event.data.dots);
|
|
141
|
+
this.scheme.set(event.data.scheme);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (!_isNgDocDemoSizeMessage(event.data))
|
|
145
|
+
return;
|
|
146
|
+
// The first message comes before the demo has rendered, with no height yet.
|
|
147
|
+
if (event.data.height === 0 && this.height() === undefined)
|
|
148
|
+
return;
|
|
149
|
+
clearTimeout(this.timer);
|
|
150
|
+
this.failed.set(false);
|
|
151
|
+
this.height.set(event.data.height);
|
|
152
|
+
}
|
|
153
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDemoFrameComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
154
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.1", type: NgDocDemoFrameComponent, isStandalone: true, selector: "ng-doc-demo-frame", inputs: { src: { classPropertyName: "src", publicName: "src", isSignal: true, isRequired: true, transformFunction: null }, frameTitle: { classPropertyName: "frameTitle", publicName: "frameTitle", isSignal: true, isRequired: true, transformFunction: null }, fill: { classPropertyName: "fill", publicName: "fill", isSignal: true, isRequired: false, transformFunction: null }, fragment: { classPropertyName: "fragment", publicName: "fragment", isSignal: true, isRequired: false, transformFunction: null }, playground: { classPropertyName: "playground", publicName: "playground", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { playgroundMessage: "playgroundMessage", playgroundSilent: "playgroundSilent" }, host: { listeners: { "window:message": "onMessage($event)" }, properties: { "attr.data-ng-doc-state": "state()", "attr.data-ng-doc-fill": "fill()" } }, viewQueries: [{ propertyName: "frame", first: true, predicate: ["frame"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (created()) {\n <iframe\n #frame\n class=\"ng-doc-demo-frame-iframe\"\n loading=\"lazy\"\n [src]=\"frameSrc()\"\n [title]=\"frameTitle()\"\n [style.height.px]=\"fill() ? null : height()\"\n [style.color-scheme]=\"scheme() ?? null\"\n (load)=\"onLoad()\"></iframe>\n}\n@if (state() !== 'ready') {\n <div class=\"ng-doc-demo-frame-status\" role=\"status\" [attr.aria-busy]=\"state() === 'loading'\">\n @if (state() === 'loading') {\n <span class=\"ng-doc-demo-frame-skeleton\" aria-hidden=\"true\"></span>\n <span\n >{{ texts.loading }}\n <a [href]=\"src()\" target=\"_blank\" rel=\"noopener\">{{ texts.openFrameInNewTab }}</a></span\n >\n } @else {\n <span\n >{{ texts.failed }}\n <a [href]=\"src()\" target=\"_blank\" rel=\"noopener\">{{ texts.openFrameInNewTab }}</a></span\n >\n }\n </div>\n}\n", styles: [":host{position:relative;display:block;width:100%}.ng-doc-demo-frame-iframe{display:block;width:100%;border:0;background:transparent;color-scheme:normal}:host(:not([data-ng-doc-state=ready])) .ng-doc-demo-frame-iframe{position:absolute;inset:0;height:100%;opacity:0;pointer-events:none}:host([data-ng-doc-fill=true]){height:100%}:host([data-ng-doc-fill=true]) .ng-doc-demo-frame-iframe{height:100%}.ng-doc-demo-frame-status{display:flex;flex-direction:column;align-items:center;gap:var(--ng-doc-space-3);padding:var(--ng-doc-space-4);font-size:13px;color:var(--ng-doc-text-muted);text-align:center}.ng-doc-demo-frame-skeleton{width:min(240px,100%);height:32px;border-radius:var(--ng-doc-radius-md);background:var(--ng-doc-base-2);animation:ng-doc-demo-frame-pulse 1.2s ease-in-out infinite alternate}@keyframes ng-doc-demo-frame-pulse{0%{opacity:.5}to{opacity:1}}@media(prefers-reduced-motion:reduce){.ng-doc-demo-frame-skeleton{animation:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
155
|
+
}
|
|
156
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDemoFrameComponent, decorators: [{
|
|
157
|
+
type: Component,
|
|
158
|
+
args: [{ selector: 'ng-doc-demo-frame', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
159
|
+
'[attr.data-ng-doc-state]': 'state()',
|
|
160
|
+
'[attr.data-ng-doc-fill]': 'fill()',
|
|
161
|
+
'(window:message)': 'onMessage($event)',
|
|
162
|
+
}, template: "@if (created()) {\n <iframe\n #frame\n class=\"ng-doc-demo-frame-iframe\"\n loading=\"lazy\"\n [src]=\"frameSrc()\"\n [title]=\"frameTitle()\"\n [style.height.px]=\"fill() ? null : height()\"\n [style.color-scheme]=\"scheme() ?? null\"\n (load)=\"onLoad()\"></iframe>\n}\n@if (state() !== 'ready') {\n <div class=\"ng-doc-demo-frame-status\" role=\"status\" [attr.aria-busy]=\"state() === 'loading'\">\n @if (state() === 'loading') {\n <span class=\"ng-doc-demo-frame-skeleton\" aria-hidden=\"true\"></span>\n <span\n >{{ texts.loading }}\n <a [href]=\"src()\" target=\"_blank\" rel=\"noopener\">{{ texts.openFrameInNewTab }}</a></span\n >\n } @else {\n <span\n >{{ texts.failed }}\n <a [href]=\"src()\" target=\"_blank\" rel=\"noopener\">{{ texts.openFrameInNewTab }}</a></span\n >\n }\n </div>\n}\n", styles: [":host{position:relative;display:block;width:100%}.ng-doc-demo-frame-iframe{display:block;width:100%;border:0;background:transparent;color-scheme:normal}:host(:not([data-ng-doc-state=ready])) .ng-doc-demo-frame-iframe{position:absolute;inset:0;height:100%;opacity:0;pointer-events:none}:host([data-ng-doc-fill=true]){height:100%}:host([data-ng-doc-fill=true]) .ng-doc-demo-frame-iframe{height:100%}.ng-doc-demo-frame-status{display:flex;flex-direction:column;align-items:center;gap:var(--ng-doc-space-3);padding:var(--ng-doc-space-4);font-size:13px;color:var(--ng-doc-text-muted);text-align:center}.ng-doc-demo-frame-skeleton{width:min(240px,100%);height:32px;border-radius:var(--ng-doc-radius-md);background:var(--ng-doc-base-2);animation:ng-doc-demo-frame-pulse 1.2s ease-in-out infinite alternate}@keyframes ng-doc-demo-frame-pulse{0%{opacity:.5}to{opacity:1}}@media(prefers-reduced-motion:reduce){.ng-doc-demo-frame-skeleton{animation:none}}\n"] }]
|
|
163
|
+
}], ctorParameters: () => [], propDecorators: { src: [{ type: i0.Input, args: [{ isSignal: true, alias: "src", required: true }] }], frameTitle: [{ type: i0.Input, args: [{ isSignal: true, alias: "frameTitle", required: true }] }], fill: [{ type: i0.Input, args: [{ isSignal: true, alias: "fill", required: false }] }], fragment: [{ type: i0.Input, args: [{ isSignal: true, alias: "fragment", required: false }] }], playground: [{ type: i0.Input, args: [{ isSignal: true, alias: "playground", required: false }] }], playgroundMessage: [{ type: i0.Output, args: ["playgroundMessage"] }], playgroundSilent: [{ type: i0.Output, args: ["playgroundSilent"] }], frame: [{ type: i0.ViewChild, args: ['frame', { isSignal: true }] }] } });
|
|
164
|
+
/**
|
|
165
|
+
* A URL with another fragment.
|
|
166
|
+
* @param url - A URL, relative or absolute.
|
|
167
|
+
* @param fragment - The fragment without `#`, or none.
|
|
168
|
+
*/
|
|
169
|
+
function withFragment(url, fragment) {
|
|
170
|
+
const base = url.replace(/#.*$/, '');
|
|
171
|
+
return fragment ? `${base}#${fragment}` : base;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/** The themes the button offers in turn; `undefined` follows the theme of the page. */
|
|
175
|
+
const THEMES = [undefined, 'light', 'dark'];
|
|
176
|
+
/**
|
|
177
|
+
* The button beside an isolated demo that switches the theme of its iframe in turn: the page's
|
|
178
|
+
* theme, Light and Dark. A `theme` option that is none of them, such as `auto` or the id of a
|
|
179
|
+
* custom theme, is offered after the page's theme.
|
|
180
|
+
*/
|
|
181
|
+
class NgDocDemoThemeButtonComponent {
|
|
182
|
+
constructor() {
|
|
183
|
+
this.texts = inject(NG_DOC_TEXTS).demo;
|
|
184
|
+
this.themeTexts = inject(NG_DOC_TEXTS).theme;
|
|
185
|
+
/** The theme of the iframe, or `undefined` while it follows the page. */
|
|
186
|
+
this.theme = model(undefined, /* @ts-ignore */
|
|
187
|
+
...(ngDevMode ? [{ debugName: "theme" }] : /* istanbul ignore next */ []));
|
|
188
|
+
/** The `theme` option of the demo, which the button offers too. */
|
|
189
|
+
this.configured = input(undefined, /* @ts-ignore */
|
|
190
|
+
...(ngDevMode ? [{ debugName: "configured" }] : /* istanbul ignore next */ []));
|
|
191
|
+
/** The theme the next press switches to. */
|
|
192
|
+
this.next = computed(() => {
|
|
193
|
+
const configured = this.configured();
|
|
194
|
+
const themes = configured && !THEMES.includes(configured)
|
|
195
|
+
? [undefined, configured, ...THEMES.slice(1)]
|
|
196
|
+
: THEMES;
|
|
197
|
+
return themes[(themes.indexOf(this.theme()) + 1) % themes.length];
|
|
198
|
+
}, /* @ts-ignore */
|
|
199
|
+
...(ngDevMode ? [{ debugName: "next" }] : /* istanbul ignore next */ []));
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* The name of a theme in the texts.
|
|
203
|
+
* @param theme - A theme, or `undefined` for the page's.
|
|
204
|
+
*/
|
|
205
|
+
name(theme) {
|
|
206
|
+
if (theme === undefined)
|
|
207
|
+
return this.texts.themePage;
|
|
208
|
+
if (theme === 'light' || theme === 'dark' || theme === 'auto')
|
|
209
|
+
return this.themeTexts[theme];
|
|
210
|
+
return theme;
|
|
211
|
+
}
|
|
212
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDemoThemeButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
213
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.1", type: NgDocDemoThemeButtonComponent, isStandalone: true, selector: "ng-doc-demo-theme-button", inputs: { theme: { classPropertyName: "theme", publicName: "theme", isSignal: true, isRequired: false, transformFunction: null }, configured: { classPropertyName: "configured", publicName: "configured", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { theme: "themeChange" }, ngImport: i0, template: `<button
|
|
214
|
+
type="button"
|
|
215
|
+
ng-doc-button-icon
|
|
216
|
+
[rounded]="false"
|
|
217
|
+
[attr.aria-label]="texts.themeLabel({ current: name(theme()), next: name(next()) })"
|
|
218
|
+
[ngDocTooltip]="texts.themeTooltip({ current: name(theme()) })"
|
|
219
|
+
(click)="theme.set(next())">
|
|
220
|
+
@switch (theme()) {
|
|
221
|
+
@case ('light') {
|
|
222
|
+
<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
223
|
+
<circle cx="12" cy="12" r="4" />
|
|
224
|
+
<path
|
|
225
|
+
d="M12 2v2m0 16v2M4.9 4.9l1.4 1.4m11.4 11.4 1.4 1.4M2 12h2m16 0h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4" />
|
|
226
|
+
</svg>
|
|
227
|
+
}
|
|
228
|
+
@case ('dark') {
|
|
229
|
+
<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
230
|
+
<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z" />
|
|
231
|
+
</svg>
|
|
232
|
+
}
|
|
233
|
+
@default {
|
|
234
|
+
<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
235
|
+
<circle cx="12" cy="12" r="9" />
|
|
236
|
+
<path d="M12 3a9 9 0 0 0 0 18z" fill="currentColor" />
|
|
237
|
+
</svg>
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
</button>`, isInline: true, styles: [":host{display:contents}svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}\n"], dependencies: [{ kind: "component", type: NgDocButtonIconComponent, selector: "button[ng-doc-button-icon], a[ng-doc-button-icon], button[ng-doc-button-icon-raised], a[ng-doc-button-icon-raised], button[ng-doc-button-icon-transparent], a[ng-doc-button-icon-transparent]", inputs: ["size", "rounded"] }, { kind: "directive", type: NgDocTooltipDirective, selector: "[ngDocTooltip]", inputs: ["ngDocTooltip", "delay", "displayOrigin", "pointerOrigin", "positions", "canOpen", "panelClass", "minHeight", "maxHeight", "height", "minWidth", "maxWidth", "width"], outputs: ["beforeOpen", "afterOpen", "beforeClose", "afterClose"], exportAs: ["ngDocTooltip"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
241
|
+
}
|
|
242
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDemoThemeButtonComponent, decorators: [{
|
|
243
|
+
type: Component,
|
|
244
|
+
args: [{ selector: 'ng-doc-demo-theme-button', template: `<button
|
|
245
|
+
type="button"
|
|
246
|
+
ng-doc-button-icon
|
|
247
|
+
[rounded]="false"
|
|
248
|
+
[attr.aria-label]="texts.themeLabel({ current: name(theme()), next: name(next()) })"
|
|
249
|
+
[ngDocTooltip]="texts.themeTooltip({ current: name(theme()) })"
|
|
250
|
+
(click)="theme.set(next())">
|
|
251
|
+
@switch (theme()) {
|
|
252
|
+
@case ('light') {
|
|
253
|
+
<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
254
|
+
<circle cx="12" cy="12" r="4" />
|
|
255
|
+
<path
|
|
256
|
+
d="M12 2v2m0 16v2M4.9 4.9l1.4 1.4m11.4 11.4 1.4 1.4M2 12h2m16 0h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4" />
|
|
257
|
+
</svg>
|
|
258
|
+
}
|
|
259
|
+
@case ('dark') {
|
|
260
|
+
<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
261
|
+
<path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z" />
|
|
262
|
+
</svg>
|
|
263
|
+
}
|
|
264
|
+
@default {
|
|
265
|
+
<svg viewBox="0 0 24 24" aria-hidden="true">
|
|
266
|
+
<circle cx="12" cy="12" r="9" />
|
|
267
|
+
<path d="M12 3a9 9 0 0 0 0 18z" fill="currentColor" />
|
|
268
|
+
</svg>
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
</button>`, changeDetection: ChangeDetectionStrategy.OnPush, imports: [NgDocButtonIconComponent, NgDocTooltipDirective], styles: [":host{display:contents}svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}\n"] }]
|
|
272
|
+
}], propDecorators: { theme: [{ type: i0.Input, args: [{ isSignal: true, alias: "theme", required: false }] }, { type: i0.Output, args: ["themeChange"] }], configured: [{ type: i0.Input, args: [{ isSignal: true, alias: "configured", required: false }] }] } });
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Generated bundle index. Do not edit.
|
|
276
|
+
*/
|
|
277
|
+
|
|
278
|
+
export { NgDocDemoFrameComponent, NgDocDemoThemeButtonComponent };
|
|
279
|
+
//# sourceMappingURL=ng-doc-app-components-demo-frame.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ng-doc-app-components-demo-frame.mjs","sources":["../../../../libs/app/components/demo-frame/demo-frame.component.ts","../../../../libs/app/components/demo-frame/demo-frame.component.html","../../../../libs/app/components/demo-frame/demo-theme-button.component.ts","../../../../libs/app/components/demo-frame/ng-doc-app-components-demo-frame.ts"],"sourcesContent":["import {\n afterNextRender,\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n effect,\n ElementRef,\n inject,\n input,\n output,\n Signal,\n signal,\n untracked,\n viewChild,\n} from '@angular/core';\nimport { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';\nimport {\n ɵisNgDocDemoBackgroundMessage,\n ɵisNgDocDemoSizeMessage,\n ɵisNgDocPlaygroundFrameMessage,\n ɵNgDocPlaygroundFrameMessage,\n} from '@ng-doc/app/demo-app';\nimport type { NgDocDemoTexts } from '@ng-doc/app/interfaces';\nimport { NG_DOC_TEXTS } from '@ng-doc/app/tokens';\n\n/** How long a loaded demo page may take to report its size before the frame reports a failure. */\nconst READY_TIMEOUT_MS = 10_000;\n\n/**\n * Shows a demo page of the demo application in an iframe, as tall as the demo's content: the demo\n * page reports its height with `postMessage`, and only messages from this iframe's window and\n * origin are accepted. The iframe is created in the browser after the first render (the server\n * renders a placeholder with a link to the demo page) and loads lazily. Until the demo reports its\n * size, a placeholder tells that it is loading; a demo page that loads without reporting it within\n * 10 seconds is reported as failed, with the link.\n */\n@Component({\n selector: 'ng-doc-demo-frame',\n templateUrl: './demo-frame.component.html',\n styleUrls: ['./demo-frame.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: {\n '[attr.data-ng-doc-state]': 'state()',\n '[attr.data-ng-doc-fill]': 'fill()',\n '(window:message)': 'onMessage($event)',\n },\n})\nexport class NgDocDemoFrameComponent {\n protected readonly texts: NgDocDemoTexts = inject(NG_DOC_TEXTS).demo;\n\n /** The URL of the demo page, relative to the document or absolute on its origin. */\n readonly src = input.required<string>();\n\n /** The accessible title of the iframe. */\n readonly frameTitle = input.required<string>();\n\n /** Whether the iframe fills its container instead of taking the demo's height (fullscreen). */\n readonly fill = input<boolean>(false);\n\n /**\n * The URL fragment of the demo page, without `#`: the state of an isolated playground, and the\n * theme the page shows (`~theme=dark`). The iframe loads with the fragment it has when the\n * iframe is created; a later fragment replaces the page's location (`location.replace`), which\n * reloads nothing and adds no history entry.\n */\n readonly fragment = input<string | undefined>(undefined);\n\n /** Whether the page is the page of an isolated playground, which reports the target. */\n readonly playground = input<boolean>(false);\n\n /** The messages of an isolated playground's page, from this iframe only. */\n readonly playgroundMessage = output<ɵNgDocPlaygroundFrameMessage>();\n\n /**\n * The page of an isolated playground (`playground`) loaded but sent no message of the playground\n * within 10 seconds, such as a page the build didn't make.\n */\n readonly playgroundSilent = output<void>();\n\n /** The height the demo reported, in pixels. */\n readonly height = signal<number | undefined>(undefined);\n\n /**\n * The background color the demo's page reported, so that the canvas around the iframe can take\n * it when the demo shows a theme of its own.\n */\n readonly background = signal<string | undefined>(undefined);\n\n /** The color of the dots of the demo canvas in the demo's theme, which its page reported. */\n readonly dots = signal<string | undefined>(undefined);\n\n /**\n * The color scheme of the demo's page, which the iframe takes: the page is transparent, and a\n * browser paints an opaque backdrop behind an iframe whose color scheme differs from its page's.\n */\n readonly scheme = signal<string | undefined>(undefined);\n\n /** `loading` until the demo reports its size, then `ready`; `failed` when it never does. */\n readonly state: Signal<'loading' | 'ready' | 'failed'> = computed(() =>\n this.height() !== undefined ? 'ready' : this.failed() ? 'failed' : 'loading',\n );\n\n /** Whether the iframe exists: only in the browser, after the first render. */\n protected readonly created = signal(false);\n\n /** The demo page's URL for the iframe, with the fragment the iframe was created with. */\n protected readonly frameSrc: Signal<SafeResourceUrl> = computed(() =>\n // The URL comes from the generated demo route and the demo's name: a page of this site.\n this.sanitizer.bypassSecurityTrustResourceUrl(withFragment(this.src(), this.initialFragment)),\n );\n\n private readonly sanitizer = inject(DomSanitizer);\n private readonly frame = viewChild<ElementRef<HTMLIFrameElement>>('frame');\n private readonly failed = signal(false);\n private readonly loaded = signal(false);\n private initialFragment?: string;\n private shownFragment?: string;\n private timer?: ReturnType<typeof setTimeout>;\n private silenceTimer?: ReturnType<typeof setTimeout>;\n private answered = false;\n\n constructor() {\n afterNextRender(() => {\n // Read once: a fragment that changes later must not change the iframe's `src`, which would\n // navigate it and add a history entry.\n this.initialFragment = this.shownFragment = untracked(this.fragment);\n this.created.set(true);\n });\n inject(DestroyRef).onDestroy(() => {\n clearTimeout(this.timer);\n clearTimeout(this.silenceTimer);\n });\n effect(() => {\n const fragment = this.fragment();\n const window = this.loaded() ? this.frame()?.nativeElement.contentWindow : undefined;\n\n if (!window || fragment === this.shownFragment) return;\n this.shownFragment = fragment;\n // Always with `#`: going from a fragment to none would load the page again.\n window.location.replace(`${withFragment(this.src(), undefined)}#${fragment ?? ''}`);\n });\n }\n\n /**\n * Waits for the demo's size once its page has loaded.\n * @internal\n */\n protected onLoad(): void {\n this.loaded.set(true);\n clearTimeout(this.timer);\n clearTimeout(this.silenceTimer);\n if (untracked(this.playground) && !this.answered) {\n this.silenceTimer = setTimeout(\n () => this.answered || this.playgroundSilent.emit(),\n READY_TIMEOUT_MS,\n );\n }\n if (this.height() !== undefined) return;\n this.timer = setTimeout(() => this.failed.set(this.height() === undefined), READY_TIMEOUT_MS);\n }\n\n /**\n * Takes the height a demo page reports, from this iframe only.\n * @param event - A message to the window.\n * @internal\n */\n protected onMessage(event: MessageEvent): void {\n const frame = this.frame()?.nativeElement;\n\n if (\n !frame?.contentWindow ||\n event.source !== frame.contentWindow ||\n event.origin !== new URL(frame.src, frame.baseURI).origin\n ) {\n return;\n }\n if (ɵisNgDocPlaygroundFrameMessage(event.data)) {\n this.answered = true;\n clearTimeout(this.silenceTimer);\n this.playgroundMessage.emit(event.data);\n return;\n }\n if (ɵisNgDocDemoBackgroundMessage(event.data)) {\n this.background.set(event.data.color);\n this.dots.set(event.data.dots);\n this.scheme.set(event.data.scheme);\n return;\n }\n if (!ɵisNgDocDemoSizeMessage(event.data)) return;\n // The first message comes before the demo has rendered, with no height yet.\n if (event.data.height === 0 && this.height() === undefined) return;\n clearTimeout(this.timer);\n this.failed.set(false);\n this.height.set(event.data.height);\n }\n}\n\n/**\n * A URL with another fragment.\n * @param url - A URL, relative or absolute.\n * @param fragment - The fragment without `#`, or none.\n */\nfunction withFragment(url: string, fragment: string | undefined): string {\n const base = url.replace(/#.*$/, '');\n\n return fragment ? `${base}#${fragment}` : base;\n}\n","@if (created()) {\n <iframe\n #frame\n class=\"ng-doc-demo-frame-iframe\"\n loading=\"lazy\"\n [src]=\"frameSrc()\"\n [title]=\"frameTitle()\"\n [style.height.px]=\"fill() ? null : height()\"\n [style.color-scheme]=\"scheme() ?? null\"\n (load)=\"onLoad()\"></iframe>\n}\n@if (state() !== 'ready') {\n <div class=\"ng-doc-demo-frame-status\" role=\"status\" [attr.aria-busy]=\"state() === 'loading'\">\n @if (state() === 'loading') {\n <span class=\"ng-doc-demo-frame-skeleton\" aria-hidden=\"true\"></span>\n <span\n >{{ texts.loading }}\n <a [href]=\"src()\" target=\"_blank\" rel=\"noopener\">{{ texts.openFrameInNewTab }}</a></span\n >\n } @else {\n <span\n >{{ texts.failed }}\n <a [href]=\"src()\" target=\"_blank\" rel=\"noopener\">{{ texts.openFrameInNewTab }}</a></span\n >\n }\n </div>\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n input,\n model,\n Signal,\n} from '@angular/core';\nimport type { NgDocDemoTexts, NgDocThemeTexts } from '@ng-doc/app/interfaces';\nimport { NG_DOC_TEXTS } from '@ng-doc/app/tokens';\nimport { NgDocButtonIconComponent, NgDocTooltipDirective } from '@ng-doc/ui-kit';\n\n/** The themes the button offers in turn; `undefined` follows the theme of the page. */\nconst THEMES: ReadonlyArray<string | undefined> = [undefined, 'light', 'dark'];\n\n/**\n * The button beside an isolated demo that switches the theme of its iframe in turn: the page's\n * theme, Light and Dark. A `theme` option that is none of them, such as `auto` or the id of a\n * custom theme, is offered after the page's theme.\n */\n@Component({\n selector: 'ng-doc-demo-theme-button',\n template: `<button\n type=\"button\"\n ng-doc-button-icon\n [rounded]=\"false\"\n [attr.aria-label]=\"texts.themeLabel({ current: name(theme()), next: name(next()) })\"\n [ngDocTooltip]=\"texts.themeTooltip({ current: name(theme()) })\"\n (click)=\"theme.set(next())\">\n @switch (theme()) {\n @case ('light') {\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path\n d=\"M12 2v2m0 16v2M4.9 4.9l1.4 1.4m11.4 11.4 1.4 1.4M2 12h2m16 0h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4\" />\n </svg>\n }\n @case ('dark') {\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path d=\"M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z\" />\n </svg>\n }\n @default {\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <circle cx=\"12\" cy=\"12\" r=\"9\" />\n <path d=\"M12 3a9 9 0 0 0 0 18z\" fill=\"currentColor\" />\n </svg>\n }\n }\n </button>`,\n styles: `\n :host {\n display: contents;\n }\n\n svg {\n width: 16px;\n height: 16px;\n fill: none;\n stroke: currentColor;\n stroke-width: 2;\n stroke-linecap: round;\n stroke-linejoin: round;\n }\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [NgDocButtonIconComponent, NgDocTooltipDirective],\n})\nexport class NgDocDemoThemeButtonComponent {\n protected readonly texts: NgDocDemoTexts = inject(NG_DOC_TEXTS).demo;\n private readonly themeTexts: NgDocThemeTexts = inject(NG_DOC_TEXTS).theme;\n\n /** The theme of the iframe, or `undefined` while it follows the page. */\n readonly theme = model<string | undefined>(undefined);\n\n /** The `theme` option of the demo, which the button offers too. */\n readonly configured = input<string | undefined>(undefined);\n\n /** The theme the next press switches to. */\n protected readonly next: Signal<string | undefined> = computed(() => {\n const configured = this.configured();\n const themes =\n configured && !THEMES.includes(configured)\n ? [undefined, configured, ...THEMES.slice(1)]\n : THEMES;\n\n return themes[(themes.indexOf(this.theme()) + 1) % themes.length];\n });\n\n /**\n * The name of a theme in the texts.\n * @param theme - A theme, or `undefined` for the page's.\n */\n protected name(theme: string | undefined): string {\n if (theme === undefined) return this.texts.themePage;\n if (theme === 'light' || theme === 'dark' || theme === 'auto') return this.themeTexts[theme];\n return theme;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["ɵisNgDocPlaygroundFrameMessage","ɵisNgDocDemoBackgroundMessage","ɵisNgDocDemoSizeMessage"],"mappings":";;;;;;;AA0BA;AACA,MAAM,gBAAgB,GAAG,MAAM;AAE/B;;;;;;;AAOG;MAYU,uBAAuB,CAAA;AA0ElC,IAAA,WAAA,GAAA;AAzEmB,QAAA,IAAA,CAAA,KAAK,GAAmB,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI;;QAG3D,IAAA,CAAA,GAAG,GAAG,KAAK,CAAC,QAAQ;gFAAU;;QAG9B,IAAA,CAAA,UAAU,GAAG,KAAK,CAAC,QAAQ;uFAAU;;QAGrC,IAAA,CAAA,IAAI,GAAG,KAAK,CAAU,KAAK;iFAAC;AAErC;;;;;AAKG;QACM,IAAA,CAAA,QAAQ,GAAG,KAAK,CAAqB,SAAS;qFAAC;;QAG/C,IAAA,CAAA,UAAU,GAAG,KAAK,CAAU,KAAK;uFAAC;;QAGlC,IAAA,CAAA,iBAAiB,GAAG,MAAM,EAAgC;AAEnE;;;AAGG;QACM,IAAA,CAAA,gBAAgB,GAAG,MAAM,EAAQ;;QAGjC,IAAA,CAAA,MAAM,GAAG,MAAM,CAAqB,SAAS;mFAAC;AAEvD;;;AAGG;QACM,IAAA,CAAA,UAAU,GAAG,MAAM,CAAqB,SAAS;uFAAC;;QAGlD,IAAA,CAAA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;ACnE5D;;AAEG;;;;"}
|
|
@@ -39,7 +39,7 @@ class NgDocDemoPaneComponent {
|
|
|
39
39
|
...(ngDevMode ? [{ debugName: "assets" }] : /* istanbul ignore next */ []));
|
|
40
40
|
}
|
|
41
41
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDemoPaneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
42
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.1", type: NgDocDemoPaneComponent, isStandalone: true, selector: "ng-doc-demo-pane", inputs: { componentName: { classPropertyName: "componentName", publicName: "componentName", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "options().class ?? \"\"" } }, ngImport: i0, template: "<ng-doc-pane [expanded]=\"options().expanded ?? false\">\n <ng-container *ngTemplateOutlet=\"codeContent\" ngDocPaneBack></ng-container>\n <div class=\"ng-doc-demo-pane-stage\" ngDocPaneFront ngDocFullscreen #stage=\"ngDocFullscreen\">\n <ng-container *ngTemplateOutlet=\"demoTemplate\"></ng-container>\n @if (!options().fullscreenRoute) {\n <ng-doc-fullscreen-toggle class=\"ng-doc-demo-pane-fullscreen\" [target]=\"stage\" />\n }\n </div>\n</ng-doc-pane>\n\n<ng-template #demoTemplate>\n @if (options().fullscreenRoute; as route) {\n <ng-doc-fullscreen-button [route]=\"route\"></ng-doc-fullscreen-button>\n } @else if (demo(); as demo) {\n <ng-container *ngComponentOutlet=\"demo; inputs: options().inputs\"></ng-container>\n }\n</ng-template>\n\n<ng-template #codeContent>\n @if (assets().length === 1) {\n <ng-doc-code [html]=\"assets()[0].code\"></ng-doc-code>\n }\n\n @if (assets().length > 1) {\n <ng-doc-tab-group [openedTab]=\"options().defaultTab\">\n @for (asset of assets(); track asset.title) {\n <ng-doc-tab [id]=\"asset.title\" [label]=\"label\" [content]=\"assetContent\">\n <ng-template #label>\n @if (asset.icon) {\n <ng-doc-icon [customIcon]=\"asset.icon\"></ng-doc-icon>\n }\n {{ asset.title }}\n </ng-template>\n <ng-template #assetContent>\n <ng-doc-code [html]=\"asset.code\"></ng-doc-code>\n </ng-template>\n </ng-doc-tab>\n }\n </ng-doc-tab-group>\n }\n</ng-template>\n", styles: [":host{display:block;height:var(--ng-doc-demo-pane-height);margin:var(--ng-doc-demo-pane-margin);--ng-doc-code-margin: 0;--ng-doc-code-border-radius: 0;--ng-doc-code-border: none;--ng-doc-tab-group-tabs-background: var(--ng-doc-demo-toolbar-background);--ng-doc-tab-group-border: none;--ng-doc-tab-group-border-radius: 0;--ng-doc-pane-border-radius: var(--ng-doc-demo-displayer-border-radius)}:host ng-doc-tab-group,:host ng-doc-code,:host ng-doc-pane{width:100%;height:100%}.ng-doc-demo-pane-stage{background-image:radial-gradient(color-mix(in srgb,var(--ng-doc-base-5) 55%,transparent) 1px,transparent 1px);background-size:16px 16px;position:relative;display:grid;place-items:center;align-self:stretch;width:100%;min-height:100%}.ng-doc-demo-pane-stage[data-ng-doc-fullscreen=true]{overflow:auto;padding:var(--ng-doc-space-16) var(--ng-doc-space-8);background-color:var(--ng-doc-pane-front-background, var(--ng-doc-pane-background, var(--ng-doc-base-1)))}.ng-doc-demo-pane-fullscreen{position:absolute;top:var(--ng-doc-space-2);right:var(--ng-doc-space-2)}\n"], dependencies: [{ kind: "component", type: NgDocPaneComponent, selector: "ng-doc-pane", inputs: ["expanded"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgDocPaneBackDirective, selector: "[ngDocPaneBack]" }, { kind: "directive", type: NgDocPaneFrontDirective, selector: "[ngDocPaneFront]" }, { kind: "component", type: NgDocCodeComponent, selector: "ng-doc-code", inputs: ["html", "copyButton", "name", "icon"] }, { kind: "component", type: NgDocTabGroupComponent, selector: "ng-doc-tab-group", inputs: ["openedTab"] }, { kind: "component", type: NgDocTabComponent, selector: "ng-doc-tab, a[ng-doc-tab]", inputs: ["label", "id", "content"] }, { kind: "component", type: NgDocFullscreenButtonComponent, selector: "ng-doc-fullscreen-button", inputs: ["route"] }, { kind: "directive", type: NgDocFullscreenDirective, selector: "[ngDocFullscreen]", exportAs: ["ngDocFullscreen"] }, { kind: "component", type: NgDocFullscreenToggleComponent, selector: "ng-doc-fullscreen-toggle", inputs: ["target"] }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "component", type: NgDocIconComponent, selector: "ng-doc-icon", inputs: ["icon", "customIcon", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
42
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.2.1", type: NgDocDemoPaneComponent, isStandalone: true, selector: "ng-doc-demo-pane", inputs: { componentName: { classPropertyName: "componentName", publicName: "componentName", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "options().class ?? \"\"" } }, ngImport: i0, template: "<ng-doc-pane [expanded]=\"options().expanded ?? false\">\n <ng-container *ngTemplateOutlet=\"codeContent\" ngDocPaneBack></ng-container>\n <div class=\"ng-doc-demo-pane-stage\" ngDocPaneFront ngDocFullscreen #stage=\"ngDocFullscreen\">\n <ng-container *ngTemplateOutlet=\"demoTemplate\"></ng-container>\n @if (!options().fullscreenRoute) {\n <ng-doc-fullscreen-toggle class=\"ng-doc-demo-pane-fullscreen\" [target]=\"stage\" />\n }\n </div>\n</ng-doc-pane>\n\n<ng-template #demoTemplate>\n @if (options().fullscreenRoute; as route) {\n <ng-doc-fullscreen-button [route]=\"route\"></ng-doc-fullscreen-button>\n } @else if (demo(); as demo) {\n <ng-container *ngComponentOutlet=\"demo; inputs: options().inputs\"></ng-container>\n }\n</ng-template>\n\n<ng-template #codeContent>\n @if (assets().length === 1) {\n <ng-doc-code [html]=\"assets()[0].code\"></ng-doc-code>\n }\n\n @if (assets().length > 1) {\n <ng-doc-tab-group [openedTab]=\"options().defaultTab\">\n @for (asset of assets(); track asset.title) {\n <ng-doc-tab [id]=\"asset.title\" [label]=\"label\" [content]=\"assetContent\">\n <ng-template #label>\n @if (asset.icon) {\n <ng-doc-icon [customIcon]=\"asset.icon\"></ng-doc-icon>\n }\n {{ asset.title }}\n </ng-template>\n <ng-template #assetContent>\n <ng-doc-code [html]=\"asset.code\"></ng-doc-code>\n </ng-template>\n </ng-doc-tab>\n }\n </ng-doc-tab-group>\n }\n</ng-template>\n", styles: [":host{display:block;height:var(--ng-doc-demo-pane-height);margin:var(--ng-doc-demo-pane-margin);--ng-doc-code-margin: 0;--ng-doc-code-border-radius: 0;--ng-doc-code-border: none;--ng-doc-tab-group-tabs-background: var(--ng-doc-demo-toolbar-background);--ng-doc-tab-group-border: none;--ng-doc-tab-group-border-radius: 0;--ng-doc-pane-border-radius: var(--ng-doc-demo-displayer-border-radius)}:host ng-doc-tab-group,:host ng-doc-code,:host ng-doc-pane{width:100%;height:100%}.ng-doc-demo-pane-stage{background-image:radial-gradient(color-mix(in srgb,var(--_ng-doc-demo-canvas-dots, var(--ng-doc-base-5)) 55%,transparent) 1px,transparent 1px);background-size:16px 16px;position:relative;display:grid;place-items:center;align-self:stretch;width:100%;min-height:100%}.ng-doc-demo-pane-stage[data-ng-doc-fullscreen=true]{overflow:auto;padding:var(--ng-doc-space-16) var(--ng-doc-space-8);background-color:var(--ng-doc-pane-front-background, var(--ng-doc-pane-background, var(--ng-doc-base-1)))}.ng-doc-demo-pane-fullscreen{position:absolute;top:var(--ng-doc-space-2);right:var(--ng-doc-space-2)}\n"], dependencies: [{ kind: "component", type: NgDocPaneComponent, selector: "ng-doc-pane", inputs: ["expanded"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: NgDocPaneBackDirective, selector: "[ngDocPaneBack]" }, { kind: "directive", type: NgDocPaneFrontDirective, selector: "[ngDocPaneFront]" }, { kind: "component", type: NgDocCodeComponent, selector: "ng-doc-code", inputs: ["html", "copyButton", "name", "icon"] }, { kind: "component", type: NgDocTabGroupComponent, selector: "ng-doc-tab-group", inputs: ["appearance", "openedTab"] }, { kind: "component", type: NgDocTabComponent, selector: "ng-doc-tab, a[ng-doc-tab]", inputs: ["label", "id", "content"] }, { kind: "component", type: NgDocFullscreenButtonComponent, selector: "ng-doc-fullscreen-button", inputs: ["route"] }, { kind: "directive", type: NgDocFullscreenDirective, selector: "[ngDocFullscreen]", exportAs: ["ngDocFullscreen"] }, { kind: "component", type: NgDocFullscreenToggleComponent, selector: "ng-doc-fullscreen-toggle", inputs: ["target"] }, { kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "component", type: NgDocIconComponent, selector: "ng-doc-icon", inputs: ["icon", "customIcon", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
43
43
|
}
|
|
44
44
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImport: i0, type: NgDocDemoPaneComponent, decorators: [{
|
|
45
45
|
type: Component,
|
|
@@ -58,7 +58,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.1", ngImpor
|
|
|
58
58
|
NgDocIconComponent,
|
|
59
59
|
], host: {
|
|
60
60
|
'[class]': 'options().class ?? ""',
|
|
61
|
-
}, template: "<ng-doc-pane [expanded]=\"options().expanded ?? false\">\n <ng-container *ngTemplateOutlet=\"codeContent\" ngDocPaneBack></ng-container>\n <div class=\"ng-doc-demo-pane-stage\" ngDocPaneFront ngDocFullscreen #stage=\"ngDocFullscreen\">\n <ng-container *ngTemplateOutlet=\"demoTemplate\"></ng-container>\n @if (!options().fullscreenRoute) {\n <ng-doc-fullscreen-toggle class=\"ng-doc-demo-pane-fullscreen\" [target]=\"stage\" />\n }\n </div>\n</ng-doc-pane>\n\n<ng-template #demoTemplate>\n @if (options().fullscreenRoute; as route) {\n <ng-doc-fullscreen-button [route]=\"route\"></ng-doc-fullscreen-button>\n } @else if (demo(); as demo) {\n <ng-container *ngComponentOutlet=\"demo; inputs: options().inputs\"></ng-container>\n }\n</ng-template>\n\n<ng-template #codeContent>\n @if (assets().length === 1) {\n <ng-doc-code [html]=\"assets()[0].code\"></ng-doc-code>\n }\n\n @if (assets().length > 1) {\n <ng-doc-tab-group [openedTab]=\"options().defaultTab\">\n @for (asset of assets(); track asset.title) {\n <ng-doc-tab [id]=\"asset.title\" [label]=\"label\" [content]=\"assetContent\">\n <ng-template #label>\n @if (asset.icon) {\n <ng-doc-icon [customIcon]=\"asset.icon\"></ng-doc-icon>\n }\n {{ asset.title }}\n </ng-template>\n <ng-template #assetContent>\n <ng-doc-code [html]=\"asset.code\"></ng-doc-code>\n </ng-template>\n </ng-doc-tab>\n }\n </ng-doc-tab-group>\n }\n</ng-template>\n", styles: [":host{display:block;height:var(--ng-doc-demo-pane-height);margin:var(--ng-doc-demo-pane-margin);--ng-doc-code-margin: 0;--ng-doc-code-border-radius: 0;--ng-doc-code-border: none;--ng-doc-tab-group-tabs-background: var(--ng-doc-demo-toolbar-background);--ng-doc-tab-group-border: none;--ng-doc-tab-group-border-radius: 0;--ng-doc-pane-border-radius: var(--ng-doc-demo-displayer-border-radius)}:host ng-doc-tab-group,:host ng-doc-code,:host ng-doc-pane{width:100%;height:100%}.ng-doc-demo-pane-stage{background-image:radial-gradient(color-mix(in srgb,var(--ng-doc-base-5) 55%,transparent) 1px,transparent 1px);background-size:16px 16px;position:relative;display:grid;place-items:center;align-self:stretch;width:100%;min-height:100%}.ng-doc-demo-pane-stage[data-ng-doc-fullscreen=true]{overflow:auto;padding:var(--ng-doc-space-16) var(--ng-doc-space-8);background-color:var(--ng-doc-pane-front-background, var(--ng-doc-pane-background, var(--ng-doc-base-1)))}.ng-doc-demo-pane-fullscreen{position:absolute;top:var(--ng-doc-space-2);right:var(--ng-doc-space-2)}\n"] }]
|
|
61
|
+
}, template: "<ng-doc-pane [expanded]=\"options().expanded ?? false\">\n <ng-container *ngTemplateOutlet=\"codeContent\" ngDocPaneBack></ng-container>\n <div class=\"ng-doc-demo-pane-stage\" ngDocPaneFront ngDocFullscreen #stage=\"ngDocFullscreen\">\n <ng-container *ngTemplateOutlet=\"demoTemplate\"></ng-container>\n @if (!options().fullscreenRoute) {\n <ng-doc-fullscreen-toggle class=\"ng-doc-demo-pane-fullscreen\" [target]=\"stage\" />\n }\n </div>\n</ng-doc-pane>\n\n<ng-template #demoTemplate>\n @if (options().fullscreenRoute; as route) {\n <ng-doc-fullscreen-button [route]=\"route\"></ng-doc-fullscreen-button>\n } @else if (demo(); as demo) {\n <ng-container *ngComponentOutlet=\"demo; inputs: options().inputs\"></ng-container>\n }\n</ng-template>\n\n<ng-template #codeContent>\n @if (assets().length === 1) {\n <ng-doc-code [html]=\"assets()[0].code\"></ng-doc-code>\n }\n\n @if (assets().length > 1) {\n <ng-doc-tab-group [openedTab]=\"options().defaultTab\">\n @for (asset of assets(); track asset.title) {\n <ng-doc-tab [id]=\"asset.title\" [label]=\"label\" [content]=\"assetContent\">\n <ng-template #label>\n @if (asset.icon) {\n <ng-doc-icon [customIcon]=\"asset.icon\"></ng-doc-icon>\n }\n {{ asset.title }}\n </ng-template>\n <ng-template #assetContent>\n <ng-doc-code [html]=\"asset.code\"></ng-doc-code>\n </ng-template>\n </ng-doc-tab>\n }\n </ng-doc-tab-group>\n }\n</ng-template>\n", styles: [":host{display:block;height:var(--ng-doc-demo-pane-height);margin:var(--ng-doc-demo-pane-margin);--ng-doc-code-margin: 0;--ng-doc-code-border-radius: 0;--ng-doc-code-border: none;--ng-doc-tab-group-tabs-background: var(--ng-doc-demo-toolbar-background);--ng-doc-tab-group-border: none;--ng-doc-tab-group-border-radius: 0;--ng-doc-pane-border-radius: var(--ng-doc-demo-displayer-border-radius)}:host ng-doc-tab-group,:host ng-doc-code,:host ng-doc-pane{width:100%;height:100%}.ng-doc-demo-pane-stage{background-image:radial-gradient(color-mix(in srgb,var(--_ng-doc-demo-canvas-dots, var(--ng-doc-base-5)) 55%,transparent) 1px,transparent 1px);background-size:16px 16px;position:relative;display:grid;place-items:center;align-self:stretch;width:100%;min-height:100%}.ng-doc-demo-pane-stage[data-ng-doc-fullscreen=true]{overflow:auto;padding:var(--ng-doc-space-16) var(--ng-doc-space-8);background-color:var(--ng-doc-pane-front-background, var(--ng-doc-pane-background, var(--ng-doc-base-1)))}.ng-doc-demo-pane-fullscreen{position:absolute;top:var(--ng-doc-space-2);right:var(--ng-doc-space-2)}\n"] }]
|
|
62
62
|
}], propDecorators: { componentName: [{ type: i0.Input, args: [{ isSignal: true, alias: "componentName", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
|
|
63
63
|
|
|
64
64
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ng-doc-app-components-demo-pane.mjs","sources":["../../../../libs/app/components/demo-pane/demo-pane.component.ts","../../../../libs/app/components/demo-pane/demo-pane.component.html","../../../../libs/app/components/demo-pane/ng-doc-app-components-demo-pane.ts"],"sourcesContent":["import { NgComponentOutlet, NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n input,\n Signal,\n Type,\n} from '@angular/core';\nimport { NgDocRootPage } from '@ng-doc/app/classes/root-page';\nimport { NgDocCodeComponent } from '@ng-doc/app/components/code';\nimport { NgDocFullscreenButtonComponent } from '@ng-doc/app/components/fullscreen-button';\nimport { NgDocFullscreenToggleComponent } from '@ng-doc/app/components/fullscreen-toggle';\nimport { NgDocDemoAsset } from '@ng-doc/app/interfaces';\nimport { asArray } from '@ng-doc/core/helpers/as-array';\nimport { NgDocDemoPaneActionOptions } from '@ng-doc/core/interfaces';\nimport {\n NgDocFullscreenDirective,\n NgDocIconComponent,\n NgDocPaneBackDirective,\n NgDocPaneComponent,\n NgDocPaneFrontDirective,\n NgDocTabComponent,\n NgDocTabGroupComponent,\n} from '@ng-doc/ui-kit';\n\n/**\n * Renders a demo of the page in front of its source files, which the reader reveals by dragging\n * the pane's resizer. The demo sits on the dot-grid canvas of demos, with a control that shows it\n * fullscreen with the browser Fullscreen API where the browser supports it.\n */\n@Component({\n selector: 'ng-doc-demo-pane',\n templateUrl: './demo-pane.component.html',\n styleUrls: ['./demo-pane.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n NgDocPaneComponent,\n NgTemplateOutlet,\n NgDocPaneBackDirective,\n NgDocPaneFrontDirective,\n NgDocCodeComponent,\n NgDocTabGroupComponent,\n NgDocTabComponent,\n NgDocFullscreenButtonComponent,\n NgDocFullscreenDirective,\n NgDocFullscreenToggleComponent,\n NgComponentOutlet,\n NgDocIconComponent,\n ],\n host: {\n '[class]': 'options().class ?? \"\"',\n },\n})\nexport class NgDocDemoPaneComponent {\n private readonly rootPage = inject(NgDocRootPage);\n\n /** Name of the demo component in the page's `demos`. */\n readonly componentName = input<string | undefined>(undefined);\n\n /** Options of the `demoPane` action. */\n readonly options = input<NgDocDemoPaneActionOptions>({});\n\n /** The demo component. */\n readonly demo: Signal<Type<unknown> | undefined> = computed(() => {\n const name: string | undefined = this.componentName();\n\n return name ? this.rootPage.page?.demos?.[name] : undefined;\n });\n\n /** Source files of the demo, filtered by the `tabs` option. */\n readonly assets: Signal<NgDocDemoAsset[]> = computed(() => {\n const name: string | undefined = this.componentName();\n const tabs: string | string[] | undefined = this.options().tabs;\n\n return name\n ? (this.rootPage.demoAssets?.[name] ?? []).filter(\n (asset: NgDocDemoAsset) => !tabs?.length || asArray(tabs).includes(asset.title),\n )\n : [];\n });\n}\n","<ng-doc-pane [expanded]=\"options().expanded ?? false\">\n <ng-container *ngTemplateOutlet=\"codeContent\" ngDocPaneBack></ng-container>\n <div class=\"ng-doc-demo-pane-stage\" ngDocPaneFront ngDocFullscreen #stage=\"ngDocFullscreen\">\n <ng-container *ngTemplateOutlet=\"demoTemplate\"></ng-container>\n @if (!options().fullscreenRoute) {\n <ng-doc-fullscreen-toggle class=\"ng-doc-demo-pane-fullscreen\" [target]=\"stage\" />\n }\n </div>\n</ng-doc-pane>\n\n<ng-template #demoTemplate>\n @if (options().fullscreenRoute; as route) {\n <ng-doc-fullscreen-button [route]=\"route\"></ng-doc-fullscreen-button>\n } @else if (demo(); as demo) {\n <ng-container *ngComponentOutlet=\"demo; inputs: options().inputs\"></ng-container>\n }\n</ng-template>\n\n<ng-template #codeContent>\n @if (assets().length === 1) {\n <ng-doc-code [html]=\"assets()[0].code\"></ng-doc-code>\n }\n\n @if (assets().length > 1) {\n <ng-doc-tab-group [openedTab]=\"options().defaultTab\">\n @for (asset of assets(); track asset.title) {\n <ng-doc-tab [id]=\"asset.title\" [label]=\"label\" [content]=\"assetContent\">\n <ng-template #label>\n @if (asset.icon) {\n <ng-doc-icon [customIcon]=\"asset.icon\"></ng-doc-icon>\n }\n {{ asset.title }}\n </ng-template>\n <ng-template #assetContent>\n <ng-doc-code [html]=\"asset.code\"></ng-doc-code>\n </ng-template>\n </ng-doc-tab>\n }\n </ng-doc-tab-group>\n }\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AA2BA;;;;AAIG;MAwBU,sBAAsB,CAAA;AAvBnC,IAAA,WAAA,GAAA;AAwBmB,QAAA,IAAA,CAAA,QAAQ,GAAG,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,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,IAAA,EAAA,EAAA,UAAA,EAAA,EAAA,OAAA,EAAA,yBAAA,EAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,QAAA,ECvDnC,ihDAyCA,EAAA,MAAA,EAAA,CAAA,
|
|
1
|
+
{"version":3,"file":"ng-doc-app-components-demo-pane.mjs","sources":["../../../../libs/app/components/demo-pane/demo-pane.component.ts","../../../../libs/app/components/demo-pane/demo-pane.component.html","../../../../libs/app/components/demo-pane/ng-doc-app-components-demo-pane.ts"],"sourcesContent":["import { NgComponentOutlet, NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n computed,\n inject,\n input,\n Signal,\n Type,\n} from '@angular/core';\nimport { NgDocRootPage } from '@ng-doc/app/classes/root-page';\nimport { NgDocCodeComponent } from '@ng-doc/app/components/code';\nimport { NgDocFullscreenButtonComponent } from '@ng-doc/app/components/fullscreen-button';\nimport { NgDocFullscreenToggleComponent } from '@ng-doc/app/components/fullscreen-toggle';\nimport { NgDocDemoAsset } from '@ng-doc/app/interfaces';\nimport { asArray } from '@ng-doc/core/helpers/as-array';\nimport { NgDocDemoPaneActionOptions } from '@ng-doc/core/interfaces';\nimport {\n NgDocFullscreenDirective,\n NgDocIconComponent,\n NgDocPaneBackDirective,\n NgDocPaneComponent,\n NgDocPaneFrontDirective,\n NgDocTabComponent,\n NgDocTabGroupComponent,\n} from '@ng-doc/ui-kit';\n\n/**\n * Renders a demo of the page in front of its source files, which the reader reveals by dragging\n * the pane's resizer. The demo sits on the dot-grid canvas of demos, with a control that shows it\n * fullscreen with the browser Fullscreen API where the browser supports it.\n */\n@Component({\n selector: 'ng-doc-demo-pane',\n templateUrl: './demo-pane.component.html',\n styleUrls: ['./demo-pane.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n imports: [\n NgDocPaneComponent,\n NgTemplateOutlet,\n NgDocPaneBackDirective,\n NgDocPaneFrontDirective,\n NgDocCodeComponent,\n NgDocTabGroupComponent,\n NgDocTabComponent,\n NgDocFullscreenButtonComponent,\n NgDocFullscreenDirective,\n NgDocFullscreenToggleComponent,\n NgComponentOutlet,\n NgDocIconComponent,\n ],\n host: {\n '[class]': 'options().class ?? \"\"',\n },\n})\nexport class NgDocDemoPaneComponent {\n private readonly rootPage = inject(NgDocRootPage);\n\n /** Name of the demo component in the page's `demos`. */\n readonly componentName = input<string | undefined>(undefined);\n\n /** Options of the `demoPane` action. */\n readonly options = input<NgDocDemoPaneActionOptions>({});\n\n /** The demo component. */\n readonly demo: Signal<Type<unknown> | undefined> = computed(() => {\n const name: string | undefined = this.componentName();\n\n return name ? this.rootPage.page?.demos?.[name] : undefined;\n });\n\n /** Source files of the demo, filtered by the `tabs` option. */\n readonly assets: Signal<NgDocDemoAsset[]> = computed(() => {\n const name: string | undefined = this.componentName();\n const tabs: string | string[] | undefined = this.options().tabs;\n\n return name\n ? (this.rootPage.demoAssets?.[name] ?? []).filter(\n (asset: NgDocDemoAsset) => !tabs?.length || asArray(tabs).includes(asset.title),\n )\n : [];\n });\n}\n","<ng-doc-pane [expanded]=\"options().expanded ?? false\">\n <ng-container *ngTemplateOutlet=\"codeContent\" ngDocPaneBack></ng-container>\n <div class=\"ng-doc-demo-pane-stage\" ngDocPaneFront ngDocFullscreen #stage=\"ngDocFullscreen\">\n <ng-container *ngTemplateOutlet=\"demoTemplate\"></ng-container>\n @if (!options().fullscreenRoute) {\n <ng-doc-fullscreen-toggle class=\"ng-doc-demo-pane-fullscreen\" [target]=\"stage\" />\n }\n </div>\n</ng-doc-pane>\n\n<ng-template #demoTemplate>\n @if (options().fullscreenRoute; as route) {\n <ng-doc-fullscreen-button [route]=\"route\"></ng-doc-fullscreen-button>\n } @else if (demo(); as demo) {\n <ng-container *ngComponentOutlet=\"demo; inputs: options().inputs\"></ng-container>\n }\n</ng-template>\n\n<ng-template #codeContent>\n @if (assets().length === 1) {\n <ng-doc-code [html]=\"assets()[0].code\"></ng-doc-code>\n }\n\n @if (assets().length > 1) {\n <ng-doc-tab-group [openedTab]=\"options().defaultTab\">\n @for (asset of assets(); track asset.title) {\n <ng-doc-tab [id]=\"asset.title\" [label]=\"label\" [content]=\"assetContent\">\n <ng-template #label>\n @if (asset.icon) {\n <ng-doc-icon [customIcon]=\"asset.icon\"></ng-doc-icon>\n }\n {{ asset.title }}\n </ng-template>\n <ng-template #assetContent>\n <ng-doc-code [html]=\"asset.code\"></ng-doc-code>\n </ng-template>\n </ng-doc-tab>\n }\n </ng-doc-tab-group>\n }\n</ng-template>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AA2BA;;;;AAIG;MAwBU,sBAAsB,CAAA;AAvBnC,IAAA,WAAA,GAAA;AAwBmB,QAAA,IAAA,CAAA,QAAQ,GAAG,MAAM,CAAC,aAAa,CAAC;;QAGxC,IAAA,CAAA,aAAa,GAAG,KAAK,CAAqB,SAAS;0FAAC;;QAGpD,IAAA,CAAA,OAAO,GAAG,KAAK,CAA6B,EAAE;oFAAC;;AAG/C,QAAA,IAAA,CAAA,IAAI,GAAsC,QAAQ,CAAC,MAAK;AAC/D,YAAA,MAAM,IAAI,GAAuB,IAAI,CAAC,aAAa,EAAE;AAErD,YAAA,OAAO,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC,GAAG,SAAS;QAC7D,CAAC;iFAAC;;AAGO,QAAA,IAAA,CAAA,MAAM,GAA6B,QAAQ,CAAC,MAAK;AACxD,YAAA,MAAM,IAAI,GAAuB,IAAI,CAAC,aAAa,EAAE;YACrD,MAAM,IAAI,GAAkC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI;AAE/D,YAAA,OAAO;AACL,kBAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,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