@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, __generator, __decorate, __param, __assign, __spread, __read, __values } 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 () {
@@ -364,693 +364,330 @@ var TuiDocDemoModule = /** @class */ (function () {
364
364
  return TuiDocDemoModule;
365
365
  }());
366
366
 
367
- var MAP = {
368
- а: 'f',
369
- б: ',',
370
- в: 'd',
371
- г: 'u',
372
- д: 'l',
373
- е: 't',
374
- ё: '`',
375
- ж: ';',
376
- з: 'p',
377
- и: 'b',
378
- й: 'q',
379
- к: 'r',
380
- л: 'k',
381
- м: 'v',
382
- н: 'y',
383
- о: 'j',
384
- п: 'g',
385
- р: 'h',
386
- с: 'c',
387
- т: 'n',
388
- у: 'e',
389
- ф: 'a',
390
- х: '[',
391
- ц: 'w',
392
- ч: 'x',
393
- ш: 'i',
394
- щ: 'o',
395
- ъ: ']',
396
- ы: 's',
397
- ь: 'm',
398
- ю: '.',
399
- я: 'z',
400
- };
401
- /**
402
- * Translates text mistakenly typed in the Russian layout into English
403
- * @param string string with Russian layout characters
404
- * @return string with English layout characters
405
- */
406
- function transliterateKeyboardLayout(string) {
407
- var newStr = '';
408
- for (var i = 0; i < string.length; i++) {
409
- newStr += string.charAt(i) in MAP ? MAP[string.charAt(i)] : string.charAt(i);
410
- }
411
- return newStr;
367
+ function rgbToHex(r, g, b) {
368
+ return ('#' +
369
+ [r, g, b]
370
+ .map(function (x) {
371
+ var hex = x.toString(16);
372
+ return hex.length === 1 ? '0' + hex : hex;
373
+ })
374
+ .join(''));
375
+ }
376
+ function hexToRgb(hex) {
377
+ var matches = hex
378
+ .replace('#', '')
379
+ .split('')
380
+ .map(function (char, _, array) { return (array.length === 3 ? char + char : char); })
381
+ .join('')
382
+ .match(/.{2}/g);
383
+ return matches
384
+ ? matches.map(function (x) { return Number.parseInt(x, 16); })
385
+ : [0, 0, 0];
412
386
  }
413
387
 
414
- var TUI_DOC_PAGES = new InjectionToken('Documentation pages', {
415
- factory: function () { return []; },
416
- });
417
-
418
- var TUI_DOC_TITLE = new InjectionToken('Page title', {
419
- factory: function () { return ''; },
420
- });
421
-
422
- var NAVIGATION_TITLE = new InjectionToken('Page title');
423
- var NAVIGATION_LABELS = new InjectionToken('Navigation sections labels for search');
424
- var NAVIGATION_ITEMS = new InjectionToken('Navigation pages');
425
- var NAVIGATION_PROVIDERS = [
426
- TuiDestroyService,
427
- {
428
- provide: NAVIGATION_TITLE,
429
- deps: [Router, ActivatedRoute, TUI_DOC_TITLE, TuiDestroyService],
430
- useFactory: titleProviderFactory,
431
- },
432
- {
433
- provide: NAVIGATION_LABELS,
434
- deps: [TUI_DOC_PAGES],
435
- useFactory: labelsProviderFactory,
436
- },
437
- {
438
- provide: NAVIGATION_ITEMS,
439
- deps: [TUI_DOC_PAGES],
440
- useFactory: itemsProviderFactory,
441
- },
442
- ];
443
- function titleProviderFactory(router, activatedRoute, titlePrefix, destroy$) {
444
- return router.events.pipe(filter(function (event) { return event instanceof NavigationEnd; }), map(function () { return activatedRoute.firstChild; }), filter(isPresent), mergeMap(function (_a) {
445
- var data = _a.data;
446
- return data;
447
- }), map(function (_a) {
448
- var title = _a.title;
449
- return titlePrefix + title;
450
- }), takeUntil(destroy$));
388
+ function inspectArray(array, depth) {
389
+ if (depth === 0) {
390
+ return '[…]';
391
+ }
392
+ var result = '';
393
+ var first = true;
394
+ for (var index = 0; index < array.length; index++) {
395
+ if (first) {
396
+ first = false;
397
+ }
398
+ else {
399
+ result += ', ';
400
+ }
401
+ result += index in array ? inspectAny(array[index], depth - 1) : 'empty';
402
+ }
403
+ return "[" + result + "]";
451
404
  }
452
- function labelsProviderFactory(pages) {
453
- return pages
454
- .map(function (_a) {
455
- var section = _a.section;
456
- return section;
457
- })
458
- .filter(isPresent)
459
- .filter(function (item, index, array) { return array.indexOf(item) === index; });
405
+ function inspectObject(object, depth) {
406
+ if (depth === 0) {
407
+ return "{\u2026}";
408
+ }
409
+ var result = '';
410
+ var first = true;
411
+ for (var key in object) {
412
+ if (!object.hasOwnProperty(key)) {
413
+ continue;
414
+ }
415
+ if (first) {
416
+ first = false;
417
+ }
418
+ else {
419
+ result += ', ';
420
+ }
421
+ result += key + ": " + inspectAny(object[key], depth - 1);
422
+ }
423
+ return "{" + result + "}";
460
424
  }
461
- function itemsProviderFactory(pages) {
462
- var labels = labelsProviderFactory(pages);
463
- return __spread(labels.map(function (label) { return pages.filter(function (_a) {
464
- var section = _a.section;
465
- return section === label;
466
- }); }), [
467
- pages.filter(function (page) { return !page.section; }),
468
- ]);
425
+ // @bad TODO add more types
426
+ /**
427
+ * Returns readable JS entity
428
+ * @param data
429
+ * @param depth
430
+ * @return readable JS entity
431
+ */
432
+ function inspectAny(data, depth) {
433
+ if (data === null) {
434
+ return 'null';
435
+ }
436
+ switch (typeof data) {
437
+ case 'string':
438
+ return "'" + data + "'";
439
+ case 'undefined':
440
+ case 'number':
441
+ case 'boolean':
442
+ case 'function':
443
+ return String(data);
444
+ }
445
+ if (data instanceof RegExp) {
446
+ return data.toString();
447
+ }
448
+ if (Array.isArray(data)) {
449
+ return inspectArray(data, depth);
450
+ }
451
+ return inspectObject(data, depth);
469
452
  }
470
453
 
471
- var SCROLL_INTO_VIEW_DELAY = 200;
472
- // @dynamic
473
- var TuiDocNavigationComponent = /** @class */ (function () {
474
- function TuiDocNavigationComponent(changeDetectorRef, titleService, title$, documentRef, mode, sidebar, labels, items, searchText, router, activatedRoute) {
475
- var _this = this;
476
- this.documentRef = documentRef;
477
- this.mode = mode;
478
- this.sidebar = sidebar;
479
- this.labels = labels;
480
- this.items = items;
481
- this.searchText = searchText;
482
- this.router = router;
454
+ var SERIALIZED_SUFFIX = '$';
455
+ // @bad TODO: refactor output and value sync
456
+ var TuiDocDocumentationPropertyConnectorDirective = /** @class */ (function () {
457
+ function TuiDocDocumentationPropertyConnectorDirective(template, locationRef, activatedRoute, urlSerializer) {
458
+ this.template = template;
459
+ this.locationRef = locationRef;
483
460
  this.activatedRoute = activatedRoute;
484
- this.search = '';
485
- this.open = false;
486
- this.openPagesArr = [];
487
- this.openPagesGroupsArr = [];
488
- this.active = '';
489
- this.menuOpen = false;
490
- this.mode$ = this.mode.change$.pipe(startWith(null), map(function () { return _this.mode.mode || 'onLight'; }));
491
- // Angular can't navigate no anchor links
492
- // https://stackoverflow.com/questions/36101756/angular2-routing-with-hashtag-to-page-anchor
493
- title$.subscribe(function (title) {
494
- changeDetectorRef.markForCheck();
495
- titleService.setTitle(title);
496
- _this.openActivePageGroup();
497
- _this.handleAnchorLink(_this.activatedRoute.snapshot.fragment);
498
- });
461
+ this.urlSerializer = urlSerializer;
462
+ this.documentationPropertyName = '';
463
+ this.documentationPropertyMode = null;
464
+ this.documentationPropertyType = '';
465
+ this.documentationPropertyValue = null;
466
+ this.documentationPropertyDeprecated = false;
467
+ this.documentationPropertyValues = null;
468
+ this.documentationPropertyValueChange = new EventEmitter();
469
+ this.changed$ = new Subject();
470
+ this.emits$ = new BehaviorSubject(1);
499
471
  }
500
- Object.defineProperty(TuiDocNavigationComponent.prototype, "canOpen", {
472
+ TuiDocDocumentationPropertyConnectorDirective.prototype.ngOnInit = function () {
473
+ this.parseParams(this.activatedRoute.snapshot.queryParams);
474
+ };
475
+ Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "attrName", {
501
476
  get: function () {
502
- return this.search.length > 2;
477
+ switch (this.documentationPropertyMode) {
478
+ case 'input':
479
+ return "[" + this.documentationPropertyName + "]";
480
+ case 'output':
481
+ return "(" + this.documentationPropertyName + ")";
482
+ case 'input-output':
483
+ return "[(" + this.documentationPropertyName + ")]";
484
+ default:
485
+ return this.documentationPropertyName;
486
+ }
503
487
  },
504
488
  enumerable: true,
505
489
  configurable: true
506
490
  });
507
- Object.defineProperty(TuiDocNavigationComponent.prototype, "filteredItems", {
491
+ Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "hasItems", {
508
492
  get: function () {
509
- return this.filterItems(this.flattenSubPages(this.items), this.search);
493
+ return !!this.documentationPropertyValues;
510
494
  },
511
495
  enumerable: true,
512
496
  configurable: true
513
497
  });
514
- Object.defineProperty(TuiDocNavigationComponent.prototype, "itemsWithoutSections", {
498
+ Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "shouldShowValues", {
515
499
  get: function () {
516
- return this.items[this.items.length - 1];
500
+ return this.documentationPropertyMode !== 'output';
517
501
  },
518
502
  enumerable: true,
519
503
  configurable: true
520
504
  });
521
- TuiDocNavigationComponent.prototype.isActive = function (route) {
522
- return route === this.active;
505
+ TuiDocDocumentationPropertyConnectorDirective.prototype.ngOnChanges = function () {
506
+ this.changed$.next();
523
507
  };
524
- TuiDocNavigationComponent.prototype.onGroupClick = function (index) {
525
- this.openPagesGroupsArr[index] = !this.openPagesGroupsArr[index];
526
- };
527
- TuiDocNavigationComponent.prototype.closeMenu = function () {
528
- this.menuOpen = false;
529
- };
530
- TuiDocNavigationComponent.prototype.onSearchChange = function (search) {
531
- this.search = search;
532
- this.open = this.canOpen;
533
- };
534
- TuiDocNavigationComponent.prototype.onClick = function () {
535
- this.open = false;
536
- this.menuOpen = false;
537
- this.search = '';
538
- this.openActivePageGroup();
539
- };
540
- TuiDocNavigationComponent.prototype.filterItems = function (items, search) {
541
- return items.map(function (section) {
542
- return uniqBy(section.filter(function (_a) {
543
- var title = _a.title, _b = _a.keywords, keywords = _b === void 0 ? '' : _b;
544
- title = title.toLowerCase();
545
- search = search.toLowerCase();
546
- keywords = keywords.toLowerCase();
547
- return (title.includes(search) ||
548
- keywords.includes(search) ||
549
- title.includes(transliterateKeyboardLayout(search)) ||
550
- keywords.includes(transliterateKeyboardLayout(search)) ||
551
- search.replace(/-/gi, '').includes(title));
552
- }), 'title');
553
- });
554
- };
555
- TuiDocNavigationComponent.prototype.flattenSubPages = function (items) {
556
- return items.reduce(function (array, item) { return __spread(array, [
557
- item.reduce(function (pages, page) {
558
- return 'subPages' in page
559
- ? __spread(pages, page.subPages) : __spread(pages, [page]);
560
- }, []),
561
- ]); }, []);
562
- };
563
- TuiDocNavigationComponent.prototype.isActiveRoute = function (route) {
564
- return this.router.isActive(route, false);
565
- };
566
- TuiDocNavigationComponent.prototype.handleAnchorLink = function (hash) {
567
- var _this = this;
568
- setTimeout(function () {
569
- _this.navigateToAnchorLink(hash);
570
- }, SCROLL_INTO_VIEW_DELAY);
571
- };
572
- TuiDocNavigationComponent.prototype.openActivePageGroup = function () {
573
- var _this = this;
574
- this.items.forEach(function (pages, pagesIndex) {
575
- pages.forEach(function (page, pageIndex) {
576
- if ('route' in page && _this.isActiveRoute(page.route)) {
577
- _this.openPagesArr[pagesIndex] = true;
578
- _this.active = page.route;
579
- }
580
- if ('subPages' in page) {
581
- page.subPages.forEach(function (subPage) {
582
- if (_this.isActiveRoute(subPage.route)) {
583
- _this.openPagesArr[pagesIndex] = true;
584
- _this.openPagesGroupsArr[pagesIndex * 100 + pageIndex] = true;
585
- _this.active = subPage.route;
586
- }
587
- });
588
- }
589
- });
590
- });
508
+ TuiDocDocumentationPropertyConnectorDirective.prototype.onValueChange = function (value) {
509
+ this.documentationPropertyValue = value;
510
+ this.documentationPropertyValueChange.emit(value);
511
+ this.setQueryParam(value);
591
512
  };
592
- TuiDocNavigationComponent.prototype.navigateToAnchorLink = function (fragment) {
593
- var element = fragment && this.documentRef.querySelector("#" + fragment);
594
- if (!element) {
513
+ TuiDocDocumentationPropertyConnectorDirective.prototype.parseParams = function (params) {
514
+ if (!params[this.documentationPropertyName] &&
515
+ !params[this.documentationPropertyName + SERIALIZED_SUFFIX]) {
595
516
  return;
596
517
  }
597
- element.classList.add('tui-doc-animated-example');
598
- element.scrollIntoView({
599
- block: 'start',
600
- inline: 'nearest',
601
- behavior: 'smooth',
602
- });
518
+ var isValueAvailableByKey = !!params[this.documentationPropertyName + SERIALIZED_SUFFIX];
519
+ if (isValueAvailableByKey && this.documentationPropertyValues) {
520
+ this.onValueChange(this.documentationPropertyValues[params[this.documentationPropertyName + SERIALIZED_SUFFIX]]);
521
+ return;
522
+ }
523
+ this.onValueChange(!isNaN(Number(params[this.documentationPropertyName]))
524
+ ? Number(params[this.documentationPropertyName])
525
+ : params[this.documentationPropertyName]);
603
526
  };
604
- TuiDocNavigationComponent.ctorParameters = function () { return [
605
- { type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] },
606
- { type: Title, decorators: [{ type: Inject, args: [Title,] }] },
607
- { type: Observable, decorators: [{ type: Inject, args: [NAVIGATION_TITLE,] }] },
608
- { type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
609
- { type: TuiModeDirective, decorators: [{ type: Inject, args: [TuiModeDirective,] }] },
610
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [TuiSidebarDirective,] }] },
611
- { type: Array, decorators: [{ type: Inject, args: [NAVIGATION_LABELS,] }] },
612
- { type: undefined, decorators: [{ type: Inject, args: [NAVIGATION_ITEMS,] }] },
613
- { type: String, decorators: [{ type: Inject, args: [TUI_DOC_SEARCH_TEXT,] }] },
614
- { type: Router, decorators: [{ type: Inject, args: [Router,] }] },
615
- { type: ActivatedRoute, decorators: [{ type: Inject, args: [ActivatedRoute,] }] }
527
+ TuiDocDocumentationPropertyConnectorDirective.prototype.setQueryParam = function (value) {
528
+ var _a;
529
+ var tree = this.urlSerializer.parse(this.locationRef.path());
530
+ var isValueAvailableByKey = value instanceof Object;
531
+ var computedValue = isValueAvailableByKey && this.documentationPropertyValues
532
+ ? this.documentationPropertyValues.indexOf(value)
533
+ : value;
534
+ var suffix = isValueAvailableByKey ? SERIALIZED_SUFFIX : '';
535
+ var propName = this.documentationPropertyName + suffix;
536
+ tree.queryParams = __assign(__assign({}, tree.queryParams), (_a = {}, _a[propName] = computedValue, _a));
537
+ this.locationRef.go(String(tree));
538
+ };
539
+ TuiDocDocumentationPropertyConnectorDirective.prototype.emitEvent = function (event) {
540
+ // For more convenient debugging
541
+ console.log(this.attrName, event);
542
+ this.emits$.next(this.emits$.value + 1);
543
+ };
544
+ TuiDocDocumentationPropertyConnectorDirective.ctorParameters = function () { return [
545
+ { type: TemplateRef, decorators: [{ type: Inject, args: [TemplateRef,] }] },
546
+ { type: Location$1, decorators: [{ type: Inject, args: [Location$1,] }] },
547
+ { type: ActivatedRoute, decorators: [{ type: Inject, args: [ActivatedRoute,] }] },
548
+ { type: UrlSerializer, decorators: [{ type: Inject, args: [UrlSerializer,] }] }
616
549
  ]; };
617
550
  __decorate([
618
- HostBinding('class._open')
619
- ], TuiDocNavigationComponent.prototype, "menuOpen", void 0);
551
+ Input()
552
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyName", void 0);
620
553
  __decorate([
621
- tuiPure
622
- ], TuiDocNavigationComponent.prototype, "filterItems", null);
554
+ Input()
555
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyMode", void 0);
623
556
  __decorate([
624
- tuiPure
625
- ], TuiDocNavigationComponent.prototype, "flattenSubPages", null);
626
- TuiDocNavigationComponent = __decorate([
627
- Component({
628
- selector: 'tui-doc-navigation',
629
- 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",
630
- providers: NAVIGATION_PROVIDERS,
631
- changeDetection: ChangeDetectionStrategy.OnPush,
632
- 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)}"]
557
+ Input()
558
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyType", void 0);
559
+ __decorate([
560
+ Input()
561
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValue", void 0);
562
+ __decorate([
563
+ Input()
564
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyDeprecated", void 0);
565
+ __decorate([
566
+ Input()
567
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValues", void 0);
568
+ __decorate([
569
+ Output()
570
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValueChange", void 0);
571
+ TuiDocDocumentationPropertyConnectorDirective = __decorate([
572
+ Directive({
573
+ selector: 'ng-template[documentationPropertyName]',
574
+ exportAs: 'documentationProperty',
633
575
  }),
634
- __param(0, Inject(ChangeDetectorRef)),
635
- __param(1, Inject(Title)),
636
- __param(2, Inject(NAVIGATION_TITLE)),
637
- __param(3, Inject(DOCUMENT)),
638
- __param(4, Inject(TuiModeDirective)),
639
- __param(5, Optional()),
640
- __param(5, Inject(TuiSidebarDirective)),
641
- __param(6, Inject(NAVIGATION_LABELS)),
642
- __param(7, Inject(NAVIGATION_ITEMS)),
643
- __param(8, Inject(TUI_DOC_SEARCH_TEXT)),
644
- __param(9, Inject(Router)),
645
- __param(10, Inject(ActivatedRoute))
646
- ], TuiDocNavigationComponent);
647
- return TuiDocNavigationComponent;
576
+ __param(0, Inject(TemplateRef)),
577
+ __param(1, Inject(Location$1)),
578
+ __param(2, Inject(ActivatedRoute)),
579
+ __param(3, Inject(UrlSerializer))
580
+ ], TuiDocDocumentationPropertyConnectorDirective);
581
+ return TuiDocDocumentationPropertyConnectorDirective;
648
582
  }());
649
583
 
650
- var ScrollIntoViewDirective = /** @class */ (function () {
651
- function ScrollIntoViewDirective(destroy$, _a) {
652
- var nativeElement = _a.nativeElement;
653
- this.scroll$ = new Subject();
654
- this.scroll$
655
- .pipe(debounceTime(750), filter(function (shallWe) { return shallWe && !!getElementObscurers(nativeElement); }), takeUntil(destroy$))
656
- .subscribe(function () {
657
- nativeElement.scrollIntoView();
658
- });
584
+ // @bad TODO subscribe propertiesConnectors changes
585
+ // @bad TODO refactor to make more flexible
586
+ // @dynamic
587
+ var TuiDocDocumentationComponent = /** @class */ (function () {
588
+ function TuiDocDocumentationComponent(changeDetectorRef, texts) {
589
+ this.changeDetectorRef = changeDetectorRef;
590
+ this.texts = texts;
591
+ this.heading = '';
592
+ this.showValues = true;
593
+ this.isAPI = false;
594
+ this.propertiesConnectors = EMPTY_QUERY;
595
+ this.activeItemIndex = 0;
659
596
  }
660
- Object.defineProperty(ScrollIntoViewDirective.prototype, "scrollIntoView", {
661
- set: function (shallWe) {
662
- this.scroll$.next(shallWe);
597
+ TuiDocDocumentationComponent.prototype.ngAfterContentInit = function () {
598
+ itemsQueryListObservable(this.propertiesConnectors)
599
+ .pipe(switchMap(function (items) { return merge.apply(void 0, __spread(items.map(function (_a) {
600
+ var changed$ = _a.changed$;
601
+ return changed$;
602
+ }))); }), watch(this.changeDetectorRef))
603
+ .subscribe();
604
+ };
605
+ Object.defineProperty(TuiDocDocumentationComponent.prototype, "type", {
606
+ get: function () {
607
+ return this.isAPI ? this.texts[0] : this.texts[1];
663
608
  },
664
609
  enumerable: true,
665
610
  configurable: true
666
611
  });
667
- ScrollIntoViewDirective.ctorParameters = function () { return [
668
- { type: TuiDestroyService, decorators: [{ type: Inject, args: [TuiDestroyService,] }] },
669
- { type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }
670
- ]; };
671
- __decorate([
672
- Input()
673
- ], ScrollIntoViewDirective.prototype, "scrollIntoView", null);
674
- ScrollIntoViewDirective = __decorate([
675
- Directive({
676
- selector: '[scrollIntoView]',
677
- providers: [TuiDestroyService],
678
- }),
679
- __param(0, Inject(TuiDestroyService)),
680
- __param(1, Inject(ElementRef))
681
- ], ScrollIntoViewDirective);
682
- return ScrollIntoViewDirective;
683
- }());
684
-
685
- var ScrollIntoViewModule = /** @class */ (function () {
686
- function ScrollIntoViewModule() {
687
- }
688
- ScrollIntoViewModule = __decorate([
689
- NgModule({
690
- declarations: [ScrollIntoViewDirective],
691
- exports: [ScrollIntoViewDirective],
692
- })
693
- ], ScrollIntoViewModule);
694
- return ScrollIntoViewModule;
695
- }());
696
-
697
- var TuiDocNavigationModule = /** @class */ (function () {
698
- function TuiDocNavigationModule() {
699
- }
700
- TuiDocNavigationModule = __decorate([
701
- NgModule({
702
- imports: [
703
- CommonModule,
704
- FormsModule,
705
- RouterModule,
706
- ScrollIntoViewModule,
707
- TuiButtonModule,
708
- TuiPrimitiveTextfieldModule,
709
- TuiTextfieldControllerModule,
710
- TuiActiveZoneModule,
711
- TuiLetModule,
712
- TuiModeModule,
713
- TuiLinkModule,
714
- TuiExpandModule,
715
- TuiHostedDropdownModule,
716
- TuiDropdownControllerModule,
717
- TuiAccordionModule,
718
- TuiScrollbarModule,
719
- TuiSvgModule,
720
- TuiDataListModule,
721
- TuiAutoFocusModule,
722
- ],
723
- declarations: [TuiDocNavigationComponent],
724
- exports: [TuiDocNavigationComponent],
725
- })
726
- ], TuiDocNavigationModule);
727
- return TuiDocNavigationModule;
728
- }());
729
-
730
- function rgbToHex(r, g, b) {
731
- return ('#' +
732
- [r, g, b]
733
- .map(function (x) {
734
- var hex = x.toString(16);
735
- return hex.length === 1 ? '0' + hex : hex;
736
- })
737
- .join(''));
738
- }
739
- function hexToRgb(hex) {
740
- var matches = hex
741
- .replace('#', '')
742
- .split('')
743
- .map(function (char, _, array) { return (array.length === 3 ? char + char : char); })
744
- .join('')
745
- .match(/.{2}/g);
746
- return matches
747
- ? matches.map(function (x) { return Number.parseInt(x, 16); })
748
- : [0, 0, 0];
749
- }
750
-
751
- function inspectArray(array, depth) {
752
- if (depth === 0) {
753
- return '[…]';
754
- }
755
- var result = '';
756
- var first = true;
757
- for (var index = 0; index < array.length; index++) {
758
- if (first) {
759
- first = false;
612
+ TuiDocDocumentationComponent.prototype.getColor = function (color) {
613
+ if (color.length === 4) {
614
+ return color
615
+ .split('')
616
+ .reduce(function (result, current) { return __spread(result, [current, current]); }, [])
617
+ .join('')
618
+ .replace('#', '');
760
619
  }
761
- else {
762
- result += ', ';
620
+ if (color.startsWith('#')) {
621
+ return color;
763
622
  }
764
- result += index in array ? inspectAny(array[index], depth - 1) : 'empty';
765
- }
766
- return "[" + result + "]";
767
- }
768
- function inspectObject(object, depth) {
769
- if (depth === 0) {
770
- return "{\u2026}";
771
- }
772
- var result = '';
773
- var first = true;
774
- for (var key in object) {
775
- if (!object.hasOwnProperty(key)) {
776
- continue;
623
+ if (color === 'transparent') {
624
+ return '#000000';
777
625
  }
778
- if (first) {
779
- first = false;
626
+ var parsed = color
627
+ .replace('rgb(', '')
628
+ .replace('rgba(', '')
629
+ .replace(')', '')
630
+ .replace(' ', '')
631
+ .split(',')
632
+ .map(function (v) { return Number.parseInt(v, 10); });
633
+ return rgbToHex.apply(void 0, __spread(parsed));
634
+ };
635
+ TuiDocDocumentationComponent.prototype.getOpacity = function (color) {
636
+ if (color.startsWith('#') || color.startsWith('rgb(')) {
637
+ return 100;
780
638
  }
781
- else {
782
- result += ', ';
639
+ if (color === 'transparent') {
640
+ return 0;
783
641
  }
784
- result += key + ": " + inspectAny(object[key], depth - 1);
785
- }
786
- return "{" + result + "}";
787
- }
788
- // @bad TODO add more types
789
- /**
790
- * Returns readable JS entity
791
- * @param data
792
- * @param depth
793
- * @return readable JS entity
794
- */
795
- function inspectAny(data, depth) {
796
- if (data === null) {
797
- return 'null';
798
- }
799
- switch (typeof data) {
800
- case 'string':
801
- return "'" + data + "'";
802
- case 'undefined':
803
- case 'number':
804
- case 'boolean':
805
- case 'function':
806
- return String(data);
807
- }
808
- if (data instanceof RegExp) {
809
- return data.toString();
810
- }
811
- if (Array.isArray(data)) {
812
- return inspectArray(data, depth);
813
- }
814
- return inspectObject(data, depth);
815
- }
816
-
817
- var SERIALIZED_SUFFIX = '$';
818
- // @bad TODO: refactor output and value sync
819
- var TuiDocDocumentationPropertyConnectorDirective = /** @class */ (function () {
820
- function TuiDocDocumentationPropertyConnectorDirective(template, locationRef, activatedRoute, urlSerializer) {
821
- this.template = template;
822
- this.locationRef = locationRef;
823
- this.activatedRoute = activatedRoute;
824
- this.urlSerializer = urlSerializer;
825
- this.documentationPropertyName = '';
826
- this.documentationPropertyMode = null;
827
- this.documentationPropertyType = '';
828
- this.documentationPropertyValue = null;
829
- this.documentationPropertyDeprecated = false;
830
- this.documentationPropertyValues = null;
831
- this.documentationPropertyValueChange = new EventEmitter();
832
- this.changed$ = new Subject();
833
- this.emits$ = new BehaviorSubject(1);
834
- }
835
- TuiDocDocumentationPropertyConnectorDirective.prototype.ngOnInit = function () {
836
- this.parseParams(this.activatedRoute.snapshot.queryParams);
837
- };
838
- Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "attrName", {
839
- get: function () {
840
- switch (this.documentationPropertyMode) {
841
- case 'input':
842
- return "[" + this.documentationPropertyName + "]";
843
- case 'output':
844
- return "(" + this.documentationPropertyName + ")";
845
- case 'input-output':
846
- return "[(" + this.documentationPropertyName + ")]";
847
- default:
848
- return this.documentationPropertyName;
849
- }
850
- },
851
- enumerable: true,
852
- configurable: true
853
- });
854
- Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "hasItems", {
855
- get: function () {
856
- return !!this.documentationPropertyValues;
857
- },
858
- enumerable: true,
859
- configurable: true
860
- });
861
- Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "shouldShowValues", {
862
- get: function () {
863
- return this.documentationPropertyMode !== 'output';
864
- },
865
- enumerable: true,
866
- configurable: true
867
- });
868
- TuiDocDocumentationPropertyConnectorDirective.prototype.ngOnChanges = function () {
869
- this.changed$.next();
870
- };
871
- TuiDocDocumentationPropertyConnectorDirective.prototype.onValueChange = function (value) {
872
- this.documentationPropertyValue = value;
873
- this.documentationPropertyValueChange.emit(value);
874
- this.setQueryParam(value);
642
+ var lastComma = color.lastIndexOf(',');
643
+ var parsed = color
644
+ .substr(lastComma)
645
+ .replace(')', '')
646
+ .replace(' ', '')
647
+ .replace(',', '');
648
+ return Math.round(Number.parseFloat(parsed) * 100);
875
649
  };
876
- TuiDocDocumentationPropertyConnectorDirective.prototype.parseParams = function (params) {
877
- if (!params[this.documentationPropertyName] &&
878
- !params[this.documentationPropertyName + SERIALIZED_SUFFIX]) {
879
- return;
880
- }
881
- var isValueAvailableByKey = !!params[this.documentationPropertyName + SERIALIZED_SUFFIX];
882
- if (isValueAvailableByKey && this.documentationPropertyValues) {
883
- this.onValueChange(this.documentationPropertyValues[params[this.documentationPropertyName + SERIALIZED_SUFFIX]]);
650
+ TuiDocDocumentationComponent.prototype.onColorChange = function (connector, color) {
651
+ var opacity = this.getOpacity(connector.documentationPropertyValue || '');
652
+ if (opacity === 100) {
653
+ connector.onValueChange(color);
884
654
  return;
885
655
  }
886
- this.onValueChange(!isNaN(Number(params[this.documentationPropertyName]))
887
- ? Number(params[this.documentationPropertyName])
888
- : params[this.documentationPropertyName]);
656
+ var rgb = hexToRgb(color).join(', ');
657
+ var result = "rgba(" + rgb + ", " + opacity / 100 + ")";
658
+ connector.onValueChange(result);
889
659
  };
890
- TuiDocDocumentationPropertyConnectorDirective.prototype.setQueryParam = function (value) {
891
- var _a;
892
- var tree = this.urlSerializer.parse(this.locationRef.path());
893
- var isValueAvailableByKey = value instanceof Object;
894
- var computedValue = isValueAvailableByKey && this.documentationPropertyValues
895
- ? this.documentationPropertyValues.indexOf(value)
896
- : value;
897
- var suffix = isValueAvailableByKey ? SERIALIZED_SUFFIX : '';
898
- var propName = this.documentationPropertyName + suffix;
899
- tree.queryParams = __assign(__assign({}, tree.queryParams), (_a = {}, _a[propName] = computedValue, _a));
900
- this.locationRef.go(String(tree));
660
+ TuiDocDocumentationComponent.prototype.onOpacityChange = function (connector, opacity) {
661
+ var hex = this.getColor(connector.documentationPropertyValue || '');
662
+ var rgb = hexToRgb(hex);
663
+ var result = "rgba(" + rgb + ", " + opacity / 100 + ")";
664
+ connector.onValueChange(result);
901
665
  };
902
- TuiDocDocumentationPropertyConnectorDirective.prototype.emitEvent = function (event) {
903
- // For more convenient debugging
904
- console.log(this.attrName, event);
905
- this.emits$.next(this.emits$.value + 1);
666
+ TuiDocDocumentationComponent.prototype.stripOptional = function (name) {
667
+ return name.replace('?', '');
906
668
  };
907
- TuiDocDocumentationPropertyConnectorDirective.ctorParameters = function () { return [
908
- { type: TemplateRef, decorators: [{ type: Inject, args: [TemplateRef,] }] },
909
- { type: Location$1, decorators: [{ type: Inject, args: [Location$1,] }] },
910
- { type: ActivatedRoute, decorators: [{ type: Inject, args: [ActivatedRoute,] }] },
911
- { type: UrlSerializer, decorators: [{ type: Inject, args: [UrlSerializer,] }] }
669
+ TuiDocDocumentationComponent.prototype.isOptional = function (name) {
670
+ return name.includes('?');
671
+ };
672
+ TuiDocDocumentationComponent.prototype.showCleaner = function (type) {
673
+ return type.includes('null');
674
+ };
675
+ TuiDocDocumentationComponent.prototype.showContentTooltip = function (type) {
676
+ return type.includes('PolymorpheusContent');
677
+ };
678
+ TuiDocDocumentationComponent.prototype.inspectAny = function (data) {
679
+ return inspectAny(data, 2);
680
+ };
681
+ TuiDocDocumentationComponent.ctorParameters = function () { return [
682
+ { type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] },
683
+ { type: Array, decorators: [{ type: Inject, args: [TUI_DOC_DOCUMENTATION_TEXTS,] }] }
912
684
  ]; };
913
685
  __decorate([
914
686
  Input()
915
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyName", void 0);
687
+ ], TuiDocDocumentationComponent.prototype, "heading", void 0);
916
688
  __decorate([
917
689
  Input()
918
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyMode", void 0);
919
- __decorate([
920
- Input()
921
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyType", void 0);
922
- __decorate([
923
- Input()
924
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValue", void 0);
925
- __decorate([
926
- Input()
927
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyDeprecated", void 0);
928
- __decorate([
929
- Input()
930
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValues", void 0);
931
- __decorate([
932
- Output()
933
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValueChange", void 0);
934
- TuiDocDocumentationPropertyConnectorDirective = __decorate([
935
- Directive({
936
- selector: 'ng-template[documentationPropertyName]',
937
- exportAs: 'documentationProperty',
938
- }),
939
- __param(0, Inject(TemplateRef)),
940
- __param(1, Inject(Location$1)),
941
- __param(2, Inject(ActivatedRoute)),
942
- __param(3, Inject(UrlSerializer))
943
- ], TuiDocDocumentationPropertyConnectorDirective);
944
- return TuiDocDocumentationPropertyConnectorDirective;
945
- }());
946
-
947
- // @bad TODO subscribe propertiesConnectors changes
948
- // @bad TODO refactor to make more flexible
949
- // @dynamic
950
- var TuiDocDocumentationComponent = /** @class */ (function () {
951
- function TuiDocDocumentationComponent(changeDetectorRef, texts) {
952
- this.changeDetectorRef = changeDetectorRef;
953
- this.texts = texts;
954
- this.heading = '';
955
- this.showValues = true;
956
- this.isAPI = false;
957
- this.propertiesConnectors = EMPTY_QUERY;
958
- this.activeItemIndex = 0;
959
- }
960
- TuiDocDocumentationComponent.prototype.ngAfterContentInit = function () {
961
- itemsQueryListObservable(this.propertiesConnectors)
962
- .pipe(switchMap(function (items) { return merge.apply(void 0, __spread(items.map(function (_a) {
963
- var changed$ = _a.changed$;
964
- return changed$;
965
- }))); }), watch(this.changeDetectorRef))
966
- .subscribe();
967
- };
968
- Object.defineProperty(TuiDocDocumentationComponent.prototype, "type", {
969
- get: function () {
970
- return this.isAPI ? this.texts[0] : this.texts[1];
971
- },
972
- enumerable: true,
973
- configurable: true
974
- });
975
- TuiDocDocumentationComponent.prototype.getColor = function (color) {
976
- if (color.length === 4) {
977
- return color
978
- .split('')
979
- .reduce(function (result, current) { return __spread(result, [current, current]); }, [])
980
- .join('')
981
- .replace('#', '');
982
- }
983
- if (color.startsWith('#')) {
984
- return color;
985
- }
986
- if (color === 'transparent') {
987
- return '#000000';
988
- }
989
- var parsed = color
990
- .replace('rgb(', '')
991
- .replace('rgba(', '')
992
- .replace(')', '')
993
- .replace(' ', '')
994
- .split(',')
995
- .map(function (v) { return Number.parseInt(v, 10); });
996
- return rgbToHex.apply(void 0, __spread(parsed));
997
- };
998
- TuiDocDocumentationComponent.prototype.getOpacity = function (color) {
999
- if (color.startsWith('#') || color.startsWith('rgb(')) {
1000
- return 100;
1001
- }
1002
- if (color === 'transparent') {
1003
- return 0;
1004
- }
1005
- var lastComma = color.lastIndexOf(',');
1006
- var parsed = color
1007
- .substr(lastComma)
1008
- .replace(')', '')
1009
- .replace(' ', '')
1010
- .replace(',', '');
1011
- return Math.round(Number.parseFloat(parsed) * 100);
1012
- };
1013
- TuiDocDocumentationComponent.prototype.onColorChange = function (connector, color) {
1014
- var opacity = this.getOpacity(connector.documentationPropertyValue || '');
1015
- if (opacity === 100) {
1016
- connector.onValueChange(color);
1017
- return;
1018
- }
1019
- var rgb = hexToRgb(color).join(', ');
1020
- var result = "rgba(" + rgb + ", " + opacity / 100 + ")";
1021
- connector.onValueChange(result);
1022
- };
1023
- TuiDocDocumentationComponent.prototype.onOpacityChange = function (connector, opacity) {
1024
- var hex = this.getColor(connector.documentationPropertyValue || '');
1025
- var rgb = hexToRgb(hex);
1026
- var result = "rgba(" + rgb + ", " + opacity / 100 + ")";
1027
- connector.onValueChange(result);
1028
- };
1029
- TuiDocDocumentationComponent.prototype.stripOptional = function (name) {
1030
- return name.replace('?', '');
1031
- };
1032
- TuiDocDocumentationComponent.prototype.isOptional = function (name) {
1033
- return name.includes('?');
1034
- };
1035
- TuiDocDocumentationComponent.prototype.showCleaner = function (type) {
1036
- return type.includes('null');
1037
- };
1038
- TuiDocDocumentationComponent.prototype.showContentTooltip = function (type) {
1039
- return type.includes('PolymorpheusContent');
1040
- };
1041
- TuiDocDocumentationComponent.prototype.inspectAny = function (data) {
1042
- return inspectAny(data, 2);
1043
- };
1044
- TuiDocDocumentationComponent.ctorParameters = function () { return [
1045
- { type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] },
1046
- { type: Array, decorators: [{ type: Inject, args: [TUI_DOC_DOCUMENTATION_TEXTS,] }] }
1047
- ]; };
1048
- __decorate([
1049
- Input()
1050
- ], TuiDocDocumentationComponent.prototype, "heading", void 0);
1051
- __decorate([
1052
- Input()
1053
- ], TuiDocDocumentationComponent.prototype, "showValues", void 0);
690
+ ], TuiDocDocumentationComponent.prototype, "showValues", void 0);
1054
691
  __decorate([
1055
692
  Input()
1056
693
  ], TuiDocDocumentationComponent.prototype, "isAPI", void 0);
@@ -1249,127 +886,490 @@ var TuiDocExampleComponent = /** @class */ (function () {
1249
886
  })
1250
887
  .subscribe();
1251
888
  };
1252
- TuiDocExampleComponent.ctorParameters = function () { return [
1253
- { type: String, decorators: [{ type: Attribute, args: ['id',] }] },
1254
- { type: Clipboard, decorators: [{ type: Inject, args: [Clipboard,] }] },
1255
- { type: TuiNotificationsService, decorators: [{ type: Inject, args: [TuiNotificationsService,] }] },
1256
- { type: Location, decorators: [{ type: Inject, args: [LOCATION,] }] },
1257
- { type: Observable, decorators: [{ type: Inject, args: [TUI_COPY_TEXTS,] }] },
1258
- { type: Array, decorators: [{ type: Inject, args: [TUI_DOC_EXAMPLE_TEXTS,] }] },
1259
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [TUI_DOC_CODE_EDITOR,] }] },
1260
- { type: undefined, decorators: [{ type: Inject, args: [TUI_DOC_EXAMPLE_CONTENT_PROCESSOR,] }] }
889
+ TuiDocExampleComponent.ctorParameters = function () { return [
890
+ { type: String, decorators: [{ type: Attribute, args: ['id',] }] },
891
+ { type: Clipboard, decorators: [{ type: Inject, args: [Clipboard,] }] },
892
+ { type: TuiNotificationsService, decorators: [{ type: Inject, args: [TuiNotificationsService,] }] },
893
+ { type: Location, decorators: [{ type: Inject, args: [LOCATION,] }] },
894
+ { type: Observable, decorators: [{ type: Inject, args: [TUI_COPY_TEXTS,] }] },
895
+ { type: Array, decorators: [{ type: Inject, args: [TUI_DOC_EXAMPLE_TEXTS,] }] },
896
+ { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [TUI_DOC_CODE_EDITOR,] }] },
897
+ { type: undefined, decorators: [{ type: Inject, args: [TUI_DOC_EXAMPLE_CONTENT_PROCESSOR,] }] }
898
+ ]; };
899
+ __decorate([
900
+ Input()
901
+ ], TuiDocExampleComponent.prototype, "heading", void 0);
902
+ __decorate([
903
+ Input()
904
+ ], TuiDocExampleComponent.prototype, "description", void 0);
905
+ __decorate([
906
+ Input()
907
+ ], TuiDocExampleComponent.prototype, "content", null);
908
+ __decorate([
909
+ Input()
910
+ ], TuiDocExampleComponent.prototype, "componentName", void 0);
911
+ TuiDocExampleComponent = __decorate([
912
+ Component({
913
+ selector: 'tui-doc-example',
914
+ 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",
915
+ changeDetection: ChangeDetectionStrategy.OnPush,
916
+ 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}"]
917
+ }),
918
+ __param(0, Attribute('id')),
919
+ __param(1, Inject(Clipboard)),
920
+ __param(2, Inject(TuiNotificationsService)),
921
+ __param(3, Inject(LOCATION)),
922
+ __param(4, Inject(TUI_COPY_TEXTS)),
923
+ __param(5, Inject(TUI_DOC_EXAMPLE_TEXTS)),
924
+ __param(6, Optional()),
925
+ __param(6, Inject(TUI_DOC_CODE_EDITOR)),
926
+ __param(7, Inject(TUI_DOC_EXAMPLE_CONTENT_PROCESSOR))
927
+ ], TuiDocExampleComponent);
928
+ return TuiDocExampleComponent;
929
+ }());
930
+
931
+ var TuiDocExampleGetTabsPipe = /** @class */ (function () {
932
+ function TuiDocExampleGetTabsPipe() {
933
+ }
934
+ TuiDocExampleGetTabsPipe.prototype.transform = function (content, defaultTab) {
935
+ return __spread([defaultTab], Object.keys(content));
936
+ };
937
+ TuiDocExampleGetTabsPipe = __decorate([
938
+ Pipe({ name: 'tuiDocExampleGetTabs' })
939
+ ], TuiDocExampleGetTabsPipe);
940
+ return TuiDocExampleGetTabsPipe;
941
+ }());
942
+
943
+ var TuiDocExampleModule = /** @class */ (function () {
944
+ function TuiDocExampleModule() {
945
+ }
946
+ TuiDocExampleModule = __decorate([
947
+ NgModule({
948
+ imports: [
949
+ CommonModule,
950
+ ClipboardModule,
951
+ TuiTabsModule,
952
+ TuiButtonModule,
953
+ TuiDocCopyModule,
954
+ TuiDocCodeModule,
955
+ PolymorpheusModule,
956
+ ],
957
+ declarations: [TuiDocExampleComponent, TuiDocExampleGetTabsPipe],
958
+ exports: [TuiDocExampleComponent, TuiDocExampleGetTabsPipe],
959
+ })
960
+ ], TuiDocExampleModule);
961
+ return TuiDocExampleModule;
962
+ }());
963
+
964
+ // @dynamic
965
+ var TuiDocMainComponent = /** @class */ (function () {
966
+ function TuiDocMainComponent(storage, windowRef) {
967
+ this.storage = storage;
968
+ this.windowRef = windowRef;
969
+ this.night = this.storage.getItem('night') === 'true' ||
970
+ (this.storage.getItem('night') === null &&
971
+ this.windowRef.matchMedia('(prefers-color-scheme: dark)').matches);
972
+ this.change$ = new Subject();
973
+ }
974
+ TuiDocMainComponent_1 = TuiDocMainComponent;
975
+ Object.defineProperty(TuiDocMainComponent.prototype, "mode", {
976
+ get: function () {
977
+ return this.night ? 'onDark' : null;
978
+ },
979
+ enumerable: true,
980
+ configurable: true
981
+ });
982
+ TuiDocMainComponent.prototype.onMode = function (night) {
983
+ this.night = night;
984
+ this.change$.next();
985
+ this.storage.setItem('night', String(night));
986
+ };
987
+ var TuiDocMainComponent_1;
988
+ TuiDocMainComponent.ctorParameters = function () { return [
989
+ { type: Storage, decorators: [{ type: Inject, args: [LOCAL_STORAGE,] }] },
990
+ { type: Window, decorators: [{ type: Inject, args: [WINDOW,] }] }
991
+ ]; };
992
+ TuiDocMainComponent = TuiDocMainComponent_1 = __decorate([
993
+ Component({
994
+ selector: 'tui-doc-main',
995
+ 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",
996
+ encapsulation: ViewEncapsulation.None,
997
+ providers: [
998
+ {
999
+ provide: TuiModeDirective,
1000
+ useExisting: forwardRef(function () { return TuiDocMainComponent_1; }),
1001
+ },
1002
+ TuiSwipeService,
1003
+ ],
1004
+ 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}"]
1005
+ }),
1006
+ __param(0, Inject(LOCAL_STORAGE)),
1007
+ __param(1, Inject(WINDOW))
1008
+ ], TuiDocMainComponent);
1009
+ return TuiDocMainComponent;
1010
+ }());
1011
+
1012
+ var ScrollIntoViewDirective = /** @class */ (function () {
1013
+ function ScrollIntoViewDirective(destroy$, _a) {
1014
+ var nativeElement = _a.nativeElement;
1015
+ this.scroll$ = new Subject();
1016
+ this.scroll$
1017
+ .pipe(debounceTime(750), filter(function (shallWe) { return shallWe && !!getElementObscurers(nativeElement); }), takeUntil(destroy$))
1018
+ .subscribe(function () {
1019
+ nativeElement.scrollIntoView();
1020
+ });
1021
+ }
1022
+ Object.defineProperty(ScrollIntoViewDirective.prototype, "scrollIntoView", {
1023
+ set: function (shallWe) {
1024
+ this.scroll$.next(shallWe);
1025
+ },
1026
+ enumerable: true,
1027
+ configurable: true
1028
+ });
1029
+ ScrollIntoViewDirective.ctorParameters = function () { return [
1030
+ { type: TuiDestroyService, decorators: [{ type: Inject, args: [TuiDestroyService,] }] },
1031
+ { type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }
1032
+ ]; };
1033
+ __decorate([
1034
+ Input()
1035
+ ], ScrollIntoViewDirective.prototype, "scrollIntoView", null);
1036
+ ScrollIntoViewDirective = __decorate([
1037
+ Directive({
1038
+ selector: '[scrollIntoView]',
1039
+ providers: [TuiDestroyService],
1040
+ }),
1041
+ __param(0, Inject(TuiDestroyService)),
1042
+ __param(1, Inject(ElementRef))
1043
+ ], ScrollIntoViewDirective);
1044
+ return ScrollIntoViewDirective;
1045
+ }());
1046
+
1047
+ var ScrollIntoViewModule = /** @class */ (function () {
1048
+ function ScrollIntoViewModule() {
1049
+ }
1050
+ ScrollIntoViewModule = __decorate([
1051
+ NgModule({
1052
+ declarations: [ScrollIntoViewDirective],
1053
+ exports: [ScrollIntoViewDirective],
1054
+ })
1055
+ ], ScrollIntoViewModule);
1056
+ return ScrollIntoViewModule;
1057
+ }());
1058
+
1059
+ var MAP = {
1060
+ а: 'f',
1061
+ б: ',',
1062
+ в: 'd',
1063
+ г: 'u',
1064
+ д: 'l',
1065
+ е: 't',
1066
+ ё: '`',
1067
+ ж: ';',
1068
+ з: 'p',
1069
+ и: 'b',
1070
+ й: 'q',
1071
+ к: 'r',
1072
+ л: 'k',
1073
+ м: 'v',
1074
+ н: 'y',
1075
+ о: 'j',
1076
+ п: 'g',
1077
+ р: 'h',
1078
+ с: 'c',
1079
+ т: 'n',
1080
+ у: 'e',
1081
+ ф: 'a',
1082
+ х: '[',
1083
+ ц: 'w',
1084
+ ч: 'x',
1085
+ ш: 'i',
1086
+ щ: 'o',
1087
+ ъ: ']',
1088
+ ы: 's',
1089
+ ь: 'm',
1090
+ ю: '.',
1091
+ я: 'z',
1092
+ };
1093
+ /**
1094
+ * Translates text mistakenly typed in the Russian layout into English
1095
+ * @param string string with Russian layout characters
1096
+ * @return string with English layout characters
1097
+ */
1098
+ function transliterateKeyboardLayout(string) {
1099
+ var newStr = '';
1100
+ for (var i = 0; i < string.length; i++) {
1101
+ newStr += string.charAt(i) in MAP ? MAP[string.charAt(i)] : string.charAt(i);
1102
+ }
1103
+ return newStr;
1104
+ }
1105
+
1106
+ var TUI_DOC_PAGES = new InjectionToken('Documentation pages', {
1107
+ factory: function () { return []; },
1108
+ });
1109
+
1110
+ var TUI_DOC_TITLE = new InjectionToken('Page title', {
1111
+ factory: function () { return ''; },
1112
+ });
1113
+
1114
+ var NAVIGATION_TITLE = new InjectionToken('Page title');
1115
+ var NAVIGATION_LABELS = new InjectionToken('Navigation sections labels for search');
1116
+ var NAVIGATION_ITEMS = new InjectionToken('Navigation pages');
1117
+ var NAVIGATION_PROVIDERS = [
1118
+ TuiDestroyService,
1119
+ {
1120
+ provide: NAVIGATION_TITLE,
1121
+ deps: [Router, ActivatedRoute, TUI_DOC_TITLE, TuiDestroyService],
1122
+ useFactory: titleProviderFactory,
1123
+ },
1124
+ {
1125
+ provide: NAVIGATION_LABELS,
1126
+ deps: [TUI_DOC_PAGES],
1127
+ useFactory: labelsProviderFactory,
1128
+ },
1129
+ {
1130
+ provide: NAVIGATION_ITEMS,
1131
+ deps: [TUI_DOC_PAGES],
1132
+ useFactory: itemsProviderFactory,
1133
+ },
1134
+ ];
1135
+ function titleProviderFactory(router, activatedRoute, titlePrefix, destroy$) {
1136
+ return router.events.pipe(filter(function (event) { return event instanceof NavigationEnd; }), map(function () { return activatedRoute.firstChild; }), filter(isPresent), mergeMap(function (_a) {
1137
+ var data = _a.data;
1138
+ return data;
1139
+ }), map(function (_a) {
1140
+ var title = _a.title;
1141
+ return titlePrefix + title;
1142
+ }), takeUntil(destroy$));
1143
+ }
1144
+ function labelsProviderFactory(pages) {
1145
+ return pages
1146
+ .map(function (_a) {
1147
+ var section = _a.section;
1148
+ return section;
1149
+ })
1150
+ .filter(isPresent)
1151
+ .filter(function (item, index, array) { return array.indexOf(item) === index; });
1152
+ }
1153
+ function itemsProviderFactory(pages) {
1154
+ var labels = labelsProviderFactory(pages);
1155
+ return __spread(labels.map(function (label) { return pages.filter(function (_a) {
1156
+ var section = _a.section;
1157
+ return section === label;
1158
+ }); }), [
1159
+ pages.filter(function (page) { return !page.section; }),
1160
+ ]);
1161
+ }
1162
+
1163
+ var SCROLL_INTO_VIEW_DELAY = 200;
1164
+ // @dynamic
1165
+ var TuiDocNavigationComponent = /** @class */ (function () {
1166
+ function TuiDocNavigationComponent(changeDetectorRef, titleService, title$, documentRef, mode, sidebar, labels, items, searchText, router, activatedRoute) {
1167
+ var _this = this;
1168
+ this.documentRef = documentRef;
1169
+ this.mode = mode;
1170
+ this.sidebar = sidebar;
1171
+ this.labels = labels;
1172
+ this.items = items;
1173
+ this.searchText = searchText;
1174
+ this.router = router;
1175
+ this.activatedRoute = activatedRoute;
1176
+ this.search = '';
1177
+ this.open = false;
1178
+ this.openPagesArr = [];
1179
+ this.openPagesGroupsArr = [];
1180
+ this.active = '';
1181
+ this.menuOpen = false;
1182
+ this.mode$ = this.mode.change$.pipe(startWith(null), map(function () { return _this.mode.mode || 'onLight'; }));
1183
+ // Angular can't navigate no anchor links
1184
+ // https://stackoverflow.com/questions/36101756/angular2-routing-with-hashtag-to-page-anchor
1185
+ title$.subscribe(function (title) {
1186
+ changeDetectorRef.markForCheck();
1187
+ titleService.setTitle(title);
1188
+ _this.openActivePageGroup();
1189
+ _this.handleAnchorLink(_this.activatedRoute.snapshot.fragment);
1190
+ });
1191
+ }
1192
+ Object.defineProperty(TuiDocNavigationComponent.prototype, "canOpen", {
1193
+ get: function () {
1194
+ return this.search.length > 2;
1195
+ },
1196
+ enumerable: true,
1197
+ configurable: true
1198
+ });
1199
+ Object.defineProperty(TuiDocNavigationComponent.prototype, "filteredItems", {
1200
+ get: function () {
1201
+ return this.filterItems(this.flattenSubPages(this.items), this.search);
1202
+ },
1203
+ enumerable: true,
1204
+ configurable: true
1205
+ });
1206
+ Object.defineProperty(TuiDocNavigationComponent.prototype, "itemsWithoutSections", {
1207
+ get: function () {
1208
+ return this.items[this.items.length - 1];
1209
+ },
1210
+ enumerable: true,
1211
+ configurable: true
1212
+ });
1213
+ TuiDocNavigationComponent.prototype.isActive = function (route) {
1214
+ return route === this.active;
1215
+ };
1216
+ TuiDocNavigationComponent.prototype.onGroupClick = function (index) {
1217
+ this.openPagesGroupsArr[index] = !this.openPagesGroupsArr[index];
1218
+ };
1219
+ TuiDocNavigationComponent.prototype.closeMenu = function () {
1220
+ this.menuOpen = false;
1221
+ };
1222
+ TuiDocNavigationComponent.prototype.onSearchChange = function (search) {
1223
+ this.search = search;
1224
+ this.open = this.canOpen;
1225
+ };
1226
+ TuiDocNavigationComponent.prototype.onClick = function () {
1227
+ this.open = false;
1228
+ this.menuOpen = false;
1229
+ this.search = '';
1230
+ this.openActivePageGroup();
1231
+ };
1232
+ TuiDocNavigationComponent.prototype.filterItems = function (items, search) {
1233
+ return items.map(function (section) {
1234
+ return uniqBy(section.filter(function (_a) {
1235
+ var title = _a.title, _b = _a.keywords, keywords = _b === void 0 ? '' : _b;
1236
+ title = title.toLowerCase();
1237
+ search = search.toLowerCase();
1238
+ keywords = keywords.toLowerCase();
1239
+ return (title.includes(search) ||
1240
+ keywords.includes(search) ||
1241
+ title.includes(transliterateKeyboardLayout(search)) ||
1242
+ keywords.includes(transliterateKeyboardLayout(search)) ||
1243
+ search.replace(/-/gi, '').includes(title));
1244
+ }), 'title');
1245
+ });
1246
+ };
1247
+ TuiDocNavigationComponent.prototype.flattenSubPages = function (items) {
1248
+ return items.reduce(function (array, item) { return __spread(array, [
1249
+ item.reduce(function (pages, page) {
1250
+ return 'subPages' in page
1251
+ ? __spread(pages, page.subPages) : __spread(pages, [page]);
1252
+ }, []),
1253
+ ]); }, []);
1254
+ };
1255
+ TuiDocNavigationComponent.prototype.isActiveRoute = function (route) {
1256
+ return this.router.isActive(route, false);
1257
+ };
1258
+ TuiDocNavigationComponent.prototype.handleAnchorLink = function (hash) {
1259
+ var _this = this;
1260
+ setTimeout(function () {
1261
+ _this.navigateToAnchorLink(hash);
1262
+ }, SCROLL_INTO_VIEW_DELAY);
1263
+ };
1264
+ TuiDocNavigationComponent.prototype.openActivePageGroup = function () {
1265
+ var _this = this;
1266
+ this.items.forEach(function (pages, pagesIndex) {
1267
+ pages.forEach(function (page, pageIndex) {
1268
+ if ('route' in page && _this.isActiveRoute(page.route)) {
1269
+ _this.openPagesArr[pagesIndex] = true;
1270
+ _this.active = page.route;
1271
+ }
1272
+ if ('subPages' in page) {
1273
+ page.subPages.forEach(function (subPage) {
1274
+ if (_this.isActiveRoute(subPage.route)) {
1275
+ _this.openPagesArr[pagesIndex] = true;
1276
+ _this.openPagesGroupsArr[pagesIndex * 100 + pageIndex] = true;
1277
+ _this.active = subPage.route;
1278
+ }
1279
+ });
1280
+ }
1281
+ });
1282
+ });
1283
+ };
1284
+ TuiDocNavigationComponent.prototype.navigateToAnchorLink = function (fragment) {
1285
+ var element = fragment && this.documentRef.querySelector("#" + fragment);
1286
+ if (!element) {
1287
+ return;
1288
+ }
1289
+ element.classList.add('tui-doc-animated-example');
1290
+ element.scrollIntoView({
1291
+ block: 'start',
1292
+ inline: 'nearest',
1293
+ behavior: 'smooth',
1294
+ });
1295
+ };
1296
+ TuiDocNavigationComponent.ctorParameters = function () { return [
1297
+ { type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] },
1298
+ { type: Title, decorators: [{ type: Inject, args: [Title,] }] },
1299
+ { type: Observable, decorators: [{ type: Inject, args: [NAVIGATION_TITLE,] }] },
1300
+ { type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
1301
+ { type: TuiModeDirective, decorators: [{ type: Inject, args: [TuiModeDirective,] }] },
1302
+ { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [TuiSidebarDirective,] }] },
1303
+ { type: Array, decorators: [{ type: Inject, args: [NAVIGATION_LABELS,] }] },
1304
+ { type: undefined, decorators: [{ type: Inject, args: [NAVIGATION_ITEMS,] }] },
1305
+ { type: String, decorators: [{ type: Inject, args: [TUI_DOC_SEARCH_TEXT,] }] },
1306
+ { type: Router, decorators: [{ type: Inject, args: [Router,] }] },
1307
+ { type: ActivatedRoute, decorators: [{ type: Inject, args: [ActivatedRoute,] }] }
1261
1308
  ]; };
1262
1309
  __decorate([
1263
- Input()
1264
- ], TuiDocExampleComponent.prototype, "heading", void 0);
1265
- __decorate([
1266
- Input()
1267
- ], TuiDocExampleComponent.prototype, "description", void 0);
1310
+ HostBinding('class._open')
1311
+ ], TuiDocNavigationComponent.prototype, "menuOpen", void 0);
1268
1312
  __decorate([
1269
- Input()
1270
- ], TuiDocExampleComponent.prototype, "content", null);
1313
+ tuiPure
1314
+ ], TuiDocNavigationComponent.prototype, "filterItems", null);
1271
1315
  __decorate([
1272
- Input()
1273
- ], TuiDocExampleComponent.prototype, "componentName", void 0);
1274
- TuiDocExampleComponent = __decorate([
1316
+ tuiPure
1317
+ ], TuiDocNavigationComponent.prototype, "flattenSubPages", null);
1318
+ TuiDocNavigationComponent = __decorate([
1275
1319
  Component({
1276
- selector: 'tui-doc-example',
1277
- 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",
1320
+ selector: 'tui-doc-navigation',
1321
+ 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",
1322
+ providers: NAVIGATION_PROVIDERS,
1278
1323
  changeDetection: ChangeDetectionStrategy.OnPush,
1279
- 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}"]
1324
+ 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)}"]
1280
1325
  }),
1281
- __param(0, Attribute('id')),
1282
- __param(1, Inject(Clipboard)),
1283
- __param(2, Inject(TuiNotificationsService)),
1284
- __param(3, Inject(LOCATION)),
1285
- __param(4, Inject(TUI_COPY_TEXTS)),
1286
- __param(5, Inject(TUI_DOC_EXAMPLE_TEXTS)),
1287
- __param(6, Optional()),
1288
- __param(6, Inject(TUI_DOC_CODE_EDITOR)),
1289
- __param(7, Inject(TUI_DOC_EXAMPLE_CONTENT_PROCESSOR))
1290
- ], TuiDocExampleComponent);
1291
- return TuiDocExampleComponent;
1292
- }());
1293
-
1294
- var TuiDocExampleGetTabsPipe = /** @class */ (function () {
1295
- function TuiDocExampleGetTabsPipe() {
1296
- }
1297
- TuiDocExampleGetTabsPipe.prototype.transform = function (content, defaultTab) {
1298
- return __spread([defaultTab], Object.keys(content));
1299
- };
1300
- TuiDocExampleGetTabsPipe = __decorate([
1301
- Pipe({ name: 'tuiDocExampleGetTabs' })
1302
- ], TuiDocExampleGetTabsPipe);
1303
- return TuiDocExampleGetTabsPipe;
1326
+ __param(0, Inject(ChangeDetectorRef)),
1327
+ __param(1, Inject(Title)),
1328
+ __param(2, Inject(NAVIGATION_TITLE)),
1329
+ __param(3, Inject(DOCUMENT)),
1330
+ __param(4, Inject(TuiModeDirective)),
1331
+ __param(5, Optional()),
1332
+ __param(5, Inject(TuiSidebarDirective)),
1333
+ __param(6, Inject(NAVIGATION_LABELS)),
1334
+ __param(7, Inject(NAVIGATION_ITEMS)),
1335
+ __param(8, Inject(TUI_DOC_SEARCH_TEXT)),
1336
+ __param(9, Inject(Router)),
1337
+ __param(10, Inject(ActivatedRoute))
1338
+ ], TuiDocNavigationComponent);
1339
+ return TuiDocNavigationComponent;
1304
1340
  }());
1305
1341
 
1306
- var TuiDocExampleModule = /** @class */ (function () {
1307
- function TuiDocExampleModule() {
1342
+ var TuiDocNavigationModule = /** @class */ (function () {
1343
+ function TuiDocNavigationModule() {
1308
1344
  }
1309
- TuiDocExampleModule = __decorate([
1345
+ TuiDocNavigationModule = __decorate([
1310
1346
  NgModule({
1311
1347
  imports: [
1312
1348
  CommonModule,
1313
- ClipboardModule,
1314
- TuiTabsModule,
1349
+ FormsModule,
1350
+ RouterModule,
1351
+ ScrollIntoViewModule,
1315
1352
  TuiButtonModule,
1316
- TuiDocCopyModule,
1317
- TuiDocCodeModule,
1318
- PolymorpheusModule,
1353
+ TuiPrimitiveTextfieldModule,
1354
+ TuiTextfieldControllerModule,
1355
+ TuiActiveZoneModule,
1356
+ TuiLetModule,
1357
+ TuiModeModule,
1358
+ TuiLinkModule,
1359
+ TuiExpandModule,
1360
+ TuiHostedDropdownModule,
1361
+ TuiDropdownControllerModule,
1362
+ TuiAccordionModule,
1363
+ TuiScrollbarModule,
1364
+ TuiSvgModule,
1365
+ TuiDataListModule,
1366
+ TuiAutoFocusModule,
1319
1367
  ],
1320
- declarations: [TuiDocExampleComponent, TuiDocExampleGetTabsPipe],
1321
- exports: [TuiDocExampleComponent, TuiDocExampleGetTabsPipe],
1368
+ declarations: [TuiDocNavigationComponent],
1369
+ exports: [TuiDocNavigationComponent],
1322
1370
  })
1323
- ], TuiDocExampleModule);
1324
- return TuiDocExampleModule;
1325
- }());
1326
-
1327
- // @dynamic
1328
- var TuiDocMainComponent = /** @class */ (function () {
1329
- function TuiDocMainComponent(storage, windowRef) {
1330
- this.storage = storage;
1331
- this.windowRef = windowRef;
1332
- this.night = this.storage.getItem('night') === 'true' ||
1333
- (this.storage.getItem('night') === null &&
1334
- this.windowRef.matchMedia('(prefers-color-scheme: dark)').matches);
1335
- this.change$ = new Subject();
1336
- }
1337
- TuiDocMainComponent_1 = TuiDocMainComponent;
1338
- Object.defineProperty(TuiDocMainComponent.prototype, "mode", {
1339
- get: function () {
1340
- return this.night ? 'onDark' : null;
1341
- },
1342
- enumerable: true,
1343
- configurable: true
1344
- });
1345
- TuiDocMainComponent.prototype.onMode = function (night) {
1346
- this.night = night;
1347
- this.change$.next();
1348
- this.storage.setItem('night', String(night));
1349
- };
1350
- var TuiDocMainComponent_1;
1351
- TuiDocMainComponent.ctorParameters = function () { return [
1352
- { type: Storage, decorators: [{ type: Inject, args: [LOCAL_STORAGE,] }] },
1353
- { type: Window, decorators: [{ type: Inject, args: [WINDOW,] }] }
1354
- ]; };
1355
- TuiDocMainComponent = TuiDocMainComponent_1 = __decorate([
1356
- Component({
1357
- selector: 'tui-doc-main',
1358
- 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",
1359
- encapsulation: ViewEncapsulation.None,
1360
- providers: [
1361
- {
1362
- provide: TuiModeDirective,
1363
- useExisting: forwardRef(function () { return TuiDocMainComponent_1; }),
1364
- },
1365
- TuiSwipeService,
1366
- ],
1367
- 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}"]
1368
- }),
1369
- __param(0, Inject(LOCAL_STORAGE)),
1370
- __param(1, Inject(WINDOW))
1371
- ], TuiDocMainComponent);
1372
- return TuiDocMainComponent;
1371
+ ], TuiDocNavigationModule);
1372
+ return TuiDocNavigationModule;
1373
1373
  }());
1374
1374
 
1375
1375
  var TUI_DOC_LOGO = new InjectionToken('Main logo', {
@@ -1462,26 +1462,6 @@ var TUI_DOC_DEFAULT_TABS = new InjectionToken('Array of default tab names', {
1462
1462
  factory: function () { return []; },
1463
1463
  });
1464
1464
 
1465
- var TuiDocPageTabConnectorDirective = /** @class */ (function () {
1466
- function TuiDocPageTabConnectorDirective(template) {
1467
- this.template = template;
1468
- }
1469
- TuiDocPageTabConnectorDirective.ctorParameters = function () { return [
1470
- { type: TemplateRef, decorators: [{ type: Inject, args: [TemplateRef,] }] }
1471
- ]; };
1472
- __decorate([
1473
- Input(),
1474
- tuiDefaultProp()
1475
- ], TuiDocPageTabConnectorDirective.prototype, "pageTab", void 0);
1476
- TuiDocPageTabConnectorDirective = __decorate([
1477
- Directive({
1478
- selector: '[pageTab]',
1479
- }),
1480
- __param(0, Inject(TemplateRef))
1481
- ], TuiDocPageTabConnectorDirective);
1482
- return TuiDocPageTabConnectorDirective;
1483
- }());
1484
-
1485
1465
  var TUI_DOC_SEE_ALSO = new InjectionToken('Array of arrays of related pages', {
1486
1466
  factory: function () { return []; },
1487
1467
  });
@@ -1504,6 +1484,26 @@ function seeAlsoProviderFactory(_a, seeAlsoGroups) {
1504
1484
  return Array.from(seeAlsoSet);
1505
1485
  }
1506
1486
 
1487
+ var TuiDocPageTabConnectorDirective = /** @class */ (function () {
1488
+ function TuiDocPageTabConnectorDirective(template) {
1489
+ this.template = template;
1490
+ }
1491
+ TuiDocPageTabConnectorDirective.ctorParameters = function () { return [
1492
+ { type: TemplateRef, decorators: [{ type: Inject, args: [TemplateRef,] }] }
1493
+ ]; };
1494
+ __decorate([
1495
+ Input(),
1496
+ tuiDefaultProp()
1497
+ ], TuiDocPageTabConnectorDirective.prototype, "pageTab", void 0);
1498
+ TuiDocPageTabConnectorDirective = __decorate([
1499
+ Directive({
1500
+ selector: '[pageTab]',
1501
+ }),
1502
+ __param(0, Inject(TemplateRef))
1503
+ ], TuiDocPageTabConnectorDirective);
1504
+ return TuiDocPageTabConnectorDirective;
1505
+ }());
1506
+
1507
1507
  // Ambient type cannot be used without dynamic https://github.com/angular/angular/issues/23395
1508
1508
  // @dynamic
1509
1509
  var TuiDocPageComponent = /** @class */ (function () {
@@ -1749,6 +1749,23 @@ var TUI_DOC_RUSSIAN = [
1749
1749
  },
1750
1750
  ];
1751
1751
 
1752
+ var TuiAddonDocModule = /** @class */ (function () {
1753
+ function TuiAddonDocModule() {
1754
+ }
1755
+ TuiAddonDocModule = __decorate([
1756
+ NgModule({
1757
+ exports: [
1758
+ TuiDocCodeModule,
1759
+ TuiDocDemoModule,
1760
+ TuiDocDocumentationModule,
1761
+ TuiDocPageModule,
1762
+ TuiDocExampleModule,
1763
+ ],
1764
+ })
1765
+ ], TuiAddonDocModule);
1766
+ return TuiAddonDocModule;
1767
+ }());
1768
+
1752
1769
  /**
1753
1770
  * Generates typical page routing structure
1754
1771
  */
@@ -1767,23 +1784,6 @@ function generateRoutes(type) {
1767
1784
  ];
1768
1785
  }
1769
1786
 
1770
- var TuiAddonDocModule = /** @class */ (function () {
1771
- function TuiAddonDocModule() {
1772
- }
1773
- TuiAddonDocModule = __decorate([
1774
- NgModule({
1775
- exports: [
1776
- TuiDocCodeModule,
1777
- TuiDocDemoModule,
1778
- TuiDocDocumentationModule,
1779
- TuiDocPageModule,
1780
- TuiDocExampleModule,
1781
- ],
1782
- })
1783
- ], TuiAddonDocModule);
1784
- return TuiAddonDocModule;
1785
- }());
1786
-
1787
1787
  /**
1788
1788
  * Public API Surface of @taiga-ui/addon-doc
1789
1789
  */
@@ -1792,5 +1792,5 @@ var TuiAddonDocModule = /** @class */ (function () {
1792
1792
  * Generated bundle index. Do not edit.
1793
1793
  */
1794
1794
 
1795
- 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 };
1795
+ 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 };
1796
1796
  //# sourceMappingURL=taiga-ui-addon-doc.js.map