@taiga-ui/addon-doc 3.20.0 → 3.21.0-dev.main-92c5f00

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.
@@ -1196,6 +1196,8 @@
1196
1196
  case "boolean":
1197
1197
  case "function":
1198
1198
  return String(data);
1199
+ default:
1200
+ break;
1199
1201
  }
1200
1202
  if (data instanceof RegExp) {
1201
1203
  return String(data);
@@ -1914,12 +1916,62 @@
1914
1916
  return newStr;
1915
1917
  }
1916
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
+
1917
1963
  /**
1918
1964
  * Documentation pages
1919
1965
  */
1920
1966
  var TUI_DOC_PAGES = new i0.InjectionToken("[TUI_DOC_PAGES]", {
1921
1967
  factory: function () { return []; },
1922
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
+ });
1923
1975
 
1924
1976
  /**
1925
1977
  * Page title prefix
@@ -1951,7 +2003,7 @@
1951
2003
  return data;
1952
2004
  }), operators.map(function (_a) {
1953
2005
  var title = _a.title;
1954
- return titlePrefix + title;
2006
+ return "" + titlePrefix + title;
1955
2007
  }), operators.takeUntil(destroy$));
1956
2008
  },
1957
2009
  },
@@ -2650,20 +2702,12 @@
2650
2702
  this.seeAlso = [];
2651
2703
  }
2652
2704
  TuiDocSeeAlsoComponent.prototype.getRouterLink = function (pageTitle) {
2653
- for (var i = 0; i < this.pages.length; i++) {
2654
- var page = this.pages
2655
- .map(function (page) { return ('subPages' in page ? page.subPages : [page]); })
2656
- .reduce(function (pages, subPages) { return __spreadArray(__spreadArray([], __read(pages)), __read(subPages)); }, [])
2657
- .find(function (page) { return page.title === pageTitle; });
2658
- if (page === null || page === void 0 ? void 0 : page.route) {
2659
- return page.route;
2660
- }
2661
- }
2662
- 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 : '';
2663
2707
  };
2664
2708
  return TuiDocSeeAlsoComponent;
2665
2709
  }());
2666
- 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 });
2667
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 });
2668
2712
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: TuiDocSeeAlsoComponent, decorators: [{
2669
2713
  type: i0.Component,
@@ -2677,9 +2721,9 @@
2677
2721
  return [{ type: undefined, decorators: [{
2678
2722
  type: i0.Inject,
2679
2723
  args: [TUI_DOC_SEE_ALSO_TEXT]
2680
- }] }, { type: undefined, decorators: [{
2724
+ }] }, { type: Map, decorators: [{
2681
2725
  type: i0.Inject,
2682
- args: [TUI_DOC_PAGES]
2726
+ args: [TUI_DOC_MAP_PAGES]
2683
2727
  }] }];
2684
2728
  }, propDecorators: { seeAlso: [{
2685
2729
  type: i0.Input
@@ -2915,6 +2959,7 @@
2915
2959
  exports.TUI_DOC_EXAMPLE_TEXTS = TUI_DOC_EXAMPLE_TEXTS;
2916
2960
  exports.TUI_DOC_EXCLUDED_PROPERTIES = TUI_DOC_EXCLUDED_PROPERTIES;
2917
2961
  exports.TUI_DOC_LOGO = TUI_DOC_LOGO;
2962
+ exports.TUI_DOC_MAP_PAGES = TUI_DOC_MAP_PAGES;
2918
2963
  exports.TUI_DOC_MENU_TEXT = TUI_DOC_MENU_TEXT;
2919
2964
  exports.TUI_DOC_PAGES = TUI_DOC_PAGES;
2920
2965
  exports.TUI_DOC_PAGE_LOADED = TUI_DOC_PAGE_LOADED;