@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,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular/common'), require('ngx-highlightjs'), require('@taiga-ui/cdk'), require('@taiga-ui/kit'), require('@taiga-ui/core'), require('@angular/forms'), require('@angular/router'), require('@angular/platform-browser'), require('@taiga-ui/addon-mobile'), require('@angular/animations'), require('@angular/cdk/clipboard'), require('@ng-web-apis/common'), require('@tinkoff/ng-polymorpheus')) :
3
- typeof define === 'function' && define.amd ? define('@taiga-ui/addon-doc', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/common', 'ngx-highlightjs', '@taiga-ui/cdk', '@taiga-ui/kit', '@taiga-ui/core', '@angular/forms', '@angular/router', '@angular/platform-browser', '@taiga-ui/addon-mobile', '@angular/animations', '@angular/cdk/clipboard', '@ng-web-apis/common', '@tinkoff/ng-polymorpheus'], factory) :
4
- (global = global || self, factory((global['taiga-ui'] = global['taiga-ui'] || {}, global['taiga-ui']['addon-doc'] = {}), global.ng.core, global.rxjs, global.rxjs.operators, global.ng.common, global.ngxHighlightjs, global.cdk, global.kit, global.core$1, global.ng.forms, global.ng.router, global.ng.platformBrowser, global.addonMobile, global.ng.animations, global.ng.cdk.clipboard, global.common$1, global.ngPolymorpheus));
5
- }(this, (function (exports, core, rxjs, operators, common, ngxHighlightjs, cdk, kit, core$1, forms, router, platformBrowser, addonMobile, animations, clipboard, common$1, ngPolymorpheus) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/operators'), require('@angular/common'), require('ngx-highlightjs'), require('@taiga-ui/cdk'), require('@taiga-ui/kit'), require('@taiga-ui/core'), require('@angular/forms'), require('@angular/router'), require('@angular/animations'), require('@angular/cdk/clipboard'), require('@ng-web-apis/common'), require('@tinkoff/ng-polymorpheus'), require('@taiga-ui/addon-mobile'), require('@angular/platform-browser')) :
3
+ typeof define === 'function' && define.amd ? define('@taiga-ui/addon-doc', ['exports', '@angular/core', 'rxjs', 'rxjs/operators', '@angular/common', 'ngx-highlightjs', '@taiga-ui/cdk', '@taiga-ui/kit', '@taiga-ui/core', '@angular/forms', '@angular/router', '@angular/animations', '@angular/cdk/clipboard', '@ng-web-apis/common', '@tinkoff/ng-polymorpheus', '@taiga-ui/addon-mobile', '@angular/platform-browser'], factory) :
4
+ (global = global || self, factory((global['taiga-ui'] = global['taiga-ui'] || {}, global['taiga-ui']['addon-doc'] = {}), global.ng.core, global.rxjs, global.rxjs.operators, global.ng.common, global.ngxHighlightjs, global.cdk, global.kit, global.core$1, global.ng.forms, global.ng.router, global.ng.animations, global.ng.cdk.clipboard, global.common$1, global.ngPolymorpheus, global.addonMobile, global.ng.platformBrowser));
5
+ }(this, (function (exports, core, rxjs, operators, common, ngxHighlightjs, cdk, kit, core$1, forms, router, animations, clipboard, common$1, ngPolymorpheus, addonMobile, platformBrowser) { 'use strict';
6
6
 
7
7
  /*! *****************************************************************************
8
8
  Copyright (c) Microsoft Corporation.
@@ -571,696 +571,333 @@
571
571
  return TuiDocDemoModule;
572
572
  }());
573
573
 
574
- var MAP = {
575
- а: 'f',
576
- б: ',',
577
- в: 'd',
578
- г: 'u',
579
- д: 'l',
580
- е: 't',
581
- ё: '`',
582
- ж: ';',
583
- з: 'p',
584
- и: 'b',
585
- й: 'q',
586
- к: 'r',
587
- л: 'k',
588
- м: 'v',
589
- н: 'y',
590
- о: 'j',
591
- п: 'g',
592
- р: 'h',
593
- с: 'c',
594
- т: 'n',
595
- у: 'e',
596
- ф: 'a',
597
- х: '[',
598
- ц: 'w',
599
- ч: 'x',
600
- ш: 'i',
601
- щ: 'o',
602
- ъ: ']',
603
- ы: 's',
604
- ь: 'm',
605
- ю: '.',
606
- я: 'z',
607
- };
608
- /**
609
- * Translates text mistakenly typed in the Russian layout into English
610
- * @param string string with Russian layout characters
611
- * @return string with English layout characters
612
- */
613
- function transliterateKeyboardLayout(string) {
614
- var newStr = '';
615
- for (var i = 0; i < string.length; i++) {
616
- newStr += string.charAt(i) in MAP ? MAP[string.charAt(i)] : string.charAt(i);
617
- }
618
- return newStr;
574
+ function rgbToHex(r, g, b) {
575
+ return ('#' +
576
+ [r, g, b]
577
+ .map(function (x) {
578
+ var hex = x.toString(16);
579
+ return hex.length === 1 ? '0' + hex : hex;
580
+ })
581
+ .join(''));
582
+ }
583
+ function hexToRgb(hex) {
584
+ var matches = hex
585
+ .replace('#', '')
586
+ .split('')
587
+ .map(function (char, _, array) { return (array.length === 3 ? char + char : char); })
588
+ .join('')
589
+ .match(/.{2}/g);
590
+ return matches
591
+ ? matches.map(function (x) { return Number.parseInt(x, 16); })
592
+ : [0, 0, 0];
619
593
  }
620
594
 
621
- var TUI_DOC_PAGES = new core.InjectionToken('Documentation pages', {
622
- factory: function () { return []; },
623
- });
624
-
625
- var TUI_DOC_TITLE = new core.InjectionToken('Page title', {
626
- factory: function () { return ''; },
627
- });
628
-
629
- var NAVIGATION_TITLE = new core.InjectionToken('Page title');
630
- var NAVIGATION_LABELS = new core.InjectionToken('Navigation sections labels for search');
631
- var NAVIGATION_ITEMS = new core.InjectionToken('Navigation pages');
632
- var NAVIGATION_PROVIDERS = [
633
- cdk.TuiDestroyService,
634
- {
635
- provide: NAVIGATION_TITLE,
636
- deps: [router.Router, router.ActivatedRoute, TUI_DOC_TITLE, cdk.TuiDestroyService],
637
- useFactory: titleProviderFactory,
638
- },
639
- {
640
- provide: NAVIGATION_LABELS,
641
- deps: [TUI_DOC_PAGES],
642
- useFactory: labelsProviderFactory,
643
- },
644
- {
645
- provide: NAVIGATION_ITEMS,
646
- deps: [TUI_DOC_PAGES],
647
- useFactory: itemsProviderFactory,
648
- },
649
- ];
650
- function titleProviderFactory(router$1, activatedRoute, titlePrefix, destroy$) {
651
- return router$1.events.pipe(operators.filter(function (event) { return event instanceof router.NavigationEnd; }), operators.map(function () { return activatedRoute.firstChild; }), operators.filter(cdk.isPresent), operators.mergeMap(function (_a) {
652
- var data = _a.data;
653
- return data;
654
- }), operators.map(function (_a) {
655
- var title = _a.title;
656
- return titlePrefix + title;
657
- }), operators.takeUntil(destroy$));
595
+ function inspectArray(array, depth) {
596
+ if (depth === 0) {
597
+ return '[…]';
598
+ }
599
+ var result = '';
600
+ var first = true;
601
+ for (var index = 0; index < array.length; index++) {
602
+ if (first) {
603
+ first = false;
604
+ }
605
+ else {
606
+ result += ', ';
607
+ }
608
+ result += index in array ? inspectAny(array[index], depth - 1) : 'empty';
609
+ }
610
+ return "[" + result + "]";
658
611
  }
659
- function labelsProviderFactory(pages) {
660
- return pages
661
- .map(function (_a) {
662
- var section = _a.section;
663
- return section;
664
- })
665
- .filter(cdk.isPresent)
666
- .filter(function (item, index, array) { return array.indexOf(item) === index; });
612
+ function inspectObject(object, depth) {
613
+ if (depth === 0) {
614
+ return "{\u2026}";
615
+ }
616
+ var result = '';
617
+ var first = true;
618
+ for (var key in object) {
619
+ if (!object.hasOwnProperty(key)) {
620
+ continue;
621
+ }
622
+ if (first) {
623
+ first = false;
624
+ }
625
+ else {
626
+ result += ', ';
627
+ }
628
+ result += key + ": " + inspectAny(object[key], depth - 1);
629
+ }
630
+ return "{" + result + "}";
667
631
  }
668
- function itemsProviderFactory(pages) {
669
- var labels = labelsProviderFactory(pages);
670
- return __spread(labels.map(function (label) { return pages.filter(function (_a) {
671
- var section = _a.section;
672
- return section === label;
673
- }); }), [
674
- pages.filter(function (page) { return !page.section; }),
675
- ]);
632
+ // @bad TODO add more types
633
+ /**
634
+ * Returns readable JS entity
635
+ * @param data
636
+ * @param depth
637
+ * @return readable JS entity
638
+ */
639
+ function inspectAny(data, depth) {
640
+ if (data === null) {
641
+ return 'null';
642
+ }
643
+ switch (typeof data) {
644
+ case 'string':
645
+ return "'" + data + "'";
646
+ case 'undefined':
647
+ case 'number':
648
+ case 'boolean':
649
+ case 'function':
650
+ return String(data);
651
+ }
652
+ if (data instanceof RegExp) {
653
+ return data.toString();
654
+ }
655
+ if (Array.isArray(data)) {
656
+ return inspectArray(data, depth);
657
+ }
658
+ return inspectObject(data, depth);
676
659
  }
677
660
 
678
- var SCROLL_INTO_VIEW_DELAY = 200;
679
- // @dynamic
680
- var TuiDocNavigationComponent = /** @class */ (function () {
681
- function TuiDocNavigationComponent(changeDetectorRef, titleService, title$, documentRef, mode, sidebar, labels, items, searchText, router, activatedRoute) {
682
- var _this = this;
683
- this.documentRef = documentRef;
684
- this.mode = mode;
685
- this.sidebar = sidebar;
686
- this.labels = labels;
687
- this.items = items;
688
- this.searchText = searchText;
689
- this.router = router;
661
+ var SERIALIZED_SUFFIX = '$';
662
+ // @bad TODO: refactor output and value sync
663
+ var TuiDocDocumentationPropertyConnectorDirective = /** @class */ (function () {
664
+ function TuiDocDocumentationPropertyConnectorDirective(template, locationRef, activatedRoute, urlSerializer) {
665
+ this.template = template;
666
+ this.locationRef = locationRef;
690
667
  this.activatedRoute = activatedRoute;
691
- this.search = '';
692
- this.open = false;
693
- this.openPagesArr = [];
694
- this.openPagesGroupsArr = [];
695
- this.active = '';
696
- this.menuOpen = false;
697
- this.mode$ = this.mode.change$.pipe(operators.startWith(null), operators.map(function () { return _this.mode.mode || 'onLight'; }));
698
- // Angular can't navigate no anchor links
699
- // https://stackoverflow.com/questions/36101756/angular2-routing-with-hashtag-to-page-anchor
700
- title$.subscribe(function (title) {
701
- changeDetectorRef.markForCheck();
702
- titleService.setTitle(title);
703
- _this.openActivePageGroup();
704
- _this.handleAnchorLink(_this.activatedRoute.snapshot.fragment);
705
- });
668
+ this.urlSerializer = urlSerializer;
669
+ this.documentationPropertyName = '';
670
+ this.documentationPropertyMode = null;
671
+ this.documentationPropertyType = '';
672
+ this.documentationPropertyValue = null;
673
+ this.documentationPropertyDeprecated = false;
674
+ this.documentationPropertyValues = null;
675
+ this.documentationPropertyValueChange = new core.EventEmitter();
676
+ this.changed$ = new rxjs.Subject();
677
+ this.emits$ = new rxjs.BehaviorSubject(1);
706
678
  }
707
- Object.defineProperty(TuiDocNavigationComponent.prototype, "canOpen", {
679
+ TuiDocDocumentationPropertyConnectorDirective.prototype.ngOnInit = function () {
680
+ this.parseParams(this.activatedRoute.snapshot.queryParams);
681
+ };
682
+ Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "attrName", {
708
683
  get: function () {
709
- return this.search.length > 2;
684
+ switch (this.documentationPropertyMode) {
685
+ case 'input':
686
+ return "[" + this.documentationPropertyName + "]";
687
+ case 'output':
688
+ return "(" + this.documentationPropertyName + ")";
689
+ case 'input-output':
690
+ return "[(" + this.documentationPropertyName + ")]";
691
+ default:
692
+ return this.documentationPropertyName;
693
+ }
710
694
  },
711
695
  enumerable: true,
712
696
  configurable: true
713
697
  });
714
- Object.defineProperty(TuiDocNavigationComponent.prototype, "filteredItems", {
698
+ Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "hasItems", {
715
699
  get: function () {
716
- return this.filterItems(this.flattenSubPages(this.items), this.search);
700
+ return !!this.documentationPropertyValues;
717
701
  },
718
702
  enumerable: true,
719
703
  configurable: true
720
704
  });
721
- Object.defineProperty(TuiDocNavigationComponent.prototype, "itemsWithoutSections", {
705
+ Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "shouldShowValues", {
722
706
  get: function () {
723
- return this.items[this.items.length - 1];
707
+ return this.documentationPropertyMode !== 'output';
724
708
  },
725
709
  enumerable: true,
726
710
  configurable: true
727
711
  });
728
- TuiDocNavigationComponent.prototype.isActive = function (route) {
729
- return route === this.active;
712
+ TuiDocDocumentationPropertyConnectorDirective.prototype.ngOnChanges = function () {
713
+ this.changed$.next();
730
714
  };
731
- TuiDocNavigationComponent.prototype.onGroupClick = function (index) {
732
- this.openPagesGroupsArr[index] = !this.openPagesGroupsArr[index];
715
+ TuiDocDocumentationPropertyConnectorDirective.prototype.onValueChange = function (value) {
716
+ this.documentationPropertyValue = value;
717
+ this.documentationPropertyValueChange.emit(value);
718
+ this.setQueryParam(value);
733
719
  };
734
- TuiDocNavigationComponent.prototype.closeMenu = function () {
735
- this.menuOpen = false;
736
- };
737
- TuiDocNavigationComponent.prototype.onSearchChange = function (search) {
738
- this.search = search;
739
- this.open = this.canOpen;
740
- };
741
- TuiDocNavigationComponent.prototype.onClick = function () {
742
- this.open = false;
743
- this.menuOpen = false;
744
- this.search = '';
745
- this.openActivePageGroup();
746
- };
747
- TuiDocNavigationComponent.prototype.filterItems = function (items, search) {
748
- return items.map(function (section) {
749
- return cdk.uniqBy(section.filter(function (_a) {
750
- var title = _a.title, _b = _a.keywords, keywords = _b === void 0 ? '' : _b;
751
- title = title.toLowerCase();
752
- search = search.toLowerCase();
753
- keywords = keywords.toLowerCase();
754
- return (title.includes(search) ||
755
- keywords.includes(search) ||
756
- title.includes(transliterateKeyboardLayout(search)) ||
757
- keywords.includes(transliterateKeyboardLayout(search)) ||
758
- search.replace(/-/gi, '').includes(title));
759
- }), 'title');
760
- });
761
- };
762
- TuiDocNavigationComponent.prototype.flattenSubPages = function (items) {
763
- return items.reduce(function (array, item) { return __spread(array, [
764
- item.reduce(function (pages, page) {
765
- return 'subPages' in page
766
- ? __spread(pages, page.subPages) : __spread(pages, [page]);
767
- }, []),
768
- ]); }, []);
769
- };
770
- TuiDocNavigationComponent.prototype.isActiveRoute = function (route) {
771
- return this.router.isActive(route, false);
772
- };
773
- TuiDocNavigationComponent.prototype.handleAnchorLink = function (hash) {
774
- var _this = this;
775
- setTimeout(function () {
776
- _this.navigateToAnchorLink(hash);
777
- }, SCROLL_INTO_VIEW_DELAY);
778
- };
779
- TuiDocNavigationComponent.prototype.openActivePageGroup = function () {
780
- var _this = this;
781
- this.items.forEach(function (pages, pagesIndex) {
782
- pages.forEach(function (page, pageIndex) {
783
- if ('route' in page && _this.isActiveRoute(page.route)) {
784
- _this.openPagesArr[pagesIndex] = true;
785
- _this.active = page.route;
786
- }
787
- if ('subPages' in page) {
788
- page.subPages.forEach(function (subPage) {
789
- if (_this.isActiveRoute(subPage.route)) {
790
- _this.openPagesArr[pagesIndex] = true;
791
- _this.openPagesGroupsArr[pagesIndex * 100 + pageIndex] = true;
792
- _this.active = subPage.route;
793
- }
794
- });
795
- }
796
- });
797
- });
798
- };
799
- TuiDocNavigationComponent.prototype.navigateToAnchorLink = function (fragment) {
800
- var element = fragment && this.documentRef.querySelector("#" + fragment);
801
- if (!element) {
720
+ TuiDocDocumentationPropertyConnectorDirective.prototype.parseParams = function (params) {
721
+ if (!params[this.documentationPropertyName] &&
722
+ !params[this.documentationPropertyName + SERIALIZED_SUFFIX]) {
802
723
  return;
803
724
  }
804
- element.classList.add('tui-doc-animated-example');
805
- element.scrollIntoView({
806
- block: 'start',
807
- inline: 'nearest',
808
- behavior: 'smooth',
809
- });
725
+ var isValueAvailableByKey = !!params[this.documentationPropertyName + SERIALIZED_SUFFIX];
726
+ if (isValueAvailableByKey && this.documentationPropertyValues) {
727
+ this.onValueChange(this.documentationPropertyValues[params[this.documentationPropertyName + SERIALIZED_SUFFIX]]);
728
+ return;
729
+ }
730
+ this.onValueChange(!isNaN(Number(params[this.documentationPropertyName]))
731
+ ? Number(params[this.documentationPropertyName])
732
+ : params[this.documentationPropertyName]);
810
733
  };
811
- TuiDocNavigationComponent.ctorParameters = function () { return [
812
- { type: core.ChangeDetectorRef, decorators: [{ type: core.Inject, args: [core.ChangeDetectorRef,] }] },
813
- { type: platformBrowser.Title, decorators: [{ type: core.Inject, args: [platformBrowser.Title,] }] },
814
- { type: rxjs.Observable, decorators: [{ type: core.Inject, args: [NAVIGATION_TITLE,] }] },
815
- { type: Document, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
816
- { type: core$1.TuiModeDirective, decorators: [{ type: core.Inject, args: [core$1.TuiModeDirective,] }] },
817
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [addonMobile.TuiSidebarDirective,] }] },
818
- { type: Array, decorators: [{ type: core.Inject, args: [NAVIGATION_LABELS,] }] },
819
- { type: undefined, decorators: [{ type: core.Inject, args: [NAVIGATION_ITEMS,] }] },
820
- { type: String, decorators: [{ type: core.Inject, args: [TUI_DOC_SEARCH_TEXT,] }] },
821
- { type: router.Router, decorators: [{ type: core.Inject, args: [router.Router,] }] },
822
- { type: router.ActivatedRoute, decorators: [{ type: core.Inject, args: [router.ActivatedRoute,] }] }
734
+ TuiDocDocumentationPropertyConnectorDirective.prototype.setQueryParam = function (value) {
735
+ var _a;
736
+ var tree = this.urlSerializer.parse(this.locationRef.path());
737
+ var isValueAvailableByKey = value instanceof Object;
738
+ var computedValue = isValueAvailableByKey && this.documentationPropertyValues
739
+ ? this.documentationPropertyValues.indexOf(value)
740
+ : value;
741
+ var suffix = isValueAvailableByKey ? SERIALIZED_SUFFIX : '';
742
+ var propName = this.documentationPropertyName + suffix;
743
+ tree.queryParams = __assign(__assign({}, tree.queryParams), (_a = {}, _a[propName] = computedValue, _a));
744
+ this.locationRef.go(String(tree));
745
+ };
746
+ TuiDocDocumentationPropertyConnectorDirective.prototype.emitEvent = function (event) {
747
+ // For more convenient debugging
748
+ console.log(this.attrName, event);
749
+ this.emits$.next(this.emits$.value + 1);
750
+ };
751
+ TuiDocDocumentationPropertyConnectorDirective.ctorParameters = function () { return [
752
+ { type: core.TemplateRef, decorators: [{ type: core.Inject, args: [core.TemplateRef,] }] },
753
+ { type: common.Location, decorators: [{ type: core.Inject, args: [common.Location,] }] },
754
+ { type: router.ActivatedRoute, decorators: [{ type: core.Inject, args: [router.ActivatedRoute,] }] },
755
+ { type: router.UrlSerializer, decorators: [{ type: core.Inject, args: [router.UrlSerializer,] }] }
823
756
  ]; };
824
757
  __decorate([
825
- core.HostBinding('class._open')
826
- ], TuiDocNavigationComponent.prototype, "menuOpen", void 0);
758
+ core.Input()
759
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyName", void 0);
827
760
  __decorate([
828
- cdk.tuiPure
829
- ], TuiDocNavigationComponent.prototype, "filterItems", null);
761
+ core.Input()
762
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyMode", void 0);
830
763
  __decorate([
831
- cdk.tuiPure
832
- ], TuiDocNavigationComponent.prototype, "flattenSubPages", null);
833
- TuiDocNavigationComponent = __decorate([
834
- core.Component({
835
- selector: 'tui-doc-navigation',
836
- 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",
837
- providers: NAVIGATION_PROVIDERS,
838
- changeDetection: core.ChangeDetectionStrategy.OnPush,
839
- 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)}"]
764
+ core.Input()
765
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyType", void 0);
766
+ __decorate([
767
+ core.Input()
768
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValue", void 0);
769
+ __decorate([
770
+ core.Input()
771
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyDeprecated", void 0);
772
+ __decorate([
773
+ core.Input()
774
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValues", void 0);
775
+ __decorate([
776
+ core.Output()
777
+ ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValueChange", void 0);
778
+ TuiDocDocumentationPropertyConnectorDirective = __decorate([
779
+ core.Directive({
780
+ selector: 'ng-template[documentationPropertyName]',
781
+ exportAs: 'documentationProperty',
840
782
  }),
841
- __param(0, core.Inject(core.ChangeDetectorRef)),
842
- __param(1, core.Inject(platformBrowser.Title)),
843
- __param(2, core.Inject(NAVIGATION_TITLE)),
844
- __param(3, core.Inject(common.DOCUMENT)),
845
- __param(4, core.Inject(core$1.TuiModeDirective)),
846
- __param(5, core.Optional()),
847
- __param(5, core.Inject(addonMobile.TuiSidebarDirective)),
848
- __param(6, core.Inject(NAVIGATION_LABELS)),
849
- __param(7, core.Inject(NAVIGATION_ITEMS)),
850
- __param(8, core.Inject(TUI_DOC_SEARCH_TEXT)),
851
- __param(9, core.Inject(router.Router)),
852
- __param(10, core.Inject(router.ActivatedRoute))
853
- ], TuiDocNavigationComponent);
854
- return TuiDocNavigationComponent;
783
+ __param(0, core.Inject(core.TemplateRef)),
784
+ __param(1, core.Inject(common.Location)),
785
+ __param(2, core.Inject(router.ActivatedRoute)),
786
+ __param(3, core.Inject(router.UrlSerializer))
787
+ ], TuiDocDocumentationPropertyConnectorDirective);
788
+ return TuiDocDocumentationPropertyConnectorDirective;
855
789
  }());
856
790
 
857
- var ScrollIntoViewDirective = /** @class */ (function () {
858
- function ScrollIntoViewDirective(destroy$, _a) {
859
- var nativeElement = _a.nativeElement;
860
- this.scroll$ = new rxjs.Subject();
861
- this.scroll$
862
- .pipe(operators.debounceTime(750), operators.filter(function (shallWe) { return shallWe && !!cdk.getElementObscurers(nativeElement); }), operators.takeUntil(destroy$))
863
- .subscribe(function () {
864
- nativeElement.scrollIntoView();
865
- });
791
+ // @bad TODO subscribe propertiesConnectors changes
792
+ // @bad TODO refactor to make more flexible
793
+ // @dynamic
794
+ var TuiDocDocumentationComponent = /** @class */ (function () {
795
+ function TuiDocDocumentationComponent(changeDetectorRef, texts) {
796
+ this.changeDetectorRef = changeDetectorRef;
797
+ this.texts = texts;
798
+ this.heading = '';
799
+ this.showValues = true;
800
+ this.isAPI = false;
801
+ this.propertiesConnectors = cdk.EMPTY_QUERY;
802
+ this.activeItemIndex = 0;
866
803
  }
867
- Object.defineProperty(ScrollIntoViewDirective.prototype, "scrollIntoView", {
868
- set: function (shallWe) {
869
- this.scroll$.next(shallWe);
804
+ TuiDocDocumentationComponent.prototype.ngAfterContentInit = function () {
805
+ cdk.itemsQueryListObservable(this.propertiesConnectors)
806
+ .pipe(operators.switchMap(function (items) { return rxjs.merge.apply(void 0, __spread(items.map(function (_a) {
807
+ var changed$ = _a.changed$;
808
+ return changed$;
809
+ }))); }), cdk.watch(this.changeDetectorRef))
810
+ .subscribe();
811
+ };
812
+ Object.defineProperty(TuiDocDocumentationComponent.prototype, "type", {
813
+ get: function () {
814
+ return this.isAPI ? this.texts[0] : this.texts[1];
870
815
  },
871
816
  enumerable: true,
872
817
  configurable: true
873
818
  });
874
- ScrollIntoViewDirective.ctorParameters = function () { return [
875
- { type: cdk.TuiDestroyService, decorators: [{ type: core.Inject, args: [cdk.TuiDestroyService,] }] },
876
- { type: core.ElementRef, decorators: [{ type: core.Inject, args: [core.ElementRef,] }] }
877
- ]; };
878
- __decorate([
879
- core.Input()
880
- ], ScrollIntoViewDirective.prototype, "scrollIntoView", null);
881
- ScrollIntoViewDirective = __decorate([
882
- core.Directive({
883
- selector: '[scrollIntoView]',
884
- providers: [cdk.TuiDestroyService],
885
- }),
886
- __param(0, core.Inject(cdk.TuiDestroyService)),
887
- __param(1, core.Inject(core.ElementRef))
888
- ], ScrollIntoViewDirective);
889
- return ScrollIntoViewDirective;
890
- }());
891
-
892
- var ScrollIntoViewModule = /** @class */ (function () {
893
- function ScrollIntoViewModule() {
894
- }
895
- ScrollIntoViewModule = __decorate([
896
- core.NgModule({
897
- declarations: [ScrollIntoViewDirective],
898
- exports: [ScrollIntoViewDirective],
899
- })
900
- ], ScrollIntoViewModule);
901
- return ScrollIntoViewModule;
902
- }());
903
-
904
- var TuiDocNavigationModule = /** @class */ (function () {
905
- function TuiDocNavigationModule() {
906
- }
907
- TuiDocNavigationModule = __decorate([
908
- core.NgModule({
909
- imports: [
910
- common.CommonModule,
911
- forms.FormsModule,
912
- router.RouterModule,
913
- ScrollIntoViewModule,
914
- core$1.TuiButtonModule,
915
- core$1.TuiPrimitiveTextfieldModule,
916
- core$1.TuiTextfieldControllerModule,
917
- cdk.TuiActiveZoneModule,
918
- cdk.TuiLetModule,
919
- core$1.TuiModeModule,
920
- core$1.TuiLinkModule,
921
- core$1.TuiExpandModule,
922
- core$1.TuiHostedDropdownModule,
923
- core$1.TuiDropdownControllerModule,
924
- kit.TuiAccordionModule,
925
- core$1.TuiScrollbarModule,
926
- core$1.TuiSvgModule,
927
- core$1.TuiDataListModule,
928
- cdk.TuiAutoFocusModule,
929
- ],
930
- declarations: [TuiDocNavigationComponent],
931
- exports: [TuiDocNavigationComponent],
932
- })
933
- ], TuiDocNavigationModule);
934
- return TuiDocNavigationModule;
935
- }());
936
-
937
- function rgbToHex(r, g, b) {
938
- return ('#' +
939
- [r, g, b]
940
- .map(function (x) {
941
- var hex = x.toString(16);
942
- return hex.length === 1 ? '0' + hex : hex;
943
- })
944
- .join(''));
945
- }
946
- function hexToRgb(hex) {
947
- var matches = hex
948
- .replace('#', '')
949
- .split('')
950
- .map(function (char, _, array) { return (array.length === 3 ? char + char : char); })
951
- .join('')
952
- .match(/.{2}/g);
953
- return matches
954
- ? matches.map(function (x) { return Number.parseInt(x, 16); })
955
- : [0, 0, 0];
956
- }
957
-
958
- function inspectArray(array, depth) {
959
- if (depth === 0) {
960
- return '[…]';
961
- }
962
- var result = '';
963
- var first = true;
964
- for (var index = 0; index < array.length; index++) {
965
- if (first) {
966
- first = false;
819
+ TuiDocDocumentationComponent.prototype.getColor = function (color) {
820
+ if (color.length === 4) {
821
+ return color
822
+ .split('')
823
+ .reduce(function (result, current) { return __spread(result, [current, current]); }, [])
824
+ .join('')
825
+ .replace('#', '');
967
826
  }
968
- else {
969
- result += ', ';
827
+ if (color.startsWith('#')) {
828
+ return color;
970
829
  }
971
- result += index in array ? inspectAny(array[index], depth - 1) : 'empty';
972
- }
973
- return "[" + result + "]";
974
- }
975
- function inspectObject(object, depth) {
976
- if (depth === 0) {
977
- return "{\u2026}";
978
- }
979
- var result = '';
980
- var first = true;
981
- for (var key in object) {
982
- if (!object.hasOwnProperty(key)) {
983
- continue;
830
+ if (color === 'transparent') {
831
+ return '#000000';
984
832
  }
985
- if (first) {
986
- first = false;
833
+ var parsed = color
834
+ .replace('rgb(', '')
835
+ .replace('rgba(', '')
836
+ .replace(')', '')
837
+ .replace(' ', '')
838
+ .split(',')
839
+ .map(function (v) { return Number.parseInt(v, 10); });
840
+ return rgbToHex.apply(void 0, __spread(parsed));
841
+ };
842
+ TuiDocDocumentationComponent.prototype.getOpacity = function (color) {
843
+ if (color.startsWith('#') || color.startsWith('rgb(')) {
844
+ return 100;
987
845
  }
988
- else {
989
- result += ', ';
846
+ if (color === 'transparent') {
847
+ return 0;
990
848
  }
991
- result += key + ": " + inspectAny(object[key], depth - 1);
992
- }
993
- return "{" + result + "}";
994
- }
995
- // @bad TODO add more types
996
- /**
997
- * Returns readable JS entity
998
- * @param data
999
- * @param depth
1000
- * @return readable JS entity
1001
- */
1002
- function inspectAny(data, depth) {
1003
- if (data === null) {
1004
- return 'null';
1005
- }
1006
- switch (typeof data) {
1007
- case 'string':
1008
- return "'" + data + "'";
1009
- case 'undefined':
1010
- case 'number':
1011
- case 'boolean':
1012
- case 'function':
1013
- return String(data);
1014
- }
1015
- if (data instanceof RegExp) {
1016
- return data.toString();
1017
- }
1018
- if (Array.isArray(data)) {
1019
- return inspectArray(data, depth);
1020
- }
1021
- return inspectObject(data, depth);
1022
- }
1023
-
1024
- var SERIALIZED_SUFFIX = '$';
1025
- // @bad TODO: refactor output and value sync
1026
- var TuiDocDocumentationPropertyConnectorDirective = /** @class */ (function () {
1027
- function TuiDocDocumentationPropertyConnectorDirective(template, locationRef, activatedRoute, urlSerializer) {
1028
- this.template = template;
1029
- this.locationRef = locationRef;
1030
- this.activatedRoute = activatedRoute;
1031
- this.urlSerializer = urlSerializer;
1032
- this.documentationPropertyName = '';
1033
- this.documentationPropertyMode = null;
1034
- this.documentationPropertyType = '';
1035
- this.documentationPropertyValue = null;
1036
- this.documentationPropertyDeprecated = false;
1037
- this.documentationPropertyValues = null;
1038
- this.documentationPropertyValueChange = new core.EventEmitter();
1039
- this.changed$ = new rxjs.Subject();
1040
- this.emits$ = new rxjs.BehaviorSubject(1);
1041
- }
1042
- TuiDocDocumentationPropertyConnectorDirective.prototype.ngOnInit = function () {
1043
- this.parseParams(this.activatedRoute.snapshot.queryParams);
1044
- };
1045
- Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "attrName", {
1046
- get: function () {
1047
- switch (this.documentationPropertyMode) {
1048
- case 'input':
1049
- return "[" + this.documentationPropertyName + "]";
1050
- case 'output':
1051
- return "(" + this.documentationPropertyName + ")";
1052
- case 'input-output':
1053
- return "[(" + this.documentationPropertyName + ")]";
1054
- default:
1055
- return this.documentationPropertyName;
1056
- }
1057
- },
1058
- enumerable: true,
1059
- configurable: true
1060
- });
1061
- Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "hasItems", {
1062
- get: function () {
1063
- return !!this.documentationPropertyValues;
1064
- },
1065
- enumerable: true,
1066
- configurable: true
1067
- });
1068
- Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "shouldShowValues", {
1069
- get: function () {
1070
- return this.documentationPropertyMode !== 'output';
1071
- },
1072
- enumerable: true,
1073
- configurable: true
1074
- });
1075
- TuiDocDocumentationPropertyConnectorDirective.prototype.ngOnChanges = function () {
1076
- this.changed$.next();
1077
- };
1078
- TuiDocDocumentationPropertyConnectorDirective.prototype.onValueChange = function (value) {
1079
- this.documentationPropertyValue = value;
1080
- this.documentationPropertyValueChange.emit(value);
1081
- this.setQueryParam(value);
849
+ var lastComma = color.lastIndexOf(',');
850
+ var parsed = color
851
+ .substr(lastComma)
852
+ .replace(')', '')
853
+ .replace(' ', '')
854
+ .replace(',', '');
855
+ return Math.round(Number.parseFloat(parsed) * 100);
1082
856
  };
1083
- TuiDocDocumentationPropertyConnectorDirective.prototype.parseParams = function (params) {
1084
- if (!params[this.documentationPropertyName] &&
1085
- !params[this.documentationPropertyName + SERIALIZED_SUFFIX]) {
1086
- return;
1087
- }
1088
- var isValueAvailableByKey = !!params[this.documentationPropertyName + SERIALIZED_SUFFIX];
1089
- if (isValueAvailableByKey && this.documentationPropertyValues) {
1090
- this.onValueChange(this.documentationPropertyValues[params[this.documentationPropertyName + SERIALIZED_SUFFIX]]);
857
+ TuiDocDocumentationComponent.prototype.onColorChange = function (connector, color) {
858
+ var opacity = this.getOpacity(connector.documentationPropertyValue || '');
859
+ if (opacity === 100) {
860
+ connector.onValueChange(color);
1091
861
  return;
1092
862
  }
1093
- this.onValueChange(!isNaN(Number(params[this.documentationPropertyName]))
1094
- ? Number(params[this.documentationPropertyName])
1095
- : params[this.documentationPropertyName]);
863
+ var rgb = hexToRgb(color).join(', ');
864
+ var result = "rgba(" + rgb + ", " + opacity / 100 + ")";
865
+ connector.onValueChange(result);
1096
866
  };
1097
- TuiDocDocumentationPropertyConnectorDirective.prototype.setQueryParam = function (value) {
1098
- var _a;
1099
- var tree = this.urlSerializer.parse(this.locationRef.path());
1100
- var isValueAvailableByKey = value instanceof Object;
1101
- var computedValue = isValueAvailableByKey && this.documentationPropertyValues
1102
- ? this.documentationPropertyValues.indexOf(value)
1103
- : value;
1104
- var suffix = isValueAvailableByKey ? SERIALIZED_SUFFIX : '';
1105
- var propName = this.documentationPropertyName + suffix;
1106
- tree.queryParams = __assign(__assign({}, tree.queryParams), (_a = {}, _a[propName] = computedValue, _a));
1107
- this.locationRef.go(String(tree));
867
+ TuiDocDocumentationComponent.prototype.onOpacityChange = function (connector, opacity) {
868
+ var hex = this.getColor(connector.documentationPropertyValue || '');
869
+ var rgb = hexToRgb(hex);
870
+ var result = "rgba(" + rgb + ", " + opacity / 100 + ")";
871
+ connector.onValueChange(result);
1108
872
  };
1109
- TuiDocDocumentationPropertyConnectorDirective.prototype.emitEvent = function (event) {
1110
- // For more convenient debugging
1111
- console.log(this.attrName, event);
1112
- this.emits$.next(this.emits$.value + 1);
873
+ TuiDocDocumentationComponent.prototype.stripOptional = function (name) {
874
+ return name.replace('?', '');
1113
875
  };
1114
- TuiDocDocumentationPropertyConnectorDirective.ctorParameters = function () { return [
1115
- { type: core.TemplateRef, decorators: [{ type: core.Inject, args: [core.TemplateRef,] }] },
1116
- { type: common.Location, decorators: [{ type: core.Inject, args: [common.Location,] }] },
1117
- { type: router.ActivatedRoute, decorators: [{ type: core.Inject, args: [router.ActivatedRoute,] }] },
1118
- { type: router.UrlSerializer, decorators: [{ type: core.Inject, args: [router.UrlSerializer,] }] }
876
+ TuiDocDocumentationComponent.prototype.isOptional = function (name) {
877
+ return name.includes('?');
878
+ };
879
+ TuiDocDocumentationComponent.prototype.showCleaner = function (type) {
880
+ return type.includes('null');
881
+ };
882
+ TuiDocDocumentationComponent.prototype.showContentTooltip = function (type) {
883
+ return type.includes('PolymorpheusContent');
884
+ };
885
+ TuiDocDocumentationComponent.prototype.inspectAny = function (data) {
886
+ return inspectAny(data, 2);
887
+ };
888
+ TuiDocDocumentationComponent.ctorParameters = function () { return [
889
+ { type: core.ChangeDetectorRef, decorators: [{ type: core.Inject, args: [core.ChangeDetectorRef,] }] },
890
+ { type: Array, decorators: [{ type: core.Inject, args: [TUI_DOC_DOCUMENTATION_TEXTS,] }] }
1119
891
  ]; };
1120
892
  __decorate([
1121
893
  core.Input()
1122
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyName", void 0);
894
+ ], TuiDocDocumentationComponent.prototype, "heading", void 0);
1123
895
  __decorate([
1124
896
  core.Input()
1125
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyMode", void 0);
897
+ ], TuiDocDocumentationComponent.prototype, "showValues", void 0);
1126
898
  __decorate([
1127
899
  core.Input()
1128
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyType", void 0);
1129
- __decorate([
1130
- core.Input()
1131
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValue", void 0);
1132
- __decorate([
1133
- core.Input()
1134
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyDeprecated", void 0);
1135
- __decorate([
1136
- core.Input()
1137
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValues", void 0);
1138
- __decorate([
1139
- core.Output()
1140
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValueChange", void 0);
1141
- TuiDocDocumentationPropertyConnectorDirective = __decorate([
1142
- core.Directive({
1143
- selector: 'ng-template[documentationPropertyName]',
1144
- exportAs: 'documentationProperty',
1145
- }),
1146
- __param(0, core.Inject(core.TemplateRef)),
1147
- __param(1, core.Inject(common.Location)),
1148
- __param(2, core.Inject(router.ActivatedRoute)),
1149
- __param(3, core.Inject(router.UrlSerializer))
1150
- ], TuiDocDocumentationPropertyConnectorDirective);
1151
- return TuiDocDocumentationPropertyConnectorDirective;
1152
- }());
1153
-
1154
- // @bad TODO subscribe propertiesConnectors changes
1155
- // @bad TODO refactor to make more flexible
1156
- // @dynamic
1157
- var TuiDocDocumentationComponent = /** @class */ (function () {
1158
- function TuiDocDocumentationComponent(changeDetectorRef, texts) {
1159
- this.changeDetectorRef = changeDetectorRef;
1160
- this.texts = texts;
1161
- this.heading = '';
1162
- this.showValues = true;
1163
- this.isAPI = false;
1164
- this.propertiesConnectors = cdk.EMPTY_QUERY;
1165
- this.activeItemIndex = 0;
1166
- }
1167
- TuiDocDocumentationComponent.prototype.ngAfterContentInit = function () {
1168
- cdk.itemsQueryListObservable(this.propertiesConnectors)
1169
- .pipe(operators.switchMap(function (items) { return rxjs.merge.apply(void 0, __spread(items.map(function (_a) {
1170
- var changed$ = _a.changed$;
1171
- return changed$;
1172
- }))); }), cdk.watch(this.changeDetectorRef))
1173
- .subscribe();
1174
- };
1175
- Object.defineProperty(TuiDocDocumentationComponent.prototype, "type", {
1176
- get: function () {
1177
- return this.isAPI ? this.texts[0] : this.texts[1];
1178
- },
1179
- enumerable: true,
1180
- configurable: true
1181
- });
1182
- TuiDocDocumentationComponent.prototype.getColor = function (color) {
1183
- if (color.length === 4) {
1184
- return color
1185
- .split('')
1186
- .reduce(function (result, current) { return __spread(result, [current, current]); }, [])
1187
- .join('')
1188
- .replace('#', '');
1189
- }
1190
- if (color.startsWith('#')) {
1191
- return color;
1192
- }
1193
- if (color === 'transparent') {
1194
- return '#000000';
1195
- }
1196
- var parsed = color
1197
- .replace('rgb(', '')
1198
- .replace('rgba(', '')
1199
- .replace(')', '')
1200
- .replace(' ', '')
1201
- .split(',')
1202
- .map(function (v) { return Number.parseInt(v, 10); });
1203
- return rgbToHex.apply(void 0, __spread(parsed));
1204
- };
1205
- TuiDocDocumentationComponent.prototype.getOpacity = function (color) {
1206
- if (color.startsWith('#') || color.startsWith('rgb(')) {
1207
- return 100;
1208
- }
1209
- if (color === 'transparent') {
1210
- return 0;
1211
- }
1212
- var lastComma = color.lastIndexOf(',');
1213
- var parsed = color
1214
- .substr(lastComma)
1215
- .replace(')', '')
1216
- .replace(' ', '')
1217
- .replace(',', '');
1218
- return Math.round(Number.parseFloat(parsed) * 100);
1219
- };
1220
- TuiDocDocumentationComponent.prototype.onColorChange = function (connector, color) {
1221
- var opacity = this.getOpacity(connector.documentationPropertyValue || '');
1222
- if (opacity === 100) {
1223
- connector.onValueChange(color);
1224
- return;
1225
- }
1226
- var rgb = hexToRgb(color).join(', ');
1227
- var result = "rgba(" + rgb + ", " + opacity / 100 + ")";
1228
- connector.onValueChange(result);
1229
- };
1230
- TuiDocDocumentationComponent.prototype.onOpacityChange = function (connector, opacity) {
1231
- var hex = this.getColor(connector.documentationPropertyValue || '');
1232
- var rgb = hexToRgb(hex);
1233
- var result = "rgba(" + rgb + ", " + opacity / 100 + ")";
1234
- connector.onValueChange(result);
1235
- };
1236
- TuiDocDocumentationComponent.prototype.stripOptional = function (name) {
1237
- return name.replace('?', '');
1238
- };
1239
- TuiDocDocumentationComponent.prototype.isOptional = function (name) {
1240
- return name.includes('?');
1241
- };
1242
- TuiDocDocumentationComponent.prototype.showCleaner = function (type) {
1243
- return type.includes('null');
1244
- };
1245
- TuiDocDocumentationComponent.prototype.showContentTooltip = function (type) {
1246
- return type.includes('PolymorpheusContent');
1247
- };
1248
- TuiDocDocumentationComponent.prototype.inspectAny = function (data) {
1249
- return inspectAny(data, 2);
1250
- };
1251
- TuiDocDocumentationComponent.ctorParameters = function () { return [
1252
- { type: core.ChangeDetectorRef, decorators: [{ type: core.Inject, args: [core.ChangeDetectorRef,] }] },
1253
- { type: Array, decorators: [{ type: core.Inject, args: [TUI_DOC_DOCUMENTATION_TEXTS,] }] }
1254
- ]; };
1255
- __decorate([
1256
- core.Input()
1257
- ], TuiDocDocumentationComponent.prototype, "heading", void 0);
1258
- __decorate([
1259
- core.Input()
1260
- ], TuiDocDocumentationComponent.prototype, "showValues", void 0);
1261
- __decorate([
1262
- core.Input()
1263
- ], TuiDocDocumentationComponent.prototype, "isAPI", void 0);
900
+ ], TuiDocDocumentationComponent.prototype, "isAPI", void 0);
1264
901
  __decorate([
1265
902
  core.ContentChildren(TuiDocDocumentationPropertyConnectorDirective)
1266
903
  ], TuiDocDocumentationComponent.prototype, "propertiesConnectors", void 0);
@@ -1456,127 +1093,490 @@
1456
1093
  })
1457
1094
  .subscribe();
1458
1095
  };
1459
- TuiDocExampleComponent.ctorParameters = function () { return [
1460
- { type: String, decorators: [{ type: core.Attribute, args: ['id',] }] },
1461
- { type: clipboard.Clipboard, decorators: [{ type: core.Inject, args: [clipboard.Clipboard,] }] },
1462
- { type: core$1.TuiNotificationsService, decorators: [{ type: core.Inject, args: [core$1.TuiNotificationsService,] }] },
1463
- { type: Location, decorators: [{ type: core.Inject, args: [common$1.LOCATION,] }] },
1464
- { type: rxjs.Observable, decorators: [{ type: core.Inject, args: [kit.TUI_COPY_TEXTS,] }] },
1465
- { type: Array, decorators: [{ type: core.Inject, args: [TUI_DOC_EXAMPLE_TEXTS,] }] },
1466
- { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [TUI_DOC_CODE_EDITOR,] }] },
1467
- { type: undefined, decorators: [{ type: core.Inject, args: [TUI_DOC_EXAMPLE_CONTENT_PROCESSOR,] }] }
1096
+ TuiDocExampleComponent.ctorParameters = function () { return [
1097
+ { type: String, decorators: [{ type: core.Attribute, args: ['id',] }] },
1098
+ { type: clipboard.Clipboard, decorators: [{ type: core.Inject, args: [clipboard.Clipboard,] }] },
1099
+ { type: core$1.TuiNotificationsService, decorators: [{ type: core.Inject, args: [core$1.TuiNotificationsService,] }] },
1100
+ { type: Location, decorators: [{ type: core.Inject, args: [common$1.LOCATION,] }] },
1101
+ { type: rxjs.Observable, decorators: [{ type: core.Inject, args: [kit.TUI_COPY_TEXTS,] }] },
1102
+ { type: Array, decorators: [{ type: core.Inject, args: [TUI_DOC_EXAMPLE_TEXTS,] }] },
1103
+ { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [TUI_DOC_CODE_EDITOR,] }] },
1104
+ { type: undefined, decorators: [{ type: core.Inject, args: [TUI_DOC_EXAMPLE_CONTENT_PROCESSOR,] }] }
1105
+ ]; };
1106
+ __decorate([
1107
+ core.Input()
1108
+ ], TuiDocExampleComponent.prototype, "heading", void 0);
1109
+ __decorate([
1110
+ core.Input()
1111
+ ], TuiDocExampleComponent.prototype, "description", void 0);
1112
+ __decorate([
1113
+ core.Input()
1114
+ ], TuiDocExampleComponent.prototype, "content", null);
1115
+ __decorate([
1116
+ core.Input()
1117
+ ], TuiDocExampleComponent.prototype, "componentName", void 0);
1118
+ TuiDocExampleComponent = __decorate([
1119
+ core.Component({
1120
+ selector: 'tui-doc-example',
1121
+ 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",
1122
+ changeDetection: core.ChangeDetectionStrategy.OnPush,
1123
+ 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}"]
1124
+ }),
1125
+ __param(0, core.Attribute('id')),
1126
+ __param(1, core.Inject(clipboard.Clipboard)),
1127
+ __param(2, core.Inject(core$1.TuiNotificationsService)),
1128
+ __param(3, core.Inject(common$1.LOCATION)),
1129
+ __param(4, core.Inject(kit.TUI_COPY_TEXTS)),
1130
+ __param(5, core.Inject(TUI_DOC_EXAMPLE_TEXTS)),
1131
+ __param(6, core.Optional()),
1132
+ __param(6, core.Inject(TUI_DOC_CODE_EDITOR)),
1133
+ __param(7, core.Inject(TUI_DOC_EXAMPLE_CONTENT_PROCESSOR))
1134
+ ], TuiDocExampleComponent);
1135
+ return TuiDocExampleComponent;
1136
+ }());
1137
+
1138
+ var TuiDocExampleGetTabsPipe = /** @class */ (function () {
1139
+ function TuiDocExampleGetTabsPipe() {
1140
+ }
1141
+ TuiDocExampleGetTabsPipe.prototype.transform = function (content, defaultTab) {
1142
+ return __spread([defaultTab], Object.keys(content));
1143
+ };
1144
+ TuiDocExampleGetTabsPipe = __decorate([
1145
+ core.Pipe({ name: 'tuiDocExampleGetTabs' })
1146
+ ], TuiDocExampleGetTabsPipe);
1147
+ return TuiDocExampleGetTabsPipe;
1148
+ }());
1149
+
1150
+ var TuiDocExampleModule = /** @class */ (function () {
1151
+ function TuiDocExampleModule() {
1152
+ }
1153
+ TuiDocExampleModule = __decorate([
1154
+ core.NgModule({
1155
+ imports: [
1156
+ common.CommonModule,
1157
+ clipboard.ClipboardModule,
1158
+ kit.TuiTabsModule,
1159
+ core$1.TuiButtonModule,
1160
+ TuiDocCopyModule,
1161
+ TuiDocCodeModule,
1162
+ ngPolymorpheus.PolymorpheusModule,
1163
+ ],
1164
+ declarations: [TuiDocExampleComponent, TuiDocExampleGetTabsPipe],
1165
+ exports: [TuiDocExampleComponent, TuiDocExampleGetTabsPipe],
1166
+ })
1167
+ ], TuiDocExampleModule);
1168
+ return TuiDocExampleModule;
1169
+ }());
1170
+
1171
+ // @dynamic
1172
+ var TuiDocMainComponent = /** @class */ (function () {
1173
+ function TuiDocMainComponent(storage, windowRef) {
1174
+ this.storage = storage;
1175
+ this.windowRef = windowRef;
1176
+ this.night = this.storage.getItem('night') === 'true' ||
1177
+ (this.storage.getItem('night') === null &&
1178
+ this.windowRef.matchMedia('(prefers-color-scheme: dark)').matches);
1179
+ this.change$ = new rxjs.Subject();
1180
+ }
1181
+ TuiDocMainComponent_1 = TuiDocMainComponent;
1182
+ Object.defineProperty(TuiDocMainComponent.prototype, "mode", {
1183
+ get: function () {
1184
+ return this.night ? 'onDark' : null;
1185
+ },
1186
+ enumerable: true,
1187
+ configurable: true
1188
+ });
1189
+ TuiDocMainComponent.prototype.onMode = function (night) {
1190
+ this.night = night;
1191
+ this.change$.next();
1192
+ this.storage.setItem('night', String(night));
1193
+ };
1194
+ var TuiDocMainComponent_1;
1195
+ TuiDocMainComponent.ctorParameters = function () { return [
1196
+ { type: Storage, decorators: [{ type: core.Inject, args: [common$1.LOCAL_STORAGE,] }] },
1197
+ { type: Window, decorators: [{ type: core.Inject, args: [common$1.WINDOW,] }] }
1198
+ ]; };
1199
+ TuiDocMainComponent = TuiDocMainComponent_1 = __decorate([
1200
+ core.Component({
1201
+ selector: 'tui-doc-main',
1202
+ 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",
1203
+ encapsulation: core.ViewEncapsulation.None,
1204
+ providers: [
1205
+ {
1206
+ provide: core$1.TuiModeDirective,
1207
+ useExisting: core.forwardRef(function () { return TuiDocMainComponent_1; }),
1208
+ },
1209
+ cdk.TuiSwipeService,
1210
+ ],
1211
+ 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}"]
1212
+ }),
1213
+ __param(0, core.Inject(common$1.LOCAL_STORAGE)),
1214
+ __param(1, core.Inject(common$1.WINDOW))
1215
+ ], TuiDocMainComponent);
1216
+ return TuiDocMainComponent;
1217
+ }());
1218
+
1219
+ var ScrollIntoViewDirective = /** @class */ (function () {
1220
+ function ScrollIntoViewDirective(destroy$, _a) {
1221
+ var nativeElement = _a.nativeElement;
1222
+ this.scroll$ = new rxjs.Subject();
1223
+ this.scroll$
1224
+ .pipe(operators.debounceTime(750), operators.filter(function (shallWe) { return shallWe && !!cdk.getElementObscurers(nativeElement); }), operators.takeUntil(destroy$))
1225
+ .subscribe(function () {
1226
+ nativeElement.scrollIntoView();
1227
+ });
1228
+ }
1229
+ Object.defineProperty(ScrollIntoViewDirective.prototype, "scrollIntoView", {
1230
+ set: function (shallWe) {
1231
+ this.scroll$.next(shallWe);
1232
+ },
1233
+ enumerable: true,
1234
+ configurable: true
1235
+ });
1236
+ ScrollIntoViewDirective.ctorParameters = function () { return [
1237
+ { type: cdk.TuiDestroyService, decorators: [{ type: core.Inject, args: [cdk.TuiDestroyService,] }] },
1238
+ { type: core.ElementRef, decorators: [{ type: core.Inject, args: [core.ElementRef,] }] }
1239
+ ]; };
1240
+ __decorate([
1241
+ core.Input()
1242
+ ], ScrollIntoViewDirective.prototype, "scrollIntoView", null);
1243
+ ScrollIntoViewDirective = __decorate([
1244
+ core.Directive({
1245
+ selector: '[scrollIntoView]',
1246
+ providers: [cdk.TuiDestroyService],
1247
+ }),
1248
+ __param(0, core.Inject(cdk.TuiDestroyService)),
1249
+ __param(1, core.Inject(core.ElementRef))
1250
+ ], ScrollIntoViewDirective);
1251
+ return ScrollIntoViewDirective;
1252
+ }());
1253
+
1254
+ var ScrollIntoViewModule = /** @class */ (function () {
1255
+ function ScrollIntoViewModule() {
1256
+ }
1257
+ ScrollIntoViewModule = __decorate([
1258
+ core.NgModule({
1259
+ declarations: [ScrollIntoViewDirective],
1260
+ exports: [ScrollIntoViewDirective],
1261
+ })
1262
+ ], ScrollIntoViewModule);
1263
+ return ScrollIntoViewModule;
1264
+ }());
1265
+
1266
+ var MAP = {
1267
+ а: 'f',
1268
+ б: ',',
1269
+ в: 'd',
1270
+ г: 'u',
1271
+ д: 'l',
1272
+ е: 't',
1273
+ ё: '`',
1274
+ ж: ';',
1275
+ з: 'p',
1276
+ и: 'b',
1277
+ й: 'q',
1278
+ к: 'r',
1279
+ л: 'k',
1280
+ м: 'v',
1281
+ н: 'y',
1282
+ о: 'j',
1283
+ п: 'g',
1284
+ р: 'h',
1285
+ с: 'c',
1286
+ т: 'n',
1287
+ у: 'e',
1288
+ ф: 'a',
1289
+ х: '[',
1290
+ ц: 'w',
1291
+ ч: 'x',
1292
+ ш: 'i',
1293
+ щ: 'o',
1294
+ ъ: ']',
1295
+ ы: 's',
1296
+ ь: 'm',
1297
+ ю: '.',
1298
+ я: 'z',
1299
+ };
1300
+ /**
1301
+ * Translates text mistakenly typed in the Russian layout into English
1302
+ * @param string string with Russian layout characters
1303
+ * @return string with English layout characters
1304
+ */
1305
+ function transliterateKeyboardLayout(string) {
1306
+ var newStr = '';
1307
+ for (var i = 0; i < string.length; i++) {
1308
+ newStr += string.charAt(i) in MAP ? MAP[string.charAt(i)] : string.charAt(i);
1309
+ }
1310
+ return newStr;
1311
+ }
1312
+
1313
+ var TUI_DOC_PAGES = new core.InjectionToken('Documentation pages', {
1314
+ factory: function () { return []; },
1315
+ });
1316
+
1317
+ var TUI_DOC_TITLE = new core.InjectionToken('Page title', {
1318
+ factory: function () { return ''; },
1319
+ });
1320
+
1321
+ var NAVIGATION_TITLE = new core.InjectionToken('Page title');
1322
+ var NAVIGATION_LABELS = new core.InjectionToken('Navigation sections labels for search');
1323
+ var NAVIGATION_ITEMS = new core.InjectionToken('Navigation pages');
1324
+ var NAVIGATION_PROVIDERS = [
1325
+ cdk.TuiDestroyService,
1326
+ {
1327
+ provide: NAVIGATION_TITLE,
1328
+ deps: [router.Router, router.ActivatedRoute, TUI_DOC_TITLE, cdk.TuiDestroyService],
1329
+ useFactory: titleProviderFactory,
1330
+ },
1331
+ {
1332
+ provide: NAVIGATION_LABELS,
1333
+ deps: [TUI_DOC_PAGES],
1334
+ useFactory: labelsProviderFactory,
1335
+ },
1336
+ {
1337
+ provide: NAVIGATION_ITEMS,
1338
+ deps: [TUI_DOC_PAGES],
1339
+ useFactory: itemsProviderFactory,
1340
+ },
1341
+ ];
1342
+ function titleProviderFactory(router$1, activatedRoute, titlePrefix, destroy$) {
1343
+ return router$1.events.pipe(operators.filter(function (event) { return event instanceof router.NavigationEnd; }), operators.map(function () { return activatedRoute.firstChild; }), operators.filter(cdk.isPresent), operators.mergeMap(function (_a) {
1344
+ var data = _a.data;
1345
+ return data;
1346
+ }), operators.map(function (_a) {
1347
+ var title = _a.title;
1348
+ return titlePrefix + title;
1349
+ }), operators.takeUntil(destroy$));
1350
+ }
1351
+ function labelsProviderFactory(pages) {
1352
+ return pages
1353
+ .map(function (_a) {
1354
+ var section = _a.section;
1355
+ return section;
1356
+ })
1357
+ .filter(cdk.isPresent)
1358
+ .filter(function (item, index, array) { return array.indexOf(item) === index; });
1359
+ }
1360
+ function itemsProviderFactory(pages) {
1361
+ var labels = labelsProviderFactory(pages);
1362
+ return __spread(labels.map(function (label) { return pages.filter(function (_a) {
1363
+ var section = _a.section;
1364
+ return section === label;
1365
+ }); }), [
1366
+ pages.filter(function (page) { return !page.section; }),
1367
+ ]);
1368
+ }
1369
+
1370
+ var SCROLL_INTO_VIEW_DELAY = 200;
1371
+ // @dynamic
1372
+ var TuiDocNavigationComponent = /** @class */ (function () {
1373
+ function TuiDocNavigationComponent(changeDetectorRef, titleService, title$, documentRef, mode, sidebar, labels, items, searchText, router, activatedRoute) {
1374
+ var _this = this;
1375
+ this.documentRef = documentRef;
1376
+ this.mode = mode;
1377
+ this.sidebar = sidebar;
1378
+ this.labels = labels;
1379
+ this.items = items;
1380
+ this.searchText = searchText;
1381
+ this.router = router;
1382
+ this.activatedRoute = activatedRoute;
1383
+ this.search = '';
1384
+ this.open = false;
1385
+ this.openPagesArr = [];
1386
+ this.openPagesGroupsArr = [];
1387
+ this.active = '';
1388
+ this.menuOpen = false;
1389
+ this.mode$ = this.mode.change$.pipe(operators.startWith(null), operators.map(function () { return _this.mode.mode || 'onLight'; }));
1390
+ // Angular can't navigate no anchor links
1391
+ // https://stackoverflow.com/questions/36101756/angular2-routing-with-hashtag-to-page-anchor
1392
+ title$.subscribe(function (title) {
1393
+ changeDetectorRef.markForCheck();
1394
+ titleService.setTitle(title);
1395
+ _this.openActivePageGroup();
1396
+ _this.handleAnchorLink(_this.activatedRoute.snapshot.fragment);
1397
+ });
1398
+ }
1399
+ Object.defineProperty(TuiDocNavigationComponent.prototype, "canOpen", {
1400
+ get: function () {
1401
+ return this.search.length > 2;
1402
+ },
1403
+ enumerable: true,
1404
+ configurable: true
1405
+ });
1406
+ Object.defineProperty(TuiDocNavigationComponent.prototype, "filteredItems", {
1407
+ get: function () {
1408
+ return this.filterItems(this.flattenSubPages(this.items), this.search);
1409
+ },
1410
+ enumerable: true,
1411
+ configurable: true
1412
+ });
1413
+ Object.defineProperty(TuiDocNavigationComponent.prototype, "itemsWithoutSections", {
1414
+ get: function () {
1415
+ return this.items[this.items.length - 1];
1416
+ },
1417
+ enumerable: true,
1418
+ configurable: true
1419
+ });
1420
+ TuiDocNavigationComponent.prototype.isActive = function (route) {
1421
+ return route === this.active;
1422
+ };
1423
+ TuiDocNavigationComponent.prototype.onGroupClick = function (index) {
1424
+ this.openPagesGroupsArr[index] = !this.openPagesGroupsArr[index];
1425
+ };
1426
+ TuiDocNavigationComponent.prototype.closeMenu = function () {
1427
+ this.menuOpen = false;
1428
+ };
1429
+ TuiDocNavigationComponent.prototype.onSearchChange = function (search) {
1430
+ this.search = search;
1431
+ this.open = this.canOpen;
1432
+ };
1433
+ TuiDocNavigationComponent.prototype.onClick = function () {
1434
+ this.open = false;
1435
+ this.menuOpen = false;
1436
+ this.search = '';
1437
+ this.openActivePageGroup();
1438
+ };
1439
+ TuiDocNavigationComponent.prototype.filterItems = function (items, search) {
1440
+ return items.map(function (section) {
1441
+ return cdk.uniqBy(section.filter(function (_a) {
1442
+ var title = _a.title, _b = _a.keywords, keywords = _b === void 0 ? '' : _b;
1443
+ title = title.toLowerCase();
1444
+ search = search.toLowerCase();
1445
+ keywords = keywords.toLowerCase();
1446
+ return (title.includes(search) ||
1447
+ keywords.includes(search) ||
1448
+ title.includes(transliterateKeyboardLayout(search)) ||
1449
+ keywords.includes(transliterateKeyboardLayout(search)) ||
1450
+ search.replace(/-/gi, '').includes(title));
1451
+ }), 'title');
1452
+ });
1453
+ };
1454
+ TuiDocNavigationComponent.prototype.flattenSubPages = function (items) {
1455
+ return items.reduce(function (array, item) { return __spread(array, [
1456
+ item.reduce(function (pages, page) {
1457
+ return 'subPages' in page
1458
+ ? __spread(pages, page.subPages) : __spread(pages, [page]);
1459
+ }, []),
1460
+ ]); }, []);
1461
+ };
1462
+ TuiDocNavigationComponent.prototype.isActiveRoute = function (route) {
1463
+ return this.router.isActive(route, false);
1464
+ };
1465
+ TuiDocNavigationComponent.prototype.handleAnchorLink = function (hash) {
1466
+ var _this = this;
1467
+ setTimeout(function () {
1468
+ _this.navigateToAnchorLink(hash);
1469
+ }, SCROLL_INTO_VIEW_DELAY);
1470
+ };
1471
+ TuiDocNavigationComponent.prototype.openActivePageGroup = function () {
1472
+ var _this = this;
1473
+ this.items.forEach(function (pages, pagesIndex) {
1474
+ pages.forEach(function (page, pageIndex) {
1475
+ if ('route' in page && _this.isActiveRoute(page.route)) {
1476
+ _this.openPagesArr[pagesIndex] = true;
1477
+ _this.active = page.route;
1478
+ }
1479
+ if ('subPages' in page) {
1480
+ page.subPages.forEach(function (subPage) {
1481
+ if (_this.isActiveRoute(subPage.route)) {
1482
+ _this.openPagesArr[pagesIndex] = true;
1483
+ _this.openPagesGroupsArr[pagesIndex * 100 + pageIndex] = true;
1484
+ _this.active = subPage.route;
1485
+ }
1486
+ });
1487
+ }
1488
+ });
1489
+ });
1490
+ };
1491
+ TuiDocNavigationComponent.prototype.navigateToAnchorLink = function (fragment) {
1492
+ var element = fragment && this.documentRef.querySelector("#" + fragment);
1493
+ if (!element) {
1494
+ return;
1495
+ }
1496
+ element.classList.add('tui-doc-animated-example');
1497
+ element.scrollIntoView({
1498
+ block: 'start',
1499
+ inline: 'nearest',
1500
+ behavior: 'smooth',
1501
+ });
1502
+ };
1503
+ TuiDocNavigationComponent.ctorParameters = function () { return [
1504
+ { type: core.ChangeDetectorRef, decorators: [{ type: core.Inject, args: [core.ChangeDetectorRef,] }] },
1505
+ { type: platformBrowser.Title, decorators: [{ type: core.Inject, args: [platformBrowser.Title,] }] },
1506
+ { type: rxjs.Observable, decorators: [{ type: core.Inject, args: [NAVIGATION_TITLE,] }] },
1507
+ { type: Document, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
1508
+ { type: core$1.TuiModeDirective, decorators: [{ type: core.Inject, args: [core$1.TuiModeDirective,] }] },
1509
+ { type: undefined, decorators: [{ type: core.Optional }, { type: core.Inject, args: [addonMobile.TuiSidebarDirective,] }] },
1510
+ { type: Array, decorators: [{ type: core.Inject, args: [NAVIGATION_LABELS,] }] },
1511
+ { type: undefined, decorators: [{ type: core.Inject, args: [NAVIGATION_ITEMS,] }] },
1512
+ { type: String, decorators: [{ type: core.Inject, args: [TUI_DOC_SEARCH_TEXT,] }] },
1513
+ { type: router.Router, decorators: [{ type: core.Inject, args: [router.Router,] }] },
1514
+ { type: router.ActivatedRoute, decorators: [{ type: core.Inject, args: [router.ActivatedRoute,] }] }
1468
1515
  ]; };
1469
1516
  __decorate([
1470
- core.Input()
1471
- ], TuiDocExampleComponent.prototype, "heading", void 0);
1472
- __decorate([
1473
- core.Input()
1474
- ], TuiDocExampleComponent.prototype, "description", void 0);
1517
+ core.HostBinding('class._open')
1518
+ ], TuiDocNavigationComponent.prototype, "menuOpen", void 0);
1475
1519
  __decorate([
1476
- core.Input()
1477
- ], TuiDocExampleComponent.prototype, "content", null);
1520
+ cdk.tuiPure
1521
+ ], TuiDocNavigationComponent.prototype, "filterItems", null);
1478
1522
  __decorate([
1479
- core.Input()
1480
- ], TuiDocExampleComponent.prototype, "componentName", void 0);
1481
- TuiDocExampleComponent = __decorate([
1523
+ cdk.tuiPure
1524
+ ], TuiDocNavigationComponent.prototype, "flattenSubPages", null);
1525
+ TuiDocNavigationComponent = __decorate([
1482
1526
  core.Component({
1483
- selector: 'tui-doc-example',
1484
- 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",
1527
+ selector: 'tui-doc-navigation',
1528
+ 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",
1529
+ providers: NAVIGATION_PROVIDERS,
1485
1530
  changeDetection: core.ChangeDetectionStrategy.OnPush,
1486
- 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}"]
1531
+ 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)}"]
1487
1532
  }),
1488
- __param(0, core.Attribute('id')),
1489
- __param(1, core.Inject(clipboard.Clipboard)),
1490
- __param(2, core.Inject(core$1.TuiNotificationsService)),
1491
- __param(3, core.Inject(common$1.LOCATION)),
1492
- __param(4, core.Inject(kit.TUI_COPY_TEXTS)),
1493
- __param(5, core.Inject(TUI_DOC_EXAMPLE_TEXTS)),
1494
- __param(6, core.Optional()),
1495
- __param(6, core.Inject(TUI_DOC_CODE_EDITOR)),
1496
- __param(7, core.Inject(TUI_DOC_EXAMPLE_CONTENT_PROCESSOR))
1497
- ], TuiDocExampleComponent);
1498
- return TuiDocExampleComponent;
1499
- }());
1500
-
1501
- var TuiDocExampleGetTabsPipe = /** @class */ (function () {
1502
- function TuiDocExampleGetTabsPipe() {
1503
- }
1504
- TuiDocExampleGetTabsPipe.prototype.transform = function (content, defaultTab) {
1505
- return __spread([defaultTab], Object.keys(content));
1506
- };
1507
- TuiDocExampleGetTabsPipe = __decorate([
1508
- core.Pipe({ name: 'tuiDocExampleGetTabs' })
1509
- ], TuiDocExampleGetTabsPipe);
1510
- return TuiDocExampleGetTabsPipe;
1533
+ __param(0, core.Inject(core.ChangeDetectorRef)),
1534
+ __param(1, core.Inject(platformBrowser.Title)),
1535
+ __param(2, core.Inject(NAVIGATION_TITLE)),
1536
+ __param(3, core.Inject(common.DOCUMENT)),
1537
+ __param(4, core.Inject(core$1.TuiModeDirective)),
1538
+ __param(5, core.Optional()),
1539
+ __param(5, core.Inject(addonMobile.TuiSidebarDirective)),
1540
+ __param(6, core.Inject(NAVIGATION_LABELS)),
1541
+ __param(7, core.Inject(NAVIGATION_ITEMS)),
1542
+ __param(8, core.Inject(TUI_DOC_SEARCH_TEXT)),
1543
+ __param(9, core.Inject(router.Router)),
1544
+ __param(10, core.Inject(router.ActivatedRoute))
1545
+ ], TuiDocNavigationComponent);
1546
+ return TuiDocNavigationComponent;
1511
1547
  }());
1512
1548
 
1513
- var TuiDocExampleModule = /** @class */ (function () {
1514
- function TuiDocExampleModule() {
1549
+ var TuiDocNavigationModule = /** @class */ (function () {
1550
+ function TuiDocNavigationModule() {
1515
1551
  }
1516
- TuiDocExampleModule = __decorate([
1552
+ TuiDocNavigationModule = __decorate([
1517
1553
  core.NgModule({
1518
1554
  imports: [
1519
1555
  common.CommonModule,
1520
- clipboard.ClipboardModule,
1521
- kit.TuiTabsModule,
1556
+ forms.FormsModule,
1557
+ router.RouterModule,
1558
+ ScrollIntoViewModule,
1522
1559
  core$1.TuiButtonModule,
1523
- TuiDocCopyModule,
1524
- TuiDocCodeModule,
1525
- ngPolymorpheus.PolymorpheusModule,
1560
+ core$1.TuiPrimitiveTextfieldModule,
1561
+ core$1.TuiTextfieldControllerModule,
1562
+ cdk.TuiActiveZoneModule,
1563
+ cdk.TuiLetModule,
1564
+ core$1.TuiModeModule,
1565
+ core$1.TuiLinkModule,
1566
+ core$1.TuiExpandModule,
1567
+ core$1.TuiHostedDropdownModule,
1568
+ core$1.TuiDropdownControllerModule,
1569
+ kit.TuiAccordionModule,
1570
+ core$1.TuiScrollbarModule,
1571
+ core$1.TuiSvgModule,
1572
+ core$1.TuiDataListModule,
1573
+ cdk.TuiAutoFocusModule,
1526
1574
  ],
1527
- declarations: [TuiDocExampleComponent, TuiDocExampleGetTabsPipe],
1528
- exports: [TuiDocExampleComponent, TuiDocExampleGetTabsPipe],
1575
+ declarations: [TuiDocNavigationComponent],
1576
+ exports: [TuiDocNavigationComponent],
1529
1577
  })
1530
- ], TuiDocExampleModule);
1531
- return TuiDocExampleModule;
1532
- }());
1533
-
1534
- // @dynamic
1535
- var TuiDocMainComponent = /** @class */ (function () {
1536
- function TuiDocMainComponent(storage, windowRef) {
1537
- this.storage = storage;
1538
- this.windowRef = windowRef;
1539
- this.night = this.storage.getItem('night') === 'true' ||
1540
- (this.storage.getItem('night') === null &&
1541
- this.windowRef.matchMedia('(prefers-color-scheme: dark)').matches);
1542
- this.change$ = new rxjs.Subject();
1543
- }
1544
- TuiDocMainComponent_1 = TuiDocMainComponent;
1545
- Object.defineProperty(TuiDocMainComponent.prototype, "mode", {
1546
- get: function () {
1547
- return this.night ? 'onDark' : null;
1548
- },
1549
- enumerable: true,
1550
- configurable: true
1551
- });
1552
- TuiDocMainComponent.prototype.onMode = function (night) {
1553
- this.night = night;
1554
- this.change$.next();
1555
- this.storage.setItem('night', String(night));
1556
- };
1557
- var TuiDocMainComponent_1;
1558
- TuiDocMainComponent.ctorParameters = function () { return [
1559
- { type: Storage, decorators: [{ type: core.Inject, args: [common$1.LOCAL_STORAGE,] }] },
1560
- { type: Window, decorators: [{ type: core.Inject, args: [common$1.WINDOW,] }] }
1561
- ]; };
1562
- TuiDocMainComponent = TuiDocMainComponent_1 = __decorate([
1563
- core.Component({
1564
- selector: 'tui-doc-main',
1565
- 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",
1566
- encapsulation: core.ViewEncapsulation.None,
1567
- providers: [
1568
- {
1569
- provide: core$1.TuiModeDirective,
1570
- useExisting: core.forwardRef(function () { return TuiDocMainComponent_1; }),
1571
- },
1572
- cdk.TuiSwipeService,
1573
- ],
1574
- 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}"]
1575
- }),
1576
- __param(0, core.Inject(common$1.LOCAL_STORAGE)),
1577
- __param(1, core.Inject(common$1.WINDOW))
1578
- ], TuiDocMainComponent);
1579
- return TuiDocMainComponent;
1578
+ ], TuiDocNavigationModule);
1579
+ return TuiDocNavigationModule;
1580
1580
  }());
1581
1581
 
1582
1582
  var TUI_DOC_LOGO = new core.InjectionToken('Main logo', {
@@ -1669,26 +1669,6 @@
1669
1669
  factory: function () { return []; },
1670
1670
  });
1671
1671
 
1672
- var TuiDocPageTabConnectorDirective = /** @class */ (function () {
1673
- function TuiDocPageTabConnectorDirective(template) {
1674
- this.template = template;
1675
- }
1676
- TuiDocPageTabConnectorDirective.ctorParameters = function () { return [
1677
- { type: core.TemplateRef, decorators: [{ type: core.Inject, args: [core.TemplateRef,] }] }
1678
- ]; };
1679
- __decorate([
1680
- core.Input(),
1681
- cdk.tuiDefaultProp()
1682
- ], TuiDocPageTabConnectorDirective.prototype, "pageTab", void 0);
1683
- TuiDocPageTabConnectorDirective = __decorate([
1684
- core.Directive({
1685
- selector: '[pageTab]',
1686
- }),
1687
- __param(0, core.Inject(core.TemplateRef))
1688
- ], TuiDocPageTabConnectorDirective);
1689
- return TuiDocPageTabConnectorDirective;
1690
- }());
1691
-
1692
1672
  var TUI_DOC_SEE_ALSO = new core.InjectionToken('Array of arrays of related pages', {
1693
1673
  factory: function () { return []; },
1694
1674
  });
@@ -1711,6 +1691,26 @@
1711
1691
  return Array.from(seeAlsoSet);
1712
1692
  }
1713
1693
 
1694
+ var TuiDocPageTabConnectorDirective = /** @class */ (function () {
1695
+ function TuiDocPageTabConnectorDirective(template) {
1696
+ this.template = template;
1697
+ }
1698
+ TuiDocPageTabConnectorDirective.ctorParameters = function () { return [
1699
+ { type: core.TemplateRef, decorators: [{ type: core.Inject, args: [core.TemplateRef,] }] }
1700
+ ]; };
1701
+ __decorate([
1702
+ core.Input(),
1703
+ cdk.tuiDefaultProp()
1704
+ ], TuiDocPageTabConnectorDirective.prototype, "pageTab", void 0);
1705
+ TuiDocPageTabConnectorDirective = __decorate([
1706
+ core.Directive({
1707
+ selector: '[pageTab]',
1708
+ }),
1709
+ __param(0, core.Inject(core.TemplateRef))
1710
+ ], TuiDocPageTabConnectorDirective);
1711
+ return TuiDocPageTabConnectorDirective;
1712
+ }());
1713
+
1714
1714
  // Ambient type cannot be used without dynamic https://github.com/angular/angular/issues/23395
1715
1715
  // @dynamic
1716
1716
  var TuiDocPageComponent = /** @class */ (function () {
@@ -1956,6 +1956,23 @@
1956
1956
  },
1957
1957
  ];
1958
1958
 
1959
+ var TuiAddonDocModule = /** @class */ (function () {
1960
+ function TuiAddonDocModule() {
1961
+ }
1962
+ TuiAddonDocModule = __decorate([
1963
+ core.NgModule({
1964
+ exports: [
1965
+ TuiDocCodeModule,
1966
+ TuiDocDemoModule,
1967
+ TuiDocDocumentationModule,
1968
+ TuiDocPageModule,
1969
+ TuiDocExampleModule,
1970
+ ],
1971
+ })
1972
+ ], TuiAddonDocModule);
1973
+ return TuiAddonDocModule;
1974
+ }());
1975
+
1959
1976
  /**
1960
1977
  * Generates typical page routing structure
1961
1978
  */
@@ -1974,23 +1991,6 @@
1974
1991
  ];
1975
1992
  }
1976
1993
 
1977
- var TuiAddonDocModule = /** @class */ (function () {
1978
- function TuiAddonDocModule() {
1979
- }
1980
- TuiAddonDocModule = __decorate([
1981
- core.NgModule({
1982
- exports: [
1983
- TuiDocCodeModule,
1984
- TuiDocDemoModule,
1985
- TuiDocDocumentationModule,
1986
- TuiDocPageModule,
1987
- TuiDocExampleModule,
1988
- ],
1989
- })
1990
- ], TuiAddonDocModule);
1991
- return TuiAddonDocModule;
1992
- }());
1993
-
1994
1994
  exports.DEMO_TEXTS = DEMO_TEXTS;
1995
1995
  exports.DOC_TEXTS = DOC_TEXTS;
1996
1996
  exports.EXAMPLE_TEXTS = EXAMPLE_TEXTS;
@@ -2032,17 +2032,17 @@
2032
2032
  exports.TuiDocPageModule = TuiDocPageModule;
2033
2033
  exports.TuiDocPageTabConnectorDirective = TuiDocPageTabConnectorDirective;
2034
2034
  exports.generateRoutes = generateRoutes;
2035
- exports.ɵa = NAVIGATION_TITLE;
2036
- exports.ɵb = NAVIGATION_LABELS;
2037
- exports.ɵc = NAVIGATION_ITEMS;
2038
- exports.ɵd = NAVIGATION_PROVIDERS;
2039
- exports.ɵe = titleProviderFactory;
2040
- exports.ɵf = labelsProviderFactory;
2041
- exports.ɵg = itemsProviderFactory;
2042
- exports.ɵh = TuiInputOpacityModule;
2043
- exports.ɵi = TuiInputOpacityDirective;
2044
- exports.ɵj = TuiDocExampleGetTabsPipe;
2045
- exports.ɵk = TuiDocHeaderModule;
2035
+ exports.ɵa = TuiInputOpacityModule;
2036
+ exports.ɵb = TuiInputOpacityDirective;
2037
+ exports.ɵc = TuiDocExampleGetTabsPipe;
2038
+ exports.ɵd = TuiDocHeaderModule;
2039
+ exports.ɵe = NAVIGATION_TITLE;
2040
+ exports.ɵf = NAVIGATION_LABELS;
2041
+ exports.ɵg = NAVIGATION_ITEMS;
2042
+ exports.ɵh = NAVIGATION_PROVIDERS;
2043
+ exports.ɵi = titleProviderFactory;
2044
+ exports.ɵj = labelsProviderFactory;
2045
+ exports.ɵk = itemsProviderFactory;
2046
2046
  exports.ɵl = TuiDocHeaderComponent;
2047
2047
  exports.ɵm = PAGE_SEE_ALSO;
2048
2048
  exports.ɵn = PAGE_PROVIDERS;