@taiga-ui/addon-doc 2.24.0 → 2.25.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 (74) hide show
  1. package/bundles/taiga-ui-addon-doc.umd.js +789 -789
  2. package/bundles/taiga-ui-addon-doc.umd.js.map +1 -1
  3. package/bundles/taiga-ui-addon-doc.umd.min.js +2 -2
  4. package/bundles/taiga-ui-addon-doc.umd.min.js.map +1 -1
  5. package/esm2015/addon-doc.module.js +1 -1
  6. package/esm2015/components/code/code.component.js +1 -1
  7. package/esm2015/components/code/code.module.js +1 -1
  8. package/esm2015/components/copy/copy.module.js +1 -1
  9. package/esm2015/components/demo/demo.component.js +1 -1
  10. package/esm2015/components/demo/demo.module.js +1 -1
  11. package/esm2015/components/documentation/documentation.component.js +1 -1
  12. package/esm2015/components/documentation/documentation.module.js +2 -2
  13. package/esm2015/components/example/example.component.js +1 -1
  14. package/esm2015/components/example/example.module.js +2 -2
  15. package/esm2015/components/main/main.module.js +1 -1
  16. package/esm2015/components/navigation/navigation.component.js +1 -1
  17. package/esm2015/components/navigation/navigation.module.js +1 -1
  18. package/esm2015/components/navigation/navigation.providers.js +1 -1
  19. package/esm2015/components/page/page.component.js +2 -2
  20. package/esm2015/components/page/page.module.js +2 -2
  21. package/esm2015/components/page/page.providers.js +1 -1
  22. package/esm2015/directives/scroll-into-view/scroll-into-view.module.js +1 -1
  23. package/esm2015/internal/header/header.component.js +1 -1
  24. package/esm2015/internal/header/header.module.js +1 -1
  25. package/esm2015/internal/input-opacity/input-opacity.module.js +1 -1
  26. package/esm2015/internal/see-also/see-also.component.js +1 -1
  27. package/esm2015/internal/see-also/see-also.module.js +1 -1
  28. package/esm2015/internal/source-code/source-code.component.js +1 -1
  29. package/esm2015/internal/source-code/source-code.module.js +1 -1
  30. package/esm2015/languages/russian.js +1 -1
  31. package/esm2015/public-api.js +5 -5
  32. package/esm2015/taiga-ui-addon-doc.js +6 -6
  33. package/esm2015/tokens/code-editor.js +1 -1
  34. package/esm2015/tokens/pages.js +1 -1
  35. package/esm2015/tokens/source-code.js +1 -1
  36. package/esm5/addon-doc.module.js +1 -1
  37. package/esm5/components/code/code.component.js +1 -1
  38. package/esm5/components/code/code.module.js +1 -1
  39. package/esm5/components/copy/copy.module.js +1 -1
  40. package/esm5/components/demo/demo.component.js +1 -1
  41. package/esm5/components/demo/demo.module.js +1 -1
  42. package/esm5/components/documentation/documentation.component.js +1 -1
  43. package/esm5/components/documentation/documentation.module.js +2 -2
  44. package/esm5/components/example/example.component.js +1 -1
  45. package/esm5/components/example/example.module.js +2 -2
  46. package/esm5/components/main/main.module.js +1 -1
  47. package/esm5/components/navigation/navigation.component.js +1 -1
  48. package/esm5/components/navigation/navigation.module.js +1 -1
  49. package/esm5/components/navigation/navigation.providers.js +1 -1
  50. package/esm5/components/page/page.component.js +2 -2
  51. package/esm5/components/page/page.module.js +2 -2
  52. package/esm5/components/page/page.providers.js +1 -1
  53. package/esm5/directives/scroll-into-view/scroll-into-view.module.js +1 -1
  54. package/esm5/internal/header/header.component.js +1 -1
  55. package/esm5/internal/header/header.module.js +1 -1
  56. package/esm5/internal/input-opacity/input-opacity.module.js +1 -1
  57. package/esm5/internal/see-also/see-also.component.js +1 -1
  58. package/esm5/internal/see-also/see-also.module.js +1 -1
  59. package/esm5/internal/source-code/source-code.component.js +1 -1
  60. package/esm5/internal/source-code/source-code.module.js +1 -1
  61. package/esm5/languages/russian.js +1 -1
  62. package/esm5/public-api.js +5 -5
  63. package/esm5/taiga-ui-addon-doc.js +6 -6
  64. package/esm5/tokens/code-editor.js +1 -1
  65. package/esm5/tokens/pages.js +1 -1
  66. package/esm5/tokens/source-code.js +1 -1
  67. package/fesm2015/taiga-ui-addon-doc.js +812 -812
  68. package/fesm2015/taiga-ui-addon-doc.js.map +1 -1
  69. package/fesm5/taiga-ui-addon-doc.js +782 -782
  70. package/fesm5/taiga-ui-addon-doc.js.map +1 -1
  71. package/package.json +5 -5
  72. package/public-api.d.ts +4 -4
  73. package/taiga-ui-addon-doc.d.ts +5 -5
  74. package/taiga-ui-addon-doc.metadata.json +1 -1
@@ -1,20 +1,20 @@
1
1
  import { __awaiter, __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, Pipe, ViewEncapsulation } from '@angular/core';
2
+ import { Input, HostBinding, Component, NgModule, Inject, ChangeDetectionStrategy, InjectionToken, Renderer2, PLATFORM_ID, ContentChild, TemplateRef, ViewChild, HostListener, forwardRef, EventEmitter, Output, Directive, ChangeDetectorRef, ContentChildren, Attribute, Optional, Pipe, ViewEncapsulation, ElementRef } from '@angular/core';
3
3
  import { BehaviorSubject, Subject, timer, Observable, merge } from 'rxjs';
4
- import { switchMap, switchMapTo, mapTo, startWith, takeUntil, filter, map, mergeMap, debounceTime, distinctUntilChanged } from 'rxjs/operators';
4
+ import { switchMap, switchMapTo, mapTo, startWith, takeUntil, map, debounceTime, filter, mergeMap, distinctUntilChanged } from 'rxjs/operators';
5
5
  import { CommonModule, isPlatformBrowser, Location as Location$1, DOCUMENT } from '@angular/common';
6
6
  import { HighlightModule } from 'ngx-highlightjs';
7
- 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';
8
- import { TUI_COPY_TEXTS, TuiSelectModule, TuiRadioBlockModule, TuiCheckboxLabeledModule, TuiDataListWrapperModule, TuiAccordionModule, TuiBadgeModule, TuiToggleModule, TuiInputCountModule, TuiTabsModule, TuiTagModule } from '@taiga-ui/kit';
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
18
 
19
19
  function rawLoad(content) {
20
20
  return __awaiter(this, void 0, void 0, function* () {
@@ -324,258 +324,565 @@ TuiDocDemoModule = __decorate([
324
324
  })
325
325
  ], TuiDocDemoModule);
326
326
 
327
- const MAP = {
328
- а: 'f',
329
- б: ',',
330
- в: 'd',
331
- г: 'u',
332
- д: 'l',
333
- е: 't',
334
- ё: '`',
335
- ж: ';',
336
- з: 'p',
337
- и: 'b',
338
- й: 'q',
339
- к: 'r',
340
- л: 'k',
341
- м: 'v',
342
- н: 'y',
343
- о: 'j',
344
- п: 'g',
345
- р: 'h',
346
- с: 'c',
347
- т: 'n',
348
- у: 'e',
349
- ф: 'a',
350
- х: '[',
351
- ц: 'w',
352
- ч: 'x',
353
- ш: 'i',
354
- щ: 'o',
355
- ъ: ']',
356
- ы: 's',
357
- ь: 'm',
358
- ю: '.',
359
- я: 'z',
360
- };
361
- /**
362
- * Translates text mistakenly typed in the Russian layout into English
363
- * @param string string with Russian layout characters
364
- * @return string with English layout characters
365
- */
366
- function transliterateKeyboardLayout(string) {
367
- let newStr = '';
368
- for (let i = 0; i < string.length; i++) {
369
- newStr += string.charAt(i) in MAP ? MAP[string.charAt(i)] : string.charAt(i);
370
- }
371
- return newStr;
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(''));
335
+ }
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];
372
346
  }
