@taiga-ui/addon-doc 2.23.0 → 2.27.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 (101) hide show
  1. package/README.md +123 -135
  2. package/bundles/taiga-ui-addon-doc.umd.js +985 -931
  3. package/bundles/taiga-ui-addon-doc.umd.js.map +1 -1
  4. package/bundles/taiga-ui-addon-doc.umd.min.js +2 -2
  5. package/bundles/taiga-ui-addon-doc.umd.min.js.map +1 -1
  6. package/components/code/code.component.d.ts +4 -1
  7. package/components/demo/demo.component.d.ts +8 -8
  8. package/components/documentation/documentation-property-connector.directive.d.ts +1 -1
  9. package/components/example/example-get-tabs.pipe.d.ts +4 -0
  10. package/components/example/example.component.d.ts +4 -7
  11. package/components/navigation/navigation.component.d.ts +1 -1
  12. package/components/page/page.component.d.ts +1 -1
  13. package/esm2015/addon-doc.module.js +1 -1
  14. package/esm2015/components/code/code.component.js +11 -4
  15. package/esm2015/components/code/code.module.js +1 -1
  16. package/esm2015/components/copy/copy.component.js +2 -2
  17. package/esm2015/components/copy/copy.module.js +1 -1
  18. package/esm2015/components/demo/demo.component.js +13 -13
  19. package/esm2015/components/demo/demo.module.js +1 -1
  20. package/esm2015/components/documentation/documentation-property-connector.directive.js +6 -7
  21. package/esm2015/components/documentation/documentation.component.js +2 -2
  22. package/esm2015/components/documentation/documentation.module.js +2 -2
  23. package/esm2015/components/example/example-get-tabs.pipe.js +12 -0
  24. package/esm2015/components/example/example.component.js +8 -26
  25. package/esm2015/components/example/example.module.js +4 -3
  26. package/esm2015/components/main/main.module.js +1 -1
  27. package/esm2015/components/navigation/navigation.component.js +3 -3
  28. package/esm2015/components/navigation/navigation.module.js +1 -1
  29. package/esm2015/components/navigation/navigation.providers.js +1 -1
  30. package/esm2015/components/page/page.component.js +4 -4
  31. package/esm2015/components/page/page.module.js +2 -2
  32. package/esm2015/components/page/page.providers.js +1 -1
  33. package/esm2015/directives/scroll-into-view/scroll-into-view.module.js +1 -1
  34. package/esm2015/interfaces/page.js +1 -1
  35. package/esm2015/internal/header/header.component.js +2 -2
  36. package/esm2015/internal/header/header.module.js +1 -1
  37. package/esm2015/internal/input-opacity/input-opacity.module.js +1 -1
  38. package/esm2015/internal/see-also/see-also.component.js +2 -2
  39. package/esm2015/internal/see-also/see-also.module.js +1 -1
  40. package/esm2015/internal/source-code/source-code.component.js +2 -2
  41. package/esm2015/internal/source-code/source-code.module.js +1 -1
  42. package/esm2015/languages/russian.js +1 -1
  43. package/esm2015/public-api.js +5 -5
  44. package/esm2015/taiga-ui-addon-doc.js +12 -11
  45. package/esm2015/tokens/code-editor.js +1 -1
  46. package/esm2015/tokens/example-content-processor.js +2 -4
  47. package/esm2015/tokens/i18n.js +13 -5
  48. package/esm2015/tokens/pages.js +1 -1
  49. package/esm2015/tokens/source-code.js +1 -1
  50. package/esm2015/utils/raw-load-record.js +12 -0
  51. package/esm2015/utils/raw-load.js +7 -0
  52. package/esm5/addon-doc.module.js +1 -1
  53. package/esm5/components/code/code.component.js +15 -4
  54. package/esm5/components/code/code.module.js +1 -1
  55. package/esm5/components/copy/copy.component.js +2 -2
  56. package/esm5/components/copy/copy.module.js +1 -1
  57. package/esm5/components/demo/demo.component.js +13 -13
  58. package/esm5/components/demo/demo.module.js +1 -1
  59. package/esm5/components/documentation/documentation-property-connector.directive.js +6 -7
  60. package/esm5/components/documentation/documentation.component.js +2 -2
  61. package/esm5/components/documentation/documentation.module.js +2 -2
  62. package/esm5/components/example/example-get-tabs.pipe.js +15 -0
  63. package/esm5/components/example/example.component.js +9 -43
  64. package/esm5/components/example/example.module.js +4 -3
  65. package/esm5/components/main/main.module.js +1 -1
  66. package/esm5/components/navigation/navigation.component.js +3 -3
  67. package/esm5/components/navigation/navigation.module.js +1 -1
  68. package/esm5/components/navigation/navigation.providers.js +1 -1
  69. package/esm5/components/page/page.component.js +4 -4
  70. package/esm5/components/page/page.module.js +2 -2
  71. package/esm5/components/page/page.providers.js +1 -1
  72. package/esm5/directives/scroll-into-view/scroll-into-view.module.js +1 -1
  73. package/esm5/interfaces/page.js +1 -1
  74. package/esm5/internal/header/header.component.js +2 -2
  75. package/esm5/internal/header/header.module.js +1 -1
  76. package/esm5/internal/input-opacity/input-opacity.module.js +1 -1
  77. package/esm5/internal/see-also/see-also.component.js +2 -2
  78. package/esm5/internal/see-also/see-also.module.js +1 -1
  79. package/esm5/internal/source-code/source-code.component.js +2 -2
  80. package/esm5/internal/source-code/source-code.module.js +1 -1
  81. package/esm5/languages/russian.js +1 -1
  82. package/esm5/public-api.js +5 -5
  83. package/esm5/taiga-ui-addon-doc.js +12 -11
  84. package/esm5/tokens/code-editor.js +1 -1
  85. package/esm5/tokens/example-content-processor.js +2 -4
  86. package/esm5/tokens/i18n.js +13 -5
  87. package/esm5/tokens/pages.js +1 -1
  88. package/esm5/tokens/source-code.js +1 -1
  89. package/esm5/utils/raw-load-record.js +44 -0
  90. package/esm5/utils/raw-load.js +21 -0
  91. package/fesm2015/taiga-ui-addon-doc.js +603 -587
  92. package/fesm2015/taiga-ui-addon-doc.js.map +1 -1
  93. package/fesm5/taiga-ui-addon-doc.js +972 -919
  94. package/fesm5/taiga-ui-addon-doc.js.map +1 -1
  95. package/interfaces/page.d.ts +4 -0
  96. package/package.json +7 -6
  97. package/public-api.d.ts +4 -4
  98. package/taiga-ui-addon-doc.d.ts +11 -10
  99. package/taiga-ui-addon-doc.metadata.json +1 -1
  100. package/utils/raw-load-record.d.ts +2 -0
  101. package/utils/raw-load.d.ts +2 -0
@@ -1,25 +1,35 @@
1
- import { __decorate, __param } from 'tslib';
2
- import { Input, HostBinding, Component, NgModule, Inject, ChangeDetectionStrategy, InjectionToken, Renderer2, PLATFORM_ID, ContentChild, TemplateRef, ViewChild, HostListener, forwardRef, ChangeDetectorRef, Optional, ElementRef, Directive, EventEmitter, Output, ContentChildren, Attribute, ViewEncapsulation } from '@angular/core';
1
+ import { __awaiter, __decorate, __param } from 'tslib';
2
+ import { Input, HostBinding, Component, NgModule, Inject, ChangeDetectionStrategy, InjectionToken, Renderer2, PLATFORM_ID, ViewChild, ContentChild, TemplateRef, HostListener, forwardRef, EventEmitter, Output, Directive, ChangeDetectorRef, ContentChildren, Attribute, Optional, Pipe, ViewEncapsulation, ElementRef } from '@angular/core';
3
+ import { BehaviorSubject, Subject, timer, Observable, merge } from 'rxjs';
4
+ import { switchMap, switchMapTo, mapTo, startWith, takeUntil, map, debounceTime, filter, mergeMap, distinctUntilChanged } from 'rxjs/operators';
3
5
  import { CommonModule, isPlatformBrowser, Location as Location$1, DOCUMENT } from '@angular/common';
4
6
  import { HighlightModule } from 'ngx-highlightjs';
5
- import { tuiPure, TuiDestroyService, TUI_IS_MOBILE, TuiDragModule, isPresent, uniqBy, getElementObscurers, TuiActiveZoneModule, TuiLetModule, TuiAutoFocusModule, EMPTY_QUERY, itemsQueryListObservable, watch, TUI_FOCUSABLE_ITEM_ACCESSOR, identity, TuiSwipeService, tuiDefaultProp } from '@taiga-ui/cdk';
6
- import { TUI_COPY_TEXTS, TuiSelectModule, TuiRadioBlockModule, TuiCheckboxLabeledModule, TuiDataListWrapperModule, TuiAccordionModule, TuiBadgeModule, TuiToggleModule, TuiInputCountModule, TuiTabsModule, TuiTagModule } from '@taiga-ui/kit';
7
- import { Subject, timer, Observable, BehaviorSubject, merge } from 'rxjs';
8
- import { switchMapTo, mapTo, startWith, takeUntil, filter, map, mergeMap, debounceTime, switchMap, distinctUntilChanged } from 'rxjs/operators';
9
- import { TuiButtonModule, TuiModeDirective, TuiLinkModule, TuiExpandModule, TuiGroupModule, TuiTooltipModule, TuiModeModule, TuiSvgModule, TuiDataListModule, TuiTextfieldControllerModule, TuiHintControllerModule, TuiPrimitiveTextfieldModule, TuiHostedDropdownModule, TuiDropdownControllerModule, TuiScrollbarModule, TuiNotificationModule, TuiNotificationsService, TuiThemeNightModule, TuiRootModule, TuiDialogModule, TuiNotificationsModule } from '@taiga-ui/core';
7
+ import { tuiPure, TuiDestroyService, TUI_IS_MOBILE, TuiDragModule, EMPTY_QUERY, itemsQueryListObservable, watch, TUI_FOCUSABLE_ITEM_ACCESSOR, identity, TuiSwipeService, getElementObscurers, isPresent, uniqBy, TuiActiveZoneModule, TuiLetModule, TuiAutoFocusModule, tuiDefaultProp } from '@taiga-ui/cdk';
8
+ import { TUI_COPY_TEXTS, TuiSelectModule, TuiRadioBlockModule, TuiCheckboxLabeledModule, TuiDataListWrapperModule, TuiBadgeModule, TuiToggleModule, TuiInputCountModule, TuiTabsModule, TuiAccordionModule, TuiTagModule } from '@taiga-ui/kit';
9
+ import { TuiButtonModule, TuiModeDirective, TuiLinkModule, TuiExpandModule, TuiGroupModule, TuiTooltipModule, TuiModeModule, TuiSvgModule, TuiDataListModule, TuiTextfieldControllerModule, TuiHintControllerModule, TuiPrimitiveTextfieldModule, TuiDropdownControllerModule, TuiNotificationModule, TuiNotificationsService, TuiHostedDropdownModule, TuiScrollbarModule, TuiThemeNightModule, TuiRootModule, TuiDialogModule, TuiNotificationsModule } from '@taiga-ui/core';
10
10
  import { FormControl, FormGroup, ReactiveFormsModule, FormsModule } from '@angular/forms';
11
- import { UrlSerializer, RouterModule, Router, ActivatedRoute, NavigationEnd } from '@angular/router';
12
- import { Title } from '@angular/platform-browser';
13
- import { TuiSidebarDirective, TuiSidebarModule } from '@taiga-ui/addon-mobile';
11
+ import { UrlSerializer, RouterModule, ActivatedRoute, Router, NavigationEnd } from '@angular/router';
14
12
  import { trigger, transition, style, animate } from '@angular/animations';
15
13
  import { Clipboard, ClipboardModule } from '@angular/cdk/clipboard';
16
14
  import { LOCATION, LOCAL_STORAGE, WINDOW } from '@ng-web-apis/common';
