@taiga-ui/addon-doc 3.21.0-dev.main-24e372e → 3.21.0-dev.main-21189a2

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.
@@ -1916,12 +1916,62 @@
1916
1916
  return newStr;
1917
1917
  }
1918
1918
 
1919
+ function tuiToFlatMapPages(pages) {
1920
+ var e_1, _b, e_2, _c;
1921
+ var map = new Map();
1922
+ try {
1923
+ for (var pages_1 = __values(pages), pages_1_1 = pages_1.next(); !pages_1_1.done; pages_1_1 = pages_1.next()) {
1924
+ var page = pages_1_1.value;
1925
+ if ("subPages" in page) {
1926
+ try {
1927
+ for (var _d = (e_2 = void 0, __values(page.subPages)), _e = _d.next(); !_e.done; _e = _d.next()) {
1928
+ var subPage = _e.value;
1929
+ tuiPageCheckUniqueTitle(subPage, map);
1930
+ map.set(subPage.title, subPage);
1931
+ }
1932
+ }
1933
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
1934
+ finally {
1935
+ try {
1936
+ if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
1937
+ }
1938
+ finally { if (e_2) throw e_2.error; }
1939
+ }
1940
+ }
1941
+ else {
1942
+ tuiPageCheckUniqueTitle(page, map);
1943
+ map.set(page.title, page);
1944
+ }
1945
+ }
1946
+ }
1947
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
1948
+ finally {
1949
+ try {
1950
+ if (pages_1_1 && !pages_1_1.done && (_b = pages_1.return)) _b.call(pages_1);
1951
+ }
1952
+ finally { if (e_1) throw e_1.error; }
1953
+ }
1954
+ return map;
1955
+ }
1956
+ function tuiPageCheckUniqueTitle(page, map) {
1957
+ var _a;
1958
+ if (map.has(page.title) && ((_a = map.get(page.title)) === null || _a === void 0 ? void 0 : _a.route) !== page.route) {
1959
+ console.error("Title for page should be unique for prevent inconsistent page names", page, "<== Collisions between ==>", map.get(page.title));
1960
+ }
1961
+ }
1962
+
1919
1963
  /**
1920
1964
  * Documentation pages
1921
1965
  */
1922
1966
  var TUI_DOC_PAGES = new i0.InjectionToken("[TUI_DOC_PAGES]", {
1923
1967
  factory: function () { return []; },
1924
1968
  });
1969
+ var TUI_DOC_MAP_PAGES = new i0.InjectionToken("[TUI_DOC_MAP_PAGES]", {
1970
+ factory: function () {
1971
+ var pages = i0.inject(TUI_DOC_PAGES);
1972
+ return tuiToFlatMapPages(pages);
1973
+ },
1974
+ });
1925
1975
 
1926
1976
  /**
1927
1977
  * Page title prefix
@@ -1953,7 +2003,7 @@
1953
2003
  return data;
1954
2004
  }), operators.map(function (_a) {
1955
2005
  var title = _a.title;
1956
- return titlePrefix + title;
2006
+ return "" + titlePrefix + title;
1957
2007
  }), operators.takeUntil(destroy$));
1958
2008
  },
1959
2009
  },
@@ -2652,20 +2702,12 @@
2652
2702
  this.seeAlso = [];
2653
2703
  }
2654
2704
  TuiDocSeeAlsoComponent.prototype.getRouterLink = function (pageTitle) {
2655
- for (var i = 0; i < this.pages.length; i++) {
2656
- var page = this.pages
2657
- .map(function (page) { return ('subPages' in page ? page.subPages : [page]); })
2658
- .reduce(function (pages, subPages) { return __spreadArray(__spreadArray([], __read(pages)), __read(subPages)); }, [])
2659
- .find(function (page) { return page.title === pageTitle; });
2660
- if (page === null || page === void 0 ? void 0 : page.route) {
2661
- return page.route;
2662
- }
2663
- }
2664
- return '';
2705
+ var _a, _b;
2706
+ return (_b = (_a = this.pages.get(pageTitle)) === null || _a === void 0 ? void 0 : _a.route) !== null && _b !== void 0 ? _b : '';
2665
2707
  };
2666
2708
  return TuiDocSeeAlsoComponent;
2667
2709
  }());
2668
- TuiDocSeeAlsoComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TuiDocSeeAlsoComponent, deps: [{ token: TUI_DOC_SEE_ALSO_TEXT }, { token: TUI_DOC_PAGES }], target: i0__namespace.ɵɵFactoryTarget.Component });
2710
+ TuiDocSeeAlsoComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TuiDocSeeAlsoComponent, deps: [{ token: TUI_DOC_SEE_ALSO_TEXT }, { token: TUI_DOC_MAP_PAGES }], target: i0__namespace.ɵɵFactoryTarget.Component });
2669
2711
  TuiDocSeeAlsoComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.17", type: TuiDocSeeAlsoComponent, selector: "tui-doc-see-also", inputs: { seeAlso: "seeAlso" }, ngImport: i0__namespace, template: "<h5 class=\"t-header\">{{ text }}</h5>\n<ng-container *ngFor=\"let item of seeAlso; last as last\">\n <a\n tuiLink\n [routerLink]=\"getRouterLink(item)\"\n [innerText]=\"item\"\n ></a>\n <ng-container *ngIf=\"!last\">{{ ', ' }}</ng-container>\n</ng-container>\n", styles: [":host{display:block}.t-header{font-size:.6875rem;line-height:1rem;text-transform:uppercase;letter-spacing:.075em;color:var(--tui-text-02);margin:0 0 .5rem;white-space:nowrap}\n"], components: [{ type: i2__namespace$1.TuiLinkComponent, selector: "a[tuiLink], button[tuiLink]", inputs: ["pseudo", "icon", "iconAlign", "iconRotated", "mode"], exportAs: ["tuiLink"] }], directives: [{ type: i4__namespace.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i6__namespace.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["routerLink", "target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo"] }, { type: i4__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0__namespace.ChangeDetectionStrategy.OnPush });
2670
2712
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TuiDocSeeAlsoComponent, decorators: [{
2671
2713
  type: i0.Component,
@@ -2679,9 +2721,9 @@
2679
2721
  return [{ type: undefined, decorators: [{
2680
2722
  type: i0.Inject,
2681
2723
  args: [TUI_DOC_SEE_ALSO_TEXT]
2682
- }] }, { type: undefined, decorators: [{
2724
+ }] }, { type: Map, decorators: [{
2683
2725
  type: i0.Inject,
2684
- args: [TUI_DOC_PAGES]
2726
+ args: [TUI_DOC_MAP_PAGES]
2685
2727
  }] }];
2686
2728
  }, propDecorators: { seeAlso: [{
2687
2729
  type: i0.Input
@@ -2917,6 +2959,7 @@
2917
2959
  exports.TUI_DOC_EXAMPLE_TEXTS = TUI_DOC_EXAMPLE_TEXTS;
2918
2960
  exports.TUI_DOC_EXCLUDED_PROPERTIES = TUI_DOC_EXCLUDED_PROPERTIES;
2919
2961
  exports.TUI_DOC_LOGO = TUI_DOC_LOGO;
2962
+ exports.TUI_DOC_MAP_PAGES = TUI_DOC_MAP_PAGES;
2920
2963
  exports.TUI_DOC_MENU_TEXT = TUI_DOC_MENU_TEXT;
2921
2964
  exports.TUI_DOC_PAGES = TUI_DOC_PAGES;
2922
2965
  exports.TUI_DOC_PAGE_LOADED = TUI_DOC_PAGE_LOADED;