373
347
 
374
- const TUI_DOC_PAGES = new InjectionToken('Documentation pages', {
375
- factory: () => [],
376
- });
377
-
378
- const TUI_DOC_TITLE = new InjectionToken('Page title', {
379
- factory: () => '',
380
- });
381
-
382
- const NAVIGATION_TITLE = new InjectionToken('Page title');
383
- const NAVIGATION_LABELS = new InjectionToken('Navigation sections labels for search');
384
- const NAVIGATION_ITEMS = new InjectionToken('Navigation pages');
385
- const NAVIGATION_PROVIDERS = [
386
- TuiDestroyService,
387
- {
388
- provide: NAVIGATION_TITLE,
389
- deps: [Router, ActivatedRoute, TUI_DOC_TITLE, TuiDestroyService],
390
- useFactory: titleProviderFactory,
391
- },
392
- {
393
- provide: NAVIGATION_LABELS,
394
- deps: [TUI_DOC_PAGES],
395
- useFactory: labelsProviderFactory,
396
- },
397
- {
398
- provide: NAVIGATION_ITEMS,
399
- deps: [TUI_DOC_PAGES],
400
- useFactory: itemsProviderFactory,
401
- },
402
- ];
403
- function titleProviderFactory(router, activatedRoute, titlePrefix, destroy$) {
404
- return router.events.pipe(filter(event => event instanceof NavigationEnd), map(() => activatedRoute.firstChild), filter(isPresent), mergeMap(({ data }) => data), map(({ title }) => titlePrefix + title), takeUntil(destroy$));
348
+ function inspectArray(array, depth) {
349
+ if (depth === 0) {
350
+ return '[…]';
351
+ }
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';
362
+ }
363
+ return `[${result}]`;
405
364
  }
