@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.
Files changed (173) hide show
  1. package/LICENSE +21 -0
  2. package/fesm2022/ng-doc-app-classes-content-controller.mjs +22 -4
  3. package/fesm2022/ng-doc-app-classes-content-controller.mjs.map +1 -1
  4. package/fesm2022/ng-doc-app-classes-default-search-engine.mjs +36 -12
  5. package/fesm2022/ng-doc-app-classes-default-search-engine.mjs.map +1 -1
  6. package/fesm2022/ng-doc-app-classes-root-page.mjs.map +1 -1
  7. package/fesm2022/ng-doc-app-components-api-list.mjs +7 -5
  8. package/fesm2022/ng-doc-app-components-api-list.mjs.map +1 -1
  9. package/fesm2022/ng-doc-app-components-breadcrumb.mjs +5 -3
  10. package/fesm2022/ng-doc-app-components-breadcrumb.mjs.map +1 -1
  11. package/fesm2022/ng-doc-app-components-code.mjs +6 -4
  12. package/fesm2022/ng-doc-app-components-code.mjs.map +1 -1
  13. package/fesm2022/ng-doc-app-components-command-palette.mjs +35 -27
  14. package/fesm2022/ng-doc-app-components-command-palette.mjs.map +1 -1
  15. package/fesm2022/ng-doc-app-components-copy-button.mjs +6 -4
  16. package/fesm2022/ng-doc-app-components-copy-button.mjs.map +1 -1
  17. package/fesm2022/ng-doc-app-components-demo-displayer.mjs +19 -4
  18. package/fesm2022/ng-doc-app-components-demo-displayer.mjs.map +1 -1
  19. package/fesm2022/ng-doc-app-components-demo-frame.mjs +279 -0
  20. package/fesm2022/ng-doc-app-components-demo-frame.mjs.map +1 -0
  21. package/fesm2022/ng-doc-app-components-demo-pane.mjs +2 -2
  22. package/fesm2022/ng-doc-app-components-demo-pane.mjs.map +1 -1
  23. package/fesm2022/ng-doc-app-components-demo.mjs +97 -14
  24. package/fesm2022/ng-doc-app-components-demo.mjs.map +1 -1
  25. package/fesm2022/ng-doc-app-components-fullscreen-button.mjs +5 -3
  26. package/fesm2022/ng-doc-app-components-fullscreen-button.mjs.map +1 -1
  27. package/fesm2022/ng-doc-app-components-fullscreen-toggle.mjs +4 -2
  28. package/fesm2022/ng-doc-app-components-fullscreen-toggle.mjs.map +1 -1
  29. package/fesm2022/ng-doc-app-components-heading-anchor.mjs +5 -3
  30. package/fesm2022/ng-doc-app-components-heading-anchor.mjs.map +1 -1
  31. package/fesm2022/ng-doc-app-components-image-viewer.mjs +5 -3
  32. package/fesm2022/ng-doc-app-components-image-viewer.mjs.map +1 -1
  33. package/fesm2022/ng-doc-app-components-navbar.mjs +4 -2
  34. package/fesm2022/ng-doc-app-components-navbar.mjs.map +1 -1
  35. package/fesm2022/ng-doc-app-components-page-navigation.mjs +5 -3
  36. package/fesm2022/ng-doc-app-components-page-navigation.mjs.map +1 -1
  37. package/fesm2022/ng-doc-app-components-page-wrapper.mjs +2 -2
  38. package/fesm2022/ng-doc-app-components-page-wrapper.mjs.map +1 -1
  39. package/fesm2022/ng-doc-app-components-page.mjs +83 -16
  40. package/fesm2022/ng-doc-app-components-page.mjs.map +1 -1
  41. package/fesm2022/ng-doc-app-components-playground.mjs +838 -141
  42. package/fesm2022/ng-doc-app-components-playground.mjs.map +1 -1
  43. package/fesm2022/ng-doc-app-components-root.mjs +51 -4
  44. package/fesm2022/ng-doc-app-components-root.mjs.map +1 -1
  45. package/fesm2022/ng-doc-app-components-search-result.mjs +8 -6
  46. package/fesm2022/ng-doc-app-components-search-result.mjs.map +1 -1
  47. package/fesm2022/ng-doc-app-components-search.mjs +7 -5
  48. package/fesm2022/ng-doc-app-components-search.mjs.map +1 -1
  49. package/fesm2022/ng-doc-app-components-sidebar.mjs +4 -3
  50. package/fesm2022/ng-doc-app-components-sidebar.mjs.map +1 -1
  51. package/fesm2022/ng-doc-app-components-tabs.mjs +21 -3
  52. package/fesm2022/ng-doc-app-components-tabs.mjs.map +1 -1
  53. package/fesm2022/ng-doc-app-components-theme-toggle.mjs +7 -5
  54. package/fesm2022/ng-doc-app-components-theme-toggle.mjs.map +1 -1
  55. package/fesm2022/ng-doc-app-components-toc.mjs +4 -2
  56. package/fesm2022/ng-doc-app-components-toc.mjs.map +1 -1
  57. package/fesm2022/ng-doc-app-components.mjs +1 -0
  58. package/fesm2022/ng-doc-app-components.mjs.map +1 -1
  59. package/fesm2022/ng-doc-app-constants.mjs +11 -1
  60. package/fesm2022/ng-doc-app-constants.mjs.map +1 -1
  61. package/fesm2022/ng-doc-app-demo-app.mjs +779 -0
  62. package/fesm2022/ng-doc-app-demo-app.mjs.map +1 -0
  63. package/fesm2022/ng-doc-app-helpers.mjs +147 -7
  64. package/fesm2022/ng-doc-app-helpers.mjs.map +1 -1
  65. package/fesm2022/ng-doc-app-processors-processors.mjs +30 -9
  66. package/fesm2022/ng-doc-app-processors-processors.mjs.map +1 -1
  67. package/fesm2022/ng-doc-app-providers-ng-doc-app.mjs +29 -18
  68. package/fesm2022/ng-doc-app-providers-ng-doc-app.mjs.map +1 -1
  69. package/fesm2022/ng-doc-app-providers-texts.mjs +53 -0
  70. package/fesm2022/ng-doc-app-providers-texts.mjs.map +1 -0
  71. package/fesm2022/ng-doc-app-providers-title.mjs +129 -0
  72. package/fesm2022/ng-doc-app-providers-title.mjs.map +1 -0
  73. package/fesm2022/ng-doc-app-providers.mjs +2 -0
  74. package/fesm2022/ng-doc-app-providers.mjs.map +1 -1
  75. package/fesm2022/ng-doc-app-services-content-scroll-intent.mjs +27 -2
  76. package/fesm2022/ng-doc-app-services-content-scroll-intent.mjs.map +1 -1
  77. package/fesm2022/ng-doc-app-services-highlighter.mjs +23 -16
  78. package/fesm2022/ng-doc-app-services-highlighter.mjs.map +1 -1
  79. package/fesm2022/ng-doc-app-services-route-preloader.mjs +34 -10
  80. package/fesm2022/ng-doc-app-services-route-preloader.mjs.map +1 -1
  81. package/fesm2022/ng-doc-app-services-shortcuts.mjs +38 -4
  82. package/fesm2022/ng-doc-app-services-shortcuts.mjs.map +1 -1
  83. package/fesm2022/ng-doc-app-texts-ar.mjs +238 -0
  84. package/fesm2022/ng-doc-app-texts-ar.mjs.map +1 -0
  85. package/fesm2022/ng-doc-app-texts-de.mjs +205 -0
  86. package/fesm2022/ng-doc-app-texts-de.mjs.map +1 -0
  87. package/fesm2022/ng-doc-app-texts-es.mjs +205 -0
  88. package/fesm2022/ng-doc-app-texts-es.mjs.map +1 -0
  89. package/fesm2022/ng-doc-app-texts-fr.mjs +205 -0
  90. package/fesm2022/ng-doc-app-texts-fr.mjs.map +1 -0
  91. package/fesm2022/ng-doc-app-texts-hi.mjs +219 -0
  92. package/fesm2022/ng-doc-app-texts-hi.mjs.map +1 -0
  93. package/fesm2022/ng-doc-app-texts-ja.mjs +205 -0
  94. package/fesm2022/ng-doc-app-texts-ja.mjs.map +1 -0
  95. package/fesm2022/ng-doc-app-texts-ko.mjs +205 -0
  96. package/fesm2022/ng-doc-app-texts-ko.mjs.map +1 -0
  97. package/fesm2022/ng-doc-app-texts-pt-br.mjs +205 -0
  98. package/fesm2022/ng-doc-app-texts-pt-br.mjs.map +1 -0
  99. package/fesm2022/ng-doc-app-texts-ru.mjs +231 -0
  100. package/fesm2022/ng-doc-app-texts-ru.mjs.map +1 -0
  101. package/fesm2022/ng-doc-app-texts-uk.mjs +231 -0
  102. package/fesm2022/ng-doc-app-texts-uk.mjs.map +1 -0
  103. package/fesm2022/ng-doc-app-texts-zh.mjs +205 -0
  104. package/fesm2022/ng-doc-app-texts-zh.mjs.map +1 -0
  105. package/fesm2022/ng-doc-app-tokens.mjs +214 -1
  106. package/fesm2022/ng-doc-app-tokens.mjs.map +1 -1
  107. package/fesm2022/ng-doc-app-type-controls-json-control.mjs +90 -0
  108. package/fesm2022/ng-doc-app-type-controls-json-control.mjs.map +1 -0
  109. package/fesm2022/ng-doc-app-type-controls-list-control.mjs +792 -0
  110. package/fesm2022/ng-doc-app-type-controls-list-control.mjs.map +1 -0
  111. package/fesm2022/ng-doc-app-type-controls-type-alias-control.mjs +45 -8
  112. package/fesm2022/ng-doc-app-type-controls-type-alias-control.mjs.map +1 -1
  113. package/fesm2022/ng-doc-app-type-controls.mjs +2 -0
  114. package/fesm2022/ng-doc-app-type-controls.mjs.map +1 -1
  115. package/package.json +73 -4
  116. package/styles/global.css +4 -0
  117. package/styles/main.css +4 -0
  118. package/styles/themes/dark.css +10 -0
  119. package/types/ng-doc-app-classes-default-search-engine.d.ts +11 -0
  120. package/types/ng-doc-app-classes-root-page.d.ts +13 -0
  121. package/types/ng-doc-app-components-api-list.d.ts +3 -1
  122. package/types/ng-doc-app-components-breadcrumb.d.ts +2 -1
  123. package/types/ng-doc-app-components-code.d.ts +2 -0
  124. package/types/ng-doc-app-components-command-palette.d.ts +3 -1
  125. package/types/ng-doc-app-components-copy-button.d.ts +3 -1
  126. package/types/ng-doc-app-components-demo-displayer.d.ts +13 -1
  127. package/types/ng-doc-app-components-demo-frame.d.ts +107 -0
  128. package/types/ng-doc-app-components-demo.d.ts +47 -10
  129. package/types/ng-doc-app-components-fullscreen-button.d.ts +2 -0
  130. package/types/ng-doc-app-components-fullscreen-toggle.d.ts +2 -0
  131. package/types/ng-doc-app-components-heading-anchor.d.ts +2 -0
  132. package/types/ng-doc-app-components-image-viewer.d.ts +2 -0
  133. package/types/ng-doc-app-components-navbar.d.ts +2 -0
  134. package/types/ng-doc-app-components-page-navigation.d.ts +2 -1
  135. package/types/ng-doc-app-components-page.d.ts +10 -1
  136. package/types/ng-doc-app-components-playground.d.ts +260 -42
  137. package/types/ng-doc-app-components-root.d.ts +18 -0
  138. package/types/ng-doc-app-components-search-result.d.ts +2 -0
  139. package/types/ng-doc-app-components-search.d.ts +2 -0
  140. package/types/ng-doc-app-components-sidebar.d.ts +2 -1
  141. package/types/ng-doc-app-components-tabs.d.ts +13 -3
  142. package/types/ng-doc-app-components-theme-toggle.d.ts +4 -1
  143. package/types/ng-doc-app-components-toc.d.ts +2 -1
  144. package/types/ng-doc-app-components.d.ts +1 -0
  145. package/types/ng-doc-app-constants.d.ts +11 -1
  146. package/types/ng-doc-app-demo-app.d.ts +297 -0
  147. package/types/ng-doc-app-helpers.d.ts +75 -4
  148. package/types/ng-doc-app-interfaces.d.ts +635 -6
  149. package/types/ng-doc-app-processors-processors.d.ts +5 -0
  150. package/types/ng-doc-app-providers-ng-doc-app.d.ts +7 -1
  151. package/types/ng-doc-app-providers-texts.d.ts +28 -0
  152. package/types/ng-doc-app-providers-title.d.ts +59 -0
  153. package/types/ng-doc-app-providers.d.ts +2 -0
  154. package/types/ng-doc-app-services-content-scroll-intent.d.ts +11 -1
  155. package/types/ng-doc-app-services-highlighter.d.ts +15 -6
  156. package/types/ng-doc-app-services-route-preloader.d.ts +13 -1
  157. package/types/ng-doc-app-services-shortcuts.d.ts +16 -0
  158. package/types/ng-doc-app-texts-ar.d.ts +13 -0
  159. package/types/ng-doc-app-texts-de.d.ts +12 -0
  160. package/types/ng-doc-app-texts-es.d.ts +12 -0
  161. package/types/ng-doc-app-texts-fr.d.ts +12 -0
  162. package/types/ng-doc-app-texts-hi.d.ts +12 -0
  163. package/types/ng-doc-app-texts-ja.d.ts +12 -0
  164. package/types/ng-doc-app-texts-ko.d.ts +12 -0
  165. package/types/ng-doc-app-texts-pt-br.d.ts +12 -0
  166. package/types/ng-doc-app-texts-ru.d.ts +12 -0
  167. package/types/ng-doc-app-texts-uk.d.ts +12 -0
  168. package/types/ng-doc-app-texts-zh.d.ts +12 -0
  169. package/types/ng-doc-app-tokens.d.ts +21 -2
  170. package/types/ng-doc-app-type-controls-json-control.d.ts +38 -0
  171. package/types/ng-doc-app-type-controls-list-control.d.ts +313 -0
  172. package/types/ng-doc-app-type-controls-type-alias-control.d.ts +28 -5
  173. package/types/ng-doc-app-type-controls.d.ts +2 -0
