@taiga-ui/addon-doc 2.55.0 → 3.0.0-rc.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 (167) hide show
  1. package/README.md +2 -2
  2. package/addon-doc.module.d.ts +9 -0
  3. package/bundles/taiga-ui-addon-doc.umd.js +1777 -1335
  4. package/bundles/taiga-ui-addon-doc.umd.js.map +1 -1
  5. package/components/code/code.component.d.ts +3 -0
  6. package/components/code/code.module.d.ts +7 -0
  7. package/components/copy/copy.component.d.ts +3 -0
  8. package/components/copy/copy.module.d.ts +7 -0
  9. package/components/demo/demo.component.d.ts +3 -0
  10. package/components/demo/demo.module.d.ts +11 -0
  11. package/components/documentation/documentation-property-connector.directive.d.ts +3 -0
  12. package/components/documentation/documentation.component.d.ts +3 -0
  13. package/components/documentation/documentation.module.d.ts +12 -0
  14. package/components/example/example-capitalize.pipe.d.ts +3 -0
  15. package/components/example/example-get-tabs.pipe.d.ts +3 -0
  16. package/components/example/example.component.d.ts +8 -5
  17. package/components/example/example.module.d.ts +14 -0
  18. package/components/main/main.component.d.ts +3 -0
  19. package/components/main/main.module.d.ts +12 -0
  20. package/components/navigation/navigation.component.d.ts +3 -0
  21. package/components/navigation/navigation.module.d.ts +12 -0
  22. package/components/page/page-tab.directive.d.ts +3 -0
  23. package/components/page/page.component.d.ts +3 -0
  24. package/components/page/page.module.d.ts +11 -0
  25. package/directives/scroll-into-view/scroll-into-view.directive.d.ts +5 -0
  26. package/directives/scroll-into-view/scroll-into-view.module.d.ts +8 -0
  27. package/esm2015/addon-doc.module.js +27 -16
  28. package/esm2015/components/code/code.component.js +25 -23
  29. package/esm2015/components/code/code.module.js +15 -12
  30. package/esm2015/components/code/parse-code-block.js +3 -3
  31. package/esm2015/components/copy/copy.component.js +24 -19
  32. package/esm2015/components/copy/copy.module.js +15 -12
  33. package/esm2015/components/demo/demo.component.js +80 -63
  34. package/esm2015/components/demo/demo.module.js +54 -13
  35. package/esm2015/components/documentation/documentation-property-connector.directive.js +51 -52
  36. package/esm2015/components/documentation/documentation.component.js +72 -64
  37. package/esm2015/components/documentation/documentation.module.js +62 -19
  38. package/esm2015/components/example/example-capitalize.pipe.js +13 -10
  39. package/esm2015/components/example/example-get-tabs.pipe.js +10 -8
  40. package/esm2015/components/example/example.component.js +88 -66
  41. package/esm2015/components/example/example.module.js +42 -21
  42. package/esm2015/components/main/main.component.js +49 -35
  43. package/esm2015/components/main/main.module.js +36 -13
  44. package/esm2015/components/navigation/navigation.component.js +86 -63
  45. package/esm2015/components/navigation/navigation.module.js +56 -13
  46. package/esm2015/components/navigation/navigation.providers.js +4 -4
  47. package/esm2015/components/page/page-tab.directive.js +18 -15
  48. package/esm2015/components/page/page.component.js +48 -43
  49. package/esm2015/components/page/page.module.js +28 -13
  50. package/esm2015/components/page/page.providers.js +4 -4
  51. package/esm2015/directives/scroll-into-view/scroll-into-view.directive.js +38 -35
  52. package/esm2015/directives/scroll-into-view/scroll-into-view.module.js +26 -22
  53. package/esm2015/interfaces/code-editor.js +2 -1
  54. package/esm2015/interfaces/page.js +4 -4
  55. package/esm2015/interfaces/source-code-path-options.js +2 -1
  56. package/esm2015/internal/header/header.component.js +35 -24
  57. package/esm2015/internal/header/header.module.js +28 -13
  58. package/esm2015/internal/input-opacity/input-opacity.directive.js +21 -20
  59. package/esm2015/internal/input-opacity/input-opacity.module.js +14 -11
  60. package/esm2015/internal/see-also/see-also.component.js +28 -24
  61. package/esm2015/internal/see-also/see-also.module.js +15 -12
  62. package/esm2015/internal/source-code/source-code.component.js +35 -34
  63. package/esm2015/internal/source-code/source-code.module.js +15 -12
  64. package/esm2015/languages/russian.js +14 -18
  65. package/esm2015/public-api.js +8 -1
  66. package/esm2015/taiga-ui-addon-doc.js +1 -13
  67. package/esm2015/tokens/code-actions.js +3 -3
  68. package/esm2015/tokens/code-editor.js +2 -2
  69. package/esm2015/tokens/default-tabs.js +2 -2
  70. package/esm2015/tokens/example-content-processor.js +2 -2
  71. package/esm2015/tokens/i18n.js +19 -19
  72. package/esm2015/tokens/logo.js +3 -3
  73. package/esm2015/tokens/page-loaded.js +2 -2
  74. package/esm2015/tokens/pages.js +2 -2
  75. package/esm2015/tokens/scroll-behavior.js +2 -2
  76. package/esm2015/tokens/see-also.js +2 -2
  77. package/esm2015/tokens/source-code.js +3 -3
  78. package/esm2015/tokens/title.js +3 -3
  79. package/esm2015/types/pages.js +2 -1
  80. package/esm2015/utils/coerce-value.js +6 -6
  81. package/esm2015/utils/color-conversion.js +5 -5
  82. package/esm2015/utils/generate-routes.js +4 -10
  83. package/esm2015/utils/inspect.js +13 -13
  84. package/esm2015/utils/raw-load-record.js +1 -1
  85. package/esm2015/utils/raw-load.js +13 -2
  86. package/esm2015/utils/transliterate-keyboard-layout.js +34 -34
  87. package/fesm2015/taiga-ui-addon-doc.js +1256 -924
  88. package/fesm2015/taiga-ui-addon-doc.js.map +1 -1
  89. package/interfaces/code-editor.d.ts +0 -10
  90. package/internal/header/header.component.d.ts +3 -0
  91. package/internal/header/header.module.d.ts +11 -0
  92. package/internal/input-opacity/input-opacity.directive.d.ts +3 -0
  93. package/internal/input-opacity/input-opacity.module.d.ts +5 -0
  94. package/internal/see-also/see-also.component.d.ts +3 -0
  95. package/internal/see-also/see-also.module.d.ts +8 -0
  96. package/internal/source-code/source-code.component.d.ts +3 -0
  97. package/internal/source-code/source-code.module.d.ts +8 -0
  98. package/languages/russian.d.ts +0 -3
  99. package/package.json +11 -14
  100. package/public-api.d.ts +2 -0
  101. package/taiga-ui-addon-doc.d.ts +1 -12
  102. package/utils/generate-routes.d.ts +1 -6
  103. package/bundles/taiga-ui-addon-doc.umd.min.js +0 -2
  104. package/bundles/taiga-ui-addon-doc.umd.min.js.map +0 -1
  105. package/esm5/addon-doc.module.js +0 -25
  106. package/esm5/components/code/code.component.js +0 -46
  107. package/esm5/components/code/code.module.js +0 -19
  108. package/esm5/components/code/parse-code-block.js +0 -21
  109. package/esm5/components/copy/copy.component.js +0 -43
  110. package/esm5/components/copy/copy.module.js +0 -19
  111. package/esm5/components/demo/demo.component.js +0 -153
  112. package/esm5/components/demo/demo.module.js +0 -43
  113. package/esm5/components/documentation/documentation-property-connector.directive.js +0 -133
  114. package/esm5/components/documentation/documentation.component.js +0 -145
  115. package/esm5/components/documentation/documentation.module.js +0 -50
  116. package/esm5/components/example/example-capitalize.pipe.js +0 -16
  117. package/esm5/components/example/example-get-tabs.pipe.js +0 -15
  118. package/esm5/components/example/example.component.js +0 -135
  119. package/esm5/components/example/example.module.js +0 -42
  120. package/esm5/components/main/main.component.js +0 -58
  121. package/esm5/components/main/main.module.js +0 -35
  122. package/esm5/components/navigation/navigation.component.js +0 -203
  123. package/esm5/components/navigation/navigation.module.js +0 -45
  124. package/esm5/components/navigation/navigation.providers.js +0 -59
  125. package/esm5/components/page/page-tab.directive.js +0 -24
  126. package/esm5/components/page/page.component.js +0 -67
  127. package/esm5/components/page/page.module.js +0 -30
  128. package/esm5/components/page/page.providers.js +0 -22
  129. package/esm5/directives/scroll-into-view/scroll-into-view.directive.js +0 -65
  130. package/esm5/directives/scroll-into-view/scroll-into-view.module.js +0 -34
  131. package/esm5/interfaces/code-editor.js +0 -1
  132. package/esm5/interfaces/page.js +0 -6
  133. package/esm5/interfaces/source-code-path-options.js +0 -1
  134. package/esm5/internal/header/header.component.js +0 -47
  135. package/esm5/internal/header/header.module.js +0 -30
  136. package/esm5/internal/input-opacity/input-opacity.directive.js +0 -36
  137. package/esm5/internal/input-opacity/input-opacity.module.js +0 -16
  138. package/esm5/internal/see-also/see-also.component.js +0 -44
  139. package/esm5/internal/see-also/see-also.module.js +0 -20
  140. package/esm5/internal/source-code/source-code.component.js +0 -61
  141. package/esm5/internal/source-code/source-code.module.js +0 -20
  142. package/esm5/languages/russian.js +0 -42
  143. package/esm5/public-api.js +0 -49
  144. package/esm5/taiga-ui-addon-doc.js +0 -17
  145. package/esm5/tokens/code-actions.js +0 -5
  146. package/esm5/tokens/code-editor.js +0 -3
  147. package/esm5/tokens/default-tabs.js +0 -5
  148. package/esm5/tokens/example-content-processor.js +0 -4
  149. package/esm5/tokens/i18n.js +0 -54
  150. package/esm5/tokens/logo.js +0 -5
  151. package/esm5/tokens/page-loaded.js +0 -5
  152. package/esm5/tokens/pages.js +0 -5
  153. package/esm5/tokens/scroll-behavior.js +0 -3
  154. package/esm5/tokens/see-also.js +0 -5
  155. package/esm5/tokens/source-code.js +0 -5
  156. package/esm5/tokens/title.js +0 -5
  157. package/esm5/types/pages.js +0 -1
  158. package/esm5/utils/coerce-value.js +0 -44
  159. package/esm5/utils/color-conversion.js +0 -27
  160. package/esm5/utils/generate-routes.js +0 -21
  161. package/esm5/utils/inspect.js +0 -68
  162. package/esm5/utils/raw-load-record.js +0 -50
  163. package/esm5/utils/raw-load.js +0 -26
  164. package/esm5/utils/transliterate-keyboard-layout.js +0 -50
  165. package/fesm5/taiga-ui-addon-doc.js +0 -2007
  166. package/fesm5/taiga-ui-addon-doc.js.map +0 -1
  167. package/taiga-ui-addon-doc.metadata.json +0 -1