406
- function labelsProviderFactory(pages) {
407
- return pages
408
- .map(({ section }) => section)
409
- .filter(isPresent)
410
- .filter((item, index, array) => array.indexOf(item) === index);
365
+ function inspectObject(object, depth) {
366
+ if (depth === 0) {
367
+ return `{}`;
368
+ }
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)}`;
382
+ }
383
+ return `{${result}}`;
411
384
  }
412
- function itemsProviderFactory(pages) {
413
- const labels = labelsProviderFactory(pages);
414
- return [
415
- ...labels.map(label => pages.filter(({ section }) => section === label)),
416
- pages.filter(page => !page.section),
417
- ];
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';
395
+ }
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);
404
+ }
405
+ if (data instanceof RegExp) {
406
+ return data.toString();
407
+ }
408
+ if (Array.isArray(data)) {
409
+ return inspectArray(data, depth);
410
+ }
411
+ return inspectObject(data, depth);
418
412
  }
419
413
 
420
- const SCROLL_INTO_VIEW_DELAY = 200;
421
- // @dynamic
422
- let TuiDocNavigationComponent = class TuiDocNavigationComponent {
423
- constructor(changeDetectorRef, titleService, title$, documentRef, mode, sidebar, labels, items, searchText, router, activatedRoute) {
424
- this.documentRef = documentRef;
425
- this.mode = mode;
426
- this.sidebar = sidebar;
427
- this.labels = labels;
428
- this.items = items;
429
- this.searchText = searchText;
430
- this.router = router;
414
+ const SERIALIZED_SUFFIX = '$';
415
+ // @bad TODO: refactor output and value sync
416
+ let TuiDocDocumentationPropertyConnectorDirective = class TuiDocDocumentationPropertyConnectorDirective {
417
+ constructor(template, locationRef, activatedRoute, urlSerializer) {
418
+ this.template = template;
419
+ this.locationRef = locationRef;
431
420
  this.activatedRoute = activatedRoute;
432
- this.search = '';
433
- this.open = false;
434
- this.openPagesArr = [];
435
- this.openPagesGroupsArr = [];
436
- this.active = '';
437
- this.menuOpen = false;
438
- this.mode$ = this.mode.change$.pipe(startWith(null), map(() => this.mode.mode || 'onLight'));
439
- // Angular can't navigate no anchor links
440
- // https://stackoverflow.com/questions/36101756/angular2-routing-with-hashtag-to-page-anchor
441
- title$.subscribe(title => {
442
- changeDetectorRef.markForCheck();
443
- titleService.setTitle(title);
444
- this.openActivePageGroup();
445
- this.handleAnchorLink(this.activatedRoute.snapshot.fragment);
446
- });
447
- }
448
- get canOpen() {
449
- return this.search.length > 2;
421
+ this.urlSerializer = urlSerializer;
422
+ this.documentationPropertyName = '';
423
+ this.documentationPropertyMode = null;
424
+ this.documentationPropertyType = '';
425
+ this.documentationPropertyValue = null;
426
+ this.documentationPropertyDeprecated = false;
427
+ this.documentationPropertyValues = null;
428
+ this.documentationPropertyValueChange = new EventEmitter();
429
+ this.changed$ = new Subject();
430
+ this.emits$ = new BehaviorSubject(1);
450
431
  }
451
- get filteredItems() {
452
- return this.filterItems(this.flattenSubPages(this.items), this.search);
432
+ ngOnInit() {
433
+ this.parseParams(this.activatedRoute.snapshot.queryParams);
453
434
  }
454
- get itemsWithoutSections() {
455
- return this.items[this.items.length - 1];
435
+ get attrName() {
436
+ switch (this.documentationPropertyMode) {
437
+ case 'input':
438
+ return `[${this.documentationPropertyName}]`;
439
+ case 'output':
440
+ return `(${this.documentationPropertyName})`;
441
+ case 'input-output':
442
+ return `[(${this.documentationPropertyName})]`;
443
+ default:
444
+ return this.documentationPropertyName;
445
+ }
456
446
  }
457
- isActive(route) {
458
- return route === this.active;
447
+ get hasItems() {
448
+ return !!this.documentationPropertyValues;
459
449
  }
460
- onGroupClick(index) {
461
- this.openPagesGroupsArr[index] = !this.openPagesGroupsArr[index];
450
+ get shouldShowValues() {
451
+ return this.documentationPropertyMode !== 'output';
462
452
  }
463
- closeMenu() {
464
- this.menuOpen = false;
453
+ ngOnChanges() {
454
+ this.changed$.next();
465
455
  }
466
- onSearchChange(search) {
467
- this.search = search;
468
- this.open = this.canOpen;
456
+ onValueChange(value) {
457
+ this.documentationPropertyValue = value;
458
+ this.documentationPropertyValueChange.emit(value);
459
+ this.setQueryParam(value);
469
460
  }
470
- onClick() {
471
- this.open = false;
472
- this.menuOpen = false;
473
- this.search = '';
474
- this.openActivePageGroup();
461
+ parseParams(params) {
462
+ if (!params[this.documentationPropertyName] &&
463
+ !params[this.documentationPropertyName + SERIALIZED_SUFFIX]) {
464
+ return;
465
+ }
466
+ const isValueAvailableByKey = !!params[this.documentationPropertyName + SERIALIZED_SUFFIX];
467
+ if (isValueAvailableByKey && this.documentationPropertyValues) {
468
+ this.onValueChange(this.documentationPropertyValues[params[this.documentationPropertyName + SERIALIZED_SUFFIX]]);
469
+ return;
470
+ }
471
+ this.onValueChange(!isNaN(Number(params[this.documentationPropertyName]))
472
+ ? Number(params[this.documentationPropertyName])
473
+ : params[this.documentationPropertyName]);
475
474
  }
476
- filterItems(items, search) {
477
- return items.map(section => uniqBy(section.filter(({ title, keywords = '' }) => {
478
- title = title.toLowerCase();
479
- search = search.toLowerCase();
480
- keywords = keywords.toLowerCase();
481
- return (title.includes(search) ||
482
- keywords.includes(search) ||
483
- title.includes(transliterateKeyboardLayout(search)) ||
484
- keywords.includes(transliterateKeyboardLayout(search)) ||
485
- search.replace(/-/gi, '').includes(title));
486
- }), 'title'));
475
+ setQueryParam(value) {
476
+ const tree = this.urlSerializer.parse(this.locationRef.path());
477
+ const isValueAvailableByKey = value instanceof Object;
478
+ const computedValue = isValueAvailableByKey && this.documentationPropertyValues
479
+ ? this.documentationPropertyValues.indexOf(value)
480
+ : value;
481
+ const suffix = isValueAvailableByKey ? SERIALIZED_SUFFIX : '';
482
+ const propName = this.documentationPropertyName + suffix;
483
+ tree.queryParams = Object.assign(Object.assign({}, tree.queryParams), { [propName]: computedValue });
484
+ this.locationRef.go(String(tree));
487
485
  }
488
- flattenSubPages(items) {
489
- return items.reduce((array, item) => [
490
- ...array,
491
- item.reduce((pages, page) => 'subPages' in page
492
- ? [...pages, ...page.subPages]
493
- : [...pages, page], []),
494
- ], []);
486
+ emitEvent(event) {
487
+ // For more convenient debugging
488
+ console.log(this.attrName, event);
489
+ this.emits$.next(this.emits$.value + 1);
495
490
  }
496
- isActiveRoute(route) {
497
- return this.router.isActive(route, false);
491
+ };
492
+ TuiDocDocumentationPropertyConnectorDirective.ctorParameters = () => [
493
+ { type: TemplateRef, decorators: [{ type: Inject, args: [TemplateRef,] }] },
494
+ { type: Location$1, decorators: [{ type: Inject, args: [Location$1,] }] },
495
+ { type: ActivatedRoute, decorators: [{ type: Inject, args: [ActivatedRoute,] }] },
496
+ { type: UrlSerializer, decorators: [{ type: Inject, args: [UrlSerializer,] }] }
497
+ ];
498
+ __decorate([
499
+ Input()
500
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyName", void 0);
501
+ __decorate([
502
+ Input()
503
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyMode", void 0);
504
+ __decorate([
505
+ Input()
506
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyType", void 0);
507
+ __decorate([
508
+ Input()
509
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValue", void 0);
510
+ __decorate([
511
+ Input()
512
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyDeprecated", void 0);
513
+ __decorate([
514
+ Input()
515
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValues", void 0);
516
+ __decorate([
517
+ Output()
518
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValueChange", void 0);
519
+ TuiDocDocumentationPropertyConnectorDirective = __decorate([
520
+ Directive({
521
+ selector: 'ng-template[documentationPropertyName]',
522
+ exportAs: 'documentationProperty',
523
+ }),
524
+ __param(0, Inject(TemplateRef)),
525
+ __param(1, Inject(Location$1)),
526
+ __param(2, Inject(ActivatedRoute)),
527
+ __param(3, Inject(UrlSerializer))
528
+ ], TuiDocDocumentationPropertyConnectorDirective);
529
+
530
+ // @bad TODO subscribe propertiesConnectors changes
531
+ // @bad TODO refactor to make more flexible
532
+ // @dynamic
533
+ let TuiDocDocumentationComponent = class TuiDocDocumentationComponent {
534
+ constructor(changeDetectorRef, texts) {
535
+ this.changeDetectorRef = changeDetectorRef;
536
+ this.texts = texts;
537
+ this.heading = '';
538
+ this.showValues = true;
539
+ this.isAPI = false;
540
+ this.propertiesConnectors = EMPTY_QUERY;
541
+ this.activeItemIndex = 0;
498
542
  }
499
- handleAnchorLink(hash) {
500
- setTimeout(() => {
501
- this.navigateToAnchorLink(hash);
502
- }, SCROLL_INTO_VIEW_DELAY);
543
+ ngAfterContentInit() {
544
+ itemsQueryListObservable(this.propertiesConnectors)
545
+ .pipe(switchMap(items => merge(...items.map(({ changed$ }) => changed$))), watch(this.changeDetectorRef))
546
+ .subscribe();
503
547
  }
504
- openActivePageGroup() {
505
- this.items.forEach((pages, pagesIndex) => {
506
- pages.forEach((page, pageIndex) => {
507
- if ('route' in page && this.isActiveRoute(page.route)) {
508
- this.openPagesArr[pagesIndex] = true;
509
- this.active = page.route;
510
- }
511
- if ('subPages' in page) {
512
- page.subPages.forEach(subPage => {
513
- if (this.isActiveRoute(subPage.route)) {
514
- this.openPagesArr[pagesIndex] = true;
515
- this.openPagesGroupsArr[pagesIndex * 100 + pageIndex] = true;
516
- this.active = subPage.route;
517
- }
518
- });
519
- }
520
- });
521
- });
548
+ get type() {
549
+ return this.isAPI ? this.texts[0] : this.texts[1];
522
550
  }
523
- navigateToAnchorLink(fragment) {
524
- const element = fragment && this.documentRef.querySelector(`#${fragment}`);
525
- if (!element) {
551
+ getColor(color) {
552
+ if (color.length === 4) {
553
+ return color
554
+ .split('')
555
+ .reduce((result, current) => [...result, current, current], [])
556
+ .join('')
557
+ .replace('#', '');
558
+ }
559
+ if (color.startsWith('#')) {
560
+ return color;
561
+ }
562
+ if (color === 'transparent') {
563
+ return '#000000';
564
+ }
565
+ const parsed = color
566
+ .replace('rgb(', '')
567
+ .replace('rgba(', '')
568
+ .replace(')', '')
569
+ .replace(' ', '')
570
+ .split(',')
571
+ .map(v => Number.parseInt(v, 10));
572
+ return rgbToHex(...parsed);
573
+ }
574
+ getOpacity(color) {
575
+ if (color.startsWith('#') || color.startsWith('rgb(')) {
576
+ return 100;
577
+ }
578
+ if (color === 'transparent') {
579
+ return 0;
580
+ }
581
+ const lastComma = color.lastIndexOf(',');
582
+ const parsed = color
583
+ .substr(lastComma)
584
+ .replace(')', '')
585
+ .replace(' ', '')
586
+ .replace(',', '');
587
+ return Math.round(Number.parseFloat(parsed) * 100);
588
+ }
589
+ onColorChange(connector, color) {
590
+ const opacity = this.getOpacity(connector.documentationPropertyValue || '');
591
+ if (opacity === 100) {
592
+ connector.onValueChange(color);
526
593
  return;
527
594
  }
528
- element.classList.add('tui-doc-animated-example');
529
- element.scrollIntoView({
530
- block: 'start',
531
- inline: 'nearest',
532
- behavior: 'smooth',
533
- });
595
+ const rgb = hexToRgb(color).join(', ');
596
+ const result = `rgba(${rgb}, ${opacity / 100})`;
597
+ connector.onValueChange(result);
598
+ }
599
+ onOpacityChange(connector, opacity) {
600
+ const hex = this.getColor(connector.documentationPropertyValue || '');
601
+ const rgb = hexToRgb(hex);
602
+ const result = `rgba(${rgb}, ${opacity / 100})`;
603
+ connector.onValueChange(result);
604
+ }
605
+ stripOptional(name) {
606
+ return name.replace('?', '');
607
+ }
608
+ isOptional(name) {
609
+ return name.includes('?');
610
+ }
611
+ showCleaner(type) {
612
+ return type.includes('null');
613
+ }
614
+ showContentTooltip(type) {
615
+ return type.includes('PolymorpheusContent');
616
+ }
617
+ inspectAny(data) {
618
+ return inspectAny(data, 2);
534
619
  }
535
620
  };