17
15
  import { PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
16
+ import { TuiSidebarDirective, TuiSidebarModule } from '@taiga-ui/addon-mobile';
17
+ import { Title } from '@angular/platform-browser';
18
+
19
+ function rawLoad(content) {
20
+ return __awaiter(this, void 0, void 0, function* () {
21
+ return content instanceof Promise ? (yield content).default : content;
22
+ });
23
+ }
18
24
 
19
25
  let TuiDocCodeComponent = class TuiDocCodeComponent {
20
26
  constructor() {
27
+ this.rawLoader$$ = new BehaviorSubject('');
21
28
  this.filename = '';
22
- this.code = '';
29
+ this.processor$ = this.rawLoader$$.pipe(switchMap(rawLoad));
30
+ }
31
+ set code(code) {
32
+ this.rawLoader$$.next(code);
23
33
  }
24
34
  get hasFilename() {
25
35
  return !!this.filename;
@@ -30,14 +40,14 @@ __decorate([
30
40
  ], TuiDocCodeComponent.prototype, "filename", void 0);
31
41
  __decorate([
32
42
  Input()
33
- ], TuiDocCodeComponent.prototype, "code", void 0);
43
+ ], TuiDocCodeComponent.prototype, "code", null);
34
44
  __decorate([
35
45
  HostBinding('class._has-filename')
36
46
  ], TuiDocCodeComponent.prototype, "hasFilename", null);
37
47
  TuiDocCodeComponent = __decorate([
38
48
  Component({
39
49
  selector: 'tui-doc-code',
40
- template: "<p *ngIf=\"filename\" class=\"t-header\">{{filename}}</p>\n<pre class=\"t-code\"><code [lineNumbers]=\"true\" [highlight]=\"code\"></code></pre>\n",
50
+ template: "<p *ngIf=\"filename\" class=\"t-header\">{{filename}}</p>\n<pre\n class=\"t-code\"\n><code [lineNumbers]=\"true\" [highlight]=\"processor$ | async\"></code></pre>\n",
41
51
  styles: [":host{display:block}.t-header{font:var(--tui-font-text-s);font-weight:700}.t-code{margin:0}.hljs:not(:empty){font:var(--tui-font-text-m);padding:1.5rem 2rem;font-family:monospace;background:var(--tui-clear-disabled);word-wrap:break-word;white-space:pre-wrap}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.hljs:not(:empty)::-webkit-scrollbar,.hljs:not(:empty)::-webkit-scrollbar-thumb{width:1rem;height:1rem;border-radius:6.25rem;background-clip:padding-box;border:6px solid transparent}.hljs:not(:empty)::-webkit-scrollbar{background-color:transparent}.hljs:not(:empty)::-webkit-scrollbar-thumb{background-color:var(--tui-clear-hover)}.hljs:not(:empty)::-webkit-scrollbar-thumb:hover{background-color:var(--tui-clear-active)}.hljs:not(:empty)::-webkit-scrollbar-thumb:active{background-color:var(--tui-text-03)}}:host._has-filename .hljs:not(:empty){border-radius:.75rem}@media screen and (max-width:47.9375em){.hljs:not(:empty){padding:1rem}}"]
42
52
  })
43
53
  ], TuiDocCodeComponent);
@@ -75,7 +85,7 @@ __decorate([
75
85
  TuiDocCopyComponent = __decorate([
76
86
  Component({
77
87
  selector: 'tui-doc-copy',
78
- template: "<button\n *ngIf=\"texts$ | async as texts\"\n tuiButton\n type=\"button\"\n class=\"t-copy\"\n appearance=\"\"\n size=\"s\"\n [title]=\"texts[0]\"\n (click)=\"onClick()\"\n>\n <span class=\"t-content\" [class.t-content_moved]=\"copied$ | async\">\n <span class=\"t-initial\" [attr.data-text]=\"texts[0]\">\n <ng-content></ng-content>\n </span>\n {{texts[1]}}\n </span>\n</button>\n",
88
+ template: "<button\n *ngIf=\"texts$ | async as texts\"\n tuiButton\n type=\"button\"\n appearance=\"\"\n size=\"s\"\n class=\"t-copy\"\n [title]=\"texts[0]\"\n (click)=\"onClick()\"\n>\n <span class=\"t-content\" [class.t-content_moved]=\"copied$ | async\">\n <span class=\"t-initial\" [attr.data-text]=\"texts[0]\">\n <ng-content></ng-content>\n </span>\n {{ texts[1] }}\n </span>\n</button>\n",
79
89
  changeDetection: ChangeDetectionStrategy.OnPush,
80
90
  providers: [TuiDestroyService],
81
91
  styles: [":host{position:relative;display:inline-block;vertical-align:middle}.t-copy{transition-property:background;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;width:100%;color:var(--tui-text-01);background:var(--tui-base-01);overflow:hidden}.t-copy:hover{background:var(--tui-base-02)}.t-initial{white-space:nowrap}.t-initial:empty:before{content:attr(data-text)}.t-content{transition-property:transform;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;display:flex;flex-direction:column;transform:translateY(1rem);text-align:center;line-height:2rem}.t-content_moved{transform:translateY(-1rem)}"]
@@ -100,7 +110,9 @@ TuiDocCopyModule = __decorate([
100
110
  * Works with a tuple
101
111
  * [@string tuiMode tooltip content, @string word 'background', @string 'form value']
102
112
  */
103
- const TUI_DOC_DEMO_TEXTS = new InjectionToken('tui-doc-demo i18n texts', { factory: () => ['Read more more about modes: ', 'Background', 'Form value'] });
113
+ const TUI_DOC_DEMO_TEXTS = new InjectionToken('tui-doc-demo i18n texts', {
114
+ factory: () => ['Read more more about modes: ', 'Background', 'Form value'],
115
+ });
104
116
  /**
105
117
  * Works with a tuple
106
118
  * [
@@ -128,15 +140,21 @@ const TUI_DOC_DOCUMENTATION_TEXTS = new InjectionToken('tui-doc-documentation i1
128
140
  * @string link to a sample copied message label
129
141
  * ]
130
142
  */
131
- const TUI_DOC_EXAMPLE_TEXTS = new InjectionToken('tui-doc-example i18n texts', { factory: () => ['Preview', 'Link to a sample was successfully copied', 'Done'] });
143
+ const TUI_DOC_EXAMPLE_TEXTS = new InjectionToken('tui-doc-example i18n texts', {
144
+ factory: () => ['Preview', 'Link to a sample was successfully copied', 'Done'],
145
+ });
132
146
  const TUI_DOC_MENU_TEXT = new InjectionToken('menu i18n text', {
133
147
  factory: () => 'Menu',
134
148
  });
135
149
  const TUI_DOC_SEARCH_TEXT = new InjectionToken('search i18n text', {
136
150
  factory: () => 'Search',
137
151
  });
138
- const TUI_DOC_SEE_ALSO_TEXT = new InjectionToken('tui-doc-see-also i18n text', { factory: () => 'See also' });
139
- const TUI_DOC_SOURCE_CODE_TEXT = new InjectionToken('tui-doc-source-code i18n text', { factory: () => 'Source code' });
152
+ const TUI_DOC_SEE_ALSO_TEXT = new InjectionToken('tui-doc-see-also i18n text', {
153
+ factory: () => 'See also',
154
+ });
155
+ const TUI_DOC_SOURCE_CODE_TEXT = new InjectionToken('tui-doc-source-code i18n text', {
156
+ factory: () => 'Source code',
157
+ });
140
158
 
141
159
  var TuiDocDemoComponent_1;
142
160
  const MIN_COMPONENT_WIDTH = 104;
@@ -147,6 +165,8 @@ let TuiDocDemoComponent = TuiDocDemoComponent_1 = class TuiDocDemoComponent {
147
165
  this.destroy$ = destroy$;
148
166
  this.renderer = renderer;
149
167
  this.texts = texts;
168
+ this.initialX = 0;
169
+ this.wrapperWidth = 0;
150
170
  this.control = null;
151
171
  this.updateOnVariants = ['change', 'blur', 'submit'];
152
172
  this.updateOn = 'change';
@@ -156,8 +176,6 @@ let TuiDocDemoComponent = TuiDocDemoComponent_1 = class TuiDocDemoComponent {
156
176
  this.mode = null;
157
177
  this.change$ = new Subject();
158
178
  this.items = ['onLight', 'onDark'];
159
- this.initialX = 0;
160
- this.wrapperWidth = 0;
161
179
  this.isBrowser = isPlatformBrowser(platformId);
162
180
  const parsedMode = locationRef.path().match(/tui-mode=(onDark|onLight)/);
163
181
  if (parsedMode !== null && parsedMode.length > 0) {
@@ -173,6 +191,9 @@ let TuiDocDemoComponent = TuiDocDemoComponent_1 = class TuiDocDemoComponent {
173
191
  this.change$.next();
174
192
  });
175
193
  }
194
+ onResize() {
195
+ this.setResizerTextContent();
196
+ }
176
197
  ngOnInit() {
177
198
  this.createForm();
178
199
  }
@@ -189,9 +210,6 @@ let TuiDocDemoComponent = TuiDocDemoComponent_1 = class TuiDocDemoComponent {
189
210
  const { offsetWidth } = this.content.nativeElement;
190
211
  this.resizerText.nativeElement.textContent = String(offsetWidth - parseInt(paddingLeft || '0', 10) * 2);
191
212
  }
192
- onResize() {
193
- this.setResizerTextContent();
194
- }
195
213
  onDragStart(event) {
196
214
  event.preventDefault();
197
215
  this.initialX = event.clientX;
@@ -235,12 +253,6 @@ TuiDocDemoComponent.ctorParameters = () => [
235
253
  { type: UrlSerializer, decorators: [{ type: Inject, args: [UrlSerializer,] }] },
236
254
  { type: Array, decorators: [{ type: Inject, args: [TUI_DOC_DEMO_TEXTS,] }] }
237
255
  ];
238
- __decorate([
239
- Input()
240
- ], TuiDocDemoComponent.prototype, "control", void 0);
241
- __decorate([
242
- ContentChild(TemplateRef)
243
- ], TuiDocDemoComponent.prototype, "template", void 0);
244
256
  __decorate([
245
257
  ViewChild('content')
246
258
  ], TuiDocDemoComponent.prototype, "content", void 0);
@@ -250,13 +262,19 @@ __decorate([
250
262
  __decorate([
251
263
  ViewChild('resizerText')
252
264
  ], TuiDocDemoComponent.prototype, "resizerText", void 0);
265
+ __decorate([
266
+ Input()
267
+ ], TuiDocDemoComponent.prototype, "control", void 0);
268
+ __decorate([
269
+ ContentChild(TemplateRef)
270
+ ], TuiDocDemoComponent.prototype, "template", void 0);
253
271
  __decorate([
254
272
  HostListener('window:resize')
255
273
  ], TuiDocDemoComponent.prototype, "onResize", null);
256
274
  TuiDocDemoComponent = TuiDocDemoComponent_1 = __decorate([
257
275
  Component({
258
276
  selector: 'tui-doc-demo',
259
- template: "<div class=\"t-bg-toggle\" [tuiMode]=\"null\">\n <ng-template #tooltip>\n {{texts[0]}}\n <a tuiLink tuiMode=\"onDark\" routerLink=\"/directives/mode\">\n <code>tuiMode</code>\n </a>\n </ng-template>\n <ng-container *ngIf=\"isMobile else desktop\">\n <tui-select\n class=\"t-mode\"\n tuiTextfieldSize=\"s\"\n [tuiTextfieldCleaner]=\"true\"\n [tuiHintContent]=\"tooltip\"\n [formControl]=\"modeControl\"\n >\n tuiMode\n <tui-data-list-wrapper\n *tuiDataList\n [items]=\"items\"\n ></tui-data-list-wrapper>\n </tui-select>\n </ng-container>\n <ng-template #desktop>\n tuiMode:\n <tui-tooltip describeId=\"form\" [content]=\"tooltip\"></tui-tooltip>\n <div tuiGroup class=\"tui-space_left-3\" [collapsed]=\"true\">\n <tui-radio-block\n class=\"tui-group__auto-width-item\"\n size=\"s\"\n nativeId=\"form\"\n [item]=\"null\"\n [hideRadio]=\"true\"\n [formControl]=\"modeControl\"\n >\n null\n </tui-radio-block>\n <tui-radio-block\n class=\"tui-group__auto-width-item\"\n item=\"onDark\"\n size=\"s\"\n nativeId=\"form\"\n [hideRadio]=\"true\"\n [formControl]=\"modeControl\"\n >\n onDark\n </tui-radio-block>\n <tui-radio-block\n class=\"tui-group__auto-width-item\"\n item=\"onLight\"\n size=\"s\"\n nativeId=\"form\"\n [hideRadio]=\"true\"\n [formControl]=\"modeControl\"\n >\n onLight\n </tui-radio-block>\n </div>\n </ng-template>\n <tui-checkbox-labeled\n class=\"tui-space_left-3\"\n size=\"m\"\n [(ngModel)]=\"opaque\"\n >\n {{texts[1]}}\n </tui-checkbox-labeled>\n</div>\n<div\n #wrapper\n class=\"t-wrapper\"\n [class.t-wrapper_dark]=\"modeControl.value === 'onDark'\"\n [class.t-wrapper_gray]=\"modeControl.value === 'onLight'\"\n [class.t-wrapper_transparent]=\"!opaque\"\n>\n <div #content id=\"demoContent\" class=\"t-content\">\n <form *ngIf=\"testForm\" class=\"t-form\" [formGroup]=\"testForm\">\n <div class=\"t-input-wrapper\">\n <ng-container *ngTemplateOutlet=\"template\"></ng-container>\n </div>\n <button\n tuiButton\n type=\"button\"\n class=\"tui-space_top-3\"\n size=\"s\"\n [iconRight]=\"icon\"\n (click)=\"toggleDetails()\"\n >\n {{texts[2]}}\n </button>\n <ng-template #icon>\n <tui-svg\n src=\"tuiIconChevronDown\"\n class=\"t-icon\"\n [class.t-icon_rotated]=\"expanded\"\n ></tui-svg>\n </ng-template>\n <tui-expand class=\"t-expand\" [expanded]=\"expanded\">\n <ng-template tuiExpandContent>\n <pre class=\"t-value\">\nForm data: {{testForm.value | json}}</pre\n >\n <div tuiGroup class=\"tui-space_top-3\">\n <tui-select\n class=\"t-select\"\n tuiTextfieldSize=\"s\"\n [ngModel]=\"updateOn\"\n [ngModelOptions]=\"{standalone: true}\"\n (ngModelChange)=\"updateOnChange($event)\"\n >\n updateOn\n <tui-data-list-wrapper\n *tuiDataList\n [items]=\"updateOnVariants\"\n ></tui-data-list-wrapper>\n </tui-select>\n <button\n tuiButton\n class=\"tui-group__auto-width-item\"\n type=\"reset\"\n size=\"s\"\n >\n Reset\n </button>\n <button\n tuiButton\n class=\"tui-group__auto-width-item\"\n type=\"submit\"\n size=\"s\"\n >\n Submit\n </button>\n </div>\n </ng-template>\n </tui-expand>\n </form>\n <ng-content></ng-content>\n </div>\n <button\n class=\"t-resizer\"\n tabindex=\"-1\"\n (tuiDragStart)=\"onDragStart($event)\"\n (tuiDragContinues)=\"onDragContinues($event)\"\n (tuiDragEnd)=\"onDragEnd()\"\n >\n <span #resizerText class=\"t-resizer-text\"></span>\n </button>\n</div>\n",
277
+ template: "<div class=\"t-bg-toggle\" [tuiMode]=\"null\">\n <ng-template #tooltip>\n {{ texts[0] }}\n <a tuiLink tuiMode=\"onDark\" routerLink=\"/directives/mode\">\n <code>tuiMode</code>\n </a>\n </ng-template>\n <ng-container *ngIf=\"isMobile; else desktop\">\n <tui-select\n tuiTextfieldSize=\"s\"\n class=\"t-mode\"\n [tuiTextfieldCleaner]=\"true\"\n [tuiHintContent]=\"tooltip\"\n [formControl]=\"modeControl\"\n >\n tuiMode\n <tui-data-list-wrapper\n *tuiDataList\n [items]=\"items\"\n ></tui-data-list-wrapper>\n </tui-select>\n </ng-container>\n <ng-template #desktop>\n tuiMode:\n <tui-tooltip describeId=\"form\" [content]=\"tooltip\"></tui-tooltip>\n <div tuiGroup class=\"tui-space_left-3\" [collapsed]=\"true\">\n <tui-radio-block\n size=\"s\"\n nativeId=\"form\"\n class=\"tui-group__auto-width-item\"\n [item]=\"null\"\n [hideRadio]=\"true\"\n [formControl]=\"modeControl\"\n >\n null\n </tui-radio-block>\n <tui-radio-block\n item=\"onDark\"\n size=\"s\"\n nativeId=\"form\"\n class=\"tui-group__auto-width-item\"\n [hideRadio]=\"true\"\n [formControl]=\"modeControl\"\n >\n onDark\n </tui-radio-block>\n <tui-radio-block\n item=\"onLight\"\n size=\"s\"\n nativeId=\"form\"\n class=\"tui-group__auto-width-item\"\n [hideRadio]=\"true\"\n [formControl]=\"modeControl\"\n >\n onLight\n </tui-radio-block>\n </div>\n </ng-template>\n <tui-checkbox-labeled\n size=\"m\"\n class=\"tui-space_left-3\"\n [(ngModel)]=\"opaque\"\n >\n {{ texts[1] }}\n </tui-checkbox-labeled>\n</div>\n<div\n #wrapper\n class=\"t-wrapper\"\n [class.t-wrapper_dark]=\"modeControl.value === 'onDark'\"\n [class.t-wrapper_gray]=\"modeControl.value === 'onLight'\"\n [class.t-wrapper_transparent]=\"!opaque\"\n>\n <div #content id=\"demoContent\" class=\"t-content\">\n <form *ngIf=\"testForm\" class=\"t-form\" [formGroup]=\"testForm\">\n <div class=\"t-input-wrapper\">\n <ng-container *ngTemplateOutlet=\"template\"></ng-container>\n </div>\n <button\n tuiButton\n type=\"button\"\n size=\"s\"\n class=\"tui-space_top-3\"\n [iconRight]=\"icon\"\n (click)=\"toggleDetails()\"\n >\n {{ texts[2] }}\n </button>\n <ng-template #icon>\n <tui-svg\n src=\"tuiIconChevronDown\"\n class=\"t-icon\"\n [class.t-icon_rotated]=\"expanded\"\n ></tui-svg>\n </ng-template>\n <tui-expand class=\"t-expand\" [expanded]=\"expanded\">\n <ng-template tuiExpandContent>\n <pre class=\"t-value\">\nForm data: {{ testForm.value | json }}</pre\n >\n <div tuiGroup class=\"tui-space_top-3\">\n <tui-select\n tuiTextfieldSize=\"s\"\n class=\"t-select\"\n [ngModel]=\"updateOn\"\n [ngModelOptions]=\"{standalone: true}\"\n (ngModelChange)=\"updateOnChange($event)\"\n >\n updateOn\n <tui-data-list-wrapper\n *tuiDataList\n [items]=\"updateOnVariants\"\n ></tui-data-list-wrapper>\n </tui-select>\n <button\n tuiButton\n type=\"reset\"\n size=\"s\"\n class=\"tui-group__auto-width-item\"\n >\n Reset\n </button>\n <button\n tuiButton\n type=\"submit\"\n size=\"s\"\n class=\"tui-group__auto-width-item\"\n >\n Submit\n </button>\n </div>\n </ng-template>\n </tui-expand>\n </form>\n <ng-content></ng-content>\n </div>\n <button\n tabindex=\"-1\"\n class=\"t-resizer\"\n (tuiDragStart)=\"onDragStart($event)\"\n (tuiDragContinues)=\"onDragContinues($event)\"\n (tuiDragEnd)=\"onDragEnd()\"\n >\n <span #resizerText class=\"t-resizer-text\"></span>\n </button>\n</div>\n",
260
278
  changeDetection: ChangeDetectionStrategy.OnPush,
261
279
  providers: [
262
280
  TuiDestroyService,
@@ -306,410 +324,89 @@ TuiDocDemoModule = __decorate([
306
324
  })
307
325
  ], TuiDocDemoModule);
308
326
 
309
- const MAP = {
310
- а: 'f',
311
- б: ',',
312
- в: 'd',
313
- г: 'u',
314
- д: 'l',
315
- е: 't',
316
- ё: '`',
317
- ж: ';',
318
- з: 'p',
319
- и: 'b',
320
- й: 'q',
321
- к: 'r',
322
- л: 'k',
323
- м: 'v',
324
- н: 'y',
325
- о: 'j',
326
- п: 'g',
327
- р: 'h',
328
- с: 'c',
329
- т: 'n',
330
- у: 'e',
331
- ф: 'a',
332
- х: '[',
333
- ц: 'w',
334
- ч: 'x',
335
- ш: 'i',
336
- щ: 'o',
337
- ъ: ']',
338
- ы: 's',
339
- ь: 'm',
340
- ю: '.',
341
- я: 'z',
342
- };
343
- /**
344
- * Translates text mistakenly typed in the Russian layout into English
345
- * @param string string with Russian layout characters
346
- * @return string with English layout characters
347
- */
348
- function transliterateKeyboardLayout(string) {
349
- let newStr = '';
350
- for (let i = 0; i < string.length; i++) {
351
- newStr += string.charAt(i) in MAP ? MAP[string.charAt(i)] : string.charAt(i);
352
- }
353
- return newStr;
354
- }
355
-
356
- const TUI_DOC_PAGES = new InjectionToken('Documentation pages', {
357
- factory: () => [],
358
- });
359
-
360
- const TUI_DOC_TITLE = new InjectionToken('Page title', {
361
- factory: () => '',
362
- });
363
-
364
- const NAVIGATION_TITLE = new InjectionToken('Page title');
365
- const NAVIGATION_LABELS = new InjectionToken('Navigation sections labels for search');
366
- const NAVIGATION_ITEMS = new InjectionToken('Navigation pages');
367
- const NAVIGATION_PROVIDERS = [
368
- TuiDestroyService,
369
- {
370
- provide: NAVIGATION_TITLE,
371
- deps: [Router, ActivatedRoute, TUI_DOC_TITLE, TuiDestroyService],
372
- useFactory: titleProviderFactory,
373
- },
374
- {
375
- provide: NAVIGATION_LABELS,
376
- deps: [TUI_DOC_PAGES],
377
- useFactory: labelsProviderFactory,
378
- },
379
- {
380
- provide: NAVIGATION_ITEMS,
381
- deps: [TUI_DOC_PAGES],
382
- useFactory: itemsProviderFactory,
383
- },
384
- ];
385
- function titleProviderFactory(router, activatedRoute, titlePrefix, destroy$) {
386
- return router.events.pipe(filter(event => event instanceof NavigationEnd), map(() => activatedRoute.firstChild), filter(isPresent), mergeMap(({ data }) => data), map(({ title }) => titlePrefix + title), takeUntil(destroy$));
387
- }
388
- function labelsProviderFactory(pages) {
389
- return pages
390
- .map(({ section }) => section)
391
- .filter(isPresent)
392
- .filter((item, index, array) => array.indexOf(item) === index);
327
+ function rgbToHex(r, g, b) {
328
+ return ('#' +
329
+ [r, g, b]
330
+ .map(x => {
331
+ const hex = x.toString(16);
332
+ return hex.length === 1 ? '0' + hex : hex;
333
+ })
334
+ .join(''));
393
335
  }
394
- function itemsProviderFactory(pages) {
395
- const labels = labelsProviderFactory(pages);
396
- return [
397
- ...labels.map(label => pages.filter(({ section }) => section === label)),
398
- pages.filter(page => !page.section),
399
- ];
336
+ function hexToRgb(hex) {
337
+ const matches = hex
338
+ .replace('#', '')
339
+ .split('')
340
+ .map((char, _, array) => (array.length === 3 ? char + char : char))
341
+ .join('')
342
+ .match(/.{2}/g);
343
+ return matches
344
+ ? matches.map(x => Number.parseInt(x, 16))
345
+ : [0, 0, 0];
400
346
  }
401
347
 
402
- const SCROLL_INTO_VIEW_DELAY = 200;
403
- // @dynamic
404
- let TuiDocNavigationComponent = class TuiDocNavigationComponent {
405
- constructor(changeDetectorRef, titleService, title$, documentRef, mode, sidebar, labels, items, searchText, router, activatedRoute) {
406
- this.documentRef = documentRef;
407
- this.mode = mode;
408
- this.sidebar = sidebar;
409
- this.labels = labels;
410
- this.items = items;
411
- this.searchText = searchText;
412
- this.router = router;
413
- this.activatedRoute = activatedRoute;
414
- this.search = '';
415
- this.open = false;
416
- this.openPagesArr = [];
417
- this.openPagesGroupsArr = [];
418
- this.active = '';
419
- this.menuOpen = false;
420
- this.mode$ = this.mode.change$.pipe(startWith(null), map(() => this.mode.mode || 'onLight'));
421
- // Angular can't navigate no anchor links
422
- // https://stackoverflow.com/questions/36101756/angular2-routing-with-hashtag-to-page-anchor
423
- title$.subscribe(title => {
424
- changeDetectorRef.markForCheck();
425
- titleService.setTitle(title);
426
- this.openActivePageGroup();
427
- this.handleAnchorLink(this.activatedRoute.snapshot.fragment);
428
- });
429
- }
430
- get canOpen() {
431
- return this.search.length > 2;
432
- }
433
- get filteredItems() {
434
- return this.filterItems(this.flattenSubPages(this.items), this.search);
348
+ function inspectArray(array, depth) {
349
+ if (depth === 0) {
350
+ return '[…]';
435
351
  }
436
- get itemsWithoutSections() {
437
- return this.items[this.items.length - 1];
352
+ let result = '';
353
+ let first = true;
354
+ for (let index = 0; index < array.length; index++) {
355
+ if (first) {
356
+ first = false;
357
+ }
358
+ else {
359
+ result += ', ';
360
+ }
361
+ result += index in array ? inspectAny(array[index], depth - 1) : 'empty';
438
362
  }
439
- isActive(route) {
440
- return route === this.active;
363
+ return `[${result}]`;
364
+ }
365
+ function inspectObject(object, depth) {
366
+ if (depth === 0) {
367
+ return `{…}`;
441
368
  }
442
- onGroupClick(index) {
443
- this.openPagesGroupsArr[index] = !this.openPagesGroupsArr[index];
369
+ let result = '';
370
+ let first = true;
371
+ for (const key in object) {
372
+ if (!object.hasOwnProperty(key)) {
373
+ continue;
374
+ }
375
+ if (first) {
376
+ first = false;
377
+ }
378
+ else {
379
+ result += ', ';
380
+ }
381
+ result += `${key}: ${inspectAny(object[key], depth - 1)}`;
444
382
  }
445
- closeMenu() {
446
- this.menuOpen = false;
383
+ return `{${result}}`;
384
+ }
385
+ // @bad TODO add more types
386
+ /**
387
+ * Returns readable JS entity
388
+ * @param data
389
+ * @param depth
390
+ * @return readable JS entity
391
+ */
392
+ function inspectAny(data, depth) {
393
+ if (data === null) {
394
+ return 'null';
447
395
  }
448
- onSearchChange(search) {
449
- this.search = search;
450
- this.open = this.canOpen;
396
+ switch (typeof data) {
397
+ case 'string':
398
+ return `'${data}'`;
399
+ case 'undefined':
400
+ case 'number':
401
+ case 'boolean':
402
+ case 'function':
403
+ return String(data);
451
404
  }
452
- onClick() {
453
- this.open = false;
454
- this.menuOpen = false;
455
- this.search = '';
456
- this.openActivePageGroup();
405
+ if (data instanceof RegExp) {
406
+ return data.toString();
457
407
  }
458
- filterItems(items, search) {
459
- return items.map(section => uniqBy(section.filter(({ title, keywords = '' }) => {
460
- title = title.toLowerCase();
461
- search = search.toLowerCase();
462
- keywords = keywords.toLowerCase();
463
- return (title.includes(search) ||
464
- keywords.includes(search) ||
465
- title.includes(transliterateKeyboardLayout(search)) ||
466
- keywords.includes(transliterateKeyboardLayout(search)) ||
467
- search.replace(/-/gi, '').includes(title));
468
- }), 'title'));
469
- }
470
- flattenSubPages(items) {
471
- return items.reduce((array, item) => [
472
- ...array,
473
- item.reduce((pages, page) => 'subPages' in page
474
- ? [...pages, ...page.subPages]
475
- : [...pages, page], []),
476
- ], []);
477
- }
478
- isActiveRoute(route) {
479
- return this.router.isActive(route, false);
480
- }
481
- handleAnchorLink(hash) {
482
- setTimeout(() => {
483
- this.navigateToAnchorLink(hash);
484
- }, SCROLL_INTO_VIEW_DELAY);
485
- }
486
- openActivePageGroup() {
487
- this.items.forEach((pages, pagesIndex) => {
488
- pages.forEach((page, pageIndex) => {
489
- if ('route' in page && this.isActiveRoute(page.route)) {
490
- this.openPagesArr[pagesIndex] = true;
491
- this.active = page.route;
492
- }
493
- if ('subPages' in page) {
494
- page.subPages.forEach(subPage => {
495
- if (this.isActiveRoute(subPage.route)) {
496
- this.openPagesArr[pagesIndex] = true;
497
- this.openPagesGroupsArr[pagesIndex * 100 + pageIndex] = true;
498
- this.active = subPage.route;
499
- }
500
- });
501
- }
502
- });
503
- });
504
- }
505
- navigateToAnchorLink(fragment) {
506
- const element = fragment && this.documentRef.querySelector(`#${fragment}`);
507
- if (!element) {
508
- return;
509
- }
510
- element.classList.add('tui-doc-animated-example');
511
- element.scrollIntoView({
512
- block: 'start',
513
- inline: 'nearest',
514
- behavior: 'smooth',
515
- });
516
- }
517
- };
518
- TuiDocNavigationComponent.ctorParameters = () => [
519
- { type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] },
520
- { type: Title, decorators: [{ type: Inject, args: [Title,] }] },
521
- { type: Observable, decorators: [{ type: Inject, args: [NAVIGATION_TITLE,] }] },
522
- { type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
523
- { type: TuiModeDirective, decorators: [{ type: Inject, args: [TuiModeDirective,] }] },
524
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [TuiSidebarDirective,] }] },
525
- { type: Array, decorators: [{ type: Inject, args: [NAVIGATION_LABELS,] }] },
526
- { type: undefined, decorators: [{ type: Inject, args: [NAVIGATION_ITEMS,] }] },
527
- { type: String, decorators: [{ type: Inject, args: [TUI_DOC_SEARCH_TEXT,] }] },
528
- { type: Router, decorators: [{ type: Inject, args: [Router,] }] },
529
- { type: ActivatedRoute, decorators: [{ type: Inject, args: [ActivatedRoute,] }] }
530
- ];
531
- __decorate([
532
- HostBinding('class._open')
533
- ], TuiDocNavigationComponent.prototype, "menuOpen", void 0);
534
- __decorate([
535
- tuiPure
536
- ], TuiDocNavigationComponent.prototype, "filterItems", null);
537
- __decorate([
538
- tuiPure
539
- ], TuiDocNavigationComponent.prototype, "flattenSubPages", null);
540
- TuiDocNavigationComponent = __decorate([
541
- Component({
542
- selector: 'tui-doc-navigation',
543
- template: "<tui-hosted-dropdown\n *tuiLet=\"filteredItems as filtered\"\n class=\"input\"\n tuiAutoFocus\n tuiDropdownLimitWidth=\"fixed\"\n [autoFocus]=\"!!sidebar\"\n [content]=\"dropdown\"\n [canOpen]=\"canOpen\"\n [(open)]=\"open\"\n>\n <tui-primitive-textfield\n iconAlign=\"left\"\n tuiTextfieldSize=\"m\"\n iconContent=\"tuiIconSearch\"\n [pseudoFocused]=\"open || null\"\n [tuiTextfieldCleaner]=\"true\"\n [tuiTextfieldLabelOutside]=\"true\"\n [value]=\"search\"\n (valueChange)=\"onSearchChange($event)\"\n >\n {{searchText}}\n </tui-primitive-textfield>\n <ng-template #dropdown let-activeZone>\n <tui-data-list>\n <tui-opt-group\n *ngFor=\"let group of filtered; let index = index\"\n [label]=\"labels[index] || ''\"\n >\n <a\n *ngFor=\"let item of group\"\n tuiOption\n [routerLink]=\"item.route\"\n (click)=\"onClick()\"\n >\n {{item.title}}\n </a>\n </tui-opt-group>\n </tui-data-list>\n </ng-template>\n</tui-hosted-dropdown>\n\n<nav class=\"navigation\">\n <tui-scrollbar [tuiMode]=\"mode$ | async\" class=\"scrollbar\">\n <tui-accordion [closeOthers]=\"false\" [rounded]=\"false\">\n <tui-accordion-item\n *ngFor=\"let label of labels; index as index\"\n size=\"s\"\n [borders]=\"null\"\n [(open)]=\"!!openPagesArr[index]\"\n >\n <span class=\"tui-space_left-2\">\n <strong>{{label}}</strong>\n </span>\n <ng-template tuiAccordionItemContent>\n <div class=\"section\">\n <ng-container\n *ngFor=\"let item of items[index]; index as subIndex\"\n >\n <ng-container\n *ngTemplateOutlet=\"pages; context: {item: item, index: (index * 100) + subIndex}\"\n >\n </ng-container>\n </ng-container>\n </div>\n </ng-template>\n </tui-accordion-item>\n </tui-accordion>\n <div class=\"items-container\">\n <ng-container\n *ngFor=\"let item of itemsWithoutSections; let index = index\"\n >\n <ng-container\n *ngTemplateOutlet=\"pages; context: {item: item, index: (items.length - 1) + index}\"\n >\n </ng-container>\n </ng-container>\n </div>\n\n <ng-template #pages let-item=\"item\" let-index=\"index\">\n <a\n *ngIf=\"!item.subPages; else subPages\"\n tuiLink\n class=\"sublink\"\n routerLinkActive=\"sublink_active\"\n [routerLink]=\"item.route\"\n [scrollIntoView]=\"isActive(item.route)\"\n (click)=\"closeMenu()\"\n >\n {{item.title}}\n </a>\n <ng-template #subPages>\n <div\n routerLinkActive\n class=\"subsection\"\n [routerLinkActiveOptions]=\"{exact: false}\"\n >\n <button\n *ngIf=\"item.subPages\"\n tuiLink\n type=\"button\"\n class=\"sublink sublink_subsection\"\n (click)=\"onGroupClick(index)\"\n >\n <tui-svg\n src=\"tuiIconChevronRight\"\n class=\"chevron\"\n [class.chevron_active]=\"!!openPagesGroupsArr[index]\"\n ></tui-svg>\n {{item.title}}\n </button>\n <tui-expand\n class=\"tui-space_left-1\"\n [expanded]=\"!!openPagesGroupsArr[index]\"\n >\n <div class=\"section section_bordered\">\n <a\n *ngFor=\"let subPage of item.subPages\"\n tuiLink\n class=\"sublink sublink_small\"\n routerLinkActive=\"sublink_active\"\n [routerLink]=\"subPage.route\"\n [scrollIntoView]=\"isActive(subPage.route)\"\n (click)=\"closeMenu()\"\n >\n {{subPage.title}}\n </a>\n </div>\n </tui-expand>\n </div>\n </ng-template>\n </ng-template>\n </tui-scrollbar>\n</nav>\n\n<ng-content></ng-content>\n",
544
- providers: NAVIGATION_PROVIDERS,
545
- changeDetection: ChangeDetectionStrategy.OnPush,
546
- styles: [":host{z-index:1;display:flex;flex-direction:column;text-align:center;background:var(--tui-base-01)}.input{display:block;margin:1.25rem}.navigation{display:flex;max-height:100%;min-height:0;flex:1 1 0;text-align:left}.scrollbar{width:100%;scroll-behavior:smooth}.items-container{display:flex;flex-direction:column;padding:0 16px}.section{display:flex;flex-direction:column;align-items:flex-start;margin:-1rem 0 -.5rem}.section_bordered{margin:.5rem 0;border-left:1px solid var(--tui-base-03)}.subsection{margin-left:.5rem}.sublink{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0;border:0;background:0 0;font-size:inherit;font:var(--tui-font-text-m);margin-left:.5rem;line-height:2.75rem}.sublink_small{margin-left:1rem;line-height:1.5rem}.sublink_small:not(:first-child){margin-top:1rem}.sublink_subsection{margin-left:0;line-height:2.75rem}.sublink_active{color:var(--tui-text-01)}.chevron{transition-property:transform;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;width:1rem;height:1rem;margin:-.25rem .25rem 0 -.1875rem}.chevron_active{transform:rotate(90deg)}"]
547
- }),
548
- __param(0, Inject(ChangeDetectorRef)),
549
- __param(1, Inject(Title)),
550
- __param(2, Inject(NAVIGATION_TITLE)),
551
- __param(3, Inject(DOCUMENT)),
552
- __param(4, Inject(TuiModeDirective)),
553
- __param(5, Optional()),
554
- __param(5, Inject(TuiSidebarDirective)),
555
- __param(6, Inject(NAVIGATION_LABELS)),
556
- __param(7, Inject(NAVIGATION_ITEMS)),
557
- __param(8, Inject(TUI_DOC_SEARCH_TEXT)),
558
- __param(9, Inject(Router)),
559
- __param(10, Inject(ActivatedRoute))
560
- ], TuiDocNavigationComponent);
561
-
562
- let ScrollIntoViewDirective = class ScrollIntoViewDirective {
563
- constructor(destroy$, { nativeElement }) {
564
- this.scroll$ = new Subject();
565
- this.scroll$
566
- .pipe(debounceTime(750), filter(shallWe => shallWe && !!getElementObscurers(nativeElement)), takeUntil(destroy$))
567
- .subscribe(() => {
568
- nativeElement.scrollIntoView();
569
- });
570
- }
571
- set scrollIntoView(shallWe) {
572
- this.scroll$.next(shallWe);
573
- }
574
- };
575
- ScrollIntoViewDirective.ctorParameters = () => [
576
- { type: TuiDestroyService, decorators: [{ type: Inject, args: [TuiDestroyService,] }] },
577
- { type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }
578
- ];
579
- __decorate([
580
- Input()
581
- ], ScrollIntoViewDirective.prototype, "scrollIntoView", null);
582
- ScrollIntoViewDirective = __decorate([
583
- Directive({
584
- selector: '[scrollIntoView]',
585
- providers: [TuiDestroyService],
586
- }),
587
- __param(0, Inject(TuiDestroyService)),
588
- __param(1, Inject(ElementRef))
589
- ], ScrollIntoViewDirective);
590
-
591
- let ScrollIntoViewModule = class ScrollIntoViewModule {
592
- };
593
- ScrollIntoViewModule = __decorate([
594
- NgModule({
595
- declarations: [ScrollIntoViewDirective],
596
- exports: [ScrollIntoViewDirective],
597
- })
598
- ], ScrollIntoViewModule);
599
-
600
- let TuiDocNavigationModule = class TuiDocNavigationModule {
601
- };
602
- TuiDocNavigationModule = __decorate([
603
- NgModule({
604
- imports: [
605
- CommonModule,
606
- FormsModule,
607
- RouterModule,
608
- ScrollIntoViewModule,
609
- TuiButtonModule,
610
- TuiPrimitiveTextfieldModule,
611
- TuiTextfieldControllerModule,
612
- TuiActiveZoneModule,
613
- TuiLetModule,
614
- TuiModeModule,
615
- TuiLinkModule,
616
- TuiExpandModule,
617
- TuiHostedDropdownModule,
618
- TuiDropdownControllerModule,
619
- TuiAccordionModule,
620
- TuiScrollbarModule,
621
- TuiSvgModule,
622
- TuiDataListModule,
623
- TuiAutoFocusModule,
624
- ],
625
- declarations: [TuiDocNavigationComponent],
626
- exports: [TuiDocNavigationComponent],
627
- })
628
- ], TuiDocNavigationModule);
629
-
630
- function rgbToHex(r, g, b) {
631
- return ('#' +
632
- [r, g, b]
633
- .map(x => {
634
- const hex = x.toString(16);
635
- return hex.length === 1 ? '0' + hex : hex;
636
- })
637
- .join(''));
638
- }
639
- function hexToRgb(hex) {
640
- const matches = hex
641
- .replace('#', '')
642
- .split('')
643
- .map((char, _, array) => (array.length === 3 ? char + char : char))
644
- .join('')
645
- .match(/.{2}/g);
646
- return matches
647
- ? matches.map(x => Number.parseInt(x, 16))
648
- : [0, 0, 0];
649
- }
650
-
651
- function inspectArray(array, depth) {
652
- if (depth === 0) {
653
- return '[…]';
654
- }
655
- let result = '';
656
- let first = true;
657
- for (let index = 0; index < array.length; index++) {
658
- if (first) {
659
- first = false;
660
- }
661
- else {
662
- result += ', ';
663
- }
664
- result += index in array ? inspectAny(array[index], depth - 1) : 'empty';
665
- }
666
- return `[${result}]`;
667
- }
668
- function inspectObject(object, depth) {
669
- if (depth === 0) {
670
- return `{…}`;
671
- }
672
- let result = '';
673
- let first = true;
674
- for (const key in object) {
675
- if (!object.hasOwnProperty(key)) {
676
- continue;
677
- }
678
- if (first) {
679
- first = false;
680
- }
681
- else {
682
- result += ', ';
683
- }
684
- result += `${key}: ${inspectAny(object[key], depth - 1)}`;
685
- }
686
- return `{${result}}`;
687
- }
688
- // @bad TODO add more types
689
- /**
690
- * Returns readable JS entity
691
- * @param data
692
- * @param depth
693
- * @return readable JS entity
694
- */
695
- function inspectAny(data, depth) {
696
- if (data === null) {
697
- return 'null';
698
- }
699
- switch (typeof data) {
700
- case 'string':
701
- return `'${data}'`;
702
- case 'undefined':
703
- case 'number':
704
- case 'boolean':
705
- case 'function':
706
- return String(data);
707
- }
708
- if (data instanceof RegExp) {
709
- return data.toString();
710
- }
711
- if (Array.isArray(data)) {
712
- return inspectArray(data, depth);
408
+ if (Array.isArray(data)) {
409
+ return inspectArray(data, depth);
713
410
  }
714
411
  return inspectObject(data, depth);
715
412
  }
@@ -761,6 +458,11 @@ let TuiDocDocumentationPropertyConnectorDirective = class TuiDocDocumentationPro
761
458
  this.documentationPropertyValueChange.emit(value);
762
459
  this.setQueryParam(value);
763
460
  }
461
+ emitEvent(event) {
462
+ // For more convenient debugging
463
+ console.log(this.attrName, event);
464
+ this.emits$.next(this.emits$.value + 1);
465
+ }
764
466
  parseParams(params) {
765
467
  if (!params[this.documentationPropertyName] &&
766
468
  !params[this.documentationPropertyName + SERIALIZED_SUFFIX]) {
@@ -786,12 +488,6 @@ let TuiDocDocumentationPropertyConnectorDirective = class TuiDocDocumentationPro
786
488
  tree.queryParams = Object.assign(Object.assign({}, tree.queryParams), { [propName]: computedValue });
787
489
  this.locationRef.go(String(tree));
788
490
  }
789
- emitEvent(event) {
790
- // For more convenient debugging
791
- // tslint:disable-next-line:no-console
792
- console.log(this.attrName, event);
793
- this.emits$.next(this.emits$.value + 1);
794
- }
795
491
  };
796
492
  TuiDocDocumentationPropertyConnectorDirective.ctorParameters = () => [
797
493
  { type: TemplateRef, decorators: [{ type: Inject, args: [TemplateRef,] }] },
@@ -941,7 +637,7 @@ __decorate([
941
637
  TuiDocDocumentationComponent = __decorate([
942
638
  Component({
943
639
  selector: 'tui-doc-documentation',
944
- template: "<h1 *ngIf=\"heading\" class=\"tui-text_h4\">{{heading}}</h1>\n<ng-content></ng-content>\n<table class=\"tui-table tui-table_layout_fixed tui-table_font-size_s\">\n <tr class=\"tui-table__tr tui-table__tr_hover_disabled t-row t-row_header\">\n <th class=\"tui-table__th tui-table__th_first t-cell t-cell_prop\">\n {{texts[2]}}\n </th>\n <td class=\"tui-table__th\">{{type}}</td>\n <td\n *ngIf=\"showValues && !isAPI\"\n class=\"\n tui-table__th tui-table__th_last tui-table__th_text_right\n t-cell t-cell_value\n \"\n >\n {{texts[3]}}\n </td>\n </tr>\n <tr\n *ngFor=\"let propertyConnector of propertiesConnectors; last as lastItem\"\n class=\"tui-table__tr tui-table__tr_hover_disabled t-row\"\n [class.t-deprecated]=\"propertyConnector.documentationPropertyDeprecated\"\n [class.tui-table__tr_border_none]=\"lastItem\"\n >\n <td\n class=\"\n tui-table__td tui-table__td_first tui-table__td_align_center\n t-cell\n \"\n >\n <div\n class=\"t-property t-cell\"\n automation-id=\"tui-documentation__property-name\"\n >\n {{stripOptional(propertyConnector.attrName)}}\n <tui-badge\n *ngIf=\"isOptional(propertyConnector.attrName)\"\n size=\"s\"\n value=\"Optional\"\n ></tui-badge>\n </div>\n <span\n *ngIf=\"propertyConnector.documentationPropertyDeprecated\"\n class=\"t-deprecated-label\"\n >deprecated</span\n >\n <ng-container\n *ngTemplateOutlet=\"propertyConnector.template\"\n ></ng-container>\n </td>\n <td class=\"tui-table__td tui-table__td_align_center t-cell\">\n <span class=\"type\">\n {{propertyConnector.documentationPropertyType}}\n <tui-tooltip\n *ngIf=\"showContentTooltip(propertyConnector.documentationPropertyType)\"\n [describeId]=\"propertyConnector.attrName\"\n [content]=\"content\"\n >\n <ng-template #content>\n {{texts[4]}}\n <a\n tuiLink\n tuiMode=\"onDark\"\n target=\"_blank\"\n href=\"https://github.com/TinkoffCreditSystems/ng-polymorpheus\"\n ><code>ng-polymorpheus</code></a\n >\n </ng-template>\n </tui-tooltip>\n </span>\n </td>\n <td\n *ngIf=\"showValues\"\n class=\"\n tui-table__td\n tui-table__td_align_center\n tui-table__td_last\n tui-table__td_text_right\n t-cell\n \"\n >\n <ng-container\n *ngIf=\"propertyConnector.shouldShowValues; else elseEmitter\"\n >\n <tui-select\n *ngIf=\"propertyConnector.hasItems; else noItems\"\n tuiTextfieldSize=\"m\"\n tuiDropdownLimitWidth=\"min\"\n [tuiTextfieldCleaner]=\"showCleaner(propertyConnector.documentationPropertyType)\"\n [tuiTextfieldLabelOutside]=\"true\"\n [nativeId]=\"propertyConnector.attrName\"\n [valueContent]=\"selectContent\"\n [ngModel]=\"propertyConnector.documentationPropertyValue\"\n (ngModelChange)=\"propertyConnector.onValueChange($event)\"\n >\n <code class=\"t-exception\">null</code>\n <tui-data-list-wrapper\n *tuiDataList\n [items]=\"propertyConnector.documentationPropertyValues\"\n [itemContent]=\"selectContent\"\n ></tui-data-list-wrapper>\n </tui-select>\n <ng-template #selectContent let-data>\n <code>{{inspectAny(data)}}</code>\n </ng-template>\n\n <ng-template #noItems>\n <ng-container\n [ngSwitch]=\"propertyConnector.documentationPropertyType\"\n >\n <tui-toggle\n *ngSwitchCase=\"'boolean'\"\n size=\"l\"\n [nativeId]=\"propertyConnector.attrName\"\n [showIcons]=\"true\"\n [ngModel]=\"propertyConnector.documentationPropertyValue\"\n (ngModelChange)=\"propertyConnector.onValueChange($event)\"\n ></tui-toggle>\n\n <tui-primitive-textfield\n *ngSwitchCase=\"'string'\"\n tuiTextfieldSize=\"m\"\n [nativeId]=\"propertyConnector.attrName\"\n [tuiTextfieldLabelOutside]=\"true\"\n [tuiTextfieldCleaner]=\"true\"\n [value]=\"propertyConnector.documentationPropertyValue || ''\"\n (valueChange)=\"propertyConnector.onValueChange($event)\"\n ></tui-primitive-textfield>\n\n <div *ngSwitchCase=\"'color'\" tuiGroup>\n <tui-primitive-textfield\n tuiTextfieldType=\"color\"\n tuiTextfieldSize=\"m\"\n [attr.id]=\"propertyConnector.attrName\"\n [tuiTextfieldLabelOutside]=\"true\"\n [tuiInputOpacity]=\"getOpacity(propertyConnector.documentationPropertyValue)\"\n [value]=\"getColor(propertyConnector.documentationPropertyValue)\"\n (valueChange)=\"onColorChange(propertyConnector, $event)\"\n ></tui-primitive-textfield>\n <tui-input-count\n tuiTextfieldSize=\"m\"\n [max]=\"100\"\n [ngModel]=\"getOpacity(propertyConnector.documentationPropertyValue)\"\n (ngModelChange)=\"onOpacityChange(propertyConnector, $event)\"\n >\n Opacity\n </tui-input-count>\n </div>\n\n <tui-input-count\n *ngSwitchCase=\"'number'\"\n tuiTextfieldSize=\"m\"\n [nativeId]=\"propertyConnector.attrName\"\n [tuiTextfieldLabelOutside]=\"true\"\n [ngModel]=\"propertyConnector.documentationPropertyValue\"\n (ngModelChange)=\"propertyConnector.onValueChange($event)\"\n ></tui-input-count>\n </ng-container>\n </ng-template>\n </ng-container>\n\n <ng-template #elseEmitter>\n <tui-notification\n class=\"t-output\"\n [@emitEvent]=\"propertyConnector.emits$ | async\"\n >\n Emit!\n </tui-notification>\n </ng-template>\n </td>\n </tr>\n</table>\n",
640
+ template: "<h1 *ngIf=\"heading\" class=\"tui-text_h4\">{{ heading }}</h1>\n<ng-content></ng-content>\n<table class=\"tui-table tui-table_layout_fixed tui-table_font-size_s\">\n <tr class=\"tui-table__tr tui-table__tr_hover_disabled t-row t-row_header\">\n <th class=\"tui-table__th tui-table__th_first t-cell t-cell_prop\">\n {{ texts[2] }}\n </th>\n <td class=\"tui-table__th\">{{ type }}</td>\n <td\n *ngIf=\"showValues && !isAPI\"\n class=\"tui-table__th tui-table__th_last tui-table__th_text_right t-cell t-cell_value\"\n >\n {{ texts[3] }}\n </td>\n </tr>\n <tr\n *ngFor=\"let propertyConnector of propertiesConnectors; last as lastItem\"\n class=\"tui-table__tr tui-table__tr_hover_disabled t-row\"\n [class.t-deprecated]=\"propertyConnector.documentationPropertyDeprecated\"\n [class.tui-table__tr_border_none]=\"lastItem\"\n >\n <td\n class=\"tui-table__td tui-table__td_first tui-table__td_align_center t-cell\"\n >\n <div\n automation-id=\"tui-documentation__property-name\"\n class=\"t-property t-cell\"\n >\n {{ stripOptional(propertyConnector.attrName) }}\n <tui-badge\n *ngIf=\"isOptional(propertyConnector.attrName)\"\n size=\"s\"\n value=\"Optional\"\n ></tui-badge>\n </div>\n <span\n *ngIf=\"propertyConnector.documentationPropertyDeprecated\"\n class=\"t-deprecated-label\"\n >\n deprecated\n </span>\n <ng-container\n *ngTemplateOutlet=\"propertyConnector.template\"\n ></ng-container>\n </td>\n <td class=\"tui-table__td tui-table__td_align_center t-cell\">\n <span class=\"type\">\n {{ propertyConnector.documentationPropertyType }}\n <tui-tooltip\n *ngIf=\"showContentTooltip(propertyConnector.documentationPropertyType)\"\n [describeId]=\"propertyConnector.attrName\"\n [content]=\"content\"\n >\n <ng-template #content>\n {{ texts[4] }}\n <a\n tuiLink\n tuiMode=\"onDark\"\n target=\"_blank\"\n href=\"https://github.com/TinkoffCreditSystems/ng-polymorpheus\"\n >\n <code>ng-polymorpheus</code>\n </a>\n </ng-template>\n </tui-tooltip>\n </span>\n </td>\n <td\n *ngIf=\"showValues\"\n class=\"tui-table__td tui-table__td_align_center tui-table__td_last tui-table__td_text_right t-cell\"\n >\n <ng-container\n *ngIf=\"propertyConnector.shouldShowValues; else elseEmitter\"\n >\n <tui-select\n *ngIf=\"propertyConnector.hasItems; else noItems\"\n tuiTextfieldSize=\"m\"\n tuiDropdownLimitWidth=\"min\"\n [tuiTextfieldCleaner]=\"showCleaner(propertyConnector.documentationPropertyType)\"\n [tuiTextfieldLabelOutside]=\"true\"\n [nativeId]=\"propertyConnector.attrName\"\n [valueContent]=\"selectContent\"\n [ngModel]=\"propertyConnector.documentationPropertyValue\"\n (ngModelChange)=\"propertyConnector.onValueChange($event)\"\n >\n <code class=\"t-exception\">null</code>\n <tui-data-list-wrapper\n *tuiDataList\n [items]=\"propertyConnector.documentationPropertyValues\"\n [itemContent]=\"selectContent\"\n ></tui-data-list-wrapper>\n </tui-select>\n <ng-template #selectContent let-data>\n <code>{{ inspectAny(data) }}</code>\n </ng-template>\n\n <ng-template #noItems>\n <ng-container\n [ngSwitch]=\"propertyConnector.documentationPropertyType\"\n >\n <tui-toggle\n *ngSwitchCase=\"'boolean'\"\n size=\"l\"\n [nativeId]=\"propertyConnector.attrName\"\n [showIcons]=\"true\"\n [ngModel]=\"propertyConnector.documentationPropertyValue\"\n (ngModelChange)=\"propertyConnector.onValueChange($event)\"\n ></tui-toggle>\n\n <tui-primitive-textfield\n *ngSwitchCase=\"'string'\"\n tuiTextfieldSize=\"m\"\n [nativeId]=\"propertyConnector.attrName\"\n [tuiTextfieldLabelOutside]=\"true\"\n [tuiTextfieldCleaner]=\"true\"\n [value]=\"propertyConnector.documentationPropertyValue || ''\"\n (valueChange)=\"propertyConnector.onValueChange($event)\"\n ></tui-primitive-textfield>\n\n <div *ngSwitchCase=\"'color'\" tuiGroup>\n <tui-primitive-textfield\n tuiTextfieldType=\"color\"\n tuiTextfieldSize=\"m\"\n [attr.id]=\"propertyConnector.attrName\"\n [tuiTextfieldLabelOutside]=\"true\"\n [tuiInputOpacity]=\"getOpacity(propertyConnector.documentationPropertyValue)\"\n [value]=\"getColor(propertyConnector.documentationPropertyValue)\"\n (valueChange)=\"onColorChange(propertyConnector, $event)\"\n ></tui-primitive-textfield>\n <tui-input-count\n tuiTextfieldSize=\"m\"\n [max]=\"100\"\n [ngModel]=\"getOpacity(propertyConnector.documentationPropertyValue)\"\n (ngModelChange)=\"onOpacityChange(propertyConnector, $event)\"\n >\n Opacity\n </tui-input-count>\n </div>\n\n <tui-input-count\n *ngSwitchCase=\"'number'\"\n tuiTextfieldSize=\"m\"\n [nativeId]=\"propertyConnector.attrName\"\n [tuiTextfieldLabelOutside]=\"true\"\n [ngModel]=\"propertyConnector.documentationPropertyValue\"\n (ngModelChange)=\"propertyConnector.onValueChange($event)\"\n ></tui-input-count>\n </ng-container>\n </ng-template>\n </ng-container>\n\n <ng-template #elseEmitter>\n <tui-notification\n class=\"t-output\"\n [@emitEvent]=\"propertyConnector.emits$ | async\"\n >\n Emit!\n </tui-notification>\n </ng-template>\n </td>\n </tr>\n</table>\n",
945
641
  changeDetection: ChangeDetectionStrategy.OnPush,
946
642
  animations: [
947
643
  trigger('emitEvent', [
@@ -1028,12 +724,20 @@ TuiDocDocumentationModule = __decorate([
1028
724
 
1029
725
  const TUI_DOC_CODE_EDITOR = new InjectionToken('Contains service for opening online IDE e.g. Stackblitz');
1030
726
 
1031
- const TUI_DOC_EXAMPLE_CONTENT_PROCESSOR = new InjectionToken('Processes content in example', {
1032
- factory: () => identity,
1033
- });
727
+ const TUI_DOC_EXAMPLE_CONTENT_PROCESSOR = new InjectionToken('Processes content in example', { factory: () => identity });
1034
728
 
1035
- // Ambient type cannot be used without dynamic https://github.com/angular/angular/issues/23395
1036
- // @dynamic
729
+ function rawLoadRecord(example) {
730
+ return __awaiter(this, void 0, void 0, function* () {
731
+ const processedContent = {};
732
+ for (const [key, content] of Object.entries(example)) {
733
+ processedContent[key] = yield rawLoad(content);
734
+ }
735
+ return processedContent;
736
+ });
737
+ }
738
+
739
+ // Ambient type cannot be used without dynamic https://github.com/angular/angular/issues/23395
740
+ // @dynamic
1037
741
  let TuiDocExampleComponent = class TuiDocExampleComponent {
1038
742
  constructor(id, clipboard, notifications, location, copyTexts$, texts, codeEditor, processContent) {
1039
743
  this.id = id;
@@ -1044,150 +748,462 @@ let TuiDocExampleComponent = class TuiDocExampleComponent {
1044
748
  this.texts = texts;
1045
749
  this.codeEditor = codeEditor;
1046
750
  this.processContent = processContent;
751
+ this.rawLoader$$ = new BehaviorSubject({});
1047
752
  this.heading = '';
1048
753
  this.description = '';
1049
754
  this.componentName = this.location.pathname.slice(1);
1050
755
  this.activeItemIndex = 0;
1051
- this.processedContent = {};
1052
756
  this.defaultTab = this.texts[0];
1053
757
  this.copy$ = this.copyTexts$.pipe(map(([copy]) => copy));
758
+ this.processor$ = this.rawLoader$$.pipe(switchMap(rawLoadRecord), map(this.processContent));
1054
759
  }
1055
760
  set content(content) {
1056
- this.processedContent = this.processContent(content);
761
+ this.rawLoader$$.next(content);
762
+ }
763
+ copyExampleLink() {
764
+ const hashPosition = this.location.href.indexOf('#');
765
+ const currentUrl = hashPosition > -1
766
+ ? this.location.href.substr(0, hashPosition)
767
+ : this.location.href;
768
+ const url = `${currentUrl}#${this.id}`;
769
+ this.clipboard.copy(url);
770
+ this.notifications
771
+ .show(this.texts[1], {
772
+ label: this.texts[2],
773
+ status: "success" /* Success */,
774
+ })
775
+ .subscribe();
776
+ }
777
+ };
778
+ TuiDocExampleComponent.ctorParameters = () => [
779
+ { type: String, decorators: [{ type: Attribute, args: ['id',] }] },
780
+ { type: Clipboard, decorators: [{ type: Inject, args: [Clipboard,] }] },
781
+ { type: TuiNotificationsService, decorators: [{ type: Inject, args: [TuiNotificationsService,] }] },
782
+ { type: Location, decorators: [{ type: Inject, args: [LOCATION,] }] },
783
+ { type: Observable, decorators: [{ type: Inject, args: [TUI_COPY_TEXTS,] }] },
784
+ { type: Array, decorators: [{ type: Inject, args: [TUI_DOC_EXAMPLE_TEXTS,] }] },
785
+ { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [TUI_DOC_CODE_EDITOR,] }] },
786
+ { type: undefined, decorators: [{ type: Inject, args: [TUI_DOC_EXAMPLE_CONTENT_PROCESSOR,] }] }
787
+ ];
788
+ __decorate([
789
+ Input()
790
+ ], TuiDocExampleComponent.prototype, "heading", void 0);
791
+ __decorate([
792
+ Input()
793
+ ], TuiDocExampleComponent.prototype, "description", void 0);
794
+ __decorate([
795
+ Input()
796
+ ], TuiDocExampleComponent.prototype, "content", null);
797
+ __decorate([
798
+ Input()
799
+ ], TuiDocExampleComponent.prototype, "componentName", void 0);
800
+ TuiDocExampleComponent = __decorate([
801
+ Component({
802
+ selector: 'tui-doc-example',
803
+ template: "<h3 *ngIf=\"heading\" class=\"t-title\">\n <span polymorpheus-outlet [content]=\"heading\"></span>\n <button\n *ngIf=\"id\"\n tuiIconButton\n type=\"button\"\n size=\"xs\"\n icon=\"tuiIconLinkLarge\"\n appearance=\"icon\"\n class=\"t-link-icon\"\n [title]=\"copy$ | async\"\n (click)=\"copyExampleLink()\"\n ></button>\n</h3>\n<h4\n *ngIf=\"description\"\n polymorpheus-outlet\n class=\"t-description\"\n [content]=\"description\"\n></h4>\n\n<div *ngIf=\"processor$ | async as content\" class=\"t-example\">\n <ng-container *ngIf=\"content | tuiDocExampleGetTabs: defaultTab as tabs\">\n <div class=\"t-tabs-wrapper\">\n <tui-tabs-with-more\n class=\"t-tabs\"\n [(activeItemIndex)]=\"activeItemIndex\"\n >\n <ng-container *ngFor=\"let tab of tabs\">\n <button *tuiTab tuiTab>{{tab}}</button>\n </ng-container>\n </tui-tabs-with-more>\n\n <button\n *ngIf=\"codeEditor\"\n tuiButton\n appearance=\"flat\"\n size=\"s\"\n (click)=\"codeEditor.open(componentName, id || '', content)\"\n >\n Edit on {{codeEditor.name}}\n </button>\n </div>\n\n <ng-container\n *ngIf=\"{\n activeTab: tabs[activeItemIndex],\n code: content[tabs[activeItemIndex]] || ''\n } as state\"\n >\n <div\n *ngIf=\"state.activeTab == defaultTab; else codeSection\"\n automation-id=\"tui-doc-example\"\n class=\"t-demo\"\n >\n <ng-content></ng-content>\n </div>\n\n <ng-template #codeSection>\n <tui-doc-copy\n class=\"t-copy-code\"\n [cdkCopyToClipboard]=\"state.code\"\n ></tui-doc-copy>\n <tui-doc-code [code]=\"state.code\"></tui-doc-code>\n </ng-template>\n </ng-container>\n </ng-container>\n</div>\n",
804
+ changeDetection: ChangeDetectionStrategy.OnPush,
805
+ styles: [":host{position:relative;display:block;padding-top:3.5rem;clear:right}.t-title{font:var(--tui-font-heading-5);margin:0 0 .5rem}@media screen and (max-width:47.9375em){:host{padding-top:2rem}.t-title{font:var(--tui-font-heading-6)}}.t-description{font:var(--tui-font-text-m);font-weight:400;margin:0}.t-description:first-letter,.t-title:first-letter{text-transform:capitalize}.t-example{position:relative;margin-top:1.5rem;border:1px solid var(--tui-base-03);border-radius:var(--tui-radius-m);box-shadow:0 .125rem .1875rem rgba(0,0,0,.1)}.t-tabs-wrapper{display:flex;padding:0 2rem;box-shadow:inset 0 -1px var(--tui-base-03);justify-content:space-between;align-items:center}@media screen and (max-width:47.9375em){.t-example{margin-top:.75rem}.t-tabs-wrapper{padding:0 1rem}}.t-tabs{flex-grow:1}.t-demo{padding:2rem;overflow-x:auto}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.t-demo::-webkit-scrollbar,.t-demo::-webkit-scrollbar-thumb{width:1rem;height:1rem;border-radius:6.25rem;background-clip:padding-box;border:6px solid transparent}.t-demo::-webkit-scrollbar{background-color:transparent}.t-demo::-webkit-scrollbar-thumb{background-color:var(--tui-clear-hover)}.t-demo::-webkit-scrollbar-thumb:hover{background-color:var(--tui-clear-active)}.t-demo::-webkit-scrollbar-thumb:active{background-color:var(--tui-text-03)}}@media screen and (max-width:47.9375em){.t-demo{padding:1rem}}.t-copy-code{position:absolute;top:4.375rem;right:1rem}.t-link-icon{margin-left:.3rem;vertical-align:baseline}"]
806
+ }),
807
+ __param(0, Attribute('id')),
808
+ __param(1, Inject(Clipboard)),
809
+ __param(2, Inject(TuiNotificationsService)),
810
+ __param(3, Inject(LOCATION)),
811
+ __param(4, Inject(TUI_COPY_TEXTS)),
812
+ __param(5, Inject(TUI_DOC_EXAMPLE_TEXTS)),
813
+ __param(6, Optional()),
814
+ __param(6, Inject(TUI_DOC_CODE_EDITOR)),
815
+ __param(7, Inject(TUI_DOC_EXAMPLE_CONTENT_PROCESSOR))
816
+ ], TuiDocExampleComponent);
817
+
818
+ let TuiDocExampleGetTabsPipe = class TuiDocExampleGetTabsPipe {
819
+ transform(content, defaultTab) {
820
+ return [defaultTab, ...Object.keys(content)];
821
+ }
822
+ };
823
+ TuiDocExampleGetTabsPipe = __decorate([
824
+ Pipe({ name: 'tuiDocExampleGetTabs' })
825
+ ], TuiDocExampleGetTabsPipe);
826
+
827
+ let TuiDocExampleModule = class TuiDocExampleModule {
828
+ };
829
+ TuiDocExampleModule = __decorate([
830
+ NgModule({
831
+ imports: [
832
+ CommonModule,
833
+ ClipboardModule,
834
+ TuiTabsModule,
835
+ TuiButtonModule,
836
+ TuiDocCopyModule,
837
+ TuiDocCodeModule,
838
+ PolymorpheusModule,
839
+ ],
840
+ declarations: [TuiDocExampleComponent, TuiDocExampleGetTabsPipe],
841
+ exports: [TuiDocExampleComponent, TuiDocExampleGetTabsPipe],
842
+ })
843
+ ], TuiDocExampleModule);
844
+
845
+ var TuiDocMainComponent_1;
846
+ // @dynamic
847
+ let TuiDocMainComponent = TuiDocMainComponent_1 = class TuiDocMainComponent {
848
+ constructor(storage, windowRef) {
849
+ this.storage = storage;
850
+ this.windowRef = windowRef;
851
+ this.night = this.storage.getItem('night') === 'true' ||
852
+ (this.storage.getItem('night') === null &&
853
+ this.windowRef.matchMedia('(prefers-color-scheme: dark)').matches);
854
+ this.change$ = new Subject();
1057
855
  }
1058
- get activeItem() {
1059
- return this.tabs[this.activeItemIndex];
856
+ get mode() {
857
+ return this.night ? 'onDark' : null;
1060
858
  }
1061
- get tabs() {
1062
- return this.getTabs(this.processedContent);
859
+ onMode(night) {
860
+ this.night = night;
861
+ this.change$.next();
862
+ this.storage.setItem('night', String(night));
863
+ }
864
+ };
865
+ TuiDocMainComponent.ctorParameters = () => [
866
+ { type: Storage, decorators: [{ type: Inject, args: [LOCAL_STORAGE,] }] },
867
+ { type: Window, decorators: [{ type: Inject, args: [WINDOW,] }] }
868
+ ];
869
+ TuiDocMainComponent = TuiDocMainComponent_1 = __decorate([
870
+ Component({
871
+ selector: 'tui-doc-main',
872
+ template: "<tui-theme-night *ngIf=\"night\"></tui-theme-night>\n<tui-root>\n <div class=\"tui-doc-page\">\n <tui-doc-navigation class=\"tui-doc-navigation\">\n <ng-content select=\"tuiDocNavigation\"></ng-content>\n </tui-doc-navigation>\n <div class=\"tui-doc-content\">\n <router-outlet class=\"tui-doc-outlet\"></router-outlet>\n </div>\n </div>\n <header tuiDocHeader>\n <label class=\"night-mode\">\n Night mode\n <tui-toggle\n class=\"tui-space_left-2\"\n [ngModel]=\"night\"\n (ngModelChange)=\"onMode($event)\"\n ></tui-toggle>\n </label>\n <ng-content select=\"tuiDocHeader\"></ng-content>\n </header>\n <ng-container ngProjectAs=\"tuiOverContent\">\n <ng-content select=\"tuiOverContent\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverDialogs\">\n <ng-content select=\"tuiOverDialogs\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverNotifications\">\n <ng-content select=\"tuiOverNotifications\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverPortals\">\n <ng-content select=\"tuiOverPortals\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverHints\">\n <ng-content select=\"tuiOverHints\"></ng-content>\n </ng-container>\n</tui-root>\n",
873
+ encapsulation: ViewEncapsulation.None,
874
+ providers: [
875
+ {
876
+ provide: TuiModeDirective,
877
+ useExisting: forwardRef(() => TuiDocMainComponent_1),
878
+ },
879
+ TuiSwipeService,
880
+ ],
881
+ styles: ["html{scroll-padding-top:4rem;height:auto}tui-root>tui-scroll-controls{top:4rem!important}@-webkit-keyframes tuiShaking{from,to{transform:translate3d(0,0,0)}10%,30%,50%,70%,90%{transform:translate3d(-.3125rem,0,0)}20%,40%,60%,80%{transform:translate3d(.3125rem,0,0)}}@keyframes tuiShaking{from,to{transform:translate3d(0,0,0)}10%,30%,50%,70%,90%{transform:translate3d(-.3125rem,0,0)}20%,40%,60%,80%{transform:translate3d(.3125rem,0,0)}}body{background:var(--tui-base-01);height:auto}tui-doc-main{display:block}code:not(.hljs):not(.exception){transition-property:background;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;background:var(--tui-base-02);color:var(--tui-text-02);vertical-align:middle;box-shadow:inset 0 -2px var(--tui-secondary);padding:.375rem .5rem;font-size:.875rem;border-radius:.5rem}:focus code:not(.exception){background:var(--tui-base-01)}.tui-doc-page{position:relative;z-index:0;padding-top:4rem}tui-doc-navigation.tui-doc-navigation{position:fixed;top:4rem;bottom:0;width:16.25rem;border-right:1px solid var(--tui-base-03)}.tui-doc-content{margin-left:16.25rem}@media screen and (max-width:47.9375em){tui-doc-navigation.tui-doc-navigation{display:none}.tui-doc-content{margin-left:0}}.tui-doc-outlet+*{display:block}.tui-doc-animated-example{-webkit-animation:1s .3s tuiShaking;animation:1s .3s tuiShaking}label.night-mode{cursor:pointer}.hljs-tag{background:0 0}.hljs{display:block;overflow-x:auto;padding:.5em;color:var(--tui-text-01);background-color:var(--tui-clear-disabled)}.hljs-subst,.hljs-title{font-weight:400;color:var(--tui-text-01)}.hljs-comment,.hljs-quote{color:var(--tui-text-03);font-style:italic}.hljs-meta{color:#e38162}.hljs-keyword,.hljs-literal,.hljs-name,.hljs-section,.hljs-selector-class,.hljs-selector-id,.hljs-selector-tag,.hljs-type{font-weight:700;color:var(--tui-link)}.hljs-attribute,.hljs-link,.hljs-number,.hljs-regexp{font-weight:700;color:var(--tui-support-06)}.hljs-link,.hljs-number,.hljs-regexp{font-weight:400}.hljs-string{color:var(--tui-positive);font-weight:700}.hljs-bullet,.hljs-formula,.hljs-symbol{color:var(--tui-text-01);background:var(--tui-base-02);font-style:italic}.hljs-doctag{text-decoration:underline}.hljs-template-variable,.hljs-variable{color:var(--tui-warning-fill)}.hljs-addition{background:var(--tui-success-bg)}.hljs-deletion{background:var(--tui-error-bg)}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}.hljs .hljs-line-numbers{padding:0}.hljs-ln-numbers{vertical-align:top;opacity:.3;text-align:right;padding-right:1em!important}"]
882
+ }),
883
+ __param(0, Inject(LOCAL_STORAGE)),
884
+ __param(1, Inject(WINDOW))
885
+ ], TuiDocMainComponent);
886
+
887
+ let ScrollIntoViewDirective = class ScrollIntoViewDirective {
888
+ constructor(destroy$, { nativeElement }) {
889
+ this.scroll$ = new Subject();
890
+ this.scroll$
891
+ .pipe(debounceTime(750), filter(shallWe => shallWe && !!getElementObscurers(nativeElement)), takeUntil(destroy$))
892
+ .subscribe(() => {
893
+ nativeElement.scrollIntoView();
894
+ });
895
+ }
896
+ set scrollIntoView(shallWe) {
897
+ this.scroll$.next(shallWe);
898
+ }
899
+ };
900
+ ScrollIntoViewDirective.ctorParameters = () => [
901
+ { type: TuiDestroyService, decorators: [{ type: Inject, args: [TuiDestroyService,] }] },
902
+ { type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }
903
+ ];
904
+ __decorate([
905
+ Input()
906
+ ], ScrollIntoViewDirective.prototype, "scrollIntoView", null);
907
+ ScrollIntoViewDirective = __decorate([
908
+ Directive({
909
+ selector: '[scrollIntoView]',
910
+ providers: [TuiDestroyService],
911
+ }),
912
+ __param(0, Inject(TuiDestroyService)),
913
+ __param(1, Inject(ElementRef))
914
+ ], ScrollIntoViewDirective);
915
+
916
+ let ScrollIntoViewModule = class ScrollIntoViewModule {
917
+ };
918
+ ScrollIntoViewModule = __decorate([
919
+ NgModule({
920
+ declarations: [ScrollIntoViewDirective],
921
+ exports: [ScrollIntoViewDirective],
922
+ })
923
+ ], ScrollIntoViewModule);
924
+
925
+ const MAP = {
926
+ а: 'f',
927
+ б: ',',
928
+ в: 'd',
929
+ г: 'u',
930
+ д: 'l',
931
+ е: 't',
932
+ ё: '`',
933
+ ж: ';',
934
+ з: 'p',
935
+ и: 'b',
936
+ й: 'q',
937
+ к: 'r',
938
+ л: 'k',
939
+ м: 'v',
940
+ н: 'y',
941
+ о: 'j',
942
+ п: 'g',
943
+ р: 'h',
944
+ с: 'c',
945
+ т: 'n',
946
+ у: 'e',
947
+ ф: 'a',
948
+ х: '[',
949
+ ц: 'w',
950
+ ч: 'x',
951
+ ш: 'i',
952
+ щ: 'o',
953
+ ъ: ']',
954
+ ы: 's',
955
+ ь: 'm',
956
+ ю: '.',
957
+ я: 'z',
958
+ };
959
+ /**
960
+ * Translates text mistakenly typed in the Russian layout into English
961
+ * @param string string with Russian layout characters
962
+ * @return string with English layout characters
963
+ */
964
+ function transliterateKeyboardLayout(string) {
965
+ let newStr = '';
966
+ for (let i = 0; i < string.length; i++) {
967
+ newStr += string.charAt(i) in MAP ? MAP[string.charAt(i)] : string.charAt(i);
968
+ }
969
+ return newStr;
970
+ }
971
+
972
+ const TUI_DOC_PAGES = new InjectionToken('Documentation pages', {
973
+ factory: () => [],
974
+ });
975
+
976
+ const TUI_DOC_TITLE = new InjectionToken('Page title', {
977
+ factory: () => '',
978
+ });
979
+
980
+ const NAVIGATION_TITLE = new InjectionToken('Page title');
981
+ const NAVIGATION_LABELS = new InjectionToken('Navigation sections labels for search');
982
+ const NAVIGATION_ITEMS = new InjectionToken('Navigation pages');
983
+ const NAVIGATION_PROVIDERS = [
984
+ TuiDestroyService,
985
+ {
986
+ provide: NAVIGATION_TITLE,
987
+ deps: [Router, ActivatedRoute, TUI_DOC_TITLE, TuiDestroyService],
988
+ useFactory: titleProviderFactory,
989
+ },
990
+ {
991
+ provide: NAVIGATION_LABELS,
992
+ deps: [TUI_DOC_PAGES],
993
+ useFactory: labelsProviderFactory,
994
+ },
995
+ {
996
+ provide: NAVIGATION_ITEMS,
997
+ deps: [TUI_DOC_PAGES],
998
+ useFactory: itemsProviderFactory,
999
+ },
1000
+ ];
1001
+ function titleProviderFactory(router, activatedRoute, titlePrefix, destroy$) {
1002
+ return router.events.pipe(filter(event => event instanceof NavigationEnd), map(() => activatedRoute.firstChild), filter(isPresent), mergeMap(({ data }) => data), map(({ title }) => titlePrefix + title), takeUntil(destroy$));
1003
+ }
1004
+ function labelsProviderFactory(pages) {
1005
+ return pages
1006
+ .map(({ section }) => section)
1007
+ .filter(isPresent)
1008
+ .filter((item, index, array) => array.indexOf(item) === index);
1009
+ }
1010
+ function itemsProviderFactory(pages) {
1011
+ const labels = labelsProviderFactory(pages);
1012
+ return [
1013
+ ...labels.map(label => pages.filter(({ section }) => section === label)),
1014
+ pages.filter(page => !page.section),
1015
+ ];
1016
+ }
1017
+
1018
+ const SCROLL_INTO_VIEW_DELAY = 200;
1019
+ // @dynamic
1020
+ let TuiDocNavigationComponent = class TuiDocNavigationComponent {
1021
+ constructor(changeDetectorRef, titleService, title$, documentRef, mode, sidebar, labels, items, searchText, router, activatedRoute) {
1022
+ this.documentRef = documentRef;
1023
+ this.mode = mode;
1024
+ this.sidebar = sidebar;
1025
+ this.labels = labels;
1026
+ this.items = items;
1027
+ this.searchText = searchText;
1028
+ this.router = router;
1029
+ this.activatedRoute = activatedRoute;
1030
+ this.menuOpen = false;
1031
+ this.search = '';
1032
+ this.open = false;
1033
+ this.openPagesArr = [];
1034
+ this.openPagesGroupsArr = [];
1035
+ this.active = '';
1036
+ this.mode$ = this.mode.change$.pipe(startWith(null), map(() => this.mode.mode || 'onLight'));
1037
+ // Angular can't navigate no anchor links
1038
+ // https://stackoverflow.com/questions/36101756/angular2-routing-with-hashtag-to-page-anchor
1039
+ title$.subscribe(title => {
1040
+ changeDetectorRef.markForCheck();
1041
+ titleService.setTitle(title);
1042
+ this.openActivePageGroup();
1043
+ this.handleAnchorLink(this.activatedRoute.snapshot.fragment);
1044
+ });
1045
+ }
1046
+ get canOpen() {
1047
+ return this.search.length > 2;
1048
+ }
1049
+ get filteredItems() {
1050
+ return this.filterItems(this.flattenSubPages(this.items), this.search);
1051
+ }
1052
+ get itemsWithoutSections() {
1053
+ return this.items[this.items.length - 1];
1054
+ }
1055
+ isActive(route) {
1056
+ return route === this.active;
1057
+ }
1058
+ onGroupClick(index) {
1059
+ this.openPagesGroupsArr[index] = !this.openPagesGroupsArr[index];
1060
+ }
1061
+ closeMenu() {
1062
+ this.menuOpen = false;
1063
+ }
1064
+ onSearchChange(search) {
1065
+ this.search = search;
1066
+ this.open = this.canOpen;
1067
+ }
1068
+ onClick() {
1069
+ this.open = false;
1070
+ this.menuOpen = false;
1071
+ this.search = '';
1072
+ this.openActivePageGroup();
1073
+ }
1074
+ filterItems(items, search) {
1075
+ return items.map(section => uniqBy(section.filter(({ title, keywords = '' }) => {
1076
+ title = title.toLowerCase();
1077
+ search = search.toLowerCase();
1078
+ keywords = keywords.toLowerCase();
1079
+ return (title.includes(search) ||
1080
+ keywords.includes(search) ||
1081
+ title.includes(transliterateKeyboardLayout(search)) ||
1082
+ keywords.includes(transliterateKeyboardLayout(search)) ||
1083
+ search.replace(/-/gi, '').includes(title));
1084
+ }), 'title'));
1085
+ }
1086
+ flattenSubPages(items) {
1087
+ return items.reduce((array, item) => [
1088
+ ...array,
1089
+ item.reduce((pages, page) => 'subPages' in page
1090
+ ? [...pages, ...page.subPages]
1091
+ : [...pages, page], []),
1092
+ ], []);
1063
1093
  }
1064
- get code() {
1065
- const code = this.processedContent[this.activeItem];
1066
- return code ? code.trim() : '';
1094
+ isActiveRoute(route) {
1095
+ return this.router.isActive(route, false);
1067
1096
  }
1068
- get isDefaultItem() {
1069
- return this.activeItem === this.defaultTab;
1097
+ handleAnchorLink(hash) {
1098
+ setTimeout(() => {
1099
+ this.navigateToAnchorLink(hash);
1100
+ }, SCROLL_INTO_VIEW_DELAY);
1070
1101
  }
1071
- copyExampleLink() {
1072
- const hashPosition = this.location.href.indexOf('#');
1073
- const currentUrl = hashPosition > -1
1074
- ? this.location.href.substr(0, hashPosition)
1075
- : this.location.href;
1076
- const url = `${currentUrl}#${this.id}`;
1077
- this.clipboard.copy(url);
1078
- this.notifications
1079
- .show(this.texts[1], {
1080
- label: this.texts[2],
1081
- status: "success" /* Success */,
1082
- })
1083
- .subscribe();
1102
+ openActivePageGroup() {
1103
+ this.items.forEach((pages, pagesIndex) => {
1104
+ pages.forEach((page, pageIndex) => {
1105
+ if ('route' in page && this.isActiveRoute(page.route)) {
1106
+ this.openPagesArr[pagesIndex] = true;
1107
+ this.active = page.route;
1108
+ }
1109
+ if ('subPages' in page) {
1110
+ page.subPages.forEach(subPage => {
1111
+ if (this.isActiveRoute(subPage.route)) {
1112
+ this.openPagesArr[pagesIndex] = true;
1113
+ this.openPagesGroupsArr[pagesIndex * 100 + pageIndex] = true;
1114
+ this.active = subPage.route;
1115
+ }
1116
+ });
1117
+ }
1118
+ });
1119
+ });
1084
1120
  }
1085
- getTabs(content) {
1086
- return [this.defaultTab, ...Object.keys(content)];
1121
+ navigateToAnchorLink(fragment) {
1122
+ const element = fragment && this.documentRef.querySelector(`#${fragment}`);
1123
+ if (!element) {
1124
+ return;
1125
+ }
1126
+ element.classList.add('tui-doc-animated-example');
1127
+ element.scrollIntoView({
1128
+ block: 'start',
1129
+ inline: 'nearest',
1130
+ behavior: 'smooth',
1131
+ });
1087
1132
  }
1088
1133
  };
1089
- TuiDocExampleComponent.ctorParameters = () => [
1090
- { type: String, decorators: [{ type: Attribute, args: ['id',] }] },
1091
- { type: Clipboard, decorators: [{ type: Inject, args: [Clipboard,] }] },
1092
- { type: TuiNotificationsService, decorators: [{ type: Inject, args: [TuiNotificationsService,] }] },
1093
- { type: Location, decorators: [{ type: Inject, args: [LOCATION,] }] },
1094
- { type: Observable, decorators: [{ type: Inject, args: [TUI_COPY_TEXTS,] }] },
1095
- { type: Array, decorators: [{ type: Inject, args: [TUI_DOC_EXAMPLE_TEXTS,] }] },
1096
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [TUI_DOC_CODE_EDITOR,] }] },
1097
- { type: undefined, decorators: [{ type: Inject, args: [TUI_DOC_EXAMPLE_CONTENT_PROCESSOR,] }] }
1134
+ TuiDocNavigationComponent.ctorParameters = () => [
1135
+ { type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] },
1136
+ { type: Title, decorators: [{ type: Inject, args: [Title,] }] },
1137
+ { type: Observable, decorators: [{ type: Inject, args: [NAVIGATION_TITLE,] }] },
1138
+ { type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
1139
+ { type: TuiModeDirective, decorators: [{ type: Inject, args: [TuiModeDirective,] }] },
1140
+ { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [TuiSidebarDirective,] }] },
1141
+ { type: Array, decorators: [{ type: Inject, args: [NAVIGATION_LABELS,] }] },
1142
+ { type: undefined, decorators: [{ type: Inject, args: [NAVIGATION_ITEMS,] }] },
1143
+ { type: String, decorators: [{ type: Inject, args: [TUI_DOC_SEARCH_TEXT,] }] },
1144
+ { type: Router, decorators: [{ type: Inject, args: [Router,] }] },
1145
+ { type: ActivatedRoute, decorators: [{ type: Inject, args: [ActivatedRoute,] }] }
1098
1146
  ];
1099
1147
  __decorate([
1100
- Input()
1101
- ], TuiDocExampleComponent.prototype, "heading", void 0);
1102
- __decorate([
1103
- Input()
1104
- ], TuiDocExampleComponent.prototype, "description", void 0);
1105
- __decorate([
1106
- Input()
1107
- ], TuiDocExampleComponent.prototype, "content", null);
1148
+ HostBinding('class._open')
1149
+ ], TuiDocNavigationComponent.prototype, "menuOpen", void 0);
1108
1150
  __decorate([
1109
- Input()
1110
- ], TuiDocExampleComponent.prototype, "componentName", void 0);
1151
+ tuiPure
1152
+ ], TuiDocNavigationComponent.prototype, "filterItems", null);
1111
1153
  __decorate([
1112
1154
  tuiPure
1113
- ], TuiDocExampleComponent.prototype, "getTabs", null);
1114
- TuiDocExampleComponent = __decorate([
1155
+ ], TuiDocNavigationComponent.prototype, "flattenSubPages", null);
1156
+ TuiDocNavigationComponent = __decorate([
1115
1157
  Component({
1116
- selector: 'tui-doc-example',
1117
- template: "<h3 *ngIf=\"heading\" class=\"t-title\">\n <span polymorpheus-outlet [content]=\"heading\"></span>\n <button\n *ngIf=\"id\"\n tuiIconButton\n type=\"button\"\n size=\"xs\"\n class=\"t-link-icon\"\n icon=\"tuiIconLinkLarge\"\n appearance=\"icon\"\n [title]=\"copy$ | async\"\n (click)=\"copyExampleLink()\"\n ></button>\n</h3>\n<h4\n *ngIf=\"description\"\n class=\"t-description\"\n polymorpheus-outlet\n [content]=\"description\"\n></h4>\n<div class=\"t-example\">\n <div class=\"t-tabs-wrapper\">\n <tui-tabs-with-more\n class=\"t-tabs\"\n [(activeItemIndex)]=\"activeItemIndex\"\n >\n <ng-container *ngFor=\"let tab of tabs\">\n <button *tuiTab tuiTab>{{tab}}</button>\n </ng-container>\n </tui-tabs-with-more>\n\n <button\n *ngIf=\"codeEditor\"\n tuiButton\n appearance=\"flat\"\n size=\"s\"\n (click)=\"codeEditor.open(componentName, id || '', processedContent)\"\n >\n Edit on {{codeEditor.name}}\n </button>\n </div>\n <ng-container [ngSwitch]=\"activeItem\">\n <div\n *ngIf=\"isDefaultItem; else codeTab\"\n class=\"t-demo\"\n automation-id=\"tui-doc-example\"\n >\n <ng-content></ng-content>\n </div>\n <ng-template #codeTab>\n <tui-doc-copy\n class=\"t-copy-code\"\n [cdkCopyToClipboard]=\"code\"\n ></tui-doc-copy>\n <tui-doc-code [code]=\"code\"></tui-doc-code>\n </ng-template>\n </ng-container>\n</div>\n",
1158
+ selector: 'tui-doc-navigation',
1159
+ template: "<tui-hosted-dropdown\n *tuiLet=\"filteredItems as filtered\"\n tuiAutoFocus\n tuiDropdownLimitWidth=\"fixed\"\n class=\"input\"\n [autoFocus]=\"!!sidebar\"\n [content]=\"dropdown\"\n [canOpen]=\"canOpen\"\n [(open)]=\"open\"\n>\n <tui-primitive-textfield\n iconAlign=\"left\"\n tuiTextfieldSize=\"m\"\n iconContent=\"tuiIconSearch\"\n [pseudoFocused]=\"open || null\"\n [tuiTextfieldCleaner]=\"true\"\n [tuiTextfieldLabelOutside]=\"true\"\n [value]=\"search\"\n (valueChange)=\"onSearchChange($event)\"\n >\n {{ searchText }}\n </tui-primitive-textfield>\n <ng-template #dropdown let-activeZone>\n <tui-data-list>\n <tui-opt-group\n *ngFor=\"let group of filtered; let index = index\"\n [label]=\"labels[index] || ''\"\n >\n <a\n *ngFor=\"let item of group\"\n tuiOption\n [routerLink]=\"item.route\"\n (click)=\"onClick()\"\n >\n {{ item.title }}\n </a>\n </tui-opt-group>\n </tui-data-list>\n </ng-template>\n</tui-hosted-dropdown>\n\n<nav class=\"navigation\">\n <tui-scrollbar class=\"scrollbar\" [tuiMode]=\"mode$ | async\">\n <tui-accordion [closeOthers]=\"false\" [rounded]=\"false\">\n <tui-accordion-item\n *ngFor=\"let label of labels; index as index\"\n size=\"s\"\n [borders]=\"null\"\n [(open)]=\"!!openPagesArr[index]\"\n >\n <span class=\"tui-space_left-2\">\n <strong>{{ label }}</strong>\n </span>\n <ng-template tuiAccordionItemContent>\n <div class=\"section\">\n <ng-container\n *ngFor=\"let item of items[index]; index as subIndex\"\n >\n <ng-container\n *ngTemplateOutlet=\"pages; context: {item: item, index: index * 100 + subIndex}\"\n ></ng-container>\n </ng-container>\n </div>\n </ng-template>\n </tui-accordion-item>\n </tui-accordion>\n <div class=\"items-container\">\n <ng-container\n *ngFor=\"let item of itemsWithoutSections; let index = index\"\n >\n <ng-container\n *ngTemplateOutlet=\"pages; context: {item: item, index: items.length - 1 + index}\"\n ></ng-container>\n </ng-container>\n </div>\n\n <ng-template #pages let-item=\"item\" let-index=\"index\">\n <a\n *ngIf=\"!item.subPages; else subPages\"\n tuiLink\n routerLinkActive=\"sublink_active\"\n class=\"sublink\"\n [routerLink]=\"item.route\"\n [scrollIntoView]=\"isActive(item.route)\"\n (click)=\"closeMenu()\"\n >\n {{ item.title }}\n </a>\n <ng-template #subPages>\n <div\n routerLinkActive\n class=\"subsection\"\n [routerLinkActiveOptions]=\"{exact: false}\"\n >\n <button\n *ngIf=\"item.subPages\"\n tuiLink\n type=\"button\"\n class=\"sublink sublink_subsection\"\n (click)=\"onGroupClick(index)\"\n >\n <tui-svg\n src=\"tuiIconChevronRight\"\n class=\"chevron\"\n [class.chevron_active]=\"!!openPagesGroupsArr[index]\"\n ></tui-svg>\n {{ item.title }}\n </button>\n <tui-expand\n class=\"tui-space_left-1\"\n [expanded]=\"!!openPagesGroupsArr[index]\"\n >\n <div class=\"section section_bordered\">\n <a\n *ngFor=\"let subPage of item.subPages\"\n tuiLink\n routerLinkActive=\"sublink_active\"\n class=\"sublink sublink_small\"\n [routerLink]=\"subPage.route\"\n [scrollIntoView]=\"isActive(subPage.route)\"\n (click)=\"closeMenu()\"\n >\n {{ subPage.title }}\n </a>\n </div>\n </tui-expand>\n </div>\n </ng-template>\n </ng-template>\n </tui-scrollbar>\n</nav>\n\n<ng-content></ng-content>\n",
1160
+ providers: NAVIGATION_PROVIDERS,
1118
1161
  changeDetection: ChangeDetectionStrategy.OnPush,
1119
- styles: [":host{position:relative;display:block;padding-top:3.5rem;clear:right}.t-title{font:var(--tui-font-heading-5);margin:0 0 .5rem}@media screen and (max-width:47.9375em){:host{padding-top:2rem}.t-title{font:var(--tui-font-heading-6)}}.t-description{font:var(--tui-font-text-m);font-weight:400;margin:0}.t-description:first-letter,.t-title:first-letter{text-transform:capitalize}.t-example{position:relative;margin-top:1.5rem;border:1px solid var(--tui-base-03);border-radius:var(--tui-radius-m);box-shadow:0 .125rem .1875rem rgba(0,0,0,.1)}.t-tabs-wrapper{display:flex;padding:0 2rem;box-shadow:inset 0 -1px var(--tui-base-03);justify-content:space-between;align-items:center}@media screen and (max-width:47.9375em){.t-example{margin-top:.75rem}.t-tabs-wrapper{padding:0 1rem}}.t-tabs{flex-grow:1}.t-demo{padding:2rem;overflow-x:auto}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.t-demo::-webkit-scrollbar,.t-demo::-webkit-scrollbar-thumb{width:1rem;height:1rem;border-radius:6.25rem;background-clip:padding-box;border:6px solid transparent}.t-demo::-webkit-scrollbar{background-color:transparent}.t-demo::-webkit-scrollbar-thumb{background-color:var(--tui-clear-hover)}.t-demo::-webkit-scrollbar-thumb:hover{background-color:var(--tui-clear-active)}.t-demo::-webkit-scrollbar-thumb:active{background-color:var(--tui-text-03)}}@media screen and (max-width:47.9375em){.t-demo{padding:1rem}}.t-copy-code{position:absolute;top:4.375rem;right:1rem}.t-link-icon{margin-left:.3rem;vertical-align:baseline}"]
1162
+ styles: [":host{z-index:1;display:flex;flex-direction:column;text-align:center;background:var(--tui-base-01)}.input{display:block;margin:1.25rem}.navigation{display:flex;max-height:100%;min-height:0;flex:1 1 0;text-align:left}.scrollbar{width:100%;scroll-behavior:smooth}.items-container{display:flex;flex-direction:column;padding:0 16px}.section{display:flex;flex-direction:column;align-items:flex-start;margin:-1rem 0 -.5rem}.section_bordered{margin:.5rem 0;border-left:1px solid var(--tui-base-03)}.subsection{margin-left:.5rem}.sublink{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0;border:0;background:0 0;font-size:inherit;font:var(--tui-font-text-m);margin-left:.5rem;line-height:2.75rem}.sublink_small{margin-left:1rem;line-height:1.5rem}.sublink_small:not(:first-child){margin-top:1rem}.sublink_subsection{margin-left:0;line-height:2.75rem}.sublink_active{color:var(--tui-text-01)}.chevron{transition-property:transform;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;width:1rem;height:1rem;margin:-.25rem .25rem 0 -.1875rem}.chevron_active{transform:rotate(90deg)}"]
1120
1163
  }),
1121
- __param(0, Attribute('id')),
1122
- __param(1, Inject(Clipboard)),
1123
- __param(2, Inject(TuiNotificationsService)),
1124
- __param(3, Inject(LOCATION)),
1125
- __param(4, Inject(TUI_COPY_TEXTS)),
1126
- __param(5, Inject(TUI_DOC_EXAMPLE_TEXTS)),
1127
- __param(6, Optional()),
1128
- __param(6, Inject(TUI_DOC_CODE_EDITOR)),
1129
- __param(7, Inject(TUI_DOC_EXAMPLE_CONTENT_PROCESSOR))
1130
- ], TuiDocExampleComponent);
1164
+ __param(0, Inject(ChangeDetectorRef)),
1165
+ __param(1, Inject(Title)),
1166
+ __param(2, Inject(NAVIGATION_TITLE)),
1167
+ __param(3, Inject(DOCUMENT)),
1168
+ __param(4, Inject(TuiModeDirective)),
1169
+ __param(5, Optional()),
1170
+ __param(5, Inject(TuiSidebarDirective)),
1171
+ __param(6, Inject(NAVIGATION_LABELS)),
1172
+ __param(7, Inject(NAVIGATION_ITEMS)),
1173
+ __param(8, Inject(TUI_DOC_SEARCH_TEXT)),
1174
+ __param(9, Inject(Router)),
1175
+ __param(10, Inject(ActivatedRoute))
1176
+ ], TuiDocNavigationComponent);
1131
1177
 
1132
- let TuiDocExampleModule = class TuiDocExampleModule {
1178
+ let TuiDocNavigationModule = class TuiDocNavigationModule {
1133
1179
  };
1134
- TuiDocExampleModule = __decorate([
1180
+ TuiDocNavigationModule = __decorate([
1135
1181
  NgModule({
1136
1182
  imports: [
1137
1183
  CommonModule,
1138
- ClipboardModule,
1139
- TuiTabsModule,
1184
+ FormsModule,
1185
+ RouterModule,
1186
+ ScrollIntoViewModule,
1140
1187
  TuiButtonModule,
1141
- TuiDocCopyModule,
1142
- TuiDocCodeModule,
1143
- PolymorpheusModule,
1188
+ TuiPrimitiveTextfieldModule,
1189
+ TuiTextfieldControllerModule,
1190
+ TuiActiveZoneModule,
1191
+ TuiLetModule,
1192
+ TuiModeModule,
1193
+ TuiLinkModule,
1194
+ TuiExpandModule,
1195
+ TuiHostedDropdownModule,
1196
+ TuiDropdownControllerModule,
1197
+ TuiAccordionModule,
1198
+ TuiScrollbarModule,
1199
+ TuiSvgModule,
1200
+ TuiDataListModule,
1201
+ TuiAutoFocusModule,
1144
1202
  ],
1145
- declarations: [TuiDocExampleComponent],
1146
- exports: [TuiDocExampleComponent],
1203
+ declarations: [TuiDocNavigationComponent],
1204
+ exports: [TuiDocNavigationComponent],
1147
1205
  })
1148
- ], TuiDocExampleModule);
1149
-
1150
- var TuiDocMainComponent_1;
1151
- // @dynamic
1152
- let TuiDocMainComponent = TuiDocMainComponent_1 = class TuiDocMainComponent {
1153
- constructor(storage, windowRef) {
1154
- this.storage = storage;
1155
- this.windowRef = windowRef;
1156
- this.night = this.storage.getItem('night') === 'true' ||
1157
- (this.storage.getItem('night') === null &&
1158
- this.windowRef.matchMedia('(prefers-color-scheme: dark)').matches);
1159
- this.change$ = new Subject();
1160
- }
1161
- get mode() {
1162
- return this.night ? 'onDark' : null;
1163
- }
1164
- onMode(night) {
1165
- this.night = night;
1166
- this.change$.next();
1167
- this.storage.setItem('night', String(night));
1168
- }
1169
- };
1170
- TuiDocMainComponent.ctorParameters = () => [
1171
- { type: Storage, decorators: [{ type: Inject, args: [LOCAL_STORAGE,] }] },
1172
- { type: Window, decorators: [{ type: Inject, args: [WINDOW,] }] }
1173
- ];
1174
- TuiDocMainComponent = TuiDocMainComponent_1 = __decorate([
1175
- Component({
1176
- selector: 'tui-doc-main',
1177
- template: "<tui-theme-night *ngIf=\"night\"></tui-theme-night>\n<tui-root>\n <div class=\"tui-doc-page\">\n <tui-doc-navigation class=\"tui-doc-navigation\">\n <ng-content select=\"tuiDocNavigation\"></ng-content>\n </tui-doc-navigation>\n <div class=\"tui-doc-content\">\n <router-outlet class=\"tui-doc-outlet\"></router-outlet>\n </div>\n </div>\n <header tuiDocHeader>\n <label class=\"night-mode\">\n Night mode\n <tui-toggle\n class=\"tui-space_left-2\"\n [ngModel]=\"night\"\n (ngModelChange)=\"onMode($event)\"\n ></tui-toggle>\n </label>\n <ng-content select=\"tuiDocHeader\"></ng-content>\n </header>\n <ng-container ngProjectAs=\"tuiOverContent\">\n <ng-content select=\"tuiOverContent\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverDialogs\">\n <ng-content select=\"tuiOverDialogs\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverNotifications\">\n <ng-content select=\"tuiOverNotifications\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverPortals\">\n <ng-content select=\"tuiOverPortals\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverHints\">\n <ng-content select=\"tuiOverHints\"></ng-content>\n </ng-container>\n</tui-root>\n",
1178
- encapsulation: ViewEncapsulation.None,
1179
- providers: [
1180
- {
1181
- provide: TuiModeDirective,
1182
- useExisting: forwardRef(() => TuiDocMainComponent_1),
1183
- },
1184
- TuiSwipeService,
1185
- ],
1186
- styles: ["html{scroll-padding-top:4rem;height:auto}tui-root>tui-scroll-controls{top:4rem!important}@-webkit-keyframes tuiShaking{from,to{transform:translate3d(0,0,0)}10%,30%,50%,70%,90%{transform:translate3d(-.3125rem,0,0)}20%,40%,60%,80%{transform:translate3d(.3125rem,0,0)}}@keyframes tuiShaking{from,to{transform:translate3d(0,0,0)}10%,30%,50%,70%,90%{transform:translate3d(-.3125rem,0,0)}20%,40%,60%,80%{transform:translate3d(.3125rem,0,0)}}body{background:var(--tui-base-01);height:auto}tui-doc-main{display:block}code:not(.hljs):not(.exception){transition-property:background;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;background:var(--tui-base-02);color:var(--tui-text-02);vertical-align:middle;box-shadow:inset 0 -2px var(--tui-secondary);padding:.375rem .5rem;font-size:.875rem;border-radius:.5rem}:focus code:not(.exception){background:var(--tui-base-01)}.tui-doc-page{position:relative;z-index:0;padding-top:4rem}tui-doc-navigation.tui-doc-navigation{position:fixed;top:4rem;bottom:0;width:16.25rem;border-right:1px solid var(--tui-base-03)}.tui-doc-content{margin-left:16.25rem}@media screen and (max-width:47.9375em){tui-doc-navigation.tui-doc-navigation{display:none}.tui-doc-content{margin-left:0}}.tui-doc-outlet+*{display:block}.tui-doc-animated-example{-webkit-animation:1s .3s tuiShaking;animation:1s .3s tuiShaking}label.night-mode{cursor:pointer}.hljs-tag{background:0 0}.hljs{display:block;overflow-x:auto;padding:.5em;color:var(--tui-text-01);background-color:var(--tui-clear-disabled)}.hljs-subst,.hljs-title{font-weight:400;color:var(--tui-text-01)}.hljs-comment,.hljs-quote{color:var(--tui-text-03);font-style:italic}.hljs-meta{color:#e38162}.hljs-keyword,.hljs-literal,.hljs-name,.hljs-section,.hljs-selector-class,.hljs-selector-id,.hljs-selector-tag,.hljs-type{font-weight:700;color:var(--tui-link)}.hljs-attribute,.hljs-link,.hljs-number,.hljs-regexp{font-weight:700;color:var(--tui-support-06)}.hljs-link,.hljs-number,.hljs-regexp{font-weight:400}.hljs-string{color:var(--tui-positive);font-weight:700}.hljs-bullet,.hljs-formula,.hljs-symbol{color:var(--tui-text-01);background:var(--tui-base-02);font-style:italic}.hljs-doctag{text-decoration:underline}.hljs-template-variable,.hljs-variable{color:var(--tui-warning-fill)}.hljs-addition{background:var(--tui-success-bg)}.hljs-deletion{background:var(--tui-error-bg)}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}.hljs .hljs-line-numbers{padding:0}.hljs-ln-numbers{vertical-align:top;opacity:.3;text-align:right;padding-right:1em!important}"]
1187
- }),
1188
- __param(0, Inject(LOCAL_STORAGE)),
1189
- __param(1, Inject(WINDOW))
1190
- ], TuiDocMainComponent);
1206
+ ], TuiDocNavigationModule);
1191
1207
 
1192
1208
  const TUI_DOC_LOGO = new InjectionToken('Main logo', {
1193
1209
  factory: () => '',
@@ -1220,7 +1236,7 @@ TuiDocHeaderComponent.ctorParameters = () => [
1220
1236
  TuiDocHeaderComponent = __decorate([
1221
1237
  Component({
1222
1238
  selector: 'header[tuiDocHeader]',
1223
- template: "<button\n tuiIconButton\n class=\"menu\"\n icon=\"tuiIconMenuLarge\"\n appearance=\"icon\"\n [title]=\"menu\"\n (click)=\"onClick()\"\n (tuiActiveZoneChange)=\"onActiveZone($event)\"\n>\n <tui-doc-navigation\n *tuiSidebar=\"open$ | async\"\n class=\"navigation\"\n ></tui-doc-navigation>\n</button>\n<div polymorpheus-outlet class=\"logo tui-text_h5\" [content]=\"logo\">\n <ng-template let-src>\n <img class=\"img\" alt=\"Logo\" [src]=\"src\" />\n </ng-template>\n</div>\n<ng-content></ng-content>\n",
1239
+ template: "<button\n tuiIconButton\n icon=\"tuiIconMenuLarge\"\n appearance=\"icon\"\n class=\"menu\"\n [title]=\"menu\"\n (click)=\"onClick()\"\n (tuiActiveZoneChange)=\"onActiveZone($event)\"\n>\n <tui-doc-navigation\n *tuiSidebar=\"open$ | async\"\n class=\"navigation\"\n ></tui-doc-navigation>\n</button>\n<div polymorpheus-outlet class=\"logo tui-text_h5\" [content]=\"logo\">\n <ng-template let-src>\n <img alt=\"Logo\" class=\"img\" [src]=\"src\" />\n </ng-template>\n</div>\n<ng-content></ng-content>\n",
1224
1240
  changeDetection: ChangeDetectionStrategy.OnPush,
1225
1241
  styles: [":host{box-shadow:0 .125rem 1rem rgba(0,0,0,.08);position:fixed;top:0;left:0;right:0;z-index:1;display:flex;height:3.9375rem;align-items:center;padding:0 1.25rem;background:var(--tui-base-01);border-bottom:1px solid var(--tui-base-03)}.logo{margin-right:auto}.img{display:block}.menu{margin-left:-1.25rem}@media screen and (min-width:48em){.menu{display:none}}.navigation{min-height:100%}"]
1226
1242
  }),
@@ -1272,25 +1288,6 @@ const TUI_DOC_DEFAULT_TABS = new InjectionToken('Array of default tab names', {
1272
1288
  factory: () => [],
1273
1289
  });
1274
1290
 
1275
- let TuiDocPageTabConnectorDirective = class TuiDocPageTabConnectorDirective {
1276
- constructor(template) {
1277
- this.template = template;
1278
- }
1279
- };
1280
- TuiDocPageTabConnectorDirective.ctorParameters = () => [
1281
- { type: TemplateRef, decorators: [{ type: Inject, args: [TemplateRef,] }] }
1282
- ];
1283
- __decorate([
1284
- Input(),
1285
- tuiDefaultProp()
1286
- ], TuiDocPageTabConnectorDirective.prototype, "pageTab", void 0);
1287
- TuiDocPageTabConnectorDirective = __decorate([
1288
- Directive({
1289
- selector: '[pageTab]',
1290
- }),
1291
- __param(0, Inject(TemplateRef))
1292
- ], TuiDocPageTabConnectorDirective);
1293
-
1294
1291
  const TUI_DOC_SEE_ALSO = new InjectionToken('Array of arrays of related pages', {
1295
1292
  factory: () => [],
1296
1293
  });
@@ -1312,6 +1309,25 @@ function seeAlsoProviderFactory({ nativeElement }, seeAlsoGroups) {
1312
1309
  return Array.from(seeAlsoSet);
1313
1310
  }
1314
1311
 
1312
+ let TuiDocPageTabConnectorDirective = class TuiDocPageTabConnectorDirective {
1313
+ constructor(template) {
1314
+ this.template = template;
1315
+ }
1316
+ };
1317
+ TuiDocPageTabConnectorDirective.ctorParameters = () => [
1318
+ { type: TemplateRef, decorators: [{ type: Inject, args: [TemplateRef,] }] }
1319
+ ];
1320
+ __decorate([
1321
+ Input(),
1322
+ tuiDefaultProp()
1323
+ ], TuiDocPageTabConnectorDirective.prototype, "pageTab", void 0);
1324
+ TuiDocPageTabConnectorDirective = __decorate([
1325
+ Directive({
1326
+ selector: '[pageTab]',
1327
+ }),
1328
+ __param(0, Inject(TemplateRef))
1329
+ ], TuiDocPageTabConnectorDirective);
1330
+
1315
1331
  // Ambient type cannot be used without dynamic https://github.com/angular/angular/issues/23395
1316
1332
  // @dynamic
1317
1333
  let TuiDocPageComponent = class TuiDocPageComponent {
@@ -1323,8 +1339,8 @@ let TuiDocPageComponent = class TuiDocPageComponent {
1323
1339
  this.package = '';
1324
1340
  this.type = '';
1325
1341
  this.path = '';
1326
- this.activeItemIndex = NaN;
1327
1342
  this.tabConnectors = EMPTY_QUERY;
1343
+ this.activeItemIndex = NaN;
1328
1344
  }
1329
1345
  get showSeeAlso() {
1330
1346
  return !!this.seeAlso.length && this.activeItemIndex === 0;
@@ -1356,7 +1372,7 @@ __decorate([
1356
1372
  TuiDocPageComponent = __decorate([
1357
1373
  Component({
1358
1374
  selector: 'tui-doc-page',
1359
- template: "<header class=\"t-header\">\n <h1 class=\"t-title\">\n {{header}}\n <tui-tag\n *ngIf=\"deprecated !== null\"\n class=\"t-tag t-tag_deprecated\"\n value=\"deprecated\"\n status=\"custom\"\n ></tui-tag>\n <tui-tag\n *ngIf=\"package\"\n class=\"t-tag t-tag_package\"\n status=\"custom\"\n [value]=\"package\"\n [autoColor]=\"true\"\n ></tui-tag>\n </h1>\n <tui-tabs-with-more\n *ngIf=\"tabConnectors.length\"\n class=\"t-tabs\"\n [(activeItemIndex)]=\"activeItemIndex\"\n >\n <ng-container\n *ngFor=\"let tab of tabConnectors; first as first; index as index\"\n >\n <ng-container *ngIf=\"first; else dynamicTab\">\n <a\n *tuiTab\n tuiTab\n routerLink=\"./\"\n routerLinkActive\n [routerLinkActiveOptions]=\"{ exact: true }\"\n >\n {{tab.pageTab || defaultTabs[index]}}\n </a>\n </ng-container>\n <ng-template #dynamicTab>\n <a\n *tuiTab\n tuiTab\n routerLinkActive\n [routerLink]=\"getRouterLink(tab.pageTab || defaultTabs[index])\"\n >\n {{tab.pageTab || defaultTabs[index]}}\n </a>\n </ng-template>\n </ng-container>\n </tui-tabs-with-more>\n <tui-doc-source-code\n class=\"t-source-code\"\n [header]=\"header\"\n [package]=\"package\"\n [type]=\"type\"\n [path]=\"path\"\n ></tui-doc-source-code>\n</header>\n<div class=\"t-content\">\n <ng-content></ng-content>\n <tui-doc-see-also\n *ngIf=\"showSeeAlso\"\n class=\"t-see-also\"\n [seeAlso]=\"seeAlso\"\n ></tui-doc-see-also>\n <ng-container *ngFor=\"let tab of tabConnectors; index as index\">\n <ng-container *ngIf=\"index === activeItemIndex\">\n <ng-container *ngTemplateOutlet=\"tab.template\"></ng-container>\n </ng-container>\n </ng-container>\n</div>\n",
1375
+ template: "<header class=\"t-header\">\n <h1 class=\"t-title\">\n {{ header }}\n <tui-tag\n *ngIf=\"deprecated !== null\"\n value=\"deprecated\"\n status=\"custom\"\n class=\"t-tag t-tag_deprecated\"\n ></tui-tag>\n <tui-tag\n *ngIf=\"package\"\n status=\"custom\"\n class=\"t-tag t-tag_package\"\n [value]=\"package\"\n [autoColor]=\"true\"\n ></tui-tag>\n </h1>\n <tui-tabs-with-more\n *ngIf=\"tabConnectors.length\"\n class=\"t-tabs\"\n [(activeItemIndex)]=\"activeItemIndex\"\n >\n <ng-container\n *ngFor=\"let tab of tabConnectors; first as first; index as index\"\n >\n <ng-container *ngIf=\"first; else dynamicTab\">\n <a\n *tuiTab\n tuiTab\n routerLink=\"./\"\n routerLinkActive\n [routerLinkActiveOptions]=\"{exact: true}\"\n >\n {{ tab.pageTab || defaultTabs[index] }}\n </a>\n </ng-container>\n <ng-template #dynamicTab>\n <a\n *tuiTab\n tuiTab\n routerLinkActive\n [routerLink]=\"getRouterLink(tab.pageTab || defaultTabs[index])\"\n >\n {{ tab.pageTab || defaultTabs[index] }}\n </a>\n </ng-template>\n </ng-container>\n </tui-tabs-with-more>\n <tui-doc-source-code\n class=\"t-source-code\"\n [header]=\"header\"\n [package]=\"package\"\n [type]=\"type\"\n [path]=\"path\"\n ></tui-doc-source-code>\n</header>\n<div class=\"t-content\">\n <ng-content></ng-content>\n <tui-doc-see-also\n *ngIf=\"showSeeAlso\"\n class=\"t-see-also\"\n [seeAlso]=\"seeAlso\"\n ></tui-doc-see-also>\n <ng-container *ngFor=\"let tab of tabConnectors; index as index\">\n <ng-container *ngIf=\"index === activeItemIndex\">\n <ng-container *ngTemplateOutlet=\"tab.template\"></ng-container>\n </ng-container>\n </ng-container>\n</div>\n",
1360
1376
  changeDetection: ChangeDetectionStrategy.OnPush,
1361
1377
  providers: PAGE_PROVIDERS,
1362
1378
  styles: [":host{display:flex;flex-direction:column;min-height:0;flex-basis:0;flex-grow:1}.t-header{display:flex;font:var(--tui-font-heading-3);flex-wrap:wrap;min-height:7.25rem;color:var(--tui-text-01);box-shadow:inset 0 -1px 0 0 var(--tui-base-03);padding:3.75rem 0 0;box-sizing:border-box;flex-shrink:0;margin:0 min(10vw,8.75rem)}@media screen and (max-width:47.9375em){.t-header{font:var(--tui-font-heading-4);min-height:4.5rem;padding:1.25rem 1.25rem 0;margin:0}}.t-title{min-width:100%;font-size:inherit;margin:0}.t-tag{vertical-align:middle;text-transform:uppercase;margin-right:.5rem}.t-tag_deprecated{background-color:var(--tui-error-fill)}.t-tag.t-tag_package{color:#000}.t-tabs{flex:1;margin:1.125rem .3125rem 0 0}@media screen and (max-width:47.9375em){.t-tabs{margin-top:.25rem}}.t-content{padding:2rem 0;margin:0 min(10vw,8.75rem)}@media screen and (max-width:47.9375em){.t-content{padding:2rem 1.25rem;margin:0}}.t-see-also{min-width:18.75rem;width:30%;float:right;margin-left:1.5rem}@media screen and (max-width:47.9375em){.t-see-also{float:none;width:100%;margin:0 0 1.5rem}}.t-source-code{align-self:flex-end;line-height:2.75rem}"]
@@ -1396,7 +1412,7 @@ __decorate([
1396
1412
  TuiDocSeeAlsoComponent = __decorate([
1397
1413
  Component({
1398
1414
  selector: 'tui-doc-see-also',
1399
- template: "<h5 class=\"header\">{{text}}</h5>\n<ng-container *ngFor=\"let item of seeAlso; last as last\">\n <a tuiLink [routerLink]=\"getRouterLink(item)\">{{item}}</a>\n <ng-container *ngIf=\"!last\">, </ng-container>\n</ng-container>\n",
1415
+ template: "<h5 class=\"header\">{{ text }}</h5>\n<ng-container *ngFor=\"let item of seeAlso; last as last\">\n <a tuiLink [routerLink]=\"getRouterLink(item)\">{{ item }}</a>\n <ng-container *ngIf=\"!last\">,</ng-container>\n</ng-container>\n",
1400
1416
  changeDetection: ChangeDetectionStrategy.OnPush,
1401
1417
  styles: [":host{display:block}.header{font-size:.6875rem;line-height:1rem;text-transform:uppercase;letter-spacing:.075em;color:var(--tui-text-02);margin:0 0 .5rem;white-space:nowrap}"]
1402
1418
  }),
@@ -1461,7 +1477,7 @@ __decorate([
1461
1477
  TuiDocSourceCodeComponent = __decorate([
1462
1478
  Component({
1463
1479
  selector: 'tui-doc-source-code',
1464
- template: "<div\n polymorpheus-outlet\n *ngIf=\"!!sourceCode\"\n [content]=\"sourceCode\"\n [context]=\"pathOptions\"\n>\n <ng-template let-link>\n <a\n *ngIf=\"link\"\n tuiIconButton\n type=\"button\"\n icon=\"tuiIconCodeLarge\"\n appearance=\"icon\"\n target=\"_blank\"\n size=\"s\"\n [title]=\"text\"\n [href]=\"link\"\n ></a>\n </ng-template>\n</div>\n",
1480
+ template: "<div\n *ngIf=\"!!sourceCode\"\n polymorpheus-outlet\n [content]=\"sourceCode\"\n [context]=\"pathOptions\"\n>\n <ng-template let-link>\n <a\n *ngIf=\"link\"\n tuiIconButton\n type=\"button\"\n icon=\"tuiIconCodeLarge\"\n appearance=\"icon\"\n target=\"_blank\"\n size=\"s\"\n [title]=\"text\"\n [href]=\"link\"\n ></a>\n </ng-template>\n</div>\n",
1465
1481
  changeDetection: ChangeDetectionStrategy.OnPush
1466
1482
  }),
1467
1483
  __param(0, Inject(TUI_DOC_SOURCE_CODE)),
@@ -1536,6 +1552,20 @@ const TUI_DOC_RUSSIAN = [
1536
1552
  },
1537
1553
  ];
1538
1554
 
1555
+ let TuiAddonDocModule = class TuiAddonDocModule {
1556
+ };
1557
+ TuiAddonDocModule = __decorate([
1558
+ NgModule({
1559
+ exports: [
1560
+ TuiDocCodeModule,
1561
+ TuiDocDemoModule,
1562
+ TuiDocDocumentationModule,
1563
+ TuiDocPageModule,
1564
+ TuiDocExampleModule,
1565
+ ],
1566
+ })
1567
+ ], TuiAddonDocModule);
1568
+
1539
1569
  /**
1540
1570
  * Generates typical page routing structure
1541
1571
  */
@@ -1554,20 +1584,6 @@ function generateRoutes(type) {
1554
1584
  ];
1555
1585
  }
1556
1586
 
1557
- let TuiAddonDocModule = class TuiAddonDocModule {
1558
- };
1559
- TuiAddonDocModule = __decorate([
1560
- NgModule({
1561
- exports: [
1562
- TuiDocCodeModule,
1563
- TuiDocDemoModule,
1564
- TuiDocDocumentationModule,
1565
- TuiDocPageModule,
1566
- TuiDocExampleModule,
1567
- ],
1568
- })
1569
- ], TuiAddonDocModule);
1570
-
1571
1587
  /**
1572
1588
  * Public API Surface of @taiga-ui/addon-doc
1573
1589
  */
@@ -1576,5 +1592,5 @@ TuiAddonDocModule = __decorate([
1576
1592
  * Generated bundle index. Do not edit.
1577
1593
  */
1578
1594
 
1579
- export { DEMO_TEXTS, DOC_TEXTS, EXAMPLE_TEXTS, ScrollIntoViewDirective, ScrollIntoViewModule, TUI_DOC_CODE_EDITOR, TUI_DOC_DEFAULT_TABS, TUI_DOC_DEMO_TEXTS, TUI_DOC_DOCUMENTATION_TEXTS, TUI_DOC_EXAMPLE_CONTENT_PROCESSOR, TUI_DOC_EXAMPLE_TEXTS, TUI_DOC_LOGO, TUI_DOC_MENU_TEXT, TUI_DOC_PAGES, TUI_DOC_RUSSIAN, TUI_DOC_SEARCH_TEXT, TUI_DOC_SEE_ALSO, TUI_DOC_SEE_ALSO_TEXT, TUI_DOC_SOURCE_CODE, TUI_DOC_SOURCE_CODE_TEXT, TUI_DOC_TITLE, TuiAddonDocModule, TuiDocCodeComponent, TuiDocCodeModule, TuiDocCopyComponent, TuiDocCopyModule, TuiDocDemoComponent, TuiDocDemoModule, TuiDocDocumentationComponent, TuiDocDocumentationModule, TuiDocDocumentationPropertyConnectorDirective, TuiDocExampleComponent, TuiDocExampleModule, TuiDocMainComponent, TuiDocMainModule, TuiDocNavigationComponent, TuiDocNavigationModule, TuiDocPageComponent, TuiDocPageModule, TuiDocPageTabConnectorDirective, generateRoutes, NAVIGATION_TITLE as ɵa, NAVIGATION_LABELS as ɵb, NAVIGATION_ITEMS as ɵc, NAVIGATION_PROVIDERS as ɵd, titleProviderFactory as ɵe, labelsProviderFactory as ɵf, itemsProviderFactory as ɵg, TuiInputOpacityModule as ɵh, TuiInputOpacityDirective as ɵi, TuiDocHeaderModule as ɵj, TuiDocHeaderComponent as ɵk, PAGE_SEE_ALSO as ɵl, PAGE_PROVIDERS as ɵm, seeAlsoProviderFactory as ɵn, TuiDocSeeAlsoModule as ɵo, TuiDocSeeAlsoComponent as ɵp, TuiDocSourceCodeModule as ɵq, TuiDocSourceCodeComponent as ɵr };
1595
+ export { DEMO_TEXTS, DOC_TEXTS, EXAMPLE_TEXTS, ScrollIntoViewDirective, ScrollIntoViewModule, TUI_DOC_CODE_EDITOR, TUI_DOC_DEFAULT_TABS, TUI_DOC_DEMO_TEXTS, TUI_DOC_DOCUMENTATION_TEXTS, TUI_DOC_EXAMPLE_CONTENT_PROCESSOR, TUI_DOC_EXAMPLE_TEXTS, TUI_DOC_LOGO, TUI_DOC_MENU_TEXT, TUI_DOC_PAGES, TUI_DOC_RUSSIAN, TUI_DOC_SEARCH_TEXT, TUI_DOC_SEE_ALSO, TUI_DOC_SEE_ALSO_TEXT, TUI_DOC_SOURCE_CODE, TUI_DOC_SOURCE_CODE_TEXT, TUI_DOC_TITLE, TuiAddonDocModule, TuiDocCodeComponent, TuiDocCodeModule, TuiDocCopyComponent, TuiDocCopyModule, TuiDocDemoComponent, TuiDocDemoModule, TuiDocDocumentationComponent, TuiDocDocumentationModule, TuiDocDocumentationPropertyConnectorDirective, TuiDocExampleComponent, TuiDocExampleModule, TuiDocMainComponent, TuiDocMainModule, TuiDocNavigationComponent, TuiDocNavigationModule, TuiDocPageComponent, TuiDocPageModule, TuiDocPageTabConnectorDirective, generateRoutes, TuiInputOpacityModule as ɵa, TuiInputOpacityDirective as ɵb, TuiDocExampleGetTabsPipe as ɵc, TuiDocHeaderModule as ɵd, NAVIGATION_TITLE as ɵe, NAVIGATION_LABELS as ɵf, NAVIGATION_ITEMS as ɵg, NAVIGATION_PROVIDERS as ɵh, titleProviderFactory as ɵi, labelsProviderFactory as ɵj, itemsProviderFactory as ɵk, TuiDocHeaderComponent as ɵl, PAGE_SEE_ALSO as ɵm, PAGE_PROVIDERS as ɵn, seeAlsoProviderFactory as ɵo, TuiDocSeeAlsoModule as ɵp, TuiDocSeeAlsoComponent as ɵq, TuiDocSourceCodeModule as ɵr, TuiDocSourceCodeComponent as ɵs };
1580
1596
  //# sourceMappingURL=taiga-ui-addon-doc.js.map