@@ -1,2007 +0,0 @@
1
- import { __awaiter, __generator, __decorate, __param, __assign, __spread, __read, __values, __extends } from 'tslib';
2
- import { Input, HostBinding, Component, NgModule, Inject, ChangeDetectionStrategy, InjectionToken, Renderer2, PLATFORM_ID, ViewChild, ContentChild, TemplateRef, HostListener, forwardRef, EventEmitter, Output, Directive, ChangeDetectorRef, ContentChildren, Attribute, Optional, Pipe, ViewEncapsulation, ElementRef } from '@angular/core';
3
- import { BehaviorSubject, Subject, timer, Observable, merge, identity, defer, of, ReplaySubject } from 'rxjs';
4
- import { switchMap, map, switchMapTo, mapTo, startWith, takeUntil, filter, debounceTime, mergeMap, take, distinctUntilChanged } from 'rxjs/operators';
5
- import MarkdownIt from 'markdown-it';
6
- import { CommonModule, isPlatformBrowser, Location as Location$1, DOCUMENT } from '@angular/common';
7
- import { HighlightModule } from 'ngx-highlightjs';
8
- import { tuiPure, TuiDestroyService, px, TUI_IS_MOBILE, TuiDragModule, EMPTY_QUERY, itemsQueryListObservable, watch, TUI_FOCUSABLE_ITEM_ACCESSOR, TUI_IS_CYPRESS, TuiSwipeService, getElementObscurers, isPresent, uniqBy, TuiActiveZoneModule, TuiLetModule, TuiAutoFocusModule, tuiDefaultProp } from '@taiga-ui/cdk';
9
- import { TUI_COPY_TEXTS, TuiSelectModule, TuiRadioBlockModule, TuiCheckboxLabeledModule, TuiDataListWrapperModule, TuiBadgeModule, TuiToggleModule, TuiInputCountModule, TuiTabsModule, TuiAccordionModule, TuiTagModule } from '@taiga-ui/kit';
10
- import { TuiButtonModule, TuiModeDirective, TuiLinkModule, TuiExpandModule, TuiGroupModule, TuiTooltipModule, TuiModeModule, TuiSvgModule, TuiDataListModule, TuiTextfieldControllerModule, TuiHintControllerModule, TuiPrimitiveTextfieldModule, TuiDropdownControllerModule, TuiNotificationModule, TuiNotificationsService, capitalizeFirstLetter, TuiHostedDropdownModule, TuiScrollbarModule, TuiThemeNightModule, TuiRootModule, TuiDialogModule, TuiAlertModule } from '@taiga-ui/core';
11
- import { FormControl, FormGroup, ReactiveFormsModule, FormsModule } from '@angular/forms';
12
- import { UrlSerializer, RouterModule, ActivatedRoute, Router, NavigationEnd } from '@angular/router';
13
- import { trigger, transition, style, animate } from '@angular/animations';
14
- import { Clipboard, ClipboardModule } from '@angular/cdk/clipboard';
15
- import { LOCATION, LOCAL_STORAGE, WINDOW } from '@ng-web-apis/common';
16
- import { PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
17
- import { TuiSidebarDirective, TuiSidebarModule } from '@taiga-ui/addon-mobile';
18
- import { Title } from '@angular/platform-browser';
19
-
20
- /**
21
- * @deprecated: use {@link tuiRawLoad} instead
22
- */
23
- // eslint-disable-next-line @typescript-eslint/naming-convention
24
- function rawLoad(content) {
25
- return __awaiter(this, void 0, void 0, function () {
26
- var _a;
27
- return __generator(this, function (_b) {
28
- switch (_b.label) {
29
- case 0:
30
- if (!(content instanceof Promise)) return [3 /*break*/, 2];
31
- return [4 /*yield*/, content];
32
- case 1:
33
- _a = (_b.sent()).default;
34
- return [3 /*break*/, 3];
35
- case 2:
36
- _a = content;
37
- _b.label = 3;
38
- case 3: return [2 /*return*/, _a];
39
- }
40
- });
41
- });
42
- }
43
- var tuiRawLoad = rawLoad;
44
-
45
- /**
46
- * @deprecated: use {@link tuiTryParseMarkdownCodeBlock} instead
47
- */
48
- // eslint-disable-next-line @typescript-eslint/naming-convention
49
- function tryParseMarkdownCodeBlock(text) {
50
- if (text === void 0) { text = ''; }
51
- var tokens = new MarkdownIt().parse(text, {});
52
- var result = tokens
53
- .filter(function (_a) {
54
- var tag = _a.tag, type = _a.type;
55
- return tag === 'code' && type === 'fence';
56
- })
57
- .map(function (_a) {
58
- var content = _a.content;
59
- return content;
60
- });
61
- return result.length ? result : [text];
62
- }
63
- var tuiTryParseMarkdownCodeBlock = tryParseMarkdownCodeBlock;
64
-
65
- var TuiDocCodeComponent = /** @class */ (function () {
66
- function TuiDocCodeComponent() {
67
- this.rawLoader$$ = new BehaviorSubject('');
68
- this.filename = '';
69
- this.processor$ = this.rawLoader$$.pipe(switchMap(rawLoad), map(tryParseMarkdownCodeBlock));
70
- }
71
- Object.defineProperty(TuiDocCodeComponent.prototype, "code", {
72
- set: function (code) {
73
- this.rawLoader$$.next(code);
74
- },
75
- enumerable: true,
76
- configurable: true
77
- });
78
- Object.defineProperty(TuiDocCodeComponent.prototype, "hasFilename", {
79
- get: function () {
80
- return !!this.filename;
81
- },
82
- enumerable: true,
83
- configurable: true
84
- });
85
- __decorate([
86
- Input()
87
- ], TuiDocCodeComponent.prototype, "filename", void 0);
88
- __decorate([
89
- Input()
90
- ], TuiDocCodeComponent.prototype, "code", null);
91
- __decorate([
92
- HostBinding('class._has-filename')
93
- ], TuiDocCodeComponent.prototype, "hasFilename", null);
94
- TuiDocCodeComponent = __decorate([
95
- Component({
96
- selector: 'tui-doc-code',
97
- template: "<p\n *ngIf=\"filename\"\n class=\"t-header\"\n>\n {{ filename }}\n</p>\n<pre\n *ngFor=\"let content of processor$ | async\"\n class=\"t-code\"\n><code [lineNumbers]=\"true\" [highlight]=\"content\"></code></pre>\n",
98
- styles: [":host{display:block}.t-header{font:var(--tui-font-text-s);font-weight:700}.t-code{margin:0}.t-code+.t-code{margin-top:1rem}.hljs:not(:empty){font:var(--tui-font-text-m);padding:1.5rem 2rem;font-family:monospace;background:var(--tui-clear-disabled);word-wrap:break-word;white-space:pre-wrap}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.hljs:not(:empty)::-webkit-scrollbar,.hljs:not(:empty)::-webkit-scrollbar-thumb{width:1rem;height:1rem;border-radius:6.25rem;background-clip:padding-box;border:2.667rem solid transparent}.hljs:not(:empty)::-webkit-scrollbar{background-color:transparent}.hljs:not(:empty)::-webkit-scrollbar-thumb{background-color:var(--tui-clear-hover)}.hljs:not(:empty)::-webkit-scrollbar-thumb:hover{background-color:var(--tui-clear-active)}.hljs:not(:empty)::-webkit-scrollbar-thumb:active{background-color:var(--tui-text-03)}}:host._has-filename .hljs:not(:empty){border-radius:.75rem}:host-context(tui-root._mobile) .hljs:not(:empty){padding:1rem}"]
99
- })
100
- ], TuiDocCodeComponent);
101
- return TuiDocCodeComponent;
102
- }());
103
-
104
- var TuiDocCodeModule = /** @class */ (function () {
105
- function TuiDocCodeModule() {
106
- }
107
- TuiDocCodeModule = __decorate([
108
- NgModule({
109
- imports: [CommonModule, HighlightModule],
110
- declarations: [TuiDocCodeComponent],
111
- exports: [TuiDocCodeComponent],
112
- })
113
- ], TuiDocCodeModule);
114
- return TuiDocCodeModule;
115
- }());
116
-
117
- var COPIED_TIMEOUT = 1500;
118
- // @dynamic
119
- var TuiDocCopyComponent = /** @class */ (function () {
120
- function TuiDocCopyComponent(texts$) {
121
- this.texts$ = texts$;
122
- this.copy$ = new Subject();
123
- }
124
- Object.defineProperty(TuiDocCopyComponent.prototype, "copied$", {
125
- get: function () {
126
- return this.copy$.pipe(switchMapTo(timer(COPIED_TIMEOUT).pipe(mapTo(false), startWith(true))));
127
- },
128
- enumerable: true,
129
- configurable: true
130
- });
131
- TuiDocCopyComponent.prototype.onClick = function () {
132
- this.copy$.next();
133
- };
134
- TuiDocCopyComponent.ctorParameters = function () { return [
135
- { type: Observable, decorators: [{ type: Inject, args: [TUI_COPY_TEXTS,] }] }
136
- ]; };
137
- __decorate([
138
- tuiPure
139
- ], TuiDocCopyComponent.prototype, "copied$", null);
140
- TuiDocCopyComponent = __decorate([
141
- Component({
142
- selector: 'tui-doc-copy',
143
- template: "<button\n *ngIf=\"texts$ | async as texts\"\n tuiButton\n type=\"button\"\n appearance=\"\"\n size=\"s\"\n class=\"t-copy\"\n [title]=\"texts[0]\"\n (click)=\"onClick()\"\n>\n <span\n class=\"t-content\"\n [class.t-content_moved]=\"copied$ | async\"\n >\n <span\n class=\"t-initial\"\n [attr.data-text]=\"texts[0]\"\n >\n <ng-content></ng-content>\n </span>\n {{ texts[1] }}\n </span>\n</button>\n",
144
- changeDetection: ChangeDetectionStrategy.OnPush,
145
- providers: [TuiDestroyService],
146
- styles: [":host{position:relative;display:inline-block;vertical-align:middle}.t-copy{transition-property:background;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;width:100%;color:var(--tui-text-01);background:var(--tui-base-01);overflow:hidden}.t-copy:hover{background:var(--tui-base-02)}.t-initial{white-space:nowrap}.t-initial:empty:before{content:attr(data-text)}.t-content{transition-property:transform;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;display:flex;flex-direction:column;transform:translateY(1rem);text-align:center;line-height:2rem}.t-content_moved{transform:translateY(-1rem)}"]
147
- }),
148
- __param(0, Inject(TUI_COPY_TEXTS))
149
- ], TuiDocCopyComponent);
150
- return TuiDocCopyComponent;
151
- }());
152
-
153
- var TuiDocCopyModule = /** @class */ (function () {
154
- function TuiDocCopyModule() {
155
- }
156
- TuiDocCopyModule = __decorate([
157
- NgModule({
158
- imports: [CommonModule, TuiButtonModule],
159
- declarations: [TuiDocCopyComponent],
160
- exports: [TuiDocCopyComponent],
161
- })
162
- ], TuiDocCopyModule);
163
- return TuiDocCopyModule;
164
- }());
165
-
166
- /**
167
- * TODO: think about reorganization in @taiga-ui/i18n way
168
- */
169
- /**
170
- * Works with a tuple
171
- * [@string tuiMode tooltip content, @string word 'background', @string 'form value']
172
- */
173
- var TUI_DOC_DEMO_TEXTS = new InjectionToken('tui-doc-demo i18n texts', {
174
- factory: function () { return ['Read more more about modes: ', 'Background', 'Form value']; },
175
- });
176
- /**
177
- * Works with a tuple
178
- * [
179
- * @string word 'argument',
180
- * @string word 'type',
181
- * @string 'name and description',
182
- * @string word 'value'
183
- * @string message for tooltip about ng-polymorpheus
184
- * ]
185
- */
186
- var TUI_DOC_DOCUMENTATION_TEXTS = new InjectionToken('tui-doc-documentation i18n texts', {
187
- factory: function () { return [
188
- 'Argument',
189
- 'Type',
190
- 'Name and description',
191
- 'Value',
192
- 'Learn about our dynamic templates from ',
193
- ]; },
194
- });
195
- /**
196
- * Works with a tuple
197
- * [
198
- * @string default tab name,
199
- * @string link to a sample copied message text,
200
- * @string link to a sample copied message label
201
- * ]
202
- */
203
- var TUI_DOC_EXAMPLE_TEXTS = new InjectionToken('tui-doc-example i18n texts', {
204
- factory: function () { return ['Preview', 'Link to a sample was successfully copied', 'Done']; },
205
- });
206
- var TUI_DOC_MENU_TEXT = new InjectionToken('menu i18n text', {
207
- factory: function () { return 'Menu'; },
208
- });
209
- var TUI_DOC_SEARCH_TEXT = new InjectionToken('search i18n text', {
210
- factory: function () { return 'Search'; },
211
- });
212
- var TUI_DOC_SEE_ALSO_TEXT = new InjectionToken('tui-doc-see-also i18n text', {
213
- factory: function () { return 'See also'; },
214
- });
215
- var TUI_DOC_SOURCE_CODE_TEXT = new InjectionToken('tui-doc-source-code i18n text', {
216
- factory: function () { return 'Source code'; },
217
- });
218
-
219
- var MIN_COMPONENT_WIDTH = 104;
220
- // @dynamic
221
- var TuiDocDemoComponent = /** @class */ (function () {
222
- function TuiDocDemoComponent(isMobile, destroy$, renderer, platformId, locationRef, urlSerializer, texts) {
223
- var _this = this;
224
- this.isMobile = isMobile;
225
- this.destroy$ = destroy$;
226
- this.renderer = renderer;
227
- this.texts = texts;
228
- this.initialX = 0;
229
- this.wrapperWidth = 0;
230
- this.control = null;
231
- this.template = null;
232
- this.updateOnVariants = ['change', 'blur', 'submit'];
233
- this.updateOn = 'change';
234
- this.expanded = false;
235
- this.opaque = true;
236
- this.modeControl = new FormControl();
237
- this.mode = null;
238
- this.change$ = new Subject();
239
- this.items = ['onLight', 'onDark'];
240
- this.isBrowser = isPlatformBrowser(platformId);
241
- var parsedMode = locationRef.path().match(/tuiMode=(onDark|onLight)/);
242
- if (parsedMode !== null && parsedMode.length > 0) {
243
- this.modeControl.setValue(parsedMode[1]);
244
- }
245
- this.modeControl.valueChanges
246
- .pipe(startWith(this.modeControl.value), takeUntil(this.destroy$))
247
- .subscribe(function (mode) {
248
- var urlTree = urlSerializer.parse(locationRef.path());
249
- urlTree.queryParams = __assign(__assign({}, urlTree.queryParams), { tuiMode: mode });
250
- locationRef.go(String(urlTree));
251
- _this.mode = mode;
252
- _this.change$.next();
253
- });
254
- }
255
- TuiDocDemoComponent_1 = TuiDocDemoComponent;
256
- TuiDocDemoComponent.prototype.onResize = function () {
257
- this.setResizerTextContent();
258
- };
259
- TuiDocDemoComponent.prototype.ngOnInit = function () {
260
- this.createForm();
261
- };
262
- TuiDocDemoComponent.prototype.ngAfterViewInit = function () {
263
- this.setResizerTextContent();
264
- };
265
- TuiDocDemoComponent.prototype.setResizerTextContent = function () {
266
- if (!this.content || !this.resizerText) {
267
- return;
268
- }
269
- var paddingLeft = this.isBrowser
270
- ? getComputedStyle(this.content.nativeElement).paddingLeft
271
- : '0';
272
- var offsetWidth = this.content.nativeElement.offsetWidth;
273
- this.resizerText.nativeElement.textContent = String(offsetWidth - parseInt(paddingLeft || '0', 10) * 2);
274
- };
275
- TuiDocDemoComponent.prototype.onDragStart = function (event) {
276
- event.preventDefault();
277
- this.initialX = event.clientX;
278
- this.wrapperWidth = this.wrapper ? this.wrapper.nativeElement.offsetWidth : 0;
279
- };
280
- TuiDocDemoComponent.prototype.onDragContinues = function (event) {
281
- var deltaX = this.initialX - event.clientX;
282
- this.resizeContent(deltaX);
283
- this.setResizerTextContent();
284
- };
285
- TuiDocDemoComponent.prototype.onDragEnd = function () {
286
- this.wrapperWidth = this.wrapper ? this.wrapper.nativeElement.offsetWidth : 0;
287
- };
288
- TuiDocDemoComponent.prototype.toggleDetails = function () {
289
- this.expanded = !this.expanded;
290
- };
291
- TuiDocDemoComponent.prototype.updateOnChange = function (updateOn) {
292
- this.updateOn = updateOn;
293
- this.createForm();
294
- };
295
- TuiDocDemoComponent.prototype.createForm = function () {
296
- var _a = this, control = _a.control, updateOn = _a.updateOn;
297
- if (!control) {
298
- return;
299
- }
300
- this.testForm = new FormGroup({ testValue: control }, { updateOn: updateOn });
301
- };
302
- TuiDocDemoComponent.prototype.resizeContent = function (delta) {
303
- if (!this.wrapper) {
304
- return;
305
- }
306
- this.renderer.setStyle(this.wrapper.nativeElement, 'width', px(Math.max(this.wrapperWidth - delta, MIN_COMPONENT_WIDTH)));
307
- };
308
- var TuiDocDemoComponent_1;
309
- TuiDocDemoComponent.ctorParameters = function () { return [
310
- { type: Boolean, decorators: [{ type: Inject, args: [TUI_IS_MOBILE,] }] },
311
- { type: TuiDestroyService, decorators: [{ type: Inject, args: [TuiDestroyService,] }] },
312
- { type: Renderer2, decorators: [{ type: Inject, args: [Renderer2,] }] },
313
- { type: undefined, decorators: [{ type: Inject, args: [PLATFORM_ID,] }] },
314
- { type: Location$1, decorators: [{ type: Inject, args: [Location$1,] }] },
315
- { type: UrlSerializer, decorators: [{ type: Inject, args: [UrlSerializer,] }] },
316
- { type: Array, decorators: [{ type: Inject, args: [TUI_DOC_DEMO_TEXTS,] }] }
317
- ]; };
318
- __decorate([
319
- ViewChild('content')
320
- ], TuiDocDemoComponent.prototype, "content", void 0);
321
- __decorate([
322
- ViewChild('wrapper')
323
- ], TuiDocDemoComponent.prototype, "wrapper", void 0);
324
- __decorate([
325
- ViewChild('resizerText')
326
- ], TuiDocDemoComponent.prototype, "resizerText", void 0);
327
- __decorate([
328
- Input()
329
- ], TuiDocDemoComponent.prototype, "control", void 0);
330
- __decorate([
331
- ContentChild(TemplateRef)
332
- ], TuiDocDemoComponent.prototype, "template", void 0);
333
- __decorate([
334
- HostListener('window:resize')
335
- ], TuiDocDemoComponent.prototype, "onResize", null);
336
- TuiDocDemoComponent = TuiDocDemoComponent_1 = __decorate([
337
- Component({
338
- selector: 'tui-doc-demo',
339
- template: "<div\n class=\"t-bg-toggle\"\n [tuiMode]=\"null\"\n>\n <ng-template #tooltip>\n {{ texts[0] }}\n <a\n tuiLink\n tuiMode=\"onDark\"\n routerLink=\"/directives/mode\"\n >\n <code>tuiMode</code>\n </a>\n </ng-template>\n <ng-container *ngIf=\"isMobile; else desktop\">\n <tui-select\n tuiTextfieldSize=\"s\"\n class=\"t-mode\"\n [tuiTextfieldCleaner]=\"true\"\n [tuiHintContent]=\"tooltip\"\n [formControl]=\"modeControl\"\n >\n tuiMode\n <tui-data-list-wrapper\n *tuiDataList\n [items]=\"items\"\n ></tui-data-list-wrapper>\n </tui-select>\n </ng-container>\n <ng-template #desktop>\n tuiMode:\n <tui-tooltip\n describeId=\"form\"\n [content]=\"tooltip\"\n ></tui-tooltip>\n <div\n tuiGroup\n class=\"t-group\"\n [collapsed]=\"true\"\n >\n <tui-radio-block\n size=\"s\"\n nativeId=\"form\"\n class=\"tui-group__auto-width-item\"\n [item]=\"null\"\n [hideRadio]=\"true\"\n [formControl]=\"modeControl\"\n >\n null\n </tui-radio-block>\n <tui-radio-block\n item=\"onDark\"\n size=\"s\"\n nativeId=\"form\"\n class=\"tui-group__auto-width-item\"\n [hideRadio]=\"true\"\n [formControl]=\"modeControl\"\n >\n onDark\n </tui-radio-block>\n <tui-radio-block\n item=\"onLight\"\n size=\"s\"\n nativeId=\"form\"\n class=\"tui-group__auto-width-item\"\n [hideRadio]=\"true\"\n [formControl]=\"modeControl\"\n >\n onLight\n </tui-radio-block>\n </div>\n </ng-template>\n <tui-checkbox-labeled\n size=\"m\"\n class=\"t-checkbox\"\n [(ngModel)]=\"opaque\"\n >\n {{ texts[1] }}\n </tui-checkbox-labeled>\n</div>\n<div\n #wrapper\n class=\"t-wrapper\"\n [class.t-wrapper_dark]=\"modeControl.value === 'onDark'\"\n [class.t-wrapper_gray]=\"modeControl.value === 'onLight'\"\n [class.t-wrapper_transparent]=\"!opaque\"\n>\n <div\n #content\n id=\"demoContent\"\n class=\"t-content\"\n >\n <form\n *ngIf=\"testForm\"\n class=\"t-form\"\n [formGroup]=\"testForm\"\n >\n <div class=\"t-input-wrapper\">\n <ng-container [ngTemplateOutlet]=\"template\"></ng-container>\n </div>\n <button\n tuiButton\n type=\"button\"\n size=\"s\"\n class=\"t-button\"\n [iconRight]=\"icon\"\n (click)=\"toggleDetails()\"\n >\n {{ texts[2] }}\n </button>\n <ng-template #icon>\n <tui-svg\n src=\"tuiIconChevronDown\"\n class=\"t-icon\"\n [class.t-icon_rotated]=\"expanded\"\n ></tui-svg>\n </ng-template>\n <tui-expand\n class=\"t-expand\"\n [expanded]=\"expanded\"\n >\n <ng-template tuiExpandContent>\n <pre class=\"t-value\">Form data: {{ testForm.value | json }}</pre>\n <div\n tuiGroup\n class=\"t-form-controls\"\n >\n <tui-select\n tuiTextfieldSize=\"s\"\n class=\"t-select\"\n [ngModel]=\"updateOn\"\n [ngModelOptions]=\"{standalone: true}\"\n (ngModelChange)=\"updateOnChange($event)\"\n >\n updateOn\n <tui-data-list-wrapper\n *tuiDataList\n [items]=\"updateOnVariants\"\n ></tui-data-list-wrapper>\n </tui-select>\n <button\n tuiButton\n type=\"reset\"\n size=\"s\"\n class=\"tui-group__auto-width-item\"\n >\n Reset\n </button>\n <button\n tuiButton\n type=\"submit\"\n size=\"s\"\n class=\"tui-group__auto-width-item\"\n >\n Submit\n </button>\n </div>\n </ng-template>\n </tui-expand>\n </form>\n <ng-content></ng-content>\n </div>\n <button\n tabindex=\"-1\"\n class=\"t-resizer\"\n (tuiDragStart)=\"onDragStart($event)\"\n (tuiDragContinues)=\"onDragContinues($event)\"\n (tuiDragEnd)=\"onDragEnd()\"\n >\n <span\n #resizerText\n class=\"t-resizer-text\"\n ></span>\n </button>\n</div>\n",
340
- changeDetection: ChangeDetectionStrategy.OnPush,
341
- providers: [
342
- TuiDestroyService,
343
- {
344
- provide: TuiModeDirective,
345
- useExisting: forwardRef(function () { return TuiDocDemoComponent_1; }),
346
- },
347
- ],
348
- styles: [":host{position:relative;display:block;min-width:100%;margin:1.5rem 0}.t-bg-toggle{position:absolute;bottom:calc(100% + .75rem);display:flex;align-items:center;justify-content:flex-end;pointer-events:none;width:100%}.t-bg-toggle>*{pointer-events:auto}.t-wrapper{box-shadow:0 .5rem 1rem rgba(0,0,0,.16);display:flex;border:1px solid var(--tui-base-03);border-radius:var(--tui-radius-m);max-width:100%;min-height:6rem;width:100%;background-color:var(--tui-base-01);overflow:hidden}.t-wrapper.t-wrapper_transparent{background-image:linear-gradient(45deg,var(--tui-base-02) 25%,transparent 25%),linear-gradient(-45deg,var(--tui-base-02) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,var(--tui-base-02) 75%),linear-gradient(-45deg,transparent 75%,var(--tui-base-02) 75%);background-size:1.25rem 1.25rem;background-position:0 0,0 .625rem,.625rem -.625rem,-.625rem 0}.t-wrapper.t-wrapper_dark{background-color:#454e58;color:var(--tui-base-01)}.t-wrapper.t-wrapper_gray{background-color:#e5e7ea}.t-wrapper.t-wrapper_dark.t-wrapper_transparent{background-image:linear-gradient(45deg,var(--tui-focus) 25%,transparent 25%),linear-gradient(-45deg,var(--tui-focus) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,var(--tui-focus) 75%),linear-gradient(-45deg,transparent 75%,var(--tui-focus) 75%)}.t-wrapper.t-wrapper_gray.t-wrapper_transparent{background-image:linear-gradient(45deg,var(--tui-base-05) 25%,transparent 25%),linear-gradient(-45deg,var(--tui-base-05) 25%,transparent 25%),linear-gradient(45deg,transparent 75%,var(--tui-base-05) 75%),linear-gradient(-45deg,transparent 75%,var(--tui-base-05) 75%)}:host-context(tui-root._mobile) .t-wrapper{min-height:auto}.t-content{flex:1 1 0;min-width:0;padding:1.5rem;box-sizing:border-box;overflow:hidden}:host-context(tui-root._mobile) .t-content{padding:1rem}.t-form{display:flex;flex-wrap:wrap;align-items:flex-start}.t-input-wrapper{width:100%;margin-bottom:.5rem}.t-expand{width:100%}.t-icon{transition-property:transform;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out}.t-icon_rotated{transform:rotate(180deg)}.t-value{flex:1;background:var(--tui-clear-inverse);padding:.75rem;border-radius:.25rem}.t-mode{width:12.5rem}.t-select{max-width:15rem}.t-resizer{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0;border:0;background:0 0;font-size:inherit;line-height:inherit;box-shadow:0 .5rem 1rem rgba(0,0,0,.16);position:relative;width:3.5rem;min-height:inherit;flex-shrink:0;border-left:1px solid var(--tui-base-03);cursor:col-resize;outline:0;background:var(--tui-base-01);color:var(--tui-text-01)}.t-resizer:after,.t-resizer:before{content:'';position:absolute;top:.75rem;left:50%;bottom:.75rem;width:1px;background:var(--tui-base-05)}.t-resizer:before{transform:translateX(.125rem)}.t-resizer:after{transform:translateX(-.1875rem)}:host-context(tui-root._mobile) .t-resizer{display:none}.t-resizer-text{font:var(--tui-font-text-s);position:relative;z-index:1;padding:.75rem;background:var(--tui-base-01)}.wrapper_light .t-resizer-text{background:#3e464e}.t-checkbox,.t-group{margin-left:.75rem}.t-button,.t-form-controls{margin-top:.75rem}@supports ((position:-webkit-sticky) or (position:sticky)){@media screen and (min-height:37.5rem){:host{position:-webkit-sticky;position:sticky;top:4.625rem;z-index:2}}}"]
349
- }),
350
- __param(0, Inject(TUI_IS_MOBILE)),
351
- __param(1, Inject(TuiDestroyService)),
352
- __param(2, Inject(Renderer2)),
353
- __param(3, Inject(PLATFORM_ID)),
354
- __param(4, Inject(Location$1)),
355
- __param(5, Inject(UrlSerializer)),
356
- __param(6, Inject(TUI_DOC_DEMO_TEXTS))
357
- ], TuiDocDemoComponent);
358
- return TuiDocDemoComponent;
359
- }());
360
-
361
- var TuiDocDemoModule = /** @class */ (function () {
362
- function TuiDocDemoModule() {
363
- }
364
- TuiDocDemoModule = __decorate([
365
- NgModule({
366
- imports: [
367
- CommonModule,
368
- ReactiveFormsModule,
369
- FormsModule,
370
- RouterModule,
371
- TuiLinkModule,
372
- TuiDragModule,
373
- TuiButtonModule,
374
- TuiSelectModule,
375
- TuiExpandModule,
376
- TuiGroupModule,
377
- TuiTooltipModule,
378
- TuiModeModule,
379
- TuiRadioBlockModule,
380
- TuiCheckboxLabeledModule,
381
- TuiSvgModule,
382
- TuiDataListWrapperModule,
383
- TuiDataListModule,
384
- TuiTextfieldControllerModule,
385
- TuiHintControllerModule,
386
- ],
387
- declarations: [TuiDocDemoComponent],
388
- exports: [TuiDocDemoComponent],
389
- })
390
- ], TuiDocDemoModule);
391
- return TuiDocDemoModule;
392
- }());
393
-
394
- /**
395
- * TODO: duplicate, need fix it before v3
396
- * TODO: move another package for reuse between addon-editor and addon-doc
397
- * @deprecated: use {@link tuiRgbToHex} instead
398
- */
399
- // eslint-disable-next-line @typescript-eslint/naming-convention
400
- function rgbToHex(r, g, b) {
401
- return "#" + [r, g, b].map(function (x) { return x.toString(16).padStart(2, '0'); }).join('');
402
- }
403
- var tuiRgbToHex = rgbToHex;
404
- /**
405
- * @deprecated: use {@link tuiHexToRgb} instead
406
- */
407
- // eslint-disable-next-line @typescript-eslint/naming-convention
408
- function hexToRgb(hex) {
409
- var matches = hex
410
- .replace('#', '')
411
- .split('')
412
- .map(function (char, _, array) { return (array.length === 3 ? char + char : char); })
413
- .join('')
414
- .match(/.{2}/g);
415
- return matches
416
- ? matches.map(function (x) { return Number.parseInt(x, 16); })
417
- : [0, 0, 0];
418
- }
419
- var tuiHexToRgb = hexToRgb;
420
-
421
- function inspectArray(array, depth) {
422
- if (depth === 0) {
423
- return '[…]';
424
- }
425
- var result = '';
426
- var first = true;
427
- for (var index = 0; index < array.length; index++) {
428
- if (first) {
429
- first = false;
430
- }
431
- else {
432
- result += ', ';
433
- }
434
- result += index in array ? inspectAny(array[index], depth - 1) : 'empty';
435
- }
436
- return "[" + result + "]";
437
- }
438
- function inspectObject(object, depth) {
439
- if (depth === 0) {
440
- return "{\u2026}";
441
- }
442
- var result = '';
443
- var first = true;
444
- for (var key in object) {
445
- if (!object.hasOwnProperty(key)) {
446
- continue;
447
- }
448
- if (first) {
449
- first = false;
450
- }
451
- else {
452
- result += ', ';
453
- }
454
- result += key + ": " + inspectAny(object[key], depth - 1);
455
- }
456
- return "{" + result + "}";
457
- }
458
- /**
459
- * @deprecated: use {@link tuiInspectAny} instead
460
- * Returns readable JS entity
461
- * @param data
462
- * @param depth
463
- * @return readable JS entity
464
- */
465
- // eslint-disable-next-line @typescript-eslint/naming-convention
466
- function inspectAny(data, depth) {
467
- if (data === null) {
468
- return 'null';
469
- }
470
- switch (typeof data) {
471
- case 'string':
472
- return "'" + data + "'";
473
- case 'undefined':
474
- case 'number':
475
- case 'boolean':
476
- case 'function':
477
- return String(data);
478
- }
479
- if (data instanceof RegExp) {
480
- return String(data);
481
- }
482
- if (Array.isArray(data)) {
483
- return inspectArray(data, depth);
484
- }
485
- return inspectObject(data, depth);
486
- }
487
- var tuiInspectAny = inspectAny;
488
-
489
- /**
490
- * @deprecated: use {@link tuiCoerceValue} instead
491
- */
492
- // eslint-disable-next-line @typescript-eslint/naming-convention
493
- function coerceValue(value) {
494
- var prepared = String(value).trim();
495
- if (isEmptyParamValue(prepared)) {
496
- return null;
497
- }
498
- else if (isBooleanParamValue(prepared)) {
499
- return String(prepared) === 'true';
500
- }
501
- else if (isNumberParamValue(prepared)) {
502
- return Number(prepared);
503
- }
504
- var decodedValue = decodeURIComponent(prepared);
505
- try {
506
- return isPossibleArray(decodedValue) || isPossibleObject(decodedValue)
507
- ? JSON.parse(decodedValue)
508
- : decodedValue;
509
- }
510
- catch (_a) {
511
- return decodedValue;
512
- }
513
- }
514
- var tuiCoerceValue = coerceValue;
515
- function isEmptyParamValue(value) {
516
- return ['undefined', 'null', 'NaN', 'Infinity'].includes(value);
517
- }
518
- function isBooleanParamValue(value) {
519
- return value === 'true' || value === 'false';
520
- }
521
- function isNumberParamValue(value) {
522
- // TODO: investigate to disallow potentially catastrophic exponential-time regular expressions.
523
- // eslint-disable-next-line unicorn/no-unsafe-regex
524
- return /^-?[\d.]+(?:e-?\d+)?$/.test(value);
525
- }
526
- function isPossibleArray(value) {
527
- return value.startsWith('[') && value.endsWith(']');
528
- }
529
- function isPossibleObject(value) {
530
- return value.startsWith('{') && value.endsWith('}');
531
- }
532
-
533
- var SERIALIZED_SUFFIX = '$';
534
- // @bad TODO: refactor output and value sync
535
- var TuiDocDocumentationPropertyConnectorDirective = /** @class */ (function () {
536
- function TuiDocDocumentationPropertyConnectorDirective(template, locationRef, activatedRoute, urlSerializer) {
537
- this.template = template;
538
- this.locationRef = locationRef;
539
- this.activatedRoute = activatedRoute;
540
- this.urlSerializer = urlSerializer;
541
- this.documentationPropertyName = '';
542
- this.documentationPropertyMode = null;
543
- this.documentationPropertyType = '';
544
- this.documentationPropertyDeprecated = false;
545
- this.documentationPropertyValues = null;
546
- this.documentationPropertyValueChange = new EventEmitter();
547
- this.changed$ = new Subject();
548
- this.emits$ = new BehaviorSubject(1);
549
- }
550
- TuiDocDocumentationPropertyConnectorDirective.prototype.ngOnInit = function () {
551
- this.parseParams(this.activatedRoute.snapshot.queryParams);
552
- };
553
- Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "attrName", {
554
- get: function () {
555
- switch (this.documentationPropertyMode) {
556
- case 'input':
557
- return "[" + this.documentationPropertyName + "]";
558
- case 'output':
559
- return "(" + this.documentationPropertyName + ")";
560
- case 'input-output':
561
- return "[(" + this.documentationPropertyName + ")]";
562
- default:
563
- return this.documentationPropertyName;
564
- }
565
- },
566
- enumerable: true,
567
- configurable: true
568
- });
569
- Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "hasItems", {
570
- get: function () {
571
- return !!this.documentationPropertyValues;
572
- },
573
- enumerable: true,
574
- configurable: true
575
- });
576
- Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "shouldShowValues", {
577
- get: function () {
578
- return this.documentationPropertyMode !== 'output';
579
- },
580
- enumerable: true,
581
- configurable: true
582
- });
583
- TuiDocDocumentationPropertyConnectorDirective.prototype.ngOnChanges = function () {
584
- this.changed$.next();
585
- };
586
- TuiDocDocumentationPropertyConnectorDirective.prototype.onValueChange = function (value) {
587
- this.documentationPropertyValue = value;
588
- this.documentationPropertyValueChange.emit(value);
589
- this.setQueryParam(value);
590
- };
591
- TuiDocDocumentationPropertyConnectorDirective.prototype.emitEvent = function (event) {
592
- // For more convenient debugging
593
- console.info(this.attrName, event);
594
- this.emits$.next(this.emits$.value + 1);
595
- };
596
- TuiDocDocumentationPropertyConnectorDirective.prototype.parseParams = function (params) {
597
- var propertyValue = params[this.documentationPropertyName];
598
- var propertyValueWithSuffix = params["" + this.documentationPropertyName + SERIALIZED_SUFFIX];
599
- if (!propertyValue && !propertyValueWithSuffix) {
600
- return;
601
- }
602
- var value = !!propertyValueWithSuffix && this.documentationPropertyValues
603
- ? this.documentationPropertyValues[propertyValueWithSuffix]
604
- : coerceValue(propertyValue);
605
- this.onValueChange(value);
606
- };
607
- TuiDocDocumentationPropertyConnectorDirective.prototype.setQueryParam = function (value) {
608
- var _a;
609
- var tree = this.urlSerializer.parse(this.locationRef.path());
610
- var isValueAvailableByKey = value instanceof Object;
611
- var computedValue = isValueAvailableByKey && this.documentationPropertyValues
612
- ? this.documentationPropertyValues.indexOf(value)
613
- : value;
614
- var suffix = isValueAvailableByKey ? SERIALIZED_SUFFIX : '';
615
- var propName = this.documentationPropertyName + suffix;
616
- tree.queryParams = __assign(__assign({}, tree.queryParams), (_a = {}, _a[propName] = computedValue, _a));
617
- this.locationRef.go(String(tree));
618
- };
619
- TuiDocDocumentationPropertyConnectorDirective.ctorParameters = function () { return [
620
- { type: TemplateRef, decorators: [{ type: Inject, args: [TemplateRef,] }] },
621
- { type: Location$1, decorators: [{ type: Inject, args: [Location$1,] }] },
622
- { type: ActivatedRoute, decorators: [{ type: Inject, args: [ActivatedRoute,] }] },
623
- { type: UrlSerializer, decorators: [{ type: Inject, args: [UrlSerializer,] }] }
624
- ]; };
625
- __decorate([
626
- Input()
627
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyName", void 0);
628
- __decorate([
629
- Input()
630
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyMode", void 0);
631
- __decorate([
632
- Input()
633
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyType", void 0);
634
- __decorate([
635
- Input()
636
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValue", void 0);
637
- __decorate([
638
- Input()
639
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyDeprecated", void 0);
640
- __decorate([
641
- Input()
642
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValues", void 0);
643
- __decorate([
644
- Output()
645
- ], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValueChange", void 0);
646
- TuiDocDocumentationPropertyConnectorDirective = __decorate([
647
- Directive({
648
- selector: 'ng-template[documentationPropertyName]',
649
- exportAs: 'documentationProperty',
650
- }),
651
- __param(0, Inject(TemplateRef)),
652
- __param(1, Inject(Location$1)),
653
- __param(2, Inject(ActivatedRoute)),
654
- __param(3, Inject(UrlSerializer))
655
- ], TuiDocDocumentationPropertyConnectorDirective);
656
- return TuiDocDocumentationPropertyConnectorDirective;
657
- }());
658
-
659
- // @bad TODO subscribe propertiesConnectors changes
660
- // @bad TODO refactor to make more flexible
661
- // @dynamic
662
- var TuiDocDocumentationComponent = /** @class */ (function () {
663
- function TuiDocDocumentationComponent(changeDetectorRef, texts) {
664
- this.changeDetectorRef = changeDetectorRef;
665
- this.texts = texts;
666
- this.heading = '';
667
- this.showValues = true;
668
- this.isAPI = false;
669
- this.propertiesConnectors = EMPTY_QUERY;
670
- this.activeItemIndex = 0;
671
- }
672
- TuiDocDocumentationComponent.prototype.ngAfterContentInit = function () {
673
- itemsQueryListObservable(this.propertiesConnectors)
674
- .pipe(switchMap(function (items) { return merge.apply(void 0, __spread(items.map(function (_a) {
675
- var changed$ = _a.changed$;
676
- return changed$;
677
- }))); }), watch(this.changeDetectorRef))
678
- .subscribe();
679
- };
680
- Object.defineProperty(TuiDocDocumentationComponent.prototype, "type", {
681
- get: function () {
682
- return this.isAPI ? this.texts[0] : this.texts[1];
683
- },
684
- enumerable: true,
685
- configurable: true
686
- });
687
- TuiDocDocumentationComponent.prototype.getColor = function (color) {
688
- if (color.length === 4) {
689
- return color
690
- .split('')
691
- .reduce(function (result, current) { return __spread(result, [current, current]); }, [])
692
- .join('')
693
- .replace('#', '');
694
- }
695
- if (color.startsWith('#')) {
696
- return color;
697
- }
698
- if (color === 'transparent') {
699
- return '#000000';
700
- }
701
- var parsed = color
702
- .replace('rgb(', '')
703
- .replace('rgba(', '')
704
- .replace(')', '')
705
- .replace(' ', '')
706
- .split(',')
707
- .map(function (v) { return Number.parseInt(v, 10); });
708
- return rgbToHex.apply(void 0, __spread(parsed));
709
- };
710
- TuiDocDocumentationComponent.prototype.getOpacity = function (color) {
711
- if (color.startsWith('#') || color.startsWith('rgb(')) {
712
- return 100;
713
- }
714
- if (color === 'transparent') {
715
- return 0;
716
- }
717
- var lastComma = color.lastIndexOf(',');
718
- var parsed = color
719
- .slice(lastComma)
720
- .replace(')', '')
721
- .replace(' ', '')
722
- .replace(',', '');
723
- return Math.round(Number.parseFloat(parsed) * 100);
724
- };
725
- TuiDocDocumentationComponent.prototype.onColorChange = function (connector, color) {
726
- var opacity = this.getOpacity(connector.documentationPropertyValue || '');
727
- if (opacity === 100) {
728
- connector.onValueChange(color);
729
- return;
730
- }
731
- var rgb = hexToRgb(color).join(', ');
732
- var result = "rgba(" + rgb + ", " + opacity / 100 + ")";
733
- connector.onValueChange(result);
734
- };
735
- TuiDocDocumentationComponent.prototype.onOpacityChange = function (connector, opacity) {
736
- var hex = this.getColor(connector.documentationPropertyValue || '');
737
- var rgb = hexToRgb(hex);
738
- var result = "rgba(" + rgb + ", " + opacity / 100 + ")";
739
- connector.onValueChange(result);
740
- };
741
- TuiDocDocumentationComponent.prototype.stripOptional = function (name) {
742
- return name.replace('?', '');
743
- };
744
- TuiDocDocumentationComponent.prototype.isOptional = function (name) {
745
- return name.includes('?');
746
- };
747
- TuiDocDocumentationComponent.prototype.isPrimitivePolymorpheusContent = function (value) {
748
- return typeof value === 'string' || typeof value === 'number';
749
- };
750
- TuiDocDocumentationComponent.prototype.showCleaner = function (type) {
751
- return type.includes('null');
752
- };
753
- TuiDocDocumentationComponent.prototype.showContentTooltip = function (type) {
754
- return type.includes('PolymorpheusContent');
755
- };
756
- TuiDocDocumentationComponent.prototype.inspectAny = function (data) {
757
- return inspectAny(data, 2);
758
- };
759
- TuiDocDocumentationComponent.ctorParameters = function () { return [
760
- { type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] },
761
- { type: Array, decorators: [{ type: Inject, args: [TUI_DOC_DOCUMENTATION_TEXTS,] }] }
762
- ]; };
763
- __decorate([
764
- Input()
765
- ], TuiDocDocumentationComponent.prototype, "heading", void 0);
766
- __decorate([
767
- Input()
768
- ], TuiDocDocumentationComponent.prototype, "showValues", void 0);
769
- __decorate([
770
- Input()
771
- ], TuiDocDocumentationComponent.prototype, "isAPI", void 0);
772
- __decorate([
773
- ContentChildren(TuiDocDocumentationPropertyConnectorDirective)
774
- ], TuiDocDocumentationComponent.prototype, "propertiesConnectors", void 0);
775
- TuiDocDocumentationComponent = __decorate([
776
- Component({
777
- selector: 'tui-doc-documentation',
778
- template: "<h1\n *ngIf=\"heading\"\n class=\"t-heading\"\n>\n {{ heading }}\n</h1>\n<ng-content></ng-content>\n<table class=\"t-table\">\n <tr class=\"t-row t-row_header\">\n <th class=\"t-th t-cell t-cell_prop\">{{ texts[2] }}</th>\n <th class=\"t-th\">{{ type }}</th>\n <th\n *ngIf=\"showValues && !isAPI\"\n class=\"t-th t-cell t-cell_value\"\n >\n {{ texts[3] }}\n </th>\n </tr>\n <tr\n *ngFor=\"let propertyConnector of propertiesConnectors\"\n class=\"t-row\"\n [class.t-deprecated]=\"propertyConnector.documentationPropertyDeprecated\"\n >\n <td class=\"t-cell\">\n <div\n automation-id=\"tui-documentation__property-name\"\n class=\"t-property\"\n >\n {{ stripOptional(propertyConnector.attrName) }}\n <tui-badge\n *ngIf=\"isOptional(propertyConnector.attrName)\"\n size=\"s\"\n value=\"Optional\"\n ></tui-badge>\n </div>\n <span\n *ngIf=\"propertyConnector.documentationPropertyDeprecated\"\n class=\"t-deprecated-label\"\n >\n deprecated\n </span>\n <ng-container [ngTemplateOutlet]=\"propertyConnector.template\"></ng-container>\n </td>\n <td class=\"t-cell\">\n <span class=\"type\">\n {{ propertyConnector.documentationPropertyType }}\n <tui-tooltip\n *ngIf=\"showContentTooltip(propertyConnector.documentationPropertyType)\"\n [describeId]=\"propertyConnector.attrName\"\n [content]=\"content\"\n >\n <ng-template #content>\n {{ texts[4] }}\n <a\n tuiLink\n tuiMode=\"onDark\"\n target=\"_blank\"\n href=\"https://github.com/tinkoff/ng-polymorpheus\"\n >\n <code>ng-polymorpheus</code>\n </a>\n </ng-template>\n </tui-tooltip>\n </span>\n </td>\n <td\n *ngIf=\"showValues\"\n class=\"t-cell\"\n >\n <ng-container *ngIf=\"propertyConnector.shouldShowValues; else elseEmitter\">\n <tui-select\n *ngIf=\"propertyConnector.hasItems; else noItems\"\n tuiTextfieldSize=\"m\"\n tuiDropdownLimitWidth=\"min\"\n [tuiTextfieldCleaner]=\"showCleaner(propertyConnector.documentationPropertyType)\"\n [tuiTextfieldLabelOutside]=\"true\"\n [nativeId]=\"propertyConnector.attrName\"\n [valueContent]=\"selectContent\"\n [ngModel]=\"propertyConnector.documentationPropertyValue\"\n (ngModelChange)=\"propertyConnector.onValueChange($event)\"\n >\n <code class=\"t-exception\">null</code>\n <tui-data-list-wrapper\n *tuiDataList\n [items]=\"propertyConnector.documentationPropertyValues\"\n [itemContent]=\"selectContent\"\n ></tui-data-list-wrapper>\n </tui-select>\n <ng-template\n #selectContent\n let-data\n >\n <code>{{ inspectAny(data) }}</code>\n </ng-template>\n\n <ng-template #noItems>\n <ng-container [ngSwitch]=\"propertyConnector.documentationPropertyType\">\n <tui-toggle\n *ngSwitchCase=\"'boolean'\"\n size=\"l\"\n [nativeId]=\"propertyConnector.attrName\"\n [showIcons]=\"true\"\n [ngModel]=\"propertyConnector.documentationPropertyValue\"\n (ngModelChange)=\"propertyConnector.onValueChange($event)\"\n ></tui-toggle>\n\n <tui-primitive-textfield\n *ngSwitchCase=\"'string'\"\n tuiTextfieldSize=\"m\"\n [nativeId]=\"propertyConnector.attrName\"\n [tuiTextfieldLabelOutside]=\"true\"\n [tuiTextfieldCleaner]=\"true\"\n [value]=\"propertyConnector.documentationPropertyValue || ''\"\n (valueChange)=\"propertyConnector.onValueChange($event)\"\n ></tui-primitive-textfield>\n\n <div\n *ngSwitchCase=\"'color'\"\n tuiGroup\n >\n <tui-primitive-textfield\n tuiTextfieldType=\"text\"\n tuiTextfieldSize=\"m\"\n [attr.id]=\"propertyConnector.attrName\"\n [tuiTextfieldLabelOutside]=\"true\"\n [tuiInputOpacity]=\"getOpacity(propertyConnector.documentationPropertyValue)\"\n [value]=\"getColor(propertyConnector.documentationPropertyValue)\"\n (valueChange)=\"onColorChange(propertyConnector, $event)\"\n ></tui-primitive-textfield>\n <tui-input-count\n tuiTextfieldSize=\"m\"\n [max]=\"100\"\n [ngModel]=\"getOpacity(propertyConnector.documentationPropertyValue)\"\n (ngModelChange)=\"onOpacityChange(propertyConnector, $event)\"\n >\n Opacity\n </tui-input-count>\n </div>\n\n <tui-input-count\n *ngSwitchCase=\"'number'\"\n tuiTextfieldSize=\"m\"\n [nativeId]=\"propertyConnector.attrName\"\n [tuiTextfieldLabelOutside]=\"true\"\n [ngModel]=\"propertyConnector.documentationPropertyValue\"\n (ngModelChange)=\"propertyConnector.onValueChange($event)\"\n ></tui-input-count>\n\n <ng-container *ngSwitchCase=\"'PolymorpheusContent'\">\n <tui-primitive-textfield\n *ngIf=\"isPrimitivePolymorpheusContent(propertyConnector.documentationPropertyValue)\"\n tuiTextfieldSize=\"m\"\n [nativeId]=\"propertyConnector.attrName\"\n [tuiTextfieldLabelOutside]=\"true\"\n [tuiTextfieldCleaner]=\"true\"\n [value]=\"propertyConnector.documentationPropertyValue.toString()\"\n (valueChange)=\"propertyConnector.onValueChange($event)\"\n >\n Default content\n </tui-primitive-textfield>\n </ng-container>\n </ng-container>\n </ng-template>\n </ng-container>\n\n <ng-template #elseEmitter>\n <tui-notification\n class=\"t-output\"\n [@emitEvent]=\"propertyConnector.emits$ | async\"\n >\n Emit!\n </tui-notification>\n </ng-template>\n </td>\n </tr>\n</table>\n",
779
- changeDetection: ChangeDetectionStrategy.OnPush,
780
- animations: [
781
- trigger('emitEvent', [
782
- transition(':increment', [style({ opacity: 1 }), animate('500ms ease-in')]),
783
- ]),
784
- ],
785
- styles: [":host{display:block;min-width:100%}.t-table{width:100%;table-layout:fixed}.t-row:not(:last-child){border-bottom:1px solid var(--tui-base-03)}:host-context(tui-root._mobile) .t-row{display:flex;flex-wrap:wrap}:host-context(tui-root._mobile) .t-row_header{display:none}.t-cell{padding:1rem 1rem .875rem}.t-cell:first-child{padding-left:0}.t-cell:last-child{padding-right:0;text-align:right}.t-cell_prop{width:40%}.t-cell_value{max-width:20rem}:host-context(tui-root._mobile) .t-cell_value{width:9.375rem}:host-context(tui-root._mobile) .t-cell{width:100%;height:auto;padding:.5rem 0;text-align:left}.t-th{padding:.5rem 1rem;color:var(--tui-text-02);font-weight:400;text-align:left}.t-property{font:var(--tui-font-text-m);margin-bottom:.25rem;font-family:monospace;color:#8f75d1}:host-context(tui-root._mobile) .t-property{padding:.5rem 0}.t-type{font-family:monospace}.t-deprecated{background-color:var(--tui-error-bg);box-shadow:-1rem 0 var(--tui-error-bg),1rem 0 var(--tui-error-bg)}.t-deprecated-label{margin-right:.125rem;color:var(--tui-error-fill)}.t-exception{display:block;width:-webkit-max-content;width:-moz-max-content;width:max-content}.t-output{text-align:left;opacity:0}.t-heading{font:var(--tui-font-heading-4)}"]
786
- }),
787
- __param(0, Inject(ChangeDetectorRef)),
788
- __param(1, Inject(TUI_DOC_DOCUMENTATION_TEXTS))
789
- ], TuiDocDocumentationComponent);
790
- return TuiDocDocumentationComponent;
791
- }());
792
-
793
- var TuiInputOpacityDirective = /** @class */ (function () {
794
- function TuiInputOpacityDirective(renderer, tuiFocusableComponent) {
795
- this.renderer = renderer;
796
- this.tuiFocusableComponent = tuiFocusableComponent;
797
- }
798
- Object.defineProperty(TuiInputOpacityDirective.prototype, "tuiInputOpacity", {
799
- set: function (opacity) {
800
- var nativeFocusableElement = this.tuiFocusableComponent.nativeFocusableElement;
801
- if (nativeFocusableElement) {
802
- this.renderer.setStyle(nativeFocusableElement, 'opacity', opacity / 100);
803
- }
804
- },
805
- enumerable: true,
806
- configurable: true
807
- });
808
- TuiInputOpacityDirective.ctorParameters = function () { return [
809
- { type: Renderer2, decorators: [{ type: Inject, args: [Renderer2,] }] },
810
- { type: undefined, decorators: [{ type: Inject, args: [TUI_FOCUSABLE_ITEM_ACCESSOR,] }] }
811
- ]; };
812
- __decorate([
813
- Input()
814
- ], TuiInputOpacityDirective.prototype, "tuiInputOpacity", null);
815
- TuiInputOpacityDirective = __decorate([
816
- Directive({
817
- selector: '[tuiInputOpacity]',
818
- }),
819
- __param(0, Inject(Renderer2)),
820
- __param(1, Inject(TUI_FOCUSABLE_ITEM_ACCESSOR))
821
- ], TuiInputOpacityDirective);
822
- return TuiInputOpacityDirective;
823
- }());
824
-
825
- var TuiInputOpacityModule = /** @class */ (function () {
826
- function TuiInputOpacityModule() {
827
- }
828
- TuiInputOpacityModule = __decorate([
829
- NgModule({
830
- declarations: [TuiInputOpacityDirective],
831
- exports: [TuiInputOpacityDirective],
832
- })
833
- ], TuiInputOpacityModule);
834
- return TuiInputOpacityModule;
835
- }());
836
-
837
- var TuiDocDocumentationModule = /** @class */ (function () {
838
- function TuiDocDocumentationModule() {
839
- }
840
- TuiDocDocumentationModule = __decorate([
841
- NgModule({
842
- imports: [
843
- CommonModule,
844
- FormsModule,
845
- RouterModule,
846
- TuiBadgeModule,
847
- TuiSelectModule,
848
- TuiToggleModule,
849
- TuiTooltipModule,
850
- TuiLinkModule,
851
- TuiInputCountModule,
852
- TuiModeModule,
853
- TuiGroupModule,
854
- TuiInputOpacityModule,
855
- TuiPrimitiveTextfieldModule,
856
- TuiTextfieldControllerModule,
857
- TuiHintControllerModule,
858
- TuiDropdownControllerModule,
859
- TuiDataListModule,
860
- TuiDataListWrapperModule,
861
- TuiNotificationModule,
862
- ],
863
- declarations: [
864
- TuiDocDocumentationComponent,
865
- TuiDocDocumentationPropertyConnectorDirective,
866
- ],
867
- exports: [
868
- TuiDocDocumentationComponent,
869
- TuiDocDocumentationPropertyConnectorDirective,
870
- ],
871
- })
872
- ], TuiDocDocumentationModule);
873
- return TuiDocDocumentationModule;
874
- }());
875
-
876
- var TUI_DOC_CODE_ACTIONS = new InjectionToken('Code actions for the opened tab with code example', {
877
- factory: function () { return ''; },
878
- });
879
-
880
- var TUI_DOC_CODE_EDITOR = new InjectionToken('Contains service for opening online IDE e.g. Stackblitz');
881
-
882
- var TUI_DOC_EXAMPLE_CONTENT_PROCESSOR = new InjectionToken('Processes content in example', { factory: function () { return identity; } });
883
-
884
- /**
885
- * @deprecated: use {@link tuiRawLoadRecord} instead
886
- */
887
- // eslint-disable-next-line @typescript-eslint/naming-convention
888
- function rawLoadRecord(example) {
889
- return __awaiter(this, void 0, void 0, function () {
890
- var processedContent, _a, _b, _c, key, content, _d, _e, e_1_1;
891
- var e_1, _f;
892
- return __generator(this, function (_g) {
893
- switch (_g.label) {
894
- case 0:
895
- processedContent = {};
896
- _g.label = 1;
897
- case 1:
898
- _g.trys.push([1, 6, 7, 8]);
899
- _a = __values(Object.entries(example)), _b = _a.next();
900
- _g.label = 2;
901
- case 2:
902
- if (!!_b.done) return [3 /*break*/, 5];
903
- _c = __read(_b.value, 2), key = _c[0], content = _c[1];
904
- if (!content) return [3 /*break*/, 4];
905
- _d = processedContent;
906
- _e = key;
907
- return [4 /*yield*/, rawLoad(content)];
908
- case 3:
909
- _d[_e] = _g.sent();
910
- _g.label = 4;
911
- case 4:
912
- _b = _a.next();
913
- return [3 /*break*/, 2];
914
- case 5: return [3 /*break*/, 8];
915
- case 6:
916
- e_1_1 = _g.sent();
917
- e_1 = { error: e_1_1 };
918
- return [3 /*break*/, 8];
919
- case 7:
920
- try {
921
- if (_b && !_b.done && (_f = _a.return)) _f.call(_a);
922
- }
923
- finally { if (e_1) throw e_1.error; }
924
- return [7 /*endfinally*/];
925
- case 8: return [2 /*return*/, processedContent];
926
- }
927
- });
928
- });
929
- }
930
- var tuiRawLoadRecord = rawLoadRecord;
931
-
932
- // Ambient type cannot be used without dynamic https://github.com/angular/angular/issues/23395
933
- // @dynamic
934
- var TuiDocExampleComponent = /** @class */ (function () {
935
- function TuiDocExampleComponent(id, clipboard, notifications, location, copyTexts$, texts, codeEditor, processContent, isCypress, codeActions, router, route, ngLocation) {
936
- var _this = this;
937
- this.id = id;
938
- this.clipboard = clipboard;
939
- this.notifications = notifications;
940
- this.location = location;
941
- this.copyTexts$ = copyTexts$;
942
- this.texts = texts;
943
- this.codeEditor = codeEditor;
944
- this.processContent = processContent;
945
- this.isCypress = isCypress;
946
- this.codeActions = codeActions;
947
- this.router = router;
948
- this.route = route;
949
- this.ngLocation = ngLocation;
950
- this.rawLoader$$ = new BehaviorSubject({});
951
- this.heading = '';
952
- this.description = '';
953
- this.componentName = this.location.pathname.slice(1);
954
- this.defaultTabIndex = 0;
955
- this.defaultTab = this.texts[this.defaultTabIndex];
956
- this.activeItemIndex = this.defaultTabIndex;
957
- this.copy$ = this.copyTexts$.pipe(map(function (_a) {
958
- var _b = __read(_a, 1), copy = _b[0];
959
- return copy;
960
- }));
961
- this.processor$ = this.rawLoader$$.pipe(switchMap(rawLoadRecord), map(function (value) { return _this.processContent(value); }));
962
- this.loading$ = new Subject();
963
- }
964
- Object.defineProperty(TuiDocExampleComponent.prototype, "content", {
965
- set: function (content) {
966
- this.rawLoader$$.next(content);
967
- },
968
- enumerable: true,
969
- configurable: true
970
- });
971
- TuiDocExampleComponent.prototype.copyExampleLink = function () {
972
- var hashPosition = this.location.href.indexOf('#');
973
- var currentUrl = hashPosition > -1
974
- ? this.location.href.slice(0, Math.max(0, hashPosition))
975
- : this.location.href;
976
- var url = currentUrl + "#" + this.id;
977
- this.setFragmentWithoutRedirect(this.id);
978
- this.clipboard.copy(url);
979
- this.notifications
980
- .show(this.texts[1], {
981
- label: this.texts[2],
982
- status: "success" /* Success */,
983
- })
984
- .subscribe();
985
- };
986
- TuiDocExampleComponent.prototype.edit = function (files) {
987
- var _this = this;
988
- var _a, _b;
989
- this.loading$.next(true);
990
- (_a = this.codeEditor) === null || _a === void 0 ? void 0 : _a.edit(this.componentName, (_b = this.id) !== null && _b !== void 0 ? _b : '', files).finally(function () { return _this.loading$.next(false); });
991
- };
992
- TuiDocExampleComponent.prototype.setFragmentWithoutRedirect = function (id) {
993
- var url = this.router
994
- .createUrlTree([], { relativeTo: this.route, fragment: id || '' })
995
- .toString();
996
- this.ngLocation.go(url);
997
- };
998
- TuiDocExampleComponent.ctorParameters = function () { return [
999
- { type: String, decorators: [{ type: Attribute, args: ['id',] }] },
1000
- { type: Clipboard, decorators: [{ type: Inject, args: [Clipboard,] }] },
1001
- { type: TuiNotificationsService, decorators: [{ type: Inject, args: [TuiNotificationsService,] }] },
1002
- { type: Location, decorators: [{ type: Inject, args: [LOCATION,] }] },
1003
- { type: Observable, decorators: [{ type: Inject, args: [TUI_COPY_TEXTS,] }] },
1004
- { type: Array, decorators: [{ type: Inject, args: [TUI_DOC_EXAMPLE_TEXTS,] }] },
1005
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [TUI_DOC_CODE_EDITOR,] }] },
1006
- { type: undefined, decorators: [{ type: Inject, args: [TUI_DOC_EXAMPLE_CONTENT_PROCESSOR,] }] },
1007
- { type: Boolean, decorators: [{ type: Inject, args: [TUI_IS_CYPRESS,] }] },
1008
- { type: Array, decorators: [{ type: Inject, args: [TUI_DOC_CODE_ACTIONS,] }] },
1009
- { type: Router, decorators: [{ type: Inject, args: [Router,] }] },
1010
- { type: ActivatedRoute, decorators: [{ type: Inject, args: [ActivatedRoute,] }] },
1011
- { type: Location$1, decorators: [{ type: Inject, args: [Location$1,] }] }
1012
- ]; };
1013
- __decorate([
1014
- Input()
1015
- ], TuiDocExampleComponent.prototype, "heading", void 0);
1016
- __decorate([
1017
- Input()
1018
- ], TuiDocExampleComponent.prototype, "description", void 0);
1019
- __decorate([
1020
- Input()
1021
- ], TuiDocExampleComponent.prototype, "content", null);
1022
- __decorate([
1023
- Input()
1024
- ], TuiDocExampleComponent.prototype, "componentName", void 0);
1025
- TuiDocExampleComponent = __decorate([
1026
- Component({
1027
- selector: 'tui-doc-example',
1028
- template: "<h3\n *ngIf=\"heading\"\n class=\"t-title\"\n>\n <span\n polymorpheus-outlet\n [content]=\"heading | tuiDocExampleCapitalize\"\n ></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 | tuiDocExampleCapitalize\"\n></h4>\n\n<div\n *ngIf=\"processor$ | async as files\"\n class=\"t-example\"\n>\n <ng-container *ngIf=\"files | 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\n *tuiTab\n tuiTab\n >\n {{ tab }}\n </button>\n </ng-container>\n </tui-tabs-with-more>\n\n <button\n *ngIf=\"codeEditor\"\n tuiButton\n appearance=\"flat\"\n size=\"s\"\n [showLoader]=\"!!(loading$ | async)\"\n (click)=\"edit(files)\"\n >\n Edit on {{ codeEditor.name }}\n </button>\n </div>\n\n <div\n *ngFor=\"let tab of tabs; let index = index\"\n class=\"t-content\"\n [class.t-content_animated]=\"!isCypress\"\n [class.t-content_visible]=\"activeItemIndex === index\"\n >\n <ng-container\n *ngIf=\"index === defaultTabIndex; else anotherTab\"\n [ngTemplateOutlet]=\"preview\"\n ></ng-container>\n <ng-template #anotherTab>\n <ng-container\n [ngTemplateOutlet]=\"codeSection\"\n [ngTemplateOutletContext]=\"{$implicit: files[tabs[activeItemIndex]] || ''}\"\n ></ng-container>\n </ng-template>\n </div>\n </ng-container>\n</div>\n\n<ng-template #preview>\n <div\n automation-id=\"tui-doc-example\"\n class=\"t-demo\"\n >\n <ng-content></ng-content>\n </div>\n</ng-template>\n\n<ng-template\n #codeSection\n let-code\n>\n <section class=\"t-code-actions\">\n <ng-container *ngFor=\"let action of codeActions\">\n <div\n polymorpheus-outlet\n [content]=\"action\"\n [context]=\"{$implicit: code}\"\n ></div>\n </ng-container>\n <tui-doc-copy [cdkCopyToClipboard]=\"code\"></tui-doc-copy>\n </section>\n <tui-doc-code [code]=\"code\"></tui-doc-code>\n</ng-template>\n",
1029
- changeDetection: ChangeDetectionStrategy.OnPush,
1030
- styles: [":host{position:relative;display:block;padding-top:3.5rem;clear:right}:host :host-context(tui-root._mobile){padding-top:2rem}.t-title{font:var(--tui-font-heading-5);margin:0 0 .5rem}:host-context(tui-root._mobile) .t-title{font:var(--tui-font-heading-6)}.t-description{font:var(--tui-font-text-m);font-weight:400;margin:0}.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)}:host-context(tui-root._mobile) .t-example{margin-top:.75rem}.t-tabs-wrapper{display:flex;padding:0 2rem;box-shadow:inset 0 -1px var(--tui-base-03);justify-content:space-between;align-items:center}:host-context(tui-root._mobile) .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:2.667rem 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)}}:host-context(tui-root._mobile) .t-demo{padding:1rem}.t-code-actions{position:absolute;top:4.375rem;right:1rem;display:flex;justify-content:flex-end;align-items:center}.t-code-actions>*{margin-left:.5rem}.t-link-icon{margin-left:.3rem;vertical-align:baseline}.t-content{will-change:opacity;height:0;visibility:hidden;opacity:0}.t-content_animated{transition:opacity .3s ease-in-out}.t-content_visible{height:auto;visibility:visible;opacity:1}"]
1031
- }),
1032
- __param(0, Attribute('id')),
1033
- __param(1, Inject(Clipboard)),
1034
- __param(2, Inject(TuiNotificationsService)),
1035
- __param(3, Inject(LOCATION)),
1036
- __param(4, Inject(TUI_COPY_TEXTS)),
1037
- __param(5, Inject(TUI_DOC_EXAMPLE_TEXTS)),
1038
- __param(6, Optional()),
1039
- __param(6, Inject(TUI_DOC_CODE_EDITOR)),
1040
- __param(7, Inject(TUI_DOC_EXAMPLE_CONTENT_PROCESSOR)),
1041
- __param(8, Inject(TUI_IS_CYPRESS)),
1042
- __param(9, Inject(TUI_DOC_CODE_ACTIONS)),
1043
- __param(10, Inject(Router)),
1044
- __param(11, Inject(ActivatedRoute)),
1045
- __param(12, Inject(Location$1))
1046
- ], TuiDocExampleComponent);
1047
- return TuiDocExampleComponent;
1048
- }());
1049
-
1050
- var TuiDocExampleCapitalizePipe = /** @class */ (function () {
1051
- function TuiDocExampleCapitalizePipe() {
1052
- }
1053
- TuiDocExampleCapitalizePipe.prototype.transform = function (content) {
1054
- return typeof content === 'string' ? capitalizeFirstLetter(content) : content;
1055
- };
1056
- TuiDocExampleCapitalizePipe = __decorate([
1057
- Pipe({ name: 'tuiDocExampleCapitalize' })
1058
- ], TuiDocExampleCapitalizePipe);
1059
- return TuiDocExampleCapitalizePipe;
1060
- }());
1061
-
1062
- var TuiDocExampleGetTabsPipe = /** @class */ (function () {
1063
- function TuiDocExampleGetTabsPipe() {
1064
- }
1065
- TuiDocExampleGetTabsPipe.prototype.transform = function (content, defaultTab) {
1066
- return __spread([defaultTab], Object.keys(content));
1067
- };
1068
- TuiDocExampleGetTabsPipe = __decorate([
1069
- Pipe({ name: 'tuiDocExampleGetTabs' })
1070
- ], TuiDocExampleGetTabsPipe);
1071
- return TuiDocExampleGetTabsPipe;
1072
- }());
1073
-
1074
- var TuiDocExampleModule = /** @class */ (function () {
1075
- function TuiDocExampleModule() {
1076
- }
1077
- TuiDocExampleModule = __decorate([
1078
- NgModule({
1079
- imports: [
1080
- CommonModule,
1081
- ClipboardModule,
1082
- TuiTabsModule,
1083
- TuiButtonModule,
1084
- TuiDocCopyModule,
1085
- TuiDocCodeModule,
1086
- PolymorpheusModule,
1087
- ],
1088
- declarations: [
1089
- TuiDocExampleComponent,
1090
- TuiDocExampleGetTabsPipe,
1091
- TuiDocExampleCapitalizePipe,
1092
- ],
1093
- exports: [
1094
- TuiDocExampleComponent,
1095
- TuiDocExampleGetTabsPipe,
1096
- TuiDocExampleCapitalizePipe,
1097
- ],
1098
- })
1099
- ], TuiDocExampleModule);
1100
- return TuiDocExampleModule;
1101
- }());
1102
-
1103
- // @dynamic
1104
- var TuiDocMainComponent = /** @class */ (function () {
1105
- function TuiDocMainComponent(storage, windowRef) {
1106
- this.storage = storage;
1107
- this.windowRef = windowRef;
1108
- this.night = this.storage.getItem('night') === 'true' ||
1109
- (this.storage.getItem('night') === null &&
1110
- this.windowRef.matchMedia('(prefers-color-scheme: dark)').matches);
1111
- this.change$ = new Subject();
1112
- }
1113
- TuiDocMainComponent_1 = TuiDocMainComponent;
1114
- Object.defineProperty(TuiDocMainComponent.prototype, "mode", {
1115
- get: function () {
1116
- return this.night ? 'onDark' : null;
1117
- },
1118
- enumerable: true,
1119
- configurable: true
1120
- });
1121
- TuiDocMainComponent.prototype.onMode = function (night) {
1122
- this.night = night;
1123
- this.change$.next();
1124
- this.storage.setItem('night', String(night));
1125
- };
1126
- var TuiDocMainComponent_1;
1127
- TuiDocMainComponent.ctorParameters = function () { return [
1128
- { type: Storage, decorators: [{ type: Inject, args: [LOCAL_STORAGE,] }] },
1129
- { type: Window, decorators: [{ type: Inject, args: [WINDOW,] }] }
1130
- ]; };
1131
- __decorate([
1132
- HostBinding('attr.data-mode')
1133
- ], TuiDocMainComponent.prototype, "mode", null);
1134
- TuiDocMainComponent = TuiDocMainComponent_1 = __decorate([
1135
- Component({
1136
- selector: 'tui-doc-main',
1137
- 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-toggle\"\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=\"tuiOverAlerts\">\n <ng-content select=\"tuiOverAlerts\"></ng-content>\n </ng-container>\n <!-- TODO: 3.0 Remove-->\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",
1138
- encapsulation: ViewEncapsulation.None,
1139
- providers: [
1140
- {
1141
- provide: TuiModeDirective,
1142
- useExisting: forwardRef(function () { return TuiDocMainComponent_1; }),
1143
- },
1144
- TuiSwipeService,
1145
- ],
1146
- styles: ["html{scroll-padding-top:4rem;height:auto}tui-root>tui-scroll-controls>.bar_vertical{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([class*=language-]):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}a:focus code,button:focus code{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}label.night-mode .tui-toggle{margin-left:.5rem}.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.hljs-line-numbers{background:0 0}.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-link-hover)}[data-mode=onDark] .hljs-template-variable,[data-mode=onDark] .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}"]
1147
- }),
1148
- __param(0, Inject(LOCAL_STORAGE)),
1149
- __param(1, Inject(WINDOW))
1150
- ], TuiDocMainComponent);
1151
- return TuiDocMainComponent;
1152
- }());
1153
-
1154
- var TUI_DOC_PAGE_LOADED = new InjectionToken('[TUI_DOC_PAGE_LOADED] Stream that emits if loading of page is over (for example, to begin scrollIntoView)', { factory: function () { return defer(function () { return timer(200).pipe(switchMapTo(of(true))); }); } });
1155
-
1156
- /**
1157
- * @deprecated: use {@link TuiScrollIntoViewLinkDirective}
1158
- * TODO: remove in v3.0
1159
- */
1160
- var ScrollIntoViewDirective = /** @class */ (function () {
1161
- function ScrollIntoViewDirective(destroy$, _a, readyToScroll$) {
1162
- var nativeElement = _a.nativeElement;
1163
- this.readyToScroll$ = readyToScroll$;
1164
- this.scroll$ = new ReplaySubject(1);
1165
- this.readyToScroll$
1166
- .pipe(filter(Boolean), switchMapTo(this.scroll$), debounceTime(750), filter(function (shallWe) { return shallWe && !!getElementObscurers(nativeElement); }), takeUntil(destroy$))
1167
- .subscribe(function () {
1168
- nativeElement.scrollIntoView();
1169
- });
1170
- }
1171
- Object.defineProperty(ScrollIntoViewDirective.prototype, "scrollIntoView", {
1172
- set: function (shallWe) {
1173
- this.scroll$.next(shallWe);
1174
- },
1175
- enumerable: true,
1176
- configurable: true
1177
- });
1178
- ScrollIntoViewDirective.ctorParameters = function () { return [
1179
- { type: TuiDestroyService, decorators: [{ type: Inject, args: [TuiDestroyService,] }] },
1180
- { type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] },
1181
- { type: Observable, decorators: [{ type: Inject, args: [TUI_DOC_PAGE_LOADED,] }] }
1182
- ]; };
1183
- __decorate([
1184
- Input()
1185
- ], ScrollIntoViewDirective.prototype, "scrollIntoView", null);
1186
- ScrollIntoViewDirective = __decorate([
1187
- Directive({
1188
- selector: '[scrollIntoView]',
1189
- providers: [TuiDestroyService],
1190
- })
1191
- // eslint-disable-next-line @typescript-eslint/naming-convention
1192
- ,
1193
- __param(0, Inject(TuiDestroyService)),
1194
- __param(1, Inject(ElementRef)),
1195
- __param(2, Inject(TUI_DOC_PAGE_LOADED))
1196
- ], ScrollIntoViewDirective);
1197
- return ScrollIntoViewDirective;
1198
- }());
1199
- var TuiScrollIntoViewLinkDirective = /** @class */ (function (_super) {
1200
- __extends(TuiScrollIntoViewLinkDirective, _super);
1201
- function TuiScrollIntoViewLinkDirective() {
1202
- return _super !== null && _super.apply(this, arguments) || this;
1203
- }
1204
- TuiScrollIntoViewLinkDirective = __decorate([
1205
- Directive({
1206
- selector: '[tuiScrollIntoViewLink]',
1207
- providers: [TuiDestroyService],
1208
- })
1209
- ], TuiScrollIntoViewLinkDirective);
1210
- return TuiScrollIntoViewLinkDirective;
1211
- }(ScrollIntoViewDirective));
1212
-
1213
- /**
1214
- * @deprecated: use {@link TuiScrollIntoViewLinkModule}
1215
- * TODO: remove in v3.0
1216
- */
1217
- var ScrollIntoViewModule = /** @class */ (function () {
1218
- // eslint-disable-next-line @typescript-eslint/naming-convention
1219
- function ScrollIntoViewModule() {
1220
- }
1221
- ScrollIntoViewModule = __decorate([
1222
- NgModule({
1223
- declarations: [ScrollIntoViewDirective],
1224
- exports: [ScrollIntoViewDirective],
1225
- })
1226
- // eslint-disable-next-line @typescript-eslint/naming-convention
1227
- ], ScrollIntoViewModule);
1228
- return ScrollIntoViewModule;
1229
- }());
1230
- var TuiScrollIntoViewLinkModule = /** @class */ (function () {
1231
- function TuiScrollIntoViewLinkModule() {
1232
- }
1233
- TuiScrollIntoViewLinkModule = __decorate([
1234
- NgModule({
1235
- declarations: [TuiScrollIntoViewLinkDirective],
1236
- exports: [TuiScrollIntoViewLinkDirective],
1237
- })
1238
- ], TuiScrollIntoViewLinkModule);
1239
- return TuiScrollIntoViewLinkModule;
1240
- }());
1241
-
1242
- var TUI_DOC_SCROLL_BEHAVIOR = new InjectionToken('[TUI_DOC_SCROLL_BEHAVIOR] Defines the transition animation for scroll', { factory: function () { return 'smooth'; } });
1243
-
1244
- var MAP = {
1245
- а: 'f',
1246
- б: ',',
1247
- в: 'd',
1248
- г: 'u',
1249
- д: 'l',
1250
- е: 't',
1251
- ё: '`',
1252
- ж: ';',
1253
- з: 'p',
1254
- и: 'b',
1255
- й: 'q',
1256
- к: 'r',
1257
- л: 'k',
1258
- м: 'v',
1259
- н: 'y',
1260
- о: 'j',
1261
- п: 'g',
1262
- р: 'h',
1263
- с: 'c',
1264
- т: 'n',
1265
- у: 'e',
1266
- ф: 'a',
1267
- х: '[',
1268
- ц: 'w',
1269
- ч: 'x',
1270
- ш: 'i',
1271
- щ: 'o',
1272
- ъ: ']',
1273
- ы: 's',
1274
- ь: 'm',
1275
- ю: '.',
1276
- я: 'z',
1277
- };
1278
- /**
1279
- * @deprecated: use {@link tuiTransliterateKeyboardLayout} instead
1280
- * Translates text mistakenly typed in the Russian layout into English
1281
- * @param string string with Russian layout characters
1282
- * @return string with English layout characters
1283
- */
1284
- // eslint-disable-next-line @typescript-eslint/naming-convention
1285
- function transliterateKeyboardLayout(string) {
1286
- var newStr = '';
1287
- for (var i = 0; i < string.length; i++) {
1288
- newStr += string.charAt(i) in MAP ? MAP[string.charAt(i)] : string.charAt(i);
1289
- }
1290
- return newStr;
1291
- }
1292
- var tuiTransliterateKeyboardLayout = transliterateKeyboardLayout;
1293
-
1294
- var TUI_DOC_PAGES = new InjectionToken('Documentation pages', {
1295
- factory: function () { return []; },
1296
- });
1297
-
1298
- var TUI_DOC_TITLE = new InjectionToken('Page title', {
1299
- factory: function () { return ''; },
1300
- });
1301
-
1302
- var NAVIGATION_TITLE = new InjectionToken('Page title');
1303
- var NAVIGATION_LABELS = new InjectionToken('Navigation sections labels for search');
1304
- var NAVIGATION_ITEMS = new InjectionToken('Navigation pages');
1305
- var NAVIGATION_PROVIDERS = [
1306
- TuiDestroyService,
1307
- {
1308
- provide: NAVIGATION_TITLE,
1309
- deps: [Router, ActivatedRoute, TUI_DOC_TITLE, TuiDestroyService],
1310
- useFactory: titleProviderFactory,
1311
- },
1312
- {
1313
- provide: NAVIGATION_LABELS,
1314
- deps: [TUI_DOC_PAGES],
1315
- useFactory: labelsProviderFactory,
1316
- },
1317
- {
1318
- provide: NAVIGATION_ITEMS,
1319
- deps: [TUI_DOC_PAGES],
1320
- useFactory: itemsProviderFactory,
1321
- },
1322
- ];
1323
- // eslint-disable-next-line @typescript-eslint/naming-convention
1324
- function titleProviderFactory(router, activatedRoute, titlePrefix, destroy$) {
1325
- return router.events.pipe(filter(function (event) { return event instanceof NavigationEnd; }), map(function () { return activatedRoute.firstChild; }), filter(isPresent), mergeMap(function (_a) {
1326
- var data = _a.data;
1327
- return data;
1328
- }), map(function (_a) {
1329
- var title = _a.title;
1330
- return titlePrefix + title;
1331
- }), takeUntil(destroy$));
1332
- }
1333
- // eslint-disable-next-line @typescript-eslint/naming-convention
1334
- function labelsProviderFactory(pages) {
1335
- return pages
1336
- .map(function (_a) {
1337
- var section = _a.section;
1338
- return section;
1339
- })
1340
- .filter(isPresent)
1341
- .filter(function (item, index, array) { return array.indexOf(item) === index; });
1342
- }
1343
- // eslint-disable-next-line @typescript-eslint/naming-convention
1344
- function itemsProviderFactory(pages) {
1345
- var labels = labelsProviderFactory(pages);
1346
- return __spread(labels.map(function (label) { return pages.filter(function (_a) {
1347
- var section = _a.section;
1348
- return section === label;
1349
- }); }), [
1350
- pages.filter(function (page) { return !page.section; }),
1351
- ]);
1352
- }
1353
-
1354
- // @dynamic
1355
- var TuiDocNavigationComponent = /** @class */ (function () {
1356
- function TuiDocNavigationComponent(changeDetectorRef, titleService, title$, documentRef, mode, sidebar, labels, items, searchText, router, activatedRoute, destroy$, readyToScroll$, scrollBehavior) {
1357
- var _this = this;
1358
- this.documentRef = documentRef;
1359
- this.mode = mode;
1360
- this.sidebar = sidebar;
1361
- this.labels = labels;
1362
- this.items = items;
1363
- this.searchText = searchText;
1364
- this.router = router;
1365
- this.activatedRoute = activatedRoute;
1366
- this.destroy$ = destroy$;
1367
- this.readyToScroll$ = readyToScroll$;
1368
- this.scrollBehavior = scrollBehavior;
1369
- this.menuOpen = false;
1370
- this.search = '';
1371
- this.open = false;
1372
- this.openPagesArr = [];
1373
- this.openPagesGroupsArr = [];
1374
- this.active = '';
1375
- this.mode$ = this.mode.change$.pipe(startWith(null), map(function () { return _this.mode.mode || 'onLight'; }));
1376
- // Angular can't navigate no anchor links
1377
- // https://stackoverflow.com/questions/36101756/angular2-routing-with-hashtag-to-page-anchor
1378
- title$.subscribe(function (title) {
1379
- changeDetectorRef.markForCheck();
1380
- titleService.setTitle(title);
1381
- _this.openActivePageGroup();
1382
- _this.handleAnchorLink(_this.activatedRoute.snapshot.fragment);
1383
- });
1384
- }
1385
- Object.defineProperty(TuiDocNavigationComponent.prototype, "canOpen", {
1386
- get: function () {
1387
- return this.search.length > 2;
1388
- },
1389
- enumerable: true,
1390
- configurable: true
1391
- });
1392
- Object.defineProperty(TuiDocNavigationComponent.prototype, "filteredItems", {
1393
- get: function () {
1394
- return this.filterItems(this.flattenSubPages(this.items), this.search);
1395
- },
1396
- enumerable: true,
1397
- configurable: true
1398
- });
1399
- Object.defineProperty(TuiDocNavigationComponent.prototype, "itemsWithoutSections", {
1400
- get: function () {
1401
- return this.items[this.items.length - 1];
1402
- },
1403
- enumerable: true,
1404
- configurable: true
1405
- });
1406
- TuiDocNavigationComponent.prototype.isActive = function (route) {
1407
- return route === this.active;
1408
- };
1409
- TuiDocNavigationComponent.prototype.onGroupClick = function (index) {
1410
- this.openPagesGroupsArr[index] = !this.openPagesGroupsArr[index];
1411
- };
1412
- TuiDocNavigationComponent.prototype.closeMenu = function () {
1413
- this.menuOpen = false;
1414
- };
1415
- TuiDocNavigationComponent.prototype.onSearchChange = function (search) {
1416
- this.search = search;
1417
- this.open = this.canOpen;
1418
- };
1419
- TuiDocNavigationComponent.prototype.onClick = function () {
1420
- this.open = false;
1421
- this.menuOpen = false;
1422
- this.search = '';
1423
- this.openActivePageGroup();
1424
- };
1425
- TuiDocNavigationComponent.prototype.filterItems = function (items, search) {
1426
- return items.map(function (section) {
1427
- return uniqBy(section.filter(function (_a) {
1428
- var title = _a.title, _b = _a.keywords, keywords = _b === void 0 ? '' : _b;
1429
- title = title.toLowerCase();
1430
- search = search.toLowerCase();
1431
- keywords = keywords.toLowerCase();
1432
- return (title.includes(search) ||
1433
- keywords.includes(search) ||
1434
- title.includes(transliterateKeyboardLayout(search)) ||
1435
- keywords.includes(transliterateKeyboardLayout(search)) ||
1436
- search.replace(/-/gi, '').includes(title));
1437
- }), 'title');
1438
- });
1439
- };
1440
- TuiDocNavigationComponent.prototype.flattenSubPages = function (items) {
1441
- return items.reduce(function (array, item) { return __spread(array, [
1442
- item.reduce(function (pages, page) {
1443
- return 'subPages' in page
1444
- ? __spread(pages, page.subPages) : __spread(pages, [page]);
1445
- }, []),
1446
- ]); }, []);
1447
- };
1448
- TuiDocNavigationComponent.prototype.isActiveRoute = function (route) {
1449
- return this.router.isActive(route, false);
1450
- };
1451
- TuiDocNavigationComponent.prototype.handleAnchorLink = function (hash) {
1452
- var _this = this;
1453
- this.readyToScroll$
1454
- .pipe(filter(Boolean), take(1), takeUntil(this.destroy$))
1455
- .subscribe(function () { return _this.navigateToAnchorLink(hash); });
1456
- };
1457
- TuiDocNavigationComponent.prototype.openActivePageGroup = function () {
1458
- var _this = this;
1459
- this.items.forEach(function (pages, pagesIndex) {
1460
- pages.forEach(function (page, pageIndex) {
1461
- if ('route' in page && _this.isActiveRoute(page.route)) {
1462
- _this.openPagesArr[pagesIndex] = true;
1463
- _this.active = page.route;
1464
- }
1465
- if ('subPages' in page) {
1466
- page.subPages.forEach(function (subPage) {
1467
- if (_this.isActiveRoute(subPage.route)) {
1468
- _this.openPagesArr[pagesIndex] = true;
1469
- _this.openPagesGroupsArr[pagesIndex * 100 + pageIndex] = true;
1470
- _this.active = subPage.route;
1471
- }
1472
- });
1473
- }
1474
- });
1475
- });
1476
- };
1477
- TuiDocNavigationComponent.prototype.navigateToAnchorLink = function (fragment) {
1478
- var element = fragment && this.documentRef.querySelector("#" + fragment);
1479
- if (!element) {
1480
- return;
1481
- }
1482
- element.classList.add('tui-doc-animated-example');
1483
- element.scrollIntoView({
1484
- block: 'start',
1485
- inline: 'nearest',
1486
- behavior: this.scrollBehavior,
1487
- });
1488
- };
1489
- TuiDocNavigationComponent.ctorParameters = function () { return [
1490
- { type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] },
1491
- { type: Title, decorators: [{ type: Inject, args: [Title,] }] },
1492
- { type: Observable, decorators: [{ type: Inject, args: [NAVIGATION_TITLE,] }] },
1493
- { type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
1494
- { type: TuiModeDirective, decorators: [{ type: Inject, args: [TuiModeDirective,] }] },
1495
- { type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [TuiSidebarDirective,] }] },
1496
- { type: Array, decorators: [{ type: Inject, args: [NAVIGATION_LABELS,] }] },
1497
- { type: undefined, decorators: [{ type: Inject, args: [NAVIGATION_ITEMS,] }] },
1498
- { type: String, decorators: [{ type: Inject, args: [TUI_DOC_SEARCH_TEXT,] }] },
1499
- { type: Router, decorators: [{ type: Inject, args: [Router,] }] },
1500
- { type: ActivatedRoute, decorators: [{ type: Inject, args: [ActivatedRoute,] }] },
1501
- { type: Observable, decorators: [{ type: Inject, args: [TuiDestroyService,] }] },
1502
- { type: Observable, decorators: [{ type: Inject, args: [TUI_DOC_PAGE_LOADED,] }] },
1503
- { type: undefined, decorators: [{ type: Inject, args: [TUI_DOC_SCROLL_BEHAVIOR,] }] }
1504
- ]; };
1505
- __decorate([
1506
- HostBinding('class._open')
1507
- ], TuiDocNavigationComponent.prototype, "menuOpen", void 0);
1508
- __decorate([
1509
- tuiPure
1510
- ], TuiDocNavigationComponent.prototype, "filterItems", null);
1511
- __decorate([
1512
- tuiPure
1513
- ], TuiDocNavigationComponent.prototype, "flattenSubPages", null);
1514
- TuiDocNavigationComponent = __decorate([
1515
- Component({
1516
- selector: 'tui-doc-navigation',
1517
- template: "<tui-hosted-dropdown\n *tuiLet=\"filteredItems as filtered\"\n tuiAutoFocus\n tuiDropdownLimitWidth=\"fixed\"\n class=\"t-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\n #dropdown\n let-activeZone\n >\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=\"t-navigation\">\n <tui-scrollbar\n class=\"t-scrollbar\"\n [tuiMode]=\"mode$ | async\"\n >\n <tui-accordion\n [closeOthers]=\"false\"\n [rounded]=\"false\"\n >\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=\"t-label\">\n <strong>{{ label }}</strong>\n </span>\n <ng-template tuiAccordionItemContent>\n <div class=\"t-section\">\n <ng-container\n *ngFor=\"let item of items[index]; index as subIndex\"\n [ngTemplateOutlet]=\"pages\"\n [ngTemplateOutletContext]=\"{item: item, index: index * 100 + subIndex}\"\n ></ng-container>\n </div>\n </ng-template>\n </tui-accordion-item>\n </tui-accordion>\n <div class=\"t-items-container\">\n <ng-container\n *ngFor=\"let item of itemsWithoutSections; let index = index\"\n [ngTemplateOutlet]=\"pages\"\n [ngTemplateOutletContext]=\"{item: item, index: items.length - 1 + index}\"\n ></ng-container>\n </div>\n\n <ng-template\n #pages\n let-item=\"item\"\n let-index=\"index\"\n >\n <a\n *ngIf=\"!item.subPages; else subPages\"\n tuiLink\n routerLinkActive=\"t-sublink_active\"\n class=\"t-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=\"t-subsection\"\n [routerLinkActiveOptions]=\"{exact: false}\"\n >\n <button\n *ngIf=\"item.subPages\"\n tuiLink\n type=\"button\"\n class=\"t-sublink t-sublink_subsection\"\n (click)=\"onGroupClick(index)\"\n >\n <tui-svg\n src=\"tuiIconChevronRight\"\n class=\"t-chevron\"\n [class.t-chevron_active]=\"!!openPagesGroupsArr[index]\"\n ></tui-svg>\n {{ item.title }}\n </button>\n <tui-expand\n class=\"t-expand\"\n [expanded]=\"!!openPagesGroupsArr[index]\"\n >\n <div class=\"t-section t-section_bordered\">\n <a\n *ngFor=\"let subPage of item.subPages\"\n tuiLink\n routerLinkActive=\"t-sublink_active\"\n class=\"t-sublink t-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",
1518
- providers: NAVIGATION_PROVIDERS,
1519
- changeDetection: ChangeDetectionStrategy.OnPush,
1520
- styles: [":host{z-index:1;display:flex;flex-direction:column;text-align:center;background:var(--tui-base-01)}.t-input{display:block;margin:1.25rem}.t-navigation{display:flex;max-height:100%;min-height:0;flex:1 1 0;text-align:left}.t-scrollbar{width:100%;scroll-behavior:smooth}.t-items-container{display:flex;flex-direction:column;padding:0 1rem}.t-label{margin-left:.5rem}.t-expand{margin-left:.25rem}.t-section{display:flex;flex-direction:column;align-items:flex-start;margin:-1rem 0 -.5rem}.t-section_bordered{margin:.5rem 0;border-left:1px solid var(--tui-base-03)}.t-subsection{margin-left:.5rem}.t-sublink{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:1rem 0 0;border:0;background:0 0;font-size:inherit;line-height:inherit;font:var(--tui-font-text-m);margin-left:.5rem}.t-sublink_small{margin-left:1rem;line-height:1.5rem;padding-top:.5rem}.t-sublink_subsection{margin-left:0;line-height:1.6rem}.t-sublink_active{color:var(--tui-text-01)}.t-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}.t-chevron_active{transform:rotate(90deg)}"]
1521
- }),
1522
- __param(0, Inject(ChangeDetectorRef)),
1523
- __param(1, Inject(Title)),
1524
- __param(2, Inject(NAVIGATION_TITLE)),
1525
- __param(3, Inject(DOCUMENT)),
1526
- __param(4, Inject(TuiModeDirective)),
1527
- __param(5, Optional()),
1528
- __param(5, Inject(TuiSidebarDirective)),
1529
- __param(6, Inject(NAVIGATION_LABELS)),
1530
- __param(7, Inject(NAVIGATION_ITEMS)),
1531
- __param(8, Inject(TUI_DOC_SEARCH_TEXT)),
1532
- __param(9, Inject(Router)),
1533
- __param(10, Inject(ActivatedRoute)),
1534
- __param(11, Inject(TuiDestroyService)),
1535
- __param(12, Inject(TUI_DOC_PAGE_LOADED)),
1536
- __param(13, Inject(TUI_DOC_SCROLL_BEHAVIOR))
1537
- ], TuiDocNavigationComponent);
1538
- return TuiDocNavigationComponent;
1539
- }());
1540
-
1541
- var TuiDocNavigationModule = /** @class */ (function () {
1542
- function TuiDocNavigationModule() {
1543
- }
1544
- TuiDocNavigationModule = __decorate([
1545
- NgModule({
1546
- imports: [
1547
- CommonModule,
1548
- FormsModule,
1549
- RouterModule,
1550
- ScrollIntoViewModule,
1551
- TuiScrollIntoViewLinkModule,
1552
- TuiButtonModule,
1553
- TuiPrimitiveTextfieldModule,
1554
- TuiTextfieldControllerModule,
1555
- TuiActiveZoneModule,
1556
- TuiLetModule,
1557
- TuiModeModule,
1558
- TuiLinkModule,
1559
- TuiExpandModule,
1560
- TuiHostedDropdownModule,
1561
- TuiDropdownControllerModule,
1562
- TuiAccordionModule,
1563
- TuiScrollbarModule,
1564
- TuiSvgModule,
1565
- TuiDataListModule,
1566
- TuiAutoFocusModule,
1567
- ],
1568
- declarations: [TuiDocNavigationComponent],
1569
- exports: [TuiDocNavigationComponent],
1570
- })
1571
- ], TuiDocNavigationModule);
1572
- return TuiDocNavigationModule;
1573
- }());
1574
-
1575
- var TUI_DOC_LOGO = new InjectionToken('Main logo', {
1576
- factory: function () { return ''; },
1577
- });
1578
-
1579
- var TuiDocHeaderComponent = /** @class */ (function () {
1580
- function TuiDocHeaderComponent(logo, menu, router, swipes$) {
1581
- this.logo = logo;
1582
- this.menu = menu;
1583
- this.router = router;
1584
- this.swipes$ = swipes$;
1585
- this.stream$ = new Subject();
1586
- this.open$ = merge(this.router.events.pipe(mapTo(false)), this.stream$, this.swipes$.pipe(filter(function (swipe) { return swipe.direction === 'left' || swipe.direction === 'right'; }), map(function (swipe) { return swipe.direction === 'right'; }))).pipe(startWith(false), distinctUntilChanged());
1587
- }
1588
- TuiDocHeaderComponent.prototype.onClick = function () {
1589
- this.stream$.next(true);
1590
- };
1591
- TuiDocHeaderComponent.prototype.onActiveZone = function (active) {
1592
- if (!active) {
1593
- this.stream$.next(false);
1594
- }
1595
- };
1596
- TuiDocHeaderComponent.ctorParameters = function () { return [
1597
- { type: undefined, decorators: [{ type: Inject, args: [TUI_DOC_LOGO,] }] },
1598
- { type: String, decorators: [{ type: Inject, args: [TUI_DOC_MENU_TEXT,] }] },
1599
- { type: Router, decorators: [{ type: Inject, args: [Router,] }] },
1600
- { type: TuiSwipeService, decorators: [{ type: Inject, args: [TuiSwipeService,] }] }
1601
- ]; };
1602
- TuiDocHeaderComponent = __decorate([
1603
- Component({
1604
- selector: 'header[tuiDocHeader]',
1605
- template: "<button\n tuiIconButton\n icon=\"tuiIconMenuLarge\"\n appearance=\"icon\"\n class=\"t-menu\"\n [title]=\"menu\"\n (click)=\"onClick()\"\n (tuiActiveZoneChange)=\"onActiveZone($event)\"\n>\n <tui-doc-navigation\n *tuiSidebar=\"!!(open$ | async)\"\n class=\"t-navigation\"\n ></tui-doc-navigation>\n</button>\n<div\n polymorpheus-outlet\n class=\"t-logo\"\n [content]=\"logo\"\n>\n <ng-template let-src>\n <img\n alt=\"Logo\"\n class=\"t-img\"\n [src]=\"src\"\n />\n </ng-template>\n</div>\n<ng-content></ng-content>\n",
1606
- changeDetection: ChangeDetectionStrategy.OnPush,
1607
- styles: [":host{box-shadow:0 .125rem 1rem rgba(0,0,0,.08);position:fixed;top:0;left:0;right:0;z-index:1;display:flex;height:3.9375rem;align-items:center;padding:0 1.25rem;background:var(--tui-base-01);border-bottom:1px solid var(--tui-base-03)}.t-logo{margin-right:auto;font:var(--tui-font-heading-5)}.t-img{display:block}.t-menu{margin-left:-1.25rem}@media screen and (min-width:48em){.t-menu{display:none}}.t-navigation{min-height:100%}"]
1608
- }),
1609
- __param(0, Inject(TUI_DOC_LOGO)),
1610
- __param(1, Inject(TUI_DOC_MENU_TEXT)),
1611
- __param(2, Inject(Router)),
1612
- __param(3, Inject(TuiSwipeService))
1613
- ], TuiDocHeaderComponent);
1614
- return TuiDocHeaderComponent;
1615
- }());
1616
-
1617
- var TuiDocHeaderModule = /** @class */ (function () {
1618
- function TuiDocHeaderModule() {
1619
- }
1620
- TuiDocHeaderModule = __decorate([
1621
- NgModule({
1622
- imports: [
1623
- CommonModule,
1624
- PolymorpheusModule,
1625
- TuiButtonModule,
1626
- TuiSidebarModule,
1627
- TuiActiveZoneModule,
1628
- TuiDocNavigationModule,
1629
- ],
1630
- declarations: [TuiDocHeaderComponent],
1631
- exports: [TuiDocHeaderComponent],
1632
- })
1633
- ], TuiDocHeaderModule);
1634
- return TuiDocHeaderModule;
1635
- }());
1636
-
1637
- var TuiDocMainModule = /** @class */ (function () {
1638
- function TuiDocMainModule() {
1639
- }
1640
- TuiDocMainModule = __decorate([
1641
- NgModule({
1642
- imports: [
1643
- CommonModule,
1644
- RouterModule,
1645
- FormsModule,
1646
- TuiToggleModule,
1647
- TuiThemeNightModule,
1648
- TuiDocHeaderModule,
1649
- TuiRootModule,
1650
- TuiDialogModule,
1651
- TuiAlertModule,
1652
- TuiDocNavigationModule,
1653
- ],
1654
- declarations: [TuiDocMainComponent],
1655
- exports: [TuiDocMainComponent],
1656
- })
1657
- ], TuiDocMainModule);
1658
- return TuiDocMainModule;
1659
- }());
1660
-
1661
- var TUI_DOC_DEFAULT_TABS = new InjectionToken('Array of default tab names', {
1662
- factory: function () { return []; },
1663
- });
1664
-
1665
- var TUI_DOC_SEE_ALSO = new InjectionToken('Array of arrays of related pages', {
1666
- factory: function () { return []; },
1667
- });
1668
-
1669
- var PAGE_SEE_ALSO = new InjectionToken('Page see also');
1670
- var PAGE_PROVIDERS = [
1671
- {
1672
- provide: PAGE_SEE_ALSO,
1673
- deps: [ElementRef, TUI_DOC_SEE_ALSO],
1674
- useFactory: seeAlsoProviderFactory,
1675
- },
1676
- ];
1677
- // eslint-disable-next-line @typescript-eslint/naming-convention
1678
- function seeAlsoProviderFactory(_a, seeAlsoGroups) {
1679
- var nativeElement = _a.nativeElement;
1680
- var currentHeader = nativeElement.getAttribute('header');
1681
- var groups = seeAlsoGroups.filter(function (group) { return group.includes(currentHeader); }) || [];
1682
- var seeAlsoSet = new Set(groups
1683
- .join()
1684
- .split(',')
1685
- .filter(function (component) { return component && component !== currentHeader; }));
1686
- return Array.from(seeAlsoSet);
1687
- }
1688
-
1689
- var TuiDocPageTabConnectorDirective = /** @class */ (function () {
1690
- function TuiDocPageTabConnectorDirective(template) {
1691
- this.template = template;
1692
- }
1693
- TuiDocPageTabConnectorDirective.ctorParameters = function () { return [
1694
- { type: TemplateRef, decorators: [{ type: Inject, args: [TemplateRef,] }] }
1695
- ]; };
1696
- __decorate([
1697
- Input(),
1698
- tuiDefaultProp()
1699
- ], TuiDocPageTabConnectorDirective.prototype, "pageTab", void 0);
1700
- TuiDocPageTabConnectorDirective = __decorate([
1701
- Directive({
1702
- selector: '[pageTab]',
1703
- }),
1704
- __param(0, Inject(TemplateRef))
1705
- ], TuiDocPageTabConnectorDirective);
1706
- return TuiDocPageTabConnectorDirective;
1707
- }());
1708
-
1709
- // Ambient type cannot be used without dynamic https://github.com/angular/angular/issues/23395
1710
- // @dynamic
1711
- var TuiDocPageComponent = /** @class */ (function () {
1712
- function TuiDocPageComponent(deprecated, defaultTabs, seeAlso) {
1713
- this.deprecated = deprecated;
1714
- this.defaultTabs = defaultTabs;
1715
- this.seeAlso = seeAlso;
1716
- this.header = '';
1717
- this.package = '';
1718
- this.type = '';
1719
- this.path = '';
1720
- this.tabConnectors = EMPTY_QUERY;
1721
- this.activeItemIndex = NaN;
1722
- }
1723
- Object.defineProperty(TuiDocPageComponent.prototype, "showSeeAlso", {
1724
- get: function () {
1725
- return !!this.seeAlso.length && this.activeItemIndex === 0;
1726
- },
1727
- enumerable: true,
1728
- configurable: true
1729
- });
1730
- TuiDocPageComponent.prototype.getRouterLink = function (tab) {
1731
- if (tab === void 0) { tab = ''; }
1732
- return "./" + tab.replace(/ /g, '_');
1733
- };
1734
- TuiDocPageComponent.ctorParameters = function () { return [
1735
- { type: String, decorators: [{ type: Attribute, args: ['deprecated',] }] },
1736
- { type: undefined, decorators: [{ type: Inject, args: [TUI_DOC_DEFAULT_TABS,] }] },
1737
- { type: undefined, decorators: [{ type: Inject, args: [PAGE_SEE_ALSO,] }] }
1738
- ]; };
1739
- __decorate([
1740
- Input()
1741
- ], TuiDocPageComponent.prototype, "header", void 0);
1742
- __decorate([
1743
- Input()
1744
- ], TuiDocPageComponent.prototype, "package", void 0);
1745
- __decorate([
1746
- Input()
1747
- ], TuiDocPageComponent.prototype, "type", void 0);
1748
- __decorate([
1749
- Input()
1750
- ], TuiDocPageComponent.prototype, "path", void 0);
1751
- __decorate([
1752
- ContentChildren(TuiDocPageTabConnectorDirective)
1753
- ], TuiDocPageComponent.prototype, "tabConnectors", void 0);
1754
- TuiDocPageComponent = __decorate([
1755
- Component({
1756
- selector: 'tui-doc-page',
1757
- template: "<header class=\"t-header\">\n <h1 class=\"t-title\">\n {{ header }}\n <tui-tag\n *ngIf=\"deprecated !== null\"\n value=\"deprecated\"\n status=\"custom\"\n class=\"t-tag t-tag_deprecated\"\n ></tui-tag>\n <tui-tag\n *ngIf=\"package\"\n status=\"custom\"\n class=\"t-tag t-tag_package\"\n [value]=\"package\"\n [autoColor]=\"true\"\n ></tui-tag>\n </h1>\n <tui-tabs-with-more\n *ngIf=\"tabConnectors.length\"\n class=\"t-tabs\"\n [(activeItemIndex)]=\"activeItemIndex\"\n >\n <ng-container *ngFor=\"let tab of tabConnectors; first as first; index as index\">\n <ng-container *ngIf=\"first; else dynamicTab\">\n <a\n *tuiTab\n tuiTab\n routerLink=\"./\"\n routerLinkActive\n [routerLinkActiveOptions]=\"{exact: true}\"\n >\n {{ tab.pageTab || defaultTabs[index] }}\n </a>\n </ng-container>\n <ng-template #dynamicTab>\n <a\n *tuiTab\n tuiTab\n routerLinkActive\n [routerLink]=\"getRouterLink(tab.pageTab || defaultTabs[index])\"\n >\n {{ tab.pageTab || defaultTabs[index] }}\n </a>\n </ng-template>\n </ng-container>\n </tui-tabs-with-more>\n <tui-doc-source-code\n class=\"t-source-code\"\n [header]=\"header\"\n [package]=\"package\"\n [type]=\"type\"\n [path]=\"path\"\n ></tui-doc-source-code>\n</header>\n<div class=\"t-content\">\n <ng-content></ng-content>\n <tui-doc-see-also\n *ngIf=\"showSeeAlso\"\n class=\"t-see-also\"\n [seeAlso]=\"seeAlso\"\n ></tui-doc-see-also>\n <ng-container *ngFor=\"let tab of tabConnectors; index as index\">\n <ng-container\n *ngIf=\"index === activeItemIndex\"\n [ngTemplateOutlet]=\"tab.template\"\n ></ng-container>\n </ng-container>\n</div>\n",
1758
- changeDetection: ChangeDetectionStrategy.OnPush,
1759
- providers: PAGE_PROVIDERS,
1760
- styles: [":host{display:flex;flex-direction:column;min-height:0;flex-basis:0;flex-grow:1}.t-header{display:flex;font:var(--tui-font-heading-3);flex-wrap:wrap;min-height:7.25rem;color:var(--tui-text-01);box-shadow:inset 0 -1px 0 0 var(--tui-base-03);padding:3.75rem 0 0;box-sizing:border-box;flex-shrink:0;margin:0 min(10vw,8.75rem)}:host-context(tui-root._mobile) .t-header{font:var(--tui-font-heading-4);min-height:4.5rem;padding:1.25rem 1.25rem 0;margin:0}.t-title{min-width:100%;font-size:inherit;margin:0}.t-tag{vertical-align:middle;text-transform:uppercase;margin-right:.5rem}.t-tag_deprecated{background-color:var(--tui-error-fill)}.t-tag.t-tag_package{color:#000}.t-tabs{flex:1;margin:1.125rem .3125rem 0 0}:host-context(tui-root._mobile) .t-tabs{margin-top:.25rem}.t-content{padding:2rem 0;margin:0 min(10vw,8.75rem)}:host-context(tui-root._mobile) .t-content{padding:2rem 1.25rem;margin:0}.t-see-also{min-width:18.75rem;width:30%;float:right;margin-left:1.5rem}:host-context(tui-root._mobile) .t-see-also{float:none;width:100%;margin:0 0 1.5rem}.t-source-code{align-self:flex-end;line-height:2.75rem}"]
1761
- }),
1762
- __param(0, Attribute('deprecated')),
1763
- __param(1, Inject(TUI_DOC_DEFAULT_TABS)),
1764
- __param(2, Inject(PAGE_SEE_ALSO))
1765
- ], TuiDocPageComponent);
1766
- return TuiDocPageComponent;
1767
- }());
1768
-
1769
- // @dynamic
1770
- var TuiDocSeeAlsoComponent = /** @class */ (function () {
1771
- function TuiDocSeeAlsoComponent(text, pages) {
1772
- this.text = text;
1773
- this.pages = pages;
1774
- this.seeAlso = [];
1775
- }
1776
- TuiDocSeeAlsoComponent.prototype.getRouterLink = function (pageTitle) {
1777
- for (var i = 0; i < this.pages.length; i++) {
1778
- var page = this.pages
1779
- .map(function (page) { return ('subPages' in page ? page.subPages : [page]); })
1780
- .reduce(function (pages, subPages) { return __spread(pages, subPages); }, [])
1781
- .find(function (page) { return page.title === pageTitle; });
1782
- if (page === null || page === void 0 ? void 0 : page.route) {
1783
- return page.route;
1784
- }
1785
- }
1786
- return '';
1787
- };
1788
- TuiDocSeeAlsoComponent.ctorParameters = function () { return [
1789
- { type: String, decorators: [{ type: Inject, args: [TUI_DOC_SEE_ALSO_TEXT,] }] },
1790
- { type: undefined, decorators: [{ type: Inject, args: [TUI_DOC_PAGES,] }] }
1791
- ]; };
1792
- __decorate([
1793
- Input()
1794
- ], TuiDocSeeAlsoComponent.prototype, "seeAlso", void 0);
1795
- TuiDocSeeAlsoComponent = __decorate([
1796
- Component({
1797
- selector: 'tui-doc-see-also',
1798
- template: "<h5 class=\"header\">{{ text }}</h5>\n<ng-container *ngFor=\"let item of seeAlso; last as last\">\n <a\n tuiLink\n [routerLink]=\"getRouterLink(item)\"\n >\n {{ item }}\n </a>\n <ng-container *ngIf=\"!last\">{{ ', ' }}</ng-container>\n</ng-container>\n",
1799
- changeDetection: ChangeDetectionStrategy.OnPush,
1800
- styles: [":host{display:block}.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}"]
1801
- }),
1802
- __param(0, Inject(TUI_DOC_SEE_ALSO_TEXT)),
1803
- __param(1, Inject(TUI_DOC_PAGES))
1804
- ], TuiDocSeeAlsoComponent);
1805
- return TuiDocSeeAlsoComponent;
1806
- }());
1807
-
1808
- var TuiDocSeeAlsoModule = /** @class */ (function () {
1809
- function TuiDocSeeAlsoModule() {
1810
- }
1811
- TuiDocSeeAlsoModule = __decorate([
1812
- NgModule({
1813
- imports: [CommonModule, RouterModule, TuiLinkModule],
1814
- declarations: [TuiDocSeeAlsoComponent],
1815
- exports: [TuiDocSeeAlsoComponent],
1816
- })
1817
- ], TuiDocSeeAlsoModule);
1818
- return TuiDocSeeAlsoModule;
1819
- }());
1820
-
1821
- var TUI_DOC_SOURCE_CODE = new InjectionToken('Source code link', {
1822
- factory: function () { return ''; },
1823
- });
1824
-
1825
- var TuiDocSourceCodeComponent = /** @class */ (function () {
1826
- function TuiDocSourceCodeComponent(sourceCode, text) {
1827
- this.sourceCode = sourceCode;
1828
- this.text = text;
1829
- this.header = '';
1830
- this.package = '';
1831
- this.type = '';
1832
- this.path = '';
1833
- }
1834
- Object.defineProperty(TuiDocSourceCodeComponent.prototype, "pathOptions", {
1835
- get: function () {
1836
- return this.getPathOptions(this.header, this.package, this.type, this.path);
1837
- },
1838
- enumerable: true,
1839
- configurable: true
1840
- });
1841
- TuiDocSourceCodeComponent.prototype.getPathOptions = function (header, packageName, type, path) {
1842
- return {
1843
- header: header,
1844
- package: packageName,
1845
- type: type,
1846
- path: path,
1847
- };
1848
- };
1849
- TuiDocSourceCodeComponent.ctorParameters = function () { return [
1850
- { type: undefined, decorators: [{ type: Inject, args: [TUI_DOC_SOURCE_CODE,] }] },
1851
- { type: String, decorators: [{ type: Inject, args: [TUI_DOC_SOURCE_CODE_TEXT,] }] }
1852
- ]; };
1853
- __decorate([
1854
- Input()
1855
- ], TuiDocSourceCodeComponent.prototype, "header", void 0);
1856
- __decorate([
1857
- Input()
1858
- ], TuiDocSourceCodeComponent.prototype, "package", void 0);
1859
- __decorate([
1860
- Input()
1861
- ], TuiDocSourceCodeComponent.prototype, "type", void 0);
1862
- __decorate([
1863
- Input()
1864
- ], TuiDocSourceCodeComponent.prototype, "path", void 0);
1865
- __decorate([
1866
- tuiPure
1867
- ], TuiDocSourceCodeComponent.prototype, "getPathOptions", null);
1868
- TuiDocSourceCodeComponent = __decorate([
1869
- Component({
1870
- selector: 'tui-doc-source-code',
1871
- template: "<div\n *ngIf=\"!!sourceCode\"\n polymorpheus-outlet\n [content]=\"sourceCode\"\n [context]=\"pathOptions\"\n>\n <ng-template let-link>\n <a\n *ngIf=\"link\"\n tuiIconButton\n type=\"button\"\n icon=\"tuiIconCodeLarge\"\n appearance=\"icon\"\n target=\"_blank\"\n size=\"s\"\n [title]=\"text\"\n [href]=\"link\"\n ></a>\n </ng-template>\n</div>\n",
1872
- changeDetection: ChangeDetectionStrategy.OnPush
1873
- }),
1874
- __param(0, Inject(TUI_DOC_SOURCE_CODE)),
1875
- __param(1, Inject(TUI_DOC_SOURCE_CODE_TEXT))
1876
- ], TuiDocSourceCodeComponent);
1877
- return TuiDocSourceCodeComponent;
1878
- }());
1879
-
1880
- var TuiDocSourceCodeModule = /** @class */ (function () {
1881
- function TuiDocSourceCodeModule() {
1882
- }
1883
- TuiDocSourceCodeModule = __decorate([
1884
- NgModule({
1885
- declarations: [TuiDocSourceCodeComponent],
1886
- imports: [CommonModule, PolymorpheusModule, TuiButtonModule],
1887
- exports: [TuiDocSourceCodeComponent],
1888
- })
1889
- ], TuiDocSourceCodeModule);
1890
- return TuiDocSourceCodeModule;
1891
- }());
1892
-
1893
- var TuiDocPageModule = /** @class */ (function () {
1894
- function TuiDocPageModule() {
1895
- }
1896
- TuiDocPageModule = __decorate([
1897
- NgModule({
1898
- imports: [
1899
- CommonModule,
1900
- RouterModule,
1901
- TuiDocSeeAlsoModule,
1902
- TuiTabsModule,
1903
- TuiTagModule,
1904
- TuiDocSourceCodeModule,
1905
- ],
1906
- declarations: [TuiDocPageComponent, TuiDocPageTabConnectorDirective],
1907
- exports: [TuiDocPageComponent, TuiDocPageTabConnectorDirective],
1908
- })
1909
- ], TuiDocPageModule);
1910
- return TuiDocPageModule;
1911
- }());
1912
-
1913
- var TUI_EXAMPLE_PRIMARY_FILE_NAME = {
1914
- TS: 'TypeScript',
1915
- LESS: 'LESS',
1916
- HTML: 'HTML',
1917
- };
1918
-
1919
- // TODO: 3.0 remove in ivy compilation
1920
- var DEMO_TEXTS = ['Сделано с помощью директивы: ', 'Фон', 'Детали формы'];
1921
- var DOC_TEXTS = [
1922
- 'Аргумент',
1923
- 'Тип',
1924
- 'Имя и описание',
1925
- 'Значение',
1926
- 'Для работы с динамическими шаблонами используется',
1927
- ];
1928
- var EXAMPLE_TEXTS = ['Превью', 'Ссылка на пример скопирована', 'Готово'];
1929
- var TUI_DOC_RUSSIAN = [
1930
- {
1931
- provide: TUI_DOC_DEMO_TEXTS,
1932
- useValue: DEMO_TEXTS,
1933
- },
1934
- {
1935
- provide: TUI_DOC_DOCUMENTATION_TEXTS,
1936
- useValue: DOC_TEXTS,
1937
- },
1938
- {
1939
- provide: TUI_DOC_EXAMPLE_TEXTS,
1940
- useValue: EXAMPLE_TEXTS,
1941
- },
1942
- {
1943
- provide: TUI_DOC_MENU_TEXT,
1944
- useValue: 'Меню',
1945
- },
1946
- {
1947
- provide: TUI_DOC_SEARCH_TEXT,
1948
- useValue: 'Поиск',
1949
- },
1950
- {
1951
- provide: TUI_DOC_SEE_ALSO_TEXT,
1952
- useValue: 'Смотрите также',
1953
- },
1954
- {
1955
- provide: TUI_DOC_SOURCE_CODE_TEXT,
1956
- useValue: 'Исходный код',
1957
- },
1958
- ];
1959
-
1960
- var TuiAddonDocModule = /** @class */ (function () {
1961
- function TuiAddonDocModule() {
1962
- }
1963
- TuiAddonDocModule = __decorate([
1964
- NgModule({
1965
- exports: [
1966
- TuiDocCodeModule,
1967
- TuiDocDemoModule,
1968
- TuiDocDocumentationModule,
1969
- TuiDocPageModule,
1970
- TuiDocExampleModule,
1971
- ],
1972
- })
1973
- ], TuiAddonDocModule);
1974
- return TuiAddonDocModule;
1975
- }());
1976
-
1977
- /**
1978
- * @deprecated: use {@link tuiGenerateRoutes} instead
1979
- * Generates typical page routing structure
1980
- */
1981
- // eslint-disable-next-line @typescript-eslint/naming-convention
1982
- function generateRoutes(type) {
1983
- return [
1984
- {
1985
- path: '',
1986
- component: type,
1987
- children: [
1988
- {
1989
- path: ':tab',
1990
- component: type,
1991
- },
1992
- ],
1993
- },
1994
- ];
1995
- }
1996
- var tuiGenerateRoutes = generateRoutes;
1997
-
1998
- /**
1999
- * Public API Surface of @taiga-ui/addon-doc
2000
- */
2001
-
2002
- /**
2003
- * Generated bundle index. Do not edit.
2004
- */
2005
-
2006
- export { DEMO_TEXTS, DOC_TEXTS, EXAMPLE_TEXTS, ScrollIntoViewDirective, ScrollIntoViewModule, TUI_DOC_CODE_ACTIONS, TUI_DOC_CODE_EDITOR, TUI_DOC_DEFAULT_TABS, TUI_DOC_DEMO_TEXTS, TUI_DOC_DOCUMENTATION_TEXTS, TUI_DOC_EXAMPLE_CONTENT_PROCESSOR, TUI_DOC_EXAMPLE_TEXTS, TUI_DOC_LOGO, TUI_DOC_MENU_TEXT, TUI_DOC_PAGES, TUI_DOC_PAGE_LOADED, TUI_DOC_RUSSIAN, TUI_DOC_SCROLL_BEHAVIOR, TUI_DOC_SEARCH_TEXT, TUI_DOC_SEE_ALSO, TUI_DOC_SEE_ALSO_TEXT, TUI_DOC_SOURCE_CODE, TUI_DOC_SOURCE_CODE_TEXT, TUI_DOC_TITLE, TUI_EXAMPLE_PRIMARY_FILE_NAME, TuiAddonDocModule, TuiDocCodeComponent, TuiDocCodeModule, TuiDocCopyComponent, TuiDocCopyModule, TuiDocDemoComponent, TuiDocDemoModule, TuiDocDocumentationComponent, TuiDocDocumentationModule, TuiDocDocumentationPropertyConnectorDirective, TuiDocExampleComponent, TuiDocExampleModule, TuiDocMainComponent, TuiDocMainModule, TuiDocNavigationComponent, TuiDocNavigationModule, TuiDocPageComponent, TuiDocPageModule, TuiDocPageTabConnectorDirective, TuiScrollIntoViewLinkDirective, TuiScrollIntoViewLinkModule, coerceValue, generateRoutes, rawLoad, rawLoadRecord, tryParseMarkdownCodeBlock, tuiCoerceValue, tuiGenerateRoutes, tuiRawLoad, tuiRawLoadRecord, tuiTryParseMarkdownCodeBlock, TuiInputOpacityModule as ɵa, TuiInputOpacityDirective as ɵb, TuiDocExampleGetTabsPipe as ɵc, TuiDocExampleCapitalizePipe as ɵd, TuiDocHeaderModule as ɵe, NAVIGATION_TITLE as ɵf, NAVIGATION_LABELS as ɵg, NAVIGATION_ITEMS as ɵh, NAVIGATION_PROVIDERS as ɵi, titleProviderFactory as ɵj, labelsProviderFactory as ɵk, itemsProviderFactory as ɵl, TuiDocHeaderComponent as ɵm, PAGE_SEE_ALSO as ɵn, PAGE_PROVIDERS as ɵo, seeAlsoProviderFactory as ɵp, TuiDocSeeAlsoModule as ɵq, TuiDocSeeAlsoComponent as ɵr, TuiDocSourceCodeModule as ɵs, TuiDocSourceCodeComponent as ɵt };
2007
- //# sourceMappingURL=taiga-ui-addon-doc.js.map