536
- TuiDocNavigationComponent.ctorParameters = () => [
621
+ TuiDocDocumentationComponent.ctorParameters = () => [
537
622
  { type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] },
538
- { type: Title, decorators: [{ type: Inject, args: [Title,] }] },
539
- { type: Observable, decorators: [{ type: Inject, args: [NAVIGATION_TITLE,] }] },
540
- { type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
541
- { type: TuiModeDirective, decorators: [{ type: Inject, args: [TuiModeDirective,] }] },
542
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [TuiSidebarDirective,] }] },
543
- { type: Array, decorators: [{ type: Inject, args: [NAVIGATION_LABELS,] }] },
544
- { type: undefined, decorators: [{ type: Inject, args: [NAVIGATION_ITEMS,] }] },
545
- { type: String, decorators: [{ type: Inject, args: [TUI_DOC_SEARCH_TEXT,] }] },
546
- { type: Router, decorators: [{ type: Inject, args: [Router,] }] },
547
- { type: ActivatedRoute, decorators: [{ type: Inject, args: [ActivatedRoute,] }] }
623
+ { type: Array, decorators: [{ type: Inject, args: [TUI_DOC_DOCUMENTATION_TEXTS,] }] }
548
624
  ];
549
625
  __decorate([
550
- HostBinding('class._open')
551
- ], TuiDocNavigationComponent.prototype, "menuOpen", void 0);
626
+ Input()
627
+ ], TuiDocDocumentationComponent.prototype, "heading", void 0);
552
628
  __decorate([
553
- tuiPure
554
- ], TuiDocNavigationComponent.prototype, "filterItems", null);
629
+ Input()
630
+ ], TuiDocDocumentationComponent.prototype, "showValues", void 0);
555
631
  __decorate([
556
- tuiPure
557
- ], TuiDocNavigationComponent.prototype, "flattenSubPages", null);
558
- TuiDocNavigationComponent = __decorate([
632
+ Input()
633
+ ], TuiDocDocumentationComponent.prototype, "isAPI", void 0);
634
+ __decorate([
635
+ ContentChildren(TuiDocDocumentationPropertyConnectorDirective)
636
+ ], TuiDocDocumentationComponent.prototype, "propertiesConnectors", void 0);
637
+ TuiDocDocumentationComponent = __decorate([
559
638
  Component({
560
- selector: 'tui-doc-navigation',
561
- 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",
562
- providers: NAVIGATION_PROVIDERS,
639
+ selector: 'tui-doc-documentation',
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=\"\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 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=\"\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",
563
641
  changeDetection: ChangeDetectionStrategy.OnPush,
564
- 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)}"]
642
+ animations: [
643
+ trigger('emitEvent', [
644
+ transition(':increment', [style({ opacity: 1 }), animate('500ms ease-in')]),
645
+ ]),
646
+ ],
647
+ styles: [":host{display:block;min-width:100%}.t-cell_prop{width:40%}.t-cell_value{max-width:20rem}@media screen and (max-width:47.9375em){.t-row{display:flex;flex-wrap:wrap}.t-row_header{display:none}.t-cell_value{width:9.375rem}.t-cell{width:100%;height:auto;padding:.5rem 0;text-align:left}}.t-property{font:var(--tui-font-text-m);margin-bottom:.25rem;font-family:monospace;color:#8f75d1}.t-type{font-family:monospace}.t-deprecated{background-color:var(--tui-error-bg)}.t-deprecated-label{margin-right:.125rem;color:var(--tui-error-fill)}.t-exception{display:block;width:-webkit-max-content;width:-moz-max-content;width:max-content}.t-output{text-align:left;opacity:0}"]
565
648
  }),
566
649
  __param(0, Inject(ChangeDetectorRef)),
567
- __param(1, Inject(Title)),
568
- __param(2, Inject(NAVIGATION_TITLE)),
569
- __param(3, Inject(DOCUMENT)),
570
- __param(4, Inject(TuiModeDirective)),
571
- __param(5, Optional()),
572
- __param(5, Inject(TuiSidebarDirective)),
573
- __param(6, Inject(NAVIGATION_LABELS)),
574
- __param(7, Inject(NAVIGATION_ITEMS)),
575
- __param(8, Inject(TUI_DOC_SEARCH_TEXT)),
576
- __param(9, Inject(Router)),
577
- __param(10, Inject(ActivatedRoute))
578
- ], TuiDocNavigationComponent);
650
+ __param(1, Inject(TUI_DOC_DOCUMENTATION_TEXTS))
651
+ ], TuiDocDocumentationComponent);
652
+
653
+ let TuiInputOpacityDirective = class TuiInputOpacityDirective {
654
+ constructor(renderer, tuiFocusableComponent) {
655
+ this.renderer = renderer;
656
+ this.tuiFocusableComponent = tuiFocusableComponent;
657
+ }
658
+ set tuiInputOpacity(opacity) {
659
+ const { nativeFocusableElement } = this.tuiFocusableComponent;
660
+ if (nativeFocusableElement) {
661
+ this.renderer.setStyle(nativeFocusableElement, 'opacity', opacity / 100);
662
+ }
663
+ }
664
+ };
665
+ TuiInputOpacityDirective.ctorParameters = () => [
666
+ { type: Renderer2, decorators: [{ type: Inject, args: [Renderer2,] }] },
667
+ { type: undefined, decorators: [{ type: Inject, args: [TUI_FOCUSABLE_ITEM_ACCESSOR,] }] }
668
+ ];
669
+ __decorate([
670
+ Input()
671
+ ], TuiInputOpacityDirective.prototype, "tuiInputOpacity", null);
672
+ TuiInputOpacityDirective = __decorate([
673
+ Directive({
674
+ selector: '[tuiInputOpacity]',
675
+ }),
676
+ __param(0, Inject(Renderer2)),
677
+ __param(1, Inject(TUI_FOCUSABLE_ITEM_ACCESSOR))
678
+ ], TuiInputOpacityDirective);
679
+
680
+ let TuiInputOpacityModule = class TuiInputOpacityModule {
681
+ };
682
+ TuiInputOpacityModule = __decorate([
683
+ NgModule({
684
+ declarations: [TuiInputOpacityDirective],
685
+ exports: [TuiInputOpacityDirective],
686
+ })
687
+ ], TuiInputOpacityModule);
688
+
689
+ let TuiDocDocumentationModule = class TuiDocDocumentationModule {
690
+ };
691
+ TuiDocDocumentationModule = __decorate([
692
+ NgModule({
693
+ imports: [
694
+ CommonModule,
695
+ FormsModule,
696
+ RouterModule,
697
+ TuiBadgeModule,
698
+ TuiSelectModule,
699
+ TuiToggleModule,
700
+ TuiTooltipModule,
701
+ TuiLinkModule,
702
+ TuiInputCountModule,
703
+ TuiModeModule,
704
+ TuiGroupModule,
705
+ TuiInputOpacityModule,
706
+ TuiPrimitiveTextfieldModule,
707
+ TuiTextfieldControllerModule,
708
+ TuiHintControllerModule,
709
+ TuiDropdownControllerModule,
710
+ TuiDataListModule,
711
+ TuiDataListWrapperModule,
712
+ TuiNotificationModule,
713
+ ],
714
+ declarations: [
715
+ TuiDocDocumentationComponent,
716
+ TuiDocDocumentationPropertyConnectorDirective,
717
+ ],
718
+ exports: [
719
+ TuiDocDocumentationComponent,
720
+ TuiDocDocumentationPropertyConnectorDirective,
721
+ ],
722
+ })
723
+ ], TuiDocDocumentationModule);
724
+
725
+ const TUI_DOC_CODE_EDITOR = new InjectionToken('Contains service for opening online IDE e.g. Stackblitz');
726
+
727
+ const TUI_DOC_EXAMPLE_CONTENT_PROCESSOR = new InjectionToken('Processes content in example', { factory: () => identity });
728
+
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
741
+ let TuiDocExampleComponent = class TuiDocExampleComponent {
742
+ constructor(id, clipboard, notifications, location, copyTexts$, texts, codeEditor, processContent) {
743
+ this.id = id;
744
+ this.clipboard = clipboard;
745
+ this.notifications = notifications;
746
+ this.location = location;
747
+ this.copyTexts$ = copyTexts$;
748
+ this.texts = texts;
749
+ this.codeEditor = codeEditor;
750
+ this.processContent = processContent;
751
+ this.rawLoader$$ = new BehaviorSubject({});
752
+ this.heading = '';
753
+ this.description = '';
754
+ this.componentName = this.location.pathname.slice(1);
755
+ this.activeItemIndex = 0;
756
+ this.defaultTab = this.texts[0];
757
+ this.copy$ = this.copyTexts$.pipe(map(([copy]) => copy));
758
+ this.processor$ = this.rawLoader$$.pipe(switchMap(rawLoadRecord), map(this.processContent));
759
+ }
760
+ set content(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();
855
+ }
856
+ get mode() {
857
+ return this.night ? 'onDark' : null;
858
+ }
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);
579
886
 
