@ng-doc/app 22.1.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 (157) 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 +195 -12
  20. package/fesm2022/ng-doc-app-components-demo-frame.mjs.map +1 -1
  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 +49 -12
  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 +743 -108
  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-theme-toggle.mjs +7 -5
  52. package/fesm2022/ng-doc-app-components-theme-toggle.mjs.map +1 -1
  53. package/fesm2022/ng-doc-app-components-toc.mjs +4 -2
  54. package/fesm2022/ng-doc-app-components-toc.mjs.map +1 -1
  55. package/fesm2022/ng-doc-app-constants.mjs +11 -1
  56. package/fesm2022/ng-doc-app-constants.mjs.map +1 -1
  57. package/fesm2022/ng-doc-app-demo-app.mjs +618 -15
  58. package/fesm2022/ng-doc-app-demo-app.mjs.map +1 -1
  59. package/fesm2022/ng-doc-app-helpers.mjs +125 -6
  60. package/fesm2022/ng-doc-app-helpers.mjs.map +1 -1
  61. package/fesm2022/ng-doc-app-providers-ng-doc-app.mjs +29 -18
  62. package/fesm2022/ng-doc-app-providers-ng-doc-app.mjs.map +1 -1
  63. package/fesm2022/ng-doc-app-providers-texts.mjs +53 -0
  64. package/fesm2022/ng-doc-app-providers-texts.mjs.map +1 -0
  65. package/fesm2022/ng-doc-app-providers.mjs +1 -0
  66. package/fesm2022/ng-doc-app-providers.mjs.map +1 -1
  67. package/fesm2022/ng-doc-app-services-content-scroll-intent.mjs +27 -2
  68. package/fesm2022/ng-doc-app-services-content-scroll-intent.mjs.map +1 -1
  69. package/fesm2022/ng-doc-app-services-highlighter.mjs +8 -5
  70. package/fesm2022/ng-doc-app-services-highlighter.mjs.map +1 -1
  71. package/fesm2022/ng-doc-app-services-shortcuts.mjs +38 -4
  72. package/fesm2022/ng-doc-app-services-shortcuts.mjs.map +1 -1
  73. package/fesm2022/ng-doc-app-texts-ar.mjs +238 -0
  74. package/fesm2022/ng-doc-app-texts-ar.mjs.map +1 -0
  75. package/fesm2022/ng-doc-app-texts-de.mjs +205 -0
  76. package/fesm2022/ng-doc-app-texts-de.mjs.map +1 -0
  77. package/fesm2022/ng-doc-app-texts-es.mjs +205 -0
  78. package/fesm2022/ng-doc-app-texts-es.mjs.map +1 -0
  79. package/fesm2022/ng-doc-app-texts-fr.mjs +205 -0
  80. package/fesm2022/ng-doc-app-texts-fr.mjs.map +1 -0
  81. package/fesm2022/ng-doc-app-texts-hi.mjs +219 -0
  82. package/fesm2022/ng-doc-app-texts-hi.mjs.map +1 -0
  83. package/fesm2022/ng-doc-app-texts-ja.mjs +205 -0
  84. package/fesm2022/ng-doc-app-texts-ja.mjs.map +1 -0
  85. package/fesm2022/ng-doc-app-texts-ko.mjs +205 -0
  86. package/fesm2022/ng-doc-app-texts-ko.mjs.map +1 -0
  87. package/fesm2022/ng-doc-app-texts-pt-br.mjs +205 -0
  88. package/fesm2022/ng-doc-app-texts-pt-br.mjs.map +1 -0
  89. package/fesm2022/ng-doc-app-texts-ru.mjs +231 -0
  90. package/fesm2022/ng-doc-app-texts-ru.mjs.map +1 -0
  91. package/fesm2022/ng-doc-app-texts-uk.mjs +231 -0
  92. package/fesm2022/ng-doc-app-texts-uk.mjs.map +1 -0
  93. package/fesm2022/ng-doc-app-texts-zh.mjs +205 -0
  94. package/fesm2022/ng-doc-app-texts-zh.mjs.map +1 -0
  95. package/fesm2022/ng-doc-app-tokens.mjs +214 -1
  96. package/fesm2022/ng-doc-app-tokens.mjs.map +1 -1
  97. package/fesm2022/ng-doc-app-type-controls-json-control.mjs +90 -0
  98. package/fesm2022/ng-doc-app-type-controls-json-control.mjs.map +1 -0
  99. package/fesm2022/ng-doc-app-type-controls-list-control.mjs +792 -0
  100. package/fesm2022/ng-doc-app-type-controls-list-control.mjs.map +1 -0
  101. package/fesm2022/ng-doc-app-type-controls-type-alias-control.mjs +5 -3
  102. package/fesm2022/ng-doc-app-type-controls-type-alias-control.mjs.map +1 -1
  103. package/fesm2022/ng-doc-app-type-controls.mjs +2 -0
  104. package/fesm2022/ng-doc-app-type-controls.mjs.map +1 -1
  105. package/package.json +59 -3
  106. package/styles/global.css +1 -0
  107. package/styles/main.css +1 -0
  108. package/types/ng-doc-app-classes-default-search-engine.d.ts +11 -0
  109. package/types/ng-doc-app-classes-root-page.d.ts +5 -0
  110. package/types/ng-doc-app-components-api-list.d.ts +3 -1
  111. package/types/ng-doc-app-components-breadcrumb.d.ts +2 -1
  112. package/types/ng-doc-app-components-code.d.ts +2 -0
  113. package/types/ng-doc-app-components-command-palette.d.ts +3 -1
  114. package/types/ng-doc-app-components-copy-button.d.ts +3 -1
  115. package/types/ng-doc-app-components-demo-displayer.d.ts +13 -1
  116. package/types/ng-doc-app-components-demo-frame.d.ts +62 -3
  117. package/types/ng-doc-app-components-demo.d.ts +27 -8
  118. package/types/ng-doc-app-components-fullscreen-button.d.ts +2 -0
  119. package/types/ng-doc-app-components-fullscreen-toggle.d.ts +2 -0
  120. package/types/ng-doc-app-components-heading-anchor.d.ts +2 -0
  121. package/types/ng-doc-app-components-image-viewer.d.ts +2 -0
  122. package/types/ng-doc-app-components-navbar.d.ts +2 -0
  123. package/types/ng-doc-app-components-page-navigation.d.ts +2 -1
  124. package/types/ng-doc-app-components-page.d.ts +10 -1
  125. package/types/ng-doc-app-components-playground.d.ts +241 -44
  126. package/types/ng-doc-app-components-root.d.ts +18 -0
  127. package/types/ng-doc-app-components-search-result.d.ts +2 -0
  128. package/types/ng-doc-app-components-search.d.ts +2 -0
  129. package/types/ng-doc-app-components-sidebar.d.ts +2 -1
  130. package/types/ng-doc-app-components-theme-toggle.d.ts +4 -1
  131. package/types/ng-doc-app-components-toc.d.ts +2 -1
  132. package/types/ng-doc-app-constants.d.ts +11 -1
  133. package/types/ng-doc-app-demo-app.d.ts +211 -3
  134. package/types/ng-doc-app-helpers.d.ts +56 -3
  135. package/types/ng-doc-app-interfaces.d.ts +621 -3
  136. package/types/ng-doc-app-providers-ng-doc-app.d.ts +6 -0
  137. package/types/ng-doc-app-providers-texts.d.ts +28 -0
  138. package/types/ng-doc-app-providers.d.ts +1 -0
  139. package/types/ng-doc-app-services-content-scroll-intent.d.ts +11 -1
  140. package/types/ng-doc-app-services-highlighter.d.ts +3 -1
  141. package/types/ng-doc-app-services-shortcuts.d.ts +16 -0
  142. package/types/ng-doc-app-texts-ar.d.ts +13 -0
  143. package/types/ng-doc-app-texts-de.d.ts +12 -0
  144. package/types/ng-doc-app-texts-es.d.ts +12 -0
  145. package/types/ng-doc-app-texts-fr.d.ts +12 -0
  146. package/types/ng-doc-app-texts-hi.d.ts +12 -0
  147. package/types/ng-doc-app-texts-ja.d.ts +12 -0
  148. package/types/ng-doc-app-texts-ko.d.ts +12 -0
  149. package/types/ng-doc-app-texts-pt-br.d.ts +12 -0
  150. package/types/ng-doc-app-texts-ru.d.ts +12 -0
  151. package/types/ng-doc-app-texts-uk.d.ts +12 -0
  152. package/types/ng-doc-app-texts-zh.d.ts +12 -0
  153. package/types/ng-doc-app-tokens.d.ts +21 -2
  154. package/types/ng-doc-app-type-controls-json-control.d.ts +38 -0
  155. package/types/ng-doc-app-type-controls-list-control.d.ts +313 -0
  156. package/types/ng-doc-app-type-controls-type-alias-control.d.ts +2 -1
  157. package/types/ng-doc-app-type-controls.d.ts +2 -0