@@ -22,7 +22,7 @@ interface NgDocApplicationConfig {
22
22
  */
23
23
  uiKit?: NgDocUiConfig;
24
24
  /**
25
- * Shiki theme.
25
+ * Extra Shiki themes and languages for the code that the browser highlights.
26
26
  */
27
27
  shiki?: NgDocHighlighterConfig;
28
28
  /**
@@ -34,6 +34,12 @@ interface NgDocApplicationConfig {
34
34
  }
35
35
  /**
36
36
  * Provides the NgDoc application configuration.
37
+ *
38
+ * Add it to the application's providers, or to the `providers` of the route that holds the
39
+ * documentation, together with the other NgDoc providers: then NgDoc starts only when the reader
40
+ * opens the documentation, and its code stays out of the application's initial bundle. It starts
41
+ * with environment initializers, which run where it is provided. The server render waits until
42
+ * the code highlighter of playgrounds has loaded.
37
43
  * @param config - The optional application configuration.
38
44
  */
39
45
  declare function provideNgDocApp(config?: NgDocApplicationConfig): Array<EnvironmentProviders | Provider>;
@@ -0,0 +1,28 @@
1
+ import { Provider } from '@angular/core';
2
+ import { NgDocTextsOverrides } from '@ng-doc/app/interfaces';
3
+
4
+ /**
5
+ * Changes the texts NgDoc shows to readers, for example to translate them. Pass the groups and
6
+ * texts to change; every other text keeps its English default (`NG_DOC_DEFAULT_TEXTS`). NgDoc
7
+ * ships complete translations in entry points of their own, such as `NG_DOC_TEXTS_DE` from
8
+ * `@ng-doc/app/texts/de`; pass one first and your changes after it.
9
+ *
10
+ * Calls and arguments add up: in one injector they apply in order, so a later one wins for a
11
+ * text both set, and the providers of a child injector (a lazy route, for example) apply on top of the
12
+ * texts of its parent. The texts are read when a component is created, so they are fixed per
13
+ * injector: switch the language by reloading the application, not at run time.
14
+ * @example
15
+ * ```typescript
16
+ * provideNgDocTexts(NG_DOC_TEXTS_DE, { search: { placeholder: 'Handbuch durchsuchen…' } });
17
+ *
18
+ * provideNgDocTexts({
19
+ * search: { placeholder: 'Dokumentation durchsuchen…' },
20
+ * searchPalette: { noResults: ({ query }) => `Keine Ergebnisse für „${query}“` },
21
+ * });
22
+ * ```
23
+ * @param texts - The texts to change, by group, in the order they apply.
24
+ * @returns The providers to add to the application, a route or a page.
25
+ */
26
+ declare function provideNgDocTexts(...texts: NgDocTextsOverrides[]): Provider[];
27
+
28
+ export { provideNgDocTexts };
@@ -0,0 +1,59 @@
1
+ import { EnvironmentProviders } from '@angular/core';
2
+ import { RouterStateSnapshot } from '@angular/router';
3
+
4
+ /**
5
+ * The parts of the current route that `provideNgDocTitle` passes to its function.
6
+ *
7
+ * Outside the documentation (a landing page, for example), `categories` is empty and `page`,
8
+ * `tab` and `api` are not set.
9
+ */
10
+ interface NgDocTitleContext {
11
+ /**
12
+ * The title Angular sets by default: the title of the deepest route that has one. It is not set
13
+ * when no route of the navigation has a title.
14
+ */
15
+ readonly title: string | undefined;
16
+ /** Titles of the categories that contain the page, the outermost category first. */
17
+ readonly categories: readonly string[];
18
+ /**
19
+ * Title of the guide or the API list. A title in the page's own route replaces it. Not set on
20
+ * an API page, which sets `api` instead.
21
+ */
22
+ readonly page: string | undefined;
23
+ /**
24
+ * Title of the active tab, when the page has more than one tab. Not set on a tab titled like
25
+ * the page, usually its first one.
26
+ */
27
+ readonly tab: string | undefined;
28
+ /** Name of the API declaration, on an API page. */
29
+ readonly api: string | undefined;
30
+ /** The router state the title is for. */
31
+ readonly snapshot: RouterStateSnapshot;
32
+ }
33
+ /**
34
+ * Builds the browser tab title from the parts of the current route. It runs in an injection
35
+ * context, so it can call `inject()`. When it returns `undefined`, the title stays as it is.
36
+ */
37
+ type NgDocTitleFn = (context: NgDocTitleContext) => string | undefined;
38
+ /**
39
+ * Builds the browser tab title of every navigation with a function that receives the categories,
40
+ * the page, the tab and the API declaration of the route, so titles like
41
+ * "Installation · Getting started | NgDoc" need no parsing of route titles.
42
+ *
43
+ * Without it, Angular sets the title of the deepest route: the page's (or its tab's) title.
44
+ * @param titleFn - Builds the title; `undefined` keeps the current title.
45
+ * @example
46
+ * ```ts
47
+ * provideNgDocTitle(({ categories, page, tab, api, title }) => {
48
+ * const name = api ?? page;
49
+ *
50
+ * return name
51
+ * ? [tab, name, ...[...categories].reverse()].filter(Boolean).join(' · ') + ' | My library'
52
+ * : (title ?? 'My library');
53
+ * });
54
+ * ```
55
+ */
56
+ declare function provideNgDocTitle(titleFn: NgDocTitleFn): EnvironmentProviders;
57
+
58
+ export { provideNgDocTitle };
59
+ export type { NgDocTitleContext, NgDocTitleFn };
@@ -3,4 +3,6 @@ export * from '@ng-doc/app/providers/ng-doc-app';
3
3
  export * from '@ng-doc/app/providers/page-skeleton';
4
4
  export * from '@ng-doc/app/providers/playground-demo';
5
5
  export * from '@ng-doc/app/providers/search-engine';
6
+ export * from '@ng-doc/app/providers/texts';
7
+ export * from '@ng-doc/app/providers/title';
6
8
  export * from '@ng-doc/app/providers/type-control';
@@ -14,6 +14,7 @@ interface NgDocInitialContentScrollIntent {
14
14
  declare class NgDocContentScrollIntent {
15
15
  private readonly browser;
16
16
  private readonly router;
17
+ private readonly location;
17
18
  private candidate?;
18
19
  private intent?;
19
20
  private readonly listeners;
@@ -26,7 +27,10 @@ declare class NgDocContentScrollIntent {
26
27
  */
27
28
  readonly currentIntent: Signal<NgDocInitialContentScrollIntent | undefined>;
28
29
  constructor();
29
- /** Starts following router events. Does nothing on the server or when already started. */
30
+ /**
31
+ * Starts following router events. Does nothing on the server or when already started. Started
32
+ * during a navigation, it follows that navigation too.
33
+ */
30
34
  start(): void;
31
35
  /**
32
36
  * Calls the listener with every change of the intent, and at once with the pending one.
@@ -40,6 +44,12 @@ declare class NgDocContentScrollIntent {
40
44
  */
41
45
  settle(navigationId: number): void;
42
46
  private navigationStarted;
47
+ /**
48
+ * Takes the navigation in progress as the candidate. The providers of a lazy route start the
49
+ * intent while the router loads that route, after the first navigation has started, and its
50
+ * fragment must still be replayed.
51
+ */
52
+ private followCurrentNavigation;
43
53
  private navigationEnded;
44
54
  private scrolled;
45
55
  private publish;
@@ -1,7 +1,7 @@
1
1
  import * as _ng_doc_app_tokens from '@ng-doc/app/tokens';
2
2
  import * as i0 from '@angular/core';
3
3
  import { OnDestroy, Signal } from '@angular/core';
4
- import { ThemeInput } from 'shiki';
4
+ import { ThemeInput, LanguageInput } from 'shiki/core';
5
5
 
6
6
  /** Shiki configuration of the code highlighter. */
7
7
  interface NgDocHighlighterConfig {
@@ -9,6 +9,13 @@ interface NgDocHighlighterConfig {
9
9
  * Themes sources.
10
10
  */
11
11
  themes?: ThemeInput[];
12
+ /**
13
+ * Shiki languages to load besides `angular-html`, the language of playground code, and the
14
+ * languages it embeds. A language named like one of them replaces it, so register here the
15
+ * languages of `shiki.langs` in `ng-doc.config.ts` that playground code uses, for example a newer
16
+ * Angular template grammar.
17
+ */
18
+ langs?: LanguageInput[];
12
19
  /**
13
20
  * Has no effect, and is reported in development mode.
14
21
  *
@@ -24,7 +31,9 @@ interface NgDocHighlighterConfig {
24
31
  };
25
32
  }
26
33
  /**
27
- * Highlights code with Shiki. `provideNgDocApp` initializes it before the application renders.
34
+ * Highlights code with Shiki. `provideNgDocApp` starts its initialization where it is provided (the
35
+ * application, or the route that holds the documentation), and the server render waits for it.
36
+ * Shiki is loaded on demand: `initialize()` imports it.
28
37
  */
29
38
  declare class NgDocHighlighterService implements OnDestroy {
30
39
  private static defaultInitialization?;
@@ -41,12 +50,12 @@ declare class NgDocHighlighterService implements OnDestroy {
41
50
  readonly ready: Signal<boolean>;
42
51
  /**
43
52
  * Loads Shiki with the built-in themes (`github-light`, `ayu-dark` and NgDoc's `css-variables`)
44
- * and the given ones. Concurrent and repeated calls share one initialization; a failed one can
45
- * be retried.
46
- * @param config - Custom Shiki themes to load.
53
+ * and the given ones, and the given languages. Concurrent and repeated calls share one
54
+ * initialization; a failed one can be retried.
55
+ * @param config - Custom Shiki themes and languages to load.
47
56
  */
48
57
  initialize(config?: NgDocHighlighterConfig): Promise<void>;
49
- /** Disposes the highlighter this service created for custom themes. */
58
+ /** Disposes the highlighter this service created for custom themes or languages. */
50
59
  ngOnDestroy(): void;
51
60
  private static create;
52
61
  /**
@@ -95,11 +95,23 @@ declare class NgDocRoutePreloader {
95
95
  /**
96
96
  * Returns the application URL of a link, or `undefined` for a link that leaves the
97
97
  * application, opens elsewhere, downloads a file or points into the current page.
98
+ *
99
+ * The link is read through the location strategy: with `PathLocationStrategy` the route is the
100
+ * link's path, and with `HashLocationStrategy` (`withHashLocation()`) it is the link's fragment
101
+ * (`#/docs/page`), so a fragment that is not a route (`#usage`) is an anchor on the page.
98
102
  * @param anchor - The link.
99
103
  * @returns The URL relative to the application's base, with its query.
100
104
  */
101
105
  private linkUrl;
102
- /** The base path of the application, ending with a slash. */
106
+ /**
107
+ * Whether the location strategy keeps the route in the document's fragment, as
108
+ * `HashLocationStrategy` does.
109
+ */
110
+ private hashLocation;
111
+ /**
112
+ * The base path of the application's routes, ending with a slash: the base href, which a
113
+ * fragment route carries only when `APP_BASE_HREF` sets one.
114
+ */
103
115
  private basePath;
104
116
  private destroy;
105
117
  static ɵfac: i0.ɵɵFactoryDeclaration<NgDocRoutePreloader, never>;
@@ -43,6 +43,10 @@ declare const NG_DOC_STORE_SHORTCUTS_KEY: string;
43
43
  * the choice is saved in the browser. A site turns them off by default with the shortcuts option
44
44
  * of provideNgDocApp. They never run while the reader types in a field or holds Command, Control
45
45
  * or Alt. Chords such as Command+K (Control+K) always work.
46
+ *
47
+ * Shortcuts run only while the documentation layout is shown: `NgDocRootComponent` turns them on
48
+ * with `listen()`, so the other pages of an application that shows its documentation under a
49
+ * route keep their own keys.
46
50
  */
47
51
  declare class NgDocShortcutsService {
48
52
  private readonly document;
@@ -52,6 +56,10 @@ declare class NgDocShortcutsService {
52
56
  private readonly appDefault;
53
57
  private readonly userChoice;
54
58
  private readonly shortcuts;
59
+ private readonly listener;
60
+ /** The layouts that listen for the shortcuts; the document listener is on while there are any. */
61
+ private listeners;
62
+ private destroyed;
55
63
  private themeToggle?;
56
64
  /**
57
65
  * Whether single-key shortcuts are on: the reader's saved choice, or the site's default.
@@ -59,6 +67,14 @@ declare class NgDocShortcutsService {
59
67
  */
60
68
  readonly enabled: Signal<boolean>;
61
69
  constructor();
70
+ /**
71
+ * Runs the shortcuts on key presses until the returned function is called. `NgDocRootComponent`
72
+ * calls it while the documentation layout is shown; a site with a layout of its own calls it
73
+ * the same way. Several callers may listen at once: the shortcuts run until each has stopped.
74
+ * Does nothing on the server.
75
+ * @returns A function that stops listening; later calls do nothing.
76
+ */
77
+ listen(): () => void;
62
78
  /**
63
79
  * Turns single-key shortcuts on or off for this reader and saves the choice in the browser.
64
80
  * @param enabled - Whether single-key shortcuts should run.
@@ -0,0 +1,13 @@
1
+ import { NgDocTexts } from '@ng-doc/app/interfaces';
2
+
3
+ /**
4
+ * The Arabic texts of NgDoc, for `provideNgDocTexts(NG_DOC_TEXTS_AR)`. Pass your own changes after
5
+ * them: `provideNgDocTexts(NG_DOC_TEXTS_AR, { search: { placeholder: '…' } })`. NgDoc's layout is
6
+ * left-to-right, so these texts translate the interface but don't mirror it.
7
+ *
8
+ * These translations welcome corrections: open an issue or a pull request at
9
+ * https://github.com/ng-doc/ng-doc that names the text (its group and key) and your wording.
10
+ */
11
+ declare const NG_DOC_TEXTS_AR: NgDocTexts;
12
+
13
+ export { NG_DOC_TEXTS_AR };
@@ -0,0 +1,12 @@
1
+ import { NgDocTexts } from '@ng-doc/app/interfaces';
2
+
3
+ /**
4
+ * The German texts of NgDoc, for `provideNgDocTexts(NG_DOC_TEXTS_DE)`. Pass your own changes after
5
+ * them: `provideNgDocTexts(NG_DOC_TEXTS_DE, { search: { placeholder: '…' } })`.
6
+ *
7
+ * These translations welcome corrections: open an issue or a pull request at
8
+ * https://github.com/ng-doc/ng-doc that names the text (its group and key) and your wording.
9
+ */
10
+ declare const NG_DOC_TEXTS_DE: NgDocTexts;
11
+
12
+ export { NG_DOC_TEXTS_DE };
@@ -0,0 +1,12 @@
1
+ import { NgDocTexts } from '@ng-doc/app/interfaces';
2
+
3
+ /**
4
+ * The Spanish texts of NgDoc, for `provideNgDocTexts(NG_DOC_TEXTS_ES)`. Pass your own changes after
5
+ * them: `provideNgDocTexts(NG_DOC_TEXTS_ES, { search: { placeholder: '…' } })`.
6
+ *
7
+ * These translations welcome corrections: open an issue or a pull request at
8
+ * https://github.com/ng-doc/ng-doc that names the text (its group and key) and your wording.
9
+ */
10
+ declare const NG_DOC_TEXTS_ES: NgDocTexts;
11
+
12
+ export { NG_DOC_TEXTS_ES };
@@ -0,0 +1,12 @@
1
+ import { NgDocTexts } from '@ng-doc/app/interfaces';
2
+
3
+ /**
4
+ * The French texts of NgDoc, for `provideNgDocTexts(NG_DOC_TEXTS_FR)`. Pass your own changes after
5
+ * them: `provideNgDocTexts(NG_DOC_TEXTS_FR, { search: { placeholder: '…' } })`.
6
+ *
7
+ * These translations welcome corrections: open an issue or a pull request at
8
+ * https://github.com/ng-doc/ng-doc that names the text (its group and key) and your wording.
9
+ */
10
+ declare const NG_DOC_TEXTS_FR: NgDocTexts;
11
+
12
+ export { NG_DOC_TEXTS_FR };
@@ -0,0 +1,12 @@
1
+ import { NgDocTexts } from '@ng-doc/app/interfaces';
2
+
3
+ /**
4
+ * The Hindi texts of NgDoc, for `provideNgDocTexts(NG_DOC_TEXTS_HI)`. Pass your own changes after
5
+ * them: `provideNgDocTexts(NG_DOC_TEXTS_HI, { search: { placeholder: '…' } })`.
6
+ *
7
+ * These translations welcome corrections: open an issue or a pull request at
8
+ * https://github.com/ng-doc/ng-doc that names the text (its group and key) and your wording.
9
+ */
10
+ declare const NG_DOC_TEXTS_HI: NgDocTexts;
11
+
12
+ export { NG_DOC_TEXTS_HI };
@@ -0,0 +1,12 @@
1
+ import { NgDocTexts } from '@ng-doc/app/interfaces';
2
+
3
+ /**
4
+ * The Japanese texts of NgDoc, for `provideNgDocTexts(NG_DOC_TEXTS_JA)`. Pass your own changes
5
+ * after them: `provideNgDocTexts(NG_DOC_TEXTS_JA, { search: { placeholder: '…' } })`.
6
+ *
7
+ * These translations welcome corrections: open an issue or a pull request at
8
+ * https://github.com/ng-doc/ng-doc that names the text (its group and key) and your wording.
9
+ */
10
+ declare const NG_DOC_TEXTS_JA: NgDocTexts;
11
+
12
+ export { NG_DOC_TEXTS_JA };
@@ -0,0 +1,12 @@
1
+ import { NgDocTexts } from '@ng-doc/app/interfaces';
2
+
3
+ /**
4
+ * The Korean texts of NgDoc, for `provideNgDocTexts(NG_DOC_TEXTS_KO)`. Pass your own changes
5
+ * after them: `provideNgDocTexts(NG_DOC_TEXTS_KO, { search: { placeholder: '…' } })`.
6
+ *
7
+ * These translations welcome corrections: open an issue or a pull request at
8
+ * https://github.com/ng-doc/ng-doc that names the text (its group and key) and your wording.
9
+ */
10
+ declare const NG_DOC_TEXTS_KO: NgDocTexts;
11
+
12
+ export { NG_DOC_TEXTS_KO };
@@ -0,0 +1,12 @@
1
+ import { NgDocTexts } from '@ng-doc/app/interfaces';
2
+
3
+ /**
4
+ * The Brazilian Portuguese texts of NgDoc, for `provideNgDocTexts(NG_DOC_TEXTS_PT_BR)`. Pass your
5
+ * own changes after them: `provideNgDocTexts(NG_DOC_TEXTS_PT_BR, { search: { placeholder: '…' } })`.
6
+ *
7
+ * These translations welcome corrections: open an issue or a pull request at
8
+ * https://github.com/ng-doc/ng-doc that names the text (its group and key) and your wording.
9
+ */
10
+ declare const NG_DOC_TEXTS_PT_BR: NgDocTexts;
11
+
12
+ export { NG_DOC_TEXTS_PT_BR };
@@ -0,0 +1,12 @@
1
+ import { NgDocTexts } from '@ng-doc/app/interfaces';
2
+
3
+ /**
4
+ * The Russian texts of NgDoc, for `provideNgDocTexts(NG_DOC_TEXTS_RU)`. Pass your own changes after
5
+ * them: `provideNgDocTexts(NG_DOC_TEXTS_RU, { search: { placeholder: '…' } })`.
6
+ *
7
+ * These translations welcome corrections: open an issue or a pull request at
8
+ * https://github.com/ng-doc/ng-doc that names the text (its group and key) and your wording.
9
+ */
10
+ declare const NG_DOC_TEXTS_RU: NgDocTexts;
11
+
12
+ export { NG_DOC_TEXTS_RU };
@@ -0,0 +1,12 @@
1
+ import { NgDocTexts } from '@ng-doc/app/interfaces';
2
+
3
+ /**
4
+ * The Ukrainian texts of NgDoc, for `provideNgDocTexts(NG_DOC_TEXTS_UK)`. Pass your own changes
5
+ * after them: `provideNgDocTexts(NG_DOC_TEXTS_UK, { search: { placeholder: '…' } })`.
6
+ *
7
+ * These translations welcome corrections: open an issue or a pull request at
8
+ * https://github.com/ng-doc/ng-doc that names the text (its group and key) and your wording.
9
+ */
10
+ declare const NG_DOC_TEXTS_UK: NgDocTexts;
11
+
12
+ export { NG_DOC_TEXTS_UK };
@@ -0,0 +1,12 @@
1
+ import { NgDocTexts } from '@ng-doc/app/interfaces';
2
+
3
+ /**
4
+ * The Simplified Chinese texts of NgDoc, for `provideNgDocTexts(NG_DOC_TEXTS_ZH)`. Pass your own
5
+ * changes after them: `provideNgDocTexts(NG_DOC_TEXTS_ZH, { search: { placeholder: '…' } })`.
6
+ *
7
+ * These translations welcome corrections: open an issue or a pull request at
8
+ * https://github.com/ng-doc/ng-doc that names the text (its group and key) and your wording.
9
+ */
10
+ declare const NG_DOC_TEXTS_ZH: NgDocTexts;
11
+
12
+ export { NG_DOC_TEXTS_ZH };
@@ -1,5 +1,5 @@
1
1
  import { InjectionToken, Provider } from '@angular/core';
2
- import { NgDocContext, NgDocPageProcessor, NgDocPageSkeleton, NgDocTypeControl } from '@ng-doc/app/interfaces';
2
+ import { NgDocContext, NgDocPageProcessor, NgDocPageSkeleton, NgDocTexts, NgDocTextsOverrides, NgDocTypeControl } from '@ng-doc/app/interfaces';
3
3
  import { Mermaid } from 'mermaid';
4
4
 
5
5
  /** Enables one delayed anchor replay after asynchronous NgDoc content is processed. */
@@ -37,7 +37,26 @@ interface NgDocShikiTheme {
37
37
  }
38
38
  declare const NG_DOC_SHIKI_THEME: InjectionToken<NgDocShikiTheme>;
39
39
 
40
+ /**
41
+ * The English texts of the NgDoc application. They are the texts NgDoc showed before the texts
42
+ * could be changed, so an application that changes none renders as before.
43
+ */
44
+ declare const NG_DOC_DEFAULT_TEXTS: NgDocTexts;
45
+ /**
46
+ * The texts the NgDoc application shows. It resolves to `NG_DOC_DEFAULT_TEXTS` unless
47
+ * `provideNgDocTexts` changes them. Inject it to show the same texts in your own components.
48
+ */
49
+ declare const NG_DOC_TEXTS: InjectionToken<NgDocTexts>;
50
+ /**
51
+ * Applies changes to texts: each group of each change replaces the texts it sets, in order, so a
52
+ * later change wins. A text set to `undefined` keeps its value. The result is frozen.
53
+ * @param texts - The texts to change.
54
+ * @param overrides - The changes, the last one winning.
55
+ * @returns New texts; `texts` and the changes are left as they are.
56
+ */
57
+ declare function mergeNgDocTexts(texts: NgDocTexts, ...overrides: readonly NgDocTextsOverrides[]): NgDocTexts;
58
+
40
59
  declare const NG_DOC_TYPE_CONTROL: InjectionToken<NgDocTypeControl>;
41
60
 
42
- export { NG_DOC_CONTENT_ANCHOR_SCROLLING, NG_DOC_CONTENT_SCROLL_POSITION_RESTORATION, NG_DOC_CONTEXT, NG_DOC_MERMAID, NG_DOC_PAGE_CUSTOM_PROCESSOR, NG_DOC_PAGE_PROCESSOR, NG_DOC_PAGE_SKELETON, NG_DOC_ROUTE_PREFIX, NG_DOC_SHIKI_THEME, NG_DOC_TYPE_CONTROL, provideMainPageProcessor, providePageProcessor };
61
+ export { NG_DOC_CONTENT_ANCHOR_SCROLLING, NG_DOC_CONTENT_SCROLL_POSITION_RESTORATION, NG_DOC_CONTEXT, NG_DOC_DEFAULT_TEXTS, NG_DOC_MERMAID, NG_DOC_PAGE_CUSTOM_PROCESSOR, NG_DOC_PAGE_PROCESSOR, NG_DOC_PAGE_SKELETON, NG_DOC_ROUTE_PREFIX, NG_DOC_SHIKI_THEME, NG_DOC_TEXTS, NG_DOC_TYPE_CONTROL, mergeNgDocTexts, provideMainPageProcessor, providePageProcessor };
43
62
  export type { NgDocContentScrollPositionRestoration, NgDocShikiTheme };
@@ -0,0 +1,38 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { Signal } from '@angular/core';
3
+ import { NgDocTypeControl, NgDocPlaygroundTexts } from '@ng-doc/app/interfaces';
4
+ import { DIControl } from 'di-controls';
5
+
6
+ /**
7
+ * The playground control of array inputs that have no list control, such as `Item[]` or
8
+ * `[string, number]`: a text area that holds the value as JSON.
9
+ *
10
+ * Text that parses sets the value; while the text is not JSON, the field is marked as invalid and
11
+ * the input keeps its last valid value. An empty field is `undefined`, and the value that the
12
+ * playground writes is shown as JSON again, so the text and the value always match. It edits any
13
+ * value that JSON can hold, so it can also be registered for an object type.
14
+ */
15
+ declare class NgDocJsonControlComponent<T = unknown> extends DIControl<T | undefined> implements NgDocTypeControl<T | undefined> {
16
+ /** The text of the field. */
17
+ protected readonly text: _angular_core.WritableSignal<string>;
18
+ /** Whether the text is not JSON. */
19
+ protected readonly invalid: _angular_core.WritableSignal<boolean>;
20
+ /** The rows of the field: its lines, from 2 to 10. */
21
+ protected readonly rows: Signal<number>;
22
+ protected readonly texts: NgDocPlaygroundTexts;
23
+ /** ID of the message that describes invalid text. */
24
+ protected readonly errorId: string;
25
+ /** The value that the text stands for. */
26
+ private textValue;
27
+ constructor();
28
+ writeValue(value: T | null | undefined): void;
29
+ /**
30
+ * Sets the value from the text of the field, when it is JSON.
31
+ * @param text - The text of the field.
32
+ */
33
+ protected edit(text: string): void;
34
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgDocJsonControlComponent<any>, never>;
35
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgDocJsonControlComponent<any>, "ng-doc-json-control", never, {}, {}, never, never, true, never>;
36
+ }
37
+
38
+ export { NgDocJsonControlComponent };