580
887
  let ScrollIntoViewDirective = class ScrollIntoViewDirective {
581
888
  constructor(destroy$, { nativeElement }) {
@@ -615,595 +922,288 @@ ScrollIntoViewModule = __decorate([
615
922
  })
616
923
  ], ScrollIntoViewModule);
617
924
 
618
- let TuiDocNavigationModule = class TuiDocNavigationModule {
619
- };
620
- TuiDocNavigationModule = __decorate([
621
- NgModule({
622
- imports: [
623
- CommonModule,
624
- FormsModule,
625
- RouterModule,
626
- ScrollIntoViewModule,
627
- TuiButtonModule,
628
- TuiPrimitiveTextfieldModule,
629
- TuiTextfieldControllerModule,
630
- TuiActiveZoneModule,
631
- TuiLetModule,
632
- TuiModeModule,
633
- TuiLinkModule,
634
- TuiExpandModule,
635
- TuiHostedDropdownModule,
636
- TuiDropdownControllerModule,
637
- TuiAccordionModule,
638
- TuiScrollbarModule,
639
- TuiSvgModule,
640
- TuiDataListModule,
641
- TuiAutoFocusModule,
642
- ],
643
- declarations: [TuiDocNavigationComponent],
644
- exports: [TuiDocNavigationComponent],
645
- })
646
- ], TuiDocNavigationModule);
647
-
648
- function rgbToHex(r, g, b) {
649
- return ('#' +
650
- [r, g, b]
651
- .map(x => {
652
- const hex = x.toString(16);
653
- return hex.length === 1 ? '0' + hex : hex;
654
- })
655
- .join(''));
656
- }
657
- function hexToRgb(hex) {
658
- const matches = hex
659
- .replace('#', '')
660
- .split('')
661
- .map((char, _, array) => (array.length === 3 ? char + char : char))
662
- .join('')
663
- .match(/.{2}/g);
664
- return matches
665
- ? matches.map(x => Number.parseInt(x, 16))
666
- : [0, 0, 0];
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;
667
970
  }
668
971
 
669
- function inspectArray(array, depth) {
670
- if (depth === 0) {
671
- return '[…]';
672
- }
673
- let result = '';
674
- let first = true;
675
- for (let index = 0; index < array.length; index++) {
676
- if (first) {
677
- first = false;
678
- }
679
- else {
680
- result += ', ';
681
- }
682
- result += index in array ? inspectAny(array[index], depth - 1) : 'empty';
683
- }
684
- return `[${result}]`;
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$));
685
1003
  }
686
- function inspectObject(object, depth) {
687
- if (depth === 0) {
688
- return `{…}`;
689
- }
690
- let result = '';
691
- let first = true;
692
- for (const key in object) {
693
- if (!object.hasOwnProperty(key)) {
694
- continue;
695
- }
696
- if (first) {
697
- first = false;
698
- }
699
- else {
700
- result += ', ';
701
- }
702
- result += `${key}: ${inspectAny(object[key], depth - 1)}`;
703
- }
704
- return `{${result}}`;
1004
+ function labelsProviderFactory(pages) {
1005
+ return pages
1006
+ .map(({ section }) => section)
1007
+ .filter(isPresent)
1008
+ .filter((item, index, array) => array.indexOf(item) === index);
705
1009
  }
706
- // @bad TODO add more types
707
- /**
708
- * Returns readable JS entity
709
- * @param data
710
- * @param depth
711
- * @return readable JS entity
712
- */
713
- function inspectAny(data, depth) {
714
- if (data === null) {
715
- return 'null';
716
- }
717
- switch (typeof data) {
718
- case 'string':
719
- return `'${data}'`;
720
- case 'undefined':
721
- case 'number':
722
- case 'boolean':
723
- case 'function':
724
- return String(data);
725
- }
726
- if (data instanceof RegExp) {
727
- return data.toString();
728
- }
729
- if (Array.isArray(data)) {
730
- return inspectArray(data, depth);
731
- }
732
- return inspectObject(data, depth);
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
+ ];
733
1016
  }
734
1017
 
735
- const SERIALIZED_SUFFIX = '$';
736
- // @bad TODO: refactor output and value sync
737
- let TuiDocDocumentationPropertyConnectorDirective = class TuiDocDocumentationPropertyConnectorDirective {
738
- constructor(template, locationRef, activatedRoute, urlSerializer) {
739
- this.template = template;
740
- this.locationRef = locationRef;
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;
741
1029
  this.activatedRoute = activatedRoute;
742
- this.urlSerializer = urlSerializer;
743
- this.documentationPropertyName = '';
744
- this.documentationPropertyMode = null;
745
- this.documentationPropertyType = '';
746
- this.documentationPropertyValue = null;
747
- this.documentationPropertyDeprecated = false;
748
- this.documentationPropertyValues = null;
749
- this.documentationPropertyValueChange = new EventEmitter();
750
- this.changed$ = new Subject();
751
- this.emits$ = new BehaviorSubject(1);
1030
+ this.search = '';
1031
+ this.open = false;
1032
+ this.openPagesArr = [];
1033
+ this.openPagesGroupsArr = [];
1034
+ this.active = '';
1035
+ this.menuOpen = false;
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
+ });
752
1045
  }