@@ -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 };
@@ -3,5 +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';
6
7
  export * from '@ng-doc/app/providers/title';
7
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;
@@ -31,7 +31,9 @@ interface NgDocHighlighterConfig {
31
31
  };
32
32
  }
33
33
  /**
34
- * 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.
35
37
  */
36
38
  declare class NgDocHighlighterService implements OnDestroy {
37
39
  private static defaultInitialization?;
@@ -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 };
@@ -0,0 +1,313 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { Signal } from '@angular/core';
3
+ import { NgDocResolvedPlaygroundOption } from '@ng-doc/app/helpers';
4
+ import { NgDocTypeControl, NgDocPlaygroundTexts } from '@ng-doc/app/interfaces';
5
+ import { NgDocPlaygroundOption } from '@ng-doc/core/interfaces';
6
+ import { DIControl } from 'di-controls';
7
+
8
+ /** A value that an item of an array control can be. */
9
+ type NgDocListControlItem = string | number | boolean;
10
+ /** A row of the dropdown of an array control. */
11
+ interface NgDocListControlRow<T> {
12
+ /** `add` for the row that adds the typed text, `item` for a suggestion or a value of a union. */
13
+ kind: 'add' | 'item';
14
+ /** The value that the row adds. */
15
+ value: T;
16
+ /** The text of the value. */
17
+ label: string;
18
+ /** Whether the array holds the value: a picked value of a union. */
19
+ selected: boolean;
20
+ }
21
+ /**
22
+ * The base of the playground controls of array inputs: a chip combobox. The items are chips, in
23
+ * one field with a text field after them. Enter adds the typed value, Backspace in the empty field
24
+ * removes the last chip, and the × of a chip removes it. A chip is dragged to another place, or
25
+ * moved with Alt+Left and Alt+Right while it is focused, and the arrow keys move between chips.
26
+ * While the reader types, a dropdown lists the matching suggestions; the arrow keys move its
27
+ * highlight, and Enter or a click picks a row. Escape closes it.
28
+ *
29
+ * Subclasses decide what an item is: typed text (`parseItem`) for the arrays of strings and
30
+ * numbers, which suggest the input's default items and the items removed while the control is
31
+ * shown, or the values of a union, which the dropdown lists (`NgDocTypeAliasListControlComponent`).
32
+ *
33
+ * The control never changes an array it received: every edit reports a new array of plain values,
34
+ * so the value can be compared with the default and sent to an isolated demo as it is. An
35
+ * `undefined` or `null` value has no items and shows as such; the first added item makes it an
36
+ * array, and removing the last item leaves an empty array. Reset returns to the input's default,
37
+ * which is how an optional input gets back to `undefined`.
38
+ */
39
+ declare abstract class NgDocListControl<T extends NgDocListControlItem> extends DIControl<T[] | undefined> implements NgDocTypeControl<T[] | undefined> {
40
+ /** Default value of the input; Reset returns to it. */
41
+ readonly default: _angular_core.InputSignal<T[] | undefined>;
42
+ /**
43
+ * Whether typed text becomes an item (`parseItem`). Without it, the dropdown lists the values the
44
+ * items can have, and a value is in the array at most once.
45
+ */
46
+ protected abstract readonly freeText: boolean;
47
+ protected readonly texts: NgDocPlaygroundTexts;
48
+ /** The prefix of the IDs of the parts of the control. */
49
+ protected readonly id: string;
50
+ /** The items of the value; none when the value is not an array. */
51
+ protected readonly items: Signal<readonly T[]>;
52
+ /** The items as the chips show them: in the order of a drag in progress. */
53
+ protected readonly shownItems: Signal<readonly T[]>;
54
+ /**
55
+ * The text shown instead of the items when the value is not an array (`undefined` or `null`), or
56
+ * is an empty array (`[]`), so that the two can be told apart. These are code, not words.
57
+ */
58
+ protected readonly literal: Signal<string>;
59
+ /** Whether Reset is shown: the value differs from the default. */
60
+ protected readonly canReset: Signal<boolean>;
61
+ /** The text of the text field. */
62
+ protected readonly text: _angular_core.WritableSignal<string>;
63
+ /** Whether the reader asked for the dropdown, by typing, clicking or an arrow key. */
64
+ protected readonly expanded: _angular_core.WritableSignal<boolean>;
65
+ /** The position of the highlighted row of the dropdown, or `-1`. */
66
+ protected readonly highlighted: _angular_core.WritableSignal<number>;
67
+ /** The position of the item edited in place, or `null`. */
68
+ protected readonly editing: _angular_core.WritableSignal<number | null>;
69
+ /** The text of the field that edits an item in place. */
70
+ protected readonly editText: _angular_core.WritableSignal<string>;
71
+ /** The position of the chip in the tab order; the others are reached with the arrow keys. */
72
+ protected readonly tabStop: _angular_core.WritableSignal<number>;
73
+ /** The position of the chip being dragged, or `null`. */
74
+ protected readonly dragIndex: _angular_core.WritableSignal<number | null>;
75
+ /** What the live region announces: the new position of a moved item. */
76
+ protected readonly announcement: _angular_core.WritableSignal<string>;
77
+ /** The width of the dropdown: the width of the field. */
78
+ protected readonly panelWidth: _angular_core.WritableSignal<number>;
79
+ /** Whether the text field holds text that is not an item, such as a word in a `number[]`. */
80
+ protected readonly invalid: Signal<boolean>;
81
+ /** Whether the field that edits an item holds text that is not an item. */
82
+ protected readonly editInvalid: Signal<boolean>;
83
+ /**
84
+ * The rows of the dropdown: the values of `candidates()` whose text contains the typed text (the
85
+ * one equal to it first), and, when the typed text is an item that no row adds, a row that adds
86
+ * it, first.
87
+ */
88
+ protected readonly rows: Signal<Array<NgDocListControlRow<T>>>;
89
+ /**
90
+ * Whether the dropdown is open: the reader asked for it and it has rows, or, for a union, says
91
+ * that no value matches the typed text.
92
+ */
93
+ protected readonly panelOpen: Signal<boolean>;
94
+ /** The items removed while the control is shown, which the arrays of strings and numbers suggest. */
95
+ private readonly removed;
96
+ private readonly injector;
97
+ private readonly dropdown;
98
+ private readonly fieldBox;
99
+ /** The items in the order of a drag in progress, or `null`. */
100
+ private readonly dragOrder;
101
+ private drag;
102
+ /** The last array the control reported, which the form writes back. */
103
+ private reported;
104
+ protected constructor();
105
+ /**
106
+ * Reads typed text as an item.
107
+ * @param text - The text.
108
+ * @returns The item, or `undefined` when the text is not one.
109
+ */
110
+ protected abstract parseItem(text: string): T | undefined;
111
+ /**
112
+ * The values that the dropdown can list, before the typed text filters them: for an array of
113
+ * strings or numbers, the items of the default and the removed items that the array doesn't
114
+ * hold. Plain arrays may hold an item twice, so typed text that is an item is added again, but
115
+ * the suggestions never repeat an item.
116
+ */
117
+ protected candidates(): readonly T[];
118
+ /**
119
+ * The text of an item.
120
+ * @param item - The item.
121
+ */
122
+ protected labelOf(item: T): string;
123
+ /**
124
+ * The text of a chip: the item's text, or `""` for an empty string.
125
+ * @param item - The item.
126
+ */
127
+ protected chipText(item: T): string;
128
+ /**
129
+ * Reads the text field as the reader types.
130
+ * @param text - The text of the field.
131
+ */
132
+ protected type(text: string): void;
133
+ /**
134
+ * Handles the keys of the text field.
135
+ * @param event - The key event.
136
+ * @param field - The text field.
137
+ */
138
+ protected fieldKeydown(event: KeyboardEvent, field: HTMLInputElement): void;
139
+ /**
140
+ * Opens the dropdown when the reader clicks the field, and focuses the text field when the click
141
+ * is not on a chip or a button.
142
+ * @param event - The click.
143
+ * @param field - The text field.
144
+ */
145
+ protected fieldClick(event: MouseEvent, field: HTMLInputElement): void;
146
+ /**
147
+ * Picks a row of the dropdown: adds its value, or removes a picked value of a union.
148
+ * @param row - The row.
149
+ */
150
+ protected pick(row: NgDocListControlRow<T>): void;
151
+ /**
152
+ * Handles the keys of a focused chip.
153
+ * @param event - The key event.
154
+ * @param index - The position of the chip.
155
+ */
156
+ protected chipKeydown(event: KeyboardEvent, index: number): void;
157
+ /**
158
+ * Removes an item. The focus goes to the chip that takes its place, the previous chip, or the
159
+ * text field when the field had it, or no chip is left.
160
+ * @param index - The position of the item.
161
+ * @param focus - Whether the focus moves; a pick in the dropdown keeps it in the text field.
162
+ */
163
+ protected remove(index: number, focus?: boolean): void;
164
+ /**
165
+ * Edits an item in place: its chip becomes a text field.
166
+ * @param index - The position of the item.
167
+ */
168
+ protected startEdit(index: number): void;
169
+ /**
170
+ * Handles the keys of the field that edits an item: Enter keeps the text, Escape the item.
171
+ * @param event - The key event.
172
+ */
173
+ protected editKeydown(event: KeyboardEvent): void;
174
+ /** Ends an edit when its field loses the focus: with the text when it is an item. */
175
+ protected editBlur(): void;
176
+ /**
177
+ * Starts to follow a pointer that went down on a chip.
178
+ * @param event - The pointer event.
179
+ * @param index - The position of the chip.
180
+ */
181
+ protected chipPointerDown(event: PointerEvent, index: number): void;
182
+ /**
183
+ * Drags the chip once the pointer has moved far enough, and moves it in front of or behind the
184
+ * chip under the pointer once the pointer passes that chip's middle.
185
+ * @param event - The pointer event.
186
+ */
187
+ protected chipPointerMove(event: PointerEvent): void;
188
+ /**
189
+ * Drops a dragged chip: the items take the order of the drag.
190
+ * @param event - The pointer event.
191
+ */
192
+ protected chipPointerUp(event: PointerEvent): void;
193
+ /** Stops following the pointer; a drag in progress leaves the items as they were. */
194
+ protected cancelDrag(): void;
195
+ /**
196
+ * Closes the dropdown and marks the control as touched when the focus leaves the control.
197
+ * @param event - The focus event.
198
+ */
199
+ protected leave(event: FocusEvent): void;
200
+ /** Sets the value back to the default of the input. */
201
+ protected reset(): void;
202
+ /**
203
+ * The ID of a row of the dropdown, which the text field names as its active descendant.
204
+ * @param index - The position of the row.
205
+ */
206
+ protected rowId(index: number): string;
207
+ /**
208
+ * Adds an item at the end.
209
+ * @param value - The item.
210
+ */
211
+ private add;
212
+ /** Adds the highlighted row, or the typed text when it is an item. */
213
+ private enter;
214
+ /**
215
+ * Moves the highlight of the dropdown, and opens it.
216
+ * @param step - `1` for the next row, `-1` for the previous one.
217
+ */
218
+ private moveHighlight;
219
+ /**
220
+ * Moves an item one place, with the focus.
221
+ * @param index - The position of the item.
222
+ * @param offset - `-1` toward the start, `1` toward the end.
223
+ */
224
+ private move;
225
+ /**
226
+ * Sets the edited item from the text of its field.
227
+ * @returns Whether the text is an item.
228
+ */
229
+ private commitEdit;
230
+ /**
231
+ * The position a dragged chip moves to: the position of the chip under the pointer, once the
232
+ * pointer has passed its middle in the direction of the move.
233
+ * @param event - The pointer event.
234
+ * @param from - The position of the dragged chip.
235
+ */
236
+ private dropTarget;
237
+ /**
238
+ * Reports a new value.
239
+ * @param value - The value.
240
+ */
241
+ private report;
242
+ /**
243
+ * Announces the new position of a moved item.
244
+ * @param order - The items after the move.
245
+ * @param index - The new position of the item.
246
+ */
247
+ private announceMove;
248
+ /**
249
+ * Focuses a chip once the chips have rendered: they are tracked by position, so the focused
250
+ * element may show another item, or be gone.
251
+ * @param index - The position of the chip.
252
+ */
253
+ private focusChip;
254
+ /** Focuses the text field once the chips have rendered. */
255
+ private focusField;
256
+ private fieldElement;
257
+ private isFocused;
258
+ /** Whether the chips flow from right to left, which turns the arrow keys round. */
259
+ private isRtl;
260
+ private host;
261
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgDocListControl<any>, never>;
262
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NgDocListControl<any>, never, never, { "default": { "alias": "default"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
263
+ }
264
+ /**
265
+ * The playground control of `string[]` inputs: a chip combobox (`NgDocListControl`). Typed text is
266
+ * an item as it is, and a double click, Enter or F2 edits a chip in place.
267
+ */
268
+ declare class NgDocStringListControlComponent extends NgDocListControl<string> {
269
+ protected readonly freeText = true;
270
+ constructor();
271
+ protected parseItem(text: string): string;
272
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgDocStringListControlComponent, never>;
273
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgDocStringListControlComponent, "ng-doc-string-list-control", never, {}, {}, never, never, true, never>;
274
+ }
275
+ /**
276
+ * The playground control of `number[]` inputs: a chip combobox (`NgDocListControl`) whose items are
277
+ * numbers. Text that is not a number marks the field as invalid and adds nothing; a chip edited to
278
+ * such text keeps its number.
279
+ */
280
+ declare class NgDocNumberListControlComponent extends NgDocListControl<number> {
281
+ protected readonly freeText = true;
282
+ constructor();
283
+ protected parseItem(text: string): number | undefined;
284
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgDocNumberListControlComponent, never>;
285
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgDocNumberListControlComponent, "ng-doc-number-list-control", never, {}, {}, never, never, true, never>;
286
+ }
287
+ /**
288
+ * The playground control of arrays of a union of literals, such as `NgDocSize[]` or
289
+ * `('a' | 'b')[]`: a chip combobox (`NgDocListControl`) whose dropdown lists every value of the
290
+ * union, with the same texts as the control of the union (`NgDocTypeAliasControlComponent`).
291
+ * Picking a value adds it, and picking a value that the array holds, which is marked, removes it.
292
+ * The typed text filters the values; it is never an item itself.
293
+ */
294
+ declare class NgDocTypeAliasListControlComponent extends NgDocListControl<NgDocListControlItem> {
295
+ /**
296
+ * The values of the items: the members of the union as written in code, plain values when
297
+ * `isManual` is set, or the names and values of enum members.
298
+ */
299
+ readonly options: _angular_core.InputSignal<(string | NgDocPlaygroundOption)[] | undefined>;
300
+ /** Whether `options` are values the user listed in the playground config. */
301
+ readonly isManual: _angular_core.InputSignal<boolean | undefined>;
302
+ protected readonly freeText = false;
303
+ /** The values of the union that an item can be; `undefined`, `null` and repeats are left out. */
304
+ protected readonly values: Signal<NgDocResolvedPlaygroundOption[]>;
305
+ constructor();
306
+ protected candidates(): readonly NgDocListControlItem[];
307
+ protected labelOf(item: NgDocListControlItem): string;
308
+ protected parseItem(): undefined;
309
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<NgDocTypeAliasListControlComponent, never>;
310
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<NgDocTypeAliasListControlComponent, "ng-doc-type-alias-list-control", never, { "options": { "alias": "options"; "required": false; "isSignal": true; }; "isManual": { "alias": "isManual"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
311
+ }
312
+
313
+ export { NgDocListControl, NgDocNumberListControlComponent, NgDocStringListControlComponent, NgDocTypeAliasListControlComponent };