753
- ngOnInit() {
754
- this.parseParams(this.activatedRoute.snapshot.queryParams);
1046
+ get canOpen() {
1047
+ return this.search.length > 2;
755
1048
  }
756
- get attrName() {
757
- switch (this.documentationPropertyMode) {
758
- case 'input':
759
- return `[${this.documentationPropertyName}]`;
760
- case 'output':
761
- return `(${this.documentationPropertyName})`;
762
- case 'input-output':
763
- return `[(${this.documentationPropertyName})]`;
764
- default:
765
- return this.documentationPropertyName;
766
- }
1049
+ get filteredItems() {
1050
+ return this.filterItems(this.flattenSubPages(this.items), this.search);
767
1051
  }
768
- get hasItems() {
769
- return !!this.documentationPropertyValues;
1052
+ get itemsWithoutSections() {
1053
+ return this.items[this.items.length - 1];
770
1054
  }
771
- get shouldShowValues() {
772
- return this.documentationPropertyMode !== 'output';
1055
+ isActive(route) {
1056
+ return route === this.active;
773
1057
  }
774
- ngOnChanges() {
775
- this.changed$.next();
1058
+ onGroupClick(index) {
1059
+ this.openPagesGroupsArr[index] = !this.openPagesGroupsArr[index];
776
1060
  }
777
- onValueChange(value) {
778
- this.documentationPropertyValue = value;
779
- this.documentationPropertyValueChange.emit(value);
780
- this.setQueryParam(value);
1061
+ closeMenu() {
1062
+ this.menuOpen = false;
781
1063
  }
782
- parseParams(params) {
783
- if (!params[this.documentationPropertyName] &&
784
- !params[this.documentationPropertyName + SERIALIZED_SUFFIX]) {
785
- return;
786
- }
787
- const isValueAvailableByKey = !!params[this.documentationPropertyName + SERIALIZED_SUFFIX];
788
- if (isValueAvailableByKey && this.documentationPropertyValues) {
789
- this.onValueChange(this.documentationPropertyValues[params[this.documentationPropertyName + SERIALIZED_SUFFIX]]);
790
- return;
791
- }
792
- this.onValueChange(!isNaN(Number(params[this.documentationPropertyName]))
793
- ? Number(params[this.documentationPropertyName])
794
- : params[this.documentationPropertyName]);
795
- }
796
- setQueryParam(value) {
797
- const tree = this.urlSerializer.parse(this.locationRef.path());
798
- const isValueAvailableByKey = value instanceof Object;
799
- const computedValue = isValueAvailableByKey && this.documentationPropertyValues
800
- ? this.documentationPropertyValues.indexOf(value)
801
- : value;
802
- const suffix = isValueAvailableByKey ? SERIALIZED_SUFFIX : '';
803
- const propName = this.documentationPropertyName + suffix;
804
- tree.queryParams = Object.assign(Object.assign({}, tree.queryParams), { [propName]: computedValue });
805
- this.locationRef.go(String(tree));
806
- }
807
- emitEvent(event) {
808
- // For more convenient debugging
809
- console.log(this.attrName, event);
810
- this.emits$.next(this.emits$.value + 1);
811
- }
812
- };
813
- TuiDocDocumentationPropertyConnectorDirective.ctorParameters = () => [
814
- { type: TemplateRef, decorators: [{ type: Inject, args: [TemplateRef,] }] },
815
- { type: Location$1, decorators: [{ type: Inject, args: [Location$1,] }] },
816
- { type: ActivatedRoute, decorators: [{ type: Inject, args: [ActivatedRoute,] }] },
817
- { type: UrlSerializer, decorators: [{ type: Inject, args: [UrlSerializer,] }] }
818
- ];
819
- __decorate([
820
- Input()
821
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyName", void 0);
822
- __decorate([
823
- Input()
824
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyMode", void 0);
825
- __decorate([
826
- Input()
827
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyType", void 0);
828
- __decorate([
829
- Input()
830
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValue", void 0);
831
- __decorate([
832
- Input()
833
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyDeprecated", void 0);
834
- __decorate([
835
- Input()
836
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValues", void 0);
837
- __decorate([
838
- Output()
839
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValueChange", void 0);
840
- TuiDocDocumentationPropertyConnectorDirective = __decorate([
841
- Directive({
842
- selector: 'ng-template[documentationPropertyName]',
843
- exportAs: 'documentationProperty',
844
- }),
845
- __param(0, Inject(TemplateRef)),
846
- __param(1, Inject(Location$1)),
847
- __param(2, Inject(ActivatedRoute)),
848
- __param(3, Inject(UrlSerializer))
849
- ], TuiDocDocumentationPropertyConnectorDirective);
850
-
851
- // @bad TODO subscribe propertiesConnectors changes
852
- // @bad TODO refactor to make more flexible
853
- // @dynamic
854
- let TuiDocDocumentationComponent = class TuiDocDocumentationComponent {
855
- constructor(changeDetectorRef, texts) {
856
- this.changeDetectorRef = changeDetectorRef;
857
- this.texts = texts;
858
- this.heading = '';
859
- this.showValues = true;
860
- this.isAPI = false;
861
- this.propertiesConnectors = EMPTY_QUERY;
862
- this.activeItemIndex = 0;
863
- }
864
- ngAfterContentInit() {
865
- itemsQueryListObservable(this.propertiesConnectors)
866
- .pipe(switchMap(items => merge(...items.map(({ changed$ }) => changed$))), watch(this.changeDetectorRef))
867
- .subscribe();
868
- }
869
- get type() {
870
- return this.isAPI ? this.texts[0] : this.texts[1];
871
- }
872
- getColor(color) {
873
- if (color.length === 4) {
874
- return color
875
- .split('')
876
- .reduce((result, current) => [...result, current, current], [])
877
- .join('')
878
- .replace('#', '');
879
- }
880
- if (color.startsWith('#')) {
881
- return color;
882
- }
883
- if (color === 'transparent') {
884
- return '#000000';
885
- }
886
- const parsed = color
887
- .replace('rgb(', '')
888
- .replace('rgba(', '')
889
- .replace(')', '')
890
- .replace(' ', '')
891
- .split(',')
892
- .map(v => Number.parseInt(v, 10));
893
- return rgbToHex(...parsed);
894
- }
895
- getOpacity(color) {
896
- if (color.startsWith('#') || color.startsWith('rgb(')) {
897
- return 100;
898
- }
899
- if (color === 'transparent') {
900
- return 0;
901
- }
902
- const lastComma = color.lastIndexOf(',');
903
- const parsed = color
904
- .substr(lastComma)
905
- .replace(')', '')
906
- .replace(' ', '')
907
- .replace(',', '');
908
- return Math.round(Number.parseFloat(parsed) * 100);
909
- }
910
- onColorChange(connector, color) {
911
- const opacity = this.getOpacity(connector.documentationPropertyValue || '');
912
- if (opacity === 100) {
913
- connector.onValueChange(color);
914
- return;
915
- }
916
- const rgb = hexToRgb(color).join(', ');
917
- const result = `rgba(${rgb}, ${opacity / 100})`;
918
- connector.onValueChange(result);
919
- }
920
- onOpacityChange(connector, opacity) {
921
- const hex = this.getColor(connector.documentationPropertyValue || '');
922
- const rgb = hexToRgb(hex);
923
- const result = `rgba(${rgb}, ${opacity / 100})`;
924
- connector.onValueChange(result);
925
- }
926
- stripOptional(name) {
927
- return name.replace('?', '');
928
- }
929
- isOptional(name) {
930
- return name.includes('?');
931
- }
932
- showCleaner(type) {
933
- return type.includes('null');
1064
+ onSearchChange(search) {
1065
+ this.search = search;
1066
+ this.open = this.canOpen;
934
1067
  }
935
- showContentTooltip(type) {
936
- return type.includes('PolymorpheusContent');
1068
+ onClick() {
1069
+ this.open = false;
1070
+ this.menuOpen = false;
1071
+ this.search = '';
1072
+ this.openActivePageGroup();
937
1073
  }
938
- inspectAny(data) {
939
- return inspectAny(data, 2);
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'));
940
1085
  }
941
- };
942
- TuiDocDocumentationComponent.ctorParameters = () => [
943
- { type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] },
944
- { type: Array, decorators: [{ type: Inject, args: [TUI_DOC_DOCUMENTATION_TEXTS,] }] }
945
- ];
946
- __decorate([
947
- Input()
948
- ], TuiDocDocumentationComponent.prototype, "heading", void 0);
949
- __decorate([
950
- Input()
951
- ], TuiDocDocumentationComponent.prototype, "showValues", void 0);
952
- __decorate([
953
- Input()
954
- ], TuiDocDocumentationComponent.prototype, "isAPI", void 0);
955
- __decorate([
956
- ContentChildren(TuiDocDocumentationPropertyConnectorDirective)
957
- ], TuiDocDocumentationComponent.prototype, "propertiesConnectors", void 0);
958
- TuiDocDocumentationComponent = __decorate([
959
- Component({
960
- selector: 'tui-doc-documentation',
961
- 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 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=\"\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",
962
- changeDetection: ChangeDetectionStrategy.OnPush,
963
- animations: [
964
- trigger('emitEvent', [
965
- transition(':increment', [style({ opacity: 1 }), animate('500ms ease-in')]),
966
- ]),
967
- ],
968
- styles: [":host{display:block;min-width:100%}.t-cell_prop{width:40%}.t-cell_value{max-width:20rem}@media screen and (max-width:47.9375em){.t-row{display:flex;flex-wrap:wrap}.t-row_header{display:none}.t-cell_value{width:9.375rem}.t-cell{width:100%;height:auto;padding:.5rem 0;text-align:left}}.t-property{font:var(--tui-font-text-m);margin-bottom:.25rem;font-family:monospace;color:#8f75d1}.t-type{font-family:monospace}.t-deprecated{background-color:var(--tui-error-bg)}.t-deprecated-label{margin-right:.125rem;color:var(--tui-error-fill)}.t-exception{display:block;width:-webkit-max-content;width:-moz-max-content;width:max-content}.t-output{text-align:left;opacity:0}"]
969
- }),
970
- __param(0, Inject(ChangeDetectorRef)),
971
- __param(1, Inject(TUI_DOC_DOCUMENTATION_TEXTS))
972
- ], TuiDocDocumentationComponent);
973
-
974
- let TuiInputOpacityDirective = class TuiInputOpacityDirective {
975
- constructor(renderer, tuiFocusableComponent) {
976
- this.renderer = renderer;
977
- this.tuiFocusableComponent = tuiFocusableComponent;
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
+ ], []);
978
1093
  }
979
- set tuiInputOpacity(opacity) {
980
- const { nativeFocusableElement } = this.tuiFocusableComponent;
981
- if (nativeFocusableElement) {
982
- this.renderer.setStyle(nativeFocusableElement, 'opacity', opacity / 100);
983
- }
1094
+ isActiveRoute(route) {
1095
+ return this.router.isActive(route, false);
984
1096
  }
985
- };
986
- TuiInputOpacityDirective.ctorParameters = () => [
987
- { type: Renderer2, decorators: [{ type: Inject, args: [Renderer2,] }] },
988
- { type: undefined, decorators: [{ type: Inject, args: [TUI_FOCUSABLE_ITEM_ACCESSOR,] }] }
989
- ];
990
- __decorate([
991
- Input()
992
- ], TuiInputOpacityDirective.prototype, "tuiInputOpacity", null);
993
- TuiInputOpacityDirective = __decorate([
994
- Directive({
995
- selector: '[tuiInputOpacity]',
996
- }),
997
- __param(0, Inject(Renderer2)),
998
- __param(1, Inject(TUI_FOCUSABLE_ITEM_ACCESSOR))
999
- ], TuiInputOpacityDirective);
1000
-
1001
- let TuiInputOpacityModule = class TuiInputOpacityModule {
1002
- };
1003
- TuiInputOpacityModule = __decorate([
1004
- NgModule({
1005
- declarations: [TuiInputOpacityDirective],
1006
- exports: [TuiInputOpacityDirective],
1007
- })
1008
- ], TuiInputOpacityModule);
1009
-
1010
- let TuiDocDocumentationModule = class TuiDocDocumentationModule {
1011
- };
1012
- TuiDocDocumentationModule = __decorate([
1013
- NgModule({
1014
- imports: [
1015
- CommonModule,
1016
- FormsModule,
1017
- RouterModule,
1018
- TuiBadgeModule,
1019
- TuiSelectModule,
1020
- TuiToggleModule,
1021
- TuiTooltipModule,
1022
- TuiLinkModule,
1023
- TuiInputCountModule,
1024
- TuiModeModule,
1025
- TuiGroupModule,
1026
- TuiInputOpacityModule,
1027
- TuiPrimitiveTextfieldModule,
1028
- TuiTextfieldControllerModule,
1029
- TuiHintControllerModule,
1030
- TuiDropdownControllerModule,
1031
- TuiDataListModule,
1032
- TuiDataListWrapperModule,
1033
- TuiNotificationModule,
1034
- ],
1035
- declarations: [
1036
- TuiDocDocumentationComponent,
1037
- TuiDocDocumentationPropertyConnectorDirective,
1038
- ],
1039
- exports: [
1040
- TuiDocDocumentationComponent,
1041
- TuiDocDocumentationPropertyConnectorDirective,
1042
- ],
1043
- })
1044
- ], TuiDocDocumentationModule);
1045
-
1046
- const TUI_DOC_CODE_EDITOR = new InjectionToken('Contains service for opening online IDE e.g. Stackblitz');
1047
-
1048
- const TUI_DOC_EXAMPLE_CONTENT_PROCESSOR = new InjectionToken('Processes content in example', { factory: () => identity });
1049
-
1050
- function rawLoadRecord(example) {
1051
- return __awaiter(this, void 0, void 0, function* () {
1052
- const processedContent = {};
1053
- for (const [key, content] of Object.entries(example)) {
1054
- processedContent[key] = yield rawLoad(content);
1055
- }
1056
- return processedContent;
1057
- });
1058
- }
1059
-
1060
- // Ambient type cannot be used without dynamic https://github.com/angular/angular/issues/23395
1061
- // @dynamic
1062
- let TuiDocExampleComponent = class TuiDocExampleComponent {
1063
- constructor(id, clipboard, notifications, location, copyTexts$, texts, codeEditor, processContent) {
1064
- this.id = id;
1065
- this.clipboard = clipboard;
1066
- this.notifications = notifications;
1067
- this.location = location;
1068
- this.copyTexts$ = copyTexts$;
1069
- this.texts = texts;
1070
- this.codeEditor = codeEditor;
1071
- this.processContent = processContent;
1072
- this.rawLoader$$ = new BehaviorSubject({});
1073
- this.heading = '';
1074
- this.description = '';
1075
- this.componentName = this.location.pathname.slice(1);
1076
- this.activeItemIndex = 0;
1077
- this.defaultTab = this.texts[0];
1078
- this.copy$ = this.copyTexts$.pipe(map(([copy]) => copy));
1079
- this.processor$ = this.rawLoader$$.pipe(switchMap(rawLoadRecord), map(this.processContent));
1097
+ handleAnchorLink(hash) {
1098
+ setTimeout(() => {
1099
+ this.navigateToAnchorLink(hash);
1100
+ }, SCROLL_INTO_VIEW_DELAY);
1080
1101
  }
1081
- set content(content) {
1082
- this.rawLoader$$.next(content);
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
+ });
1083
1120
  }
1084
- copyExampleLink() {
1085
- const hashPosition = this.location.href.indexOf('#');
1086
- const currentUrl = hashPosition > -1
1087
- ? this.location.href.substr(0, hashPosition)
1088
- : this.location.href;
1089
- const url = `${currentUrl}#${this.id}`;
1090
- this.clipboard.copy(url);
1091
- this.notifications
1092
- .show(this.texts[1], {
1093
- label: this.texts[2],
1094
- status: "success" /* Success */,
1095
- })
1096
- .subscribe();
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
+ });
1097
1132
  }
1098
1133
  };
1099
- TuiDocExampleComponent.ctorParameters = () => [
1100
- { type: String, decorators: [{ type: Attribute, args: ['id',] }] },
1101
- { type: Clipboard, decorators: [{ type: Inject, args: [Clipboard,] }] },
1102
- { type: TuiNotificationsService, decorators: [{ type: Inject, args: [TuiNotificationsService,] }] },
1103
- { type: Location, decorators: [{ type: Inject, args: [LOCATION,] }] },
1104
- { type: Observable, decorators: [{ type: Inject, args: [TUI_COPY_TEXTS,] }] },
1105
- { type: Array, decorators: [{ type: Inject, args: [TUI_DOC_EXAMPLE_TEXTS,] }] },
1106
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [TUI_DOC_CODE_EDITOR,] }] },
1107
- { 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,] }] }
1108
1146
  ];
1109
1147
  __decorate([
1110
- Input()
1111
- ], TuiDocExampleComponent.prototype, "heading", void 0);
1112
- __decorate([
1113
- Input()
1114
- ], TuiDocExampleComponent.prototype, "description", void 0);
1148
+ HostBinding('class._open')
1149
+ ], TuiDocNavigationComponent.prototype, "menuOpen", void 0);
1115
1150
  __decorate([
1116
- Input()
1117
- ], TuiDocExampleComponent.prototype, "content", null);
1151
+ tuiPure
1152
+ ], TuiDocNavigationComponent.prototype, "filterItems", null);
1118
1153
  __decorate([
1119
- Input()
1120
- ], TuiDocExampleComponent.prototype, "componentName", void 0);
1121
- TuiDocExampleComponent = __decorate([
1154
+ tuiPure
1155
+ ], TuiDocNavigationComponent.prototype, "flattenSubPages", null);
1156
+ TuiDocNavigationComponent = __decorate([
1122
1157
  Component({
1123
- selector: 'tui-doc-example',
1124
- 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",
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,
1125
1161
  changeDetection: ChangeDetectionStrategy.OnPush,
1126
- 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)}"]
1127
1163
  }),
1128
- __param(0, Attribute('id')),
1129
- __param(1, Inject(Clipboard)),
1130
- __param(2, Inject(TuiNotificationsService)),
1131
- __param(3, Inject(LOCATION)),
1132
- __param(4, Inject(TUI_COPY_TEXTS)),
1133
- __param(5, Inject(TUI_DOC_EXAMPLE_TEXTS)),
1134
- __param(6, Optional()),
1135
- __param(6, Inject(TUI_DOC_CODE_EDITOR)),
1136
- __param(7, Inject(TUI_DOC_EXAMPLE_CONTENT_PROCESSOR))
1137
- ], TuiDocExampleComponent);
1138
-
1139
- let TuiDocExampleGetTabsPipe = class TuiDocExampleGetTabsPipe {
1140
- transform(content, defaultTab) {
1141
- return [defaultTab, ...Object.keys(content)];
1142
- }
1143
- };
1144
- TuiDocExampleGetTabsPipe = __decorate([
1145
- Pipe({ name: 'tuiDocExampleGetTabs' })
1146
- ], TuiDocExampleGetTabsPipe);
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);
1147
1177
 
1148
- let TuiDocExampleModule = class TuiDocExampleModule {
1178
+ let TuiDocNavigationModule = class TuiDocNavigationModule {
1149
1179
  };
1150
- TuiDocExampleModule = __decorate([
1180
+ TuiDocNavigationModule = __decorate([
1151
1181
  NgModule({
1152
1182
  imports: [
1153
1183
  CommonModule,
1154
- ClipboardModule,
1155
- TuiTabsModule,
1184
+ FormsModule,
1185
+ RouterModule,
1186
+ ScrollIntoViewModule,
1156
1187
  TuiButtonModule,
1157
- TuiDocCopyModule,
1158
- TuiDocCodeModule,
1159
- 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,
1160
1202
  ],
1161
- declarations: [TuiDocExampleComponent, TuiDocExampleGetTabsPipe],
1162
- exports: [TuiDocExampleComponent, TuiDocExampleGetTabsPipe],
1203
+ declarations: [TuiDocNavigationComponent],
1204
+ exports: [TuiDocNavigationComponent],
1163
1205
  })
1164
- ], TuiDocExampleModule);
1165
-
1166
- var TuiDocMainComponent_1;
1167
- // @dynamic
1168
- let TuiDocMainComponent = TuiDocMainComponent_1 = class TuiDocMainComponent {
1169
- constructor(storage, windowRef) {
1170
- this.storage = storage;
1171
- this.windowRef = windowRef;
1172
- this.night = this.storage.getItem('night') === 'true' ||
1173
- (this.storage.getItem('night') === null &&
1174
- this.windowRef.matchMedia('(prefers-color-scheme: dark)').matches);
1175
- this.change$ = new Subject();
1176
- }
1177
- get mode() {
1178
- return this.night ? 'onDark' : null;
1179
- }
1180
- onMode(night) {
1181
- this.night = night;
1182
- this.change$.next();
1183
- this.storage.setItem('night', String(night));
1184
- }
1185
- };
1186
- TuiDocMainComponent.ctorParameters = () => [
1187
- { type: Storage, decorators: [{ type: Inject, args: [LOCAL_STORAGE,] }] },
1188
- { type: Window, decorators: [{ type: Inject, args: [WINDOW,] }] }
1189
- ];
1190
- TuiDocMainComponent = TuiDocMainComponent_1 = __decorate([
1191
- Component({
1192
- selector: 'tui-doc-main',
1193
- 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",
1194
- encapsulation: ViewEncapsulation.None,
1195
- providers: [
1196
- {
1197
- provide: TuiModeDirective,
1198
- useExisting: forwardRef(() => TuiDocMainComponent_1),
1199
- },
1200
- TuiSwipeService,
1201
- ],
1202
- 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}"]
1203
- }),
1204
- __param(0, Inject(LOCAL_STORAGE)),
1205
- __param(1, Inject(WINDOW))
1206
- ], TuiDocMainComponent);
1206
+ ], TuiDocNavigationModule);
1207
1207
 
1208
1208
  const TUI_DOC_LOGO = new InjectionToken('Main logo', {
1209
1209
  factory: () => '',
@@ -1288,25 +1288,6 @@ const TUI_DOC_DEFAULT_TABS = new InjectionToken('Array of default tab names', {
1288
1288
  factory: () => [],
1289
1289
  });
1290
1290
 
1291
- let TuiDocPageTabConnectorDirective = class TuiDocPageTabConnectorDirective {
1292
- constructor(template) {
1293
- this.template = template;
1294
- }
1295
- };
1296
- TuiDocPageTabConnectorDirective.ctorParameters = () => [
1297
- { type: TemplateRef, decorators: [{ type: Inject, args: [TemplateRef,] }] }
1298
- ];
1299
- __decorate([
1300
- Input(),
1301
- tuiDefaultProp()
1302
- ], TuiDocPageTabConnectorDirective.prototype, "pageTab", void 0);
1303
- TuiDocPageTabConnectorDirective = __decorate([
1304
- Directive({
1305
- selector: '[pageTab]',
1306
- }),
1307
- __param(0, Inject(TemplateRef))
1308
- ], TuiDocPageTabConnectorDirective);
1309
-
1310
1291
  const TUI_DOC_SEE_ALSO = new InjectionToken('Array of arrays of related pages', {
1311
1292
  factory: () => [],
1312
1293
  });
@@ -1328,6 +1309,25 @@ function seeAlsoProviderFactory({ nativeElement }, seeAlsoGroups) {
1328
1309
  return Array.from(seeAlsoSet);
1329
1310
  }
1330
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
+
1331
1331
  // Ambient type cannot be used without dynamic https://github.com/angular/angular/issues/23395
1332
1332
  // @dynamic
1333
1333
  let TuiDocPageComponent = class TuiDocPageComponent {
@@ -1552,6 +1552,20 @@ const TUI_DOC_RUSSIAN = [
1552
1552
  },
1553
1553
  ];
1554
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
+
1555
1569
  /**
1556
1570
  * Generates typical page routing structure
1557
1571
  */
@@ -1570,20 +1584,6 @@ function generateRoutes(type) {
1570
1584
  ];
1571
1585
  }
1572
1586
 
1573
- let TuiAddonDocModule = class TuiAddonDocModule {
1574
- };
1575
- TuiAddonDocModule = __decorate([
1576
- NgModule({
1577
- exports: [
1578
- TuiDocCodeModule,
1579
- TuiDocDemoModule,
1580
- TuiDocDocumentationModule,
1581
- TuiDocPageModule,
1582
- TuiDocExampleModule,
1583
- ],
1584
- })
1585
- ], TuiAddonDocModule);
1586
-
1587
1587
  /**
1588
1588
  * Public API Surface of @taiga-ui/addon-doc
1589
1589
  */
@@ -1592,5 +1592,5 @@ TuiAddonDocModule = __decorate([
1592
1592
  * Generated bundle index. Do not edit.
1593
1593
  */
1594
1594
 
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, 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, TuiDocExampleGetTabsPipe as ɵj, TuiDocHeaderModule 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 };
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 };
1596
1596
  //# sourceMappingURL=taiga-ui-addon-doc.js.map