@taiga-ui/addon-doc 2.23.0 → 2.27.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.
- package/README.md +123 -135
- package/bundles/taiga-ui-addon-doc.umd.js +985 -931
- package/bundles/taiga-ui-addon-doc.umd.js.map +1 -1
- package/bundles/taiga-ui-addon-doc.umd.min.js +2 -2
- package/bundles/taiga-ui-addon-doc.umd.min.js.map +1 -1
- package/components/code/code.component.d.ts +4 -1
- package/components/demo/demo.component.d.ts +8 -8
- package/components/documentation/documentation-property-connector.directive.d.ts +1 -1
- package/components/example/example-get-tabs.pipe.d.ts +4 -0
- package/components/example/example.component.d.ts +4 -7
- package/components/navigation/navigation.component.d.ts +1 -1
- package/components/page/page.component.d.ts +1 -1
- package/esm2015/addon-doc.module.js +1 -1
- package/esm2015/components/code/code.component.js +11 -4
- package/esm2015/components/code/code.module.js +1 -1
- package/esm2015/components/copy/copy.component.js +2 -2
- package/esm2015/components/copy/copy.module.js +1 -1
- package/esm2015/components/demo/demo.component.js +13 -13
- package/esm2015/components/demo/demo.module.js +1 -1
- package/esm2015/components/documentation/documentation-property-connector.directive.js +6 -7
- package/esm2015/components/documentation/documentation.component.js +2 -2
- package/esm2015/components/documentation/documentation.module.js +2 -2
- package/esm2015/components/example/example-get-tabs.pipe.js +12 -0
- package/esm2015/components/example/example.component.js +8 -26
- package/esm2015/components/example/example.module.js +4 -3
- package/esm2015/components/main/main.module.js +1 -1
- package/esm2015/components/navigation/navigation.component.js +3 -3
- package/esm2015/components/navigation/navigation.module.js +1 -1
- package/esm2015/components/navigation/navigation.providers.js +1 -1
- package/esm2015/components/page/page.component.js +4 -4
- package/esm2015/components/page/page.module.js +2 -2
- package/esm2015/components/page/page.providers.js +1 -1
- package/esm2015/directives/scroll-into-view/scroll-into-view.module.js +1 -1
- package/esm2015/interfaces/page.js +1 -1
- package/esm2015/internal/header/header.component.js +2 -2
- package/esm2015/internal/header/header.module.js +1 -1
- package/esm2015/internal/input-opacity/input-opacity.module.js +1 -1
- package/esm2015/internal/see-also/see-also.component.js +2 -2
- package/esm2015/internal/see-also/see-also.module.js +1 -1
- package/esm2015/internal/source-code/source-code.component.js +2 -2
- package/esm2015/internal/source-code/source-code.module.js +1 -1
- package/esm2015/languages/russian.js +1 -1
- package/esm2015/public-api.js +5 -5
- package/esm2015/taiga-ui-addon-doc.js +12 -11
- package/esm2015/tokens/code-editor.js +1 -1
- package/esm2015/tokens/example-content-processor.js +2 -4
- package/esm2015/tokens/i18n.js +13 -5
- package/esm2015/tokens/pages.js +1 -1
- package/esm2015/tokens/source-code.js +1 -1
- package/esm2015/utils/raw-load-record.js +12 -0
- package/esm2015/utils/raw-load.js +7 -0
- package/esm5/addon-doc.module.js +1 -1
- package/esm5/components/code/code.component.js +15 -4
- package/esm5/components/code/code.module.js +1 -1
- package/esm5/components/copy/copy.component.js +2 -2
- package/esm5/components/copy/copy.module.js +1 -1
- package/esm5/components/demo/demo.component.js +13 -13
- package/esm5/components/demo/demo.module.js +1 -1
- package/esm5/components/documentation/documentation-property-connector.directive.js +6 -7
- package/esm5/components/documentation/documentation.component.js +2 -2
- package/esm5/components/documentation/documentation.module.js +2 -2
- package/esm5/components/example/example-get-tabs.pipe.js +15 -0
- package/esm5/components/example/example.component.js +9 -43
- package/esm5/components/example/example.module.js +4 -3
- package/esm5/components/main/main.module.js +1 -1
- package/esm5/components/navigation/navigation.component.js +3 -3
- package/esm5/components/navigation/navigation.module.js +1 -1
- package/esm5/components/navigation/navigation.providers.js +1 -1
- package/esm5/components/page/page.component.js +4 -4
- package/esm5/components/page/page.module.js +2 -2
- package/esm5/components/page/page.providers.js +1 -1
- package/esm5/directives/scroll-into-view/scroll-into-view.module.js +1 -1
- package/esm5/interfaces/page.js +1 -1
- package/esm5/internal/header/header.component.js +2 -2
- package/esm5/internal/header/header.module.js +1 -1
- package/esm5/internal/input-opacity/input-opacity.module.js +1 -1
- package/esm5/internal/see-also/see-also.component.js +2 -2
- package/esm5/internal/see-also/see-also.module.js +1 -1
- package/esm5/internal/source-code/source-code.component.js +2 -2
- package/esm5/internal/source-code/source-code.module.js +1 -1
- package/esm5/languages/russian.js +1 -1
- package/esm5/public-api.js +5 -5
- package/esm5/taiga-ui-addon-doc.js +12 -11
- package/esm5/tokens/code-editor.js +1 -1
- package/esm5/tokens/example-content-processor.js +2 -4
- package/esm5/tokens/i18n.js +13 -5
- package/esm5/tokens/pages.js +1 -1
- package/esm5/tokens/source-code.js +1 -1
- package/esm5/utils/raw-load-record.js +44 -0
- package/esm5/utils/raw-load.js +21 -0
- package/fesm2015/taiga-ui-addon-doc.js +603 -587
- package/fesm2015/taiga-ui-addon-doc.js.map +1 -1
- package/fesm5/taiga-ui-addon-doc.js +972 -919
- package/fesm5/taiga-ui-addon-doc.js.map +1 -1
- package/interfaces/page.d.ts +4 -0
- package/package.json +7 -6
- package/public-api.d.ts +4 -4
- package/taiga-ui-addon-doc.d.ts +11 -10
- package/taiga-ui-addon-doc.metadata.json +1 -1
- package/utils/raw-load-record.d.ts +2 -0
- package/utils/raw-load.d.ts +2 -0
|
@@ -1,26 +1,54 @@
|
|
|
1
|
-
import { __decorate, __param, __assign, __spread, __read } from 'tslib';
|
|
2
|
-
import { Input, HostBinding, Component, NgModule, Inject, ChangeDetectionStrategy, InjectionToken, Renderer2, PLATFORM_ID, ContentChild, TemplateRef,
|
|
1
|
+
import { __awaiter, __generator, __decorate, __param, __assign, __spread, __read, __values } 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 } from 'rxjs';
|
|
4
|
+
import { switchMap, switchMapTo, mapTo, startWith, takeUntil, map, debounceTime, filter, mergeMap, distinctUntilChanged } from 'rxjs/operators';
|
|
3
5
|
import { CommonModule, isPlatformBrowser, Location as Location$1, DOCUMENT } from '@angular/common';
|
|
4
6
|
import { HighlightModule } from 'ngx-highlightjs';
|
|
5
|
-
import { tuiPure, TuiDestroyService, TUI_IS_MOBILE, TuiDragModule,
|
|
6
|
-
import { TUI_COPY_TEXTS, TuiSelectModule, TuiRadioBlockModule, TuiCheckboxLabeledModule, TuiDataListWrapperModule,
|
|
7
|
-
import {
|
|
8
|
-
import { switchMapTo, mapTo, startWith, takeUntil, filter, map, mergeMap, debounceTime, switchMap, distinctUntilChanged } from 'rxjs/operators';
|
|
9
|
-
import { TuiButtonModule, TuiModeDirective, TuiLinkModule, TuiExpandModule, TuiGroupModule, TuiTooltipModule, TuiModeModule, TuiSvgModule, TuiDataListModule, TuiTextfieldControllerModule, TuiHintControllerModule, TuiPrimitiveTextfieldModule, TuiHostedDropdownModule, TuiDropdownControllerModule, TuiScrollbarModule, TuiNotificationModule, TuiNotificationsService, TuiThemeNightModule, TuiRootModule, TuiDialogModule, TuiNotificationsModule } from '@taiga-ui/core';
|
|
7
|
+
import { tuiPure, TuiDestroyService, TUI_IS_MOBILE, TuiDragModule, EMPTY_QUERY, itemsQueryListObservable, watch, TUI_FOCUSABLE_ITEM_ACCESSOR, identity, TuiSwipeService, getElementObscurers, isPresent, uniqBy, TuiActiveZoneModule, TuiLetModule, TuiAutoFocusModule, tuiDefaultProp } from '@taiga-ui/cdk';
|
|
8
|
+
import { TUI_COPY_TEXTS, TuiSelectModule, TuiRadioBlockModule, TuiCheckboxLabeledModule, TuiDataListWrapperModule, TuiBadgeModule, TuiToggleModule, TuiInputCountModule, TuiTabsModule, TuiAccordionModule, TuiTagModule } from '@taiga-ui/kit';
|
|
9
|
+
import { TuiButtonModule, TuiModeDirective, TuiLinkModule, TuiExpandModule, TuiGroupModule, TuiTooltipModule, TuiModeModule, TuiSvgModule, TuiDataListModule, TuiTextfieldControllerModule, TuiHintControllerModule, TuiPrimitiveTextfieldModule, TuiDropdownControllerModule, TuiNotificationModule, TuiNotificationsService, TuiHostedDropdownModule, TuiScrollbarModule, TuiThemeNightModule, TuiRootModule, TuiDialogModule, TuiNotificationsModule } from '@taiga-ui/core';
|
|
10
10
|
import { FormControl, FormGroup, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
|
11
|
-
import { UrlSerializer, RouterModule,
|
|
12
|
-
import { Title } from '@angular/platform-browser';
|
|
13
|
-
import { TuiSidebarDirective, TuiSidebarModule } from '@taiga-ui/addon-mobile';
|
|
11
|
+
import { UrlSerializer, RouterModule, ActivatedRoute, Router, NavigationEnd } from '@angular/router';
|
|
14
12
|
import { trigger, transition, style, animate } from '@angular/animations';
|
|
15
13
|
import { Clipboard, ClipboardModule } from '@angular/cdk/clipboard';
|
|
16
14
|
import { LOCATION, LOCAL_STORAGE, WINDOW } from '@ng-web-apis/common';
|
|
17
15
|
import { PolymorpheusModule } from '@tinkoff/ng-polymorpheus';
|
|
16
|
+
import { TuiSidebarDirective, TuiSidebarModule } from '@taiga-ui/addon-mobile';
|
|
17
|
+
import { Title } from '@angular/platform-browser';
|
|
18
|
+
|
|
19
|
+
function rawLoad(content) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
21
|
+
var _a;
|
|
22
|
+
return __generator(this, function (_b) {
|
|
23
|
+
switch (_b.label) {
|
|
24
|
+
case 0:
|
|
25
|
+
if (!(content instanceof Promise)) return [3 /*break*/, 2];
|
|
26
|
+
return [4 /*yield*/, content];
|
|
27
|
+
case 1:
|
|
28
|
+
_a = (_b.sent()).default;
|
|
29
|
+
return [3 /*break*/, 3];
|
|
30
|
+
case 2:
|
|
31
|
+
_a = content;
|
|
32
|
+
_b.label = 3;
|
|
33
|
+
case 3: return [2 /*return*/, _a];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
18
38
|
|
|
19
39
|
var TuiDocCodeComponent = /** @class */ (function () {
|
|
20
40
|
function TuiDocCodeComponent() {
|
|
41
|
+
this.rawLoader$$ = new BehaviorSubject('');
|
|
21
42
|
this.filename = '';
|
|
22
|
-
this.
|
|
43
|
+
this.processor$ = this.rawLoader$$.pipe(switchMap(rawLoad));
|
|
23
44
|
}
|
|
45
|
+
Object.defineProperty(TuiDocCodeComponent.prototype, "code", {
|
|
46
|
+
set: function (code) {
|
|
47
|
+
this.rawLoader$$.next(code);
|
|
48
|
+
},
|
|
49
|
+
enumerable: true,
|
|
50
|
+
configurable: true
|
|
51
|
+
});
|
|
24
52
|
Object.defineProperty(TuiDocCodeComponent.prototype, "hasFilename", {
|
|
25
53
|
get: function () {
|
|
26
54
|
return !!this.filename;
|
|
@@ -33,14 +61,14 @@ var TuiDocCodeComponent = /** @class */ (function () {
|
|
|
33
61
|
], TuiDocCodeComponent.prototype, "filename", void 0);
|
|
34
62
|
__decorate([
|
|
35
63
|
Input()
|
|
36
|
-
], TuiDocCodeComponent.prototype, "code",
|
|
64
|
+
], TuiDocCodeComponent.prototype, "code", null);
|
|
37
65
|
__decorate([
|
|
38
66
|
HostBinding('class._has-filename')
|
|
39
67
|
], TuiDocCodeComponent.prototype, "hasFilename", null);
|
|
40
68
|
TuiDocCodeComponent = __decorate([
|
|
41
69
|
Component({
|
|
42
70
|
selector: 'tui-doc-code',
|
|
43
|
-
template: "<p *ngIf=\"filename\" class=\"t-header\">{{filename}}</p>\n<pre
|
|
71
|
+
template: "<p *ngIf=\"filename\" class=\"t-header\">{{filename}}</p>\n<pre\n class=\"t-code\"\n><code [lineNumbers]=\"true\" [highlight]=\"processor$ | async\"></code></pre>\n",
|
|
44
72
|
styles: [":host{display:block}.t-header{font:var(--tui-font-text-s);font-weight:700}.t-code{margin:0}.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:6px 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}@media screen and (max-width:47.9375em){.hljs:not(:empty){padding:1rem}}"]
|
|
45
73
|
})
|
|
46
74
|
], TuiDocCodeComponent);
|
|
@@ -86,7 +114,7 @@ var TuiDocCopyComponent = /** @class */ (function () {
|
|
|
86
114
|
TuiDocCopyComponent = __decorate([
|
|
87
115
|
Component({
|
|
88
116
|
selector: 'tui-doc-copy',
|
|
89
|
-
template: "<button\n *ngIf=\"texts$ | async as texts\"\n tuiButton\n type=\"button\"\n
|
|
117
|
+
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 class=\"t-content\" [class.t-content_moved]=\"copied$ | async\">\n <span class=\"t-initial\" [attr.data-text]=\"texts[0]\">\n <ng-content></ng-content>\n </span>\n {{ texts[1] }}\n </span>\n</button>\n",
|
|
90
118
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
91
119
|
providers: [TuiDestroyService],
|
|
92
120
|
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)}"]
|
|
@@ -116,7 +144,9 @@ var TuiDocCopyModule = /** @class */ (function () {
|
|
|
116
144
|
* Works with a tuple
|
|
117
145
|
* [@string tuiMode tooltip content, @string word 'background', @string 'form value']
|
|
118
146
|
*/
|
|
119
|
-
var TUI_DOC_DEMO_TEXTS = new InjectionToken('tui-doc-demo i18n texts', {
|
|
147
|
+
var TUI_DOC_DEMO_TEXTS = new InjectionToken('tui-doc-demo i18n texts', {
|
|
148
|
+
factory: function () { return ['Read more more about modes: ', 'Background', 'Form value']; },
|
|
149
|
+
});
|
|
120
150
|
/**
|
|
121
151
|
* Works with a tuple
|
|
122
152
|
* [
|
|
@@ -144,15 +174,21 @@ var TUI_DOC_DOCUMENTATION_TEXTS = new InjectionToken('tui-doc-documentation i18n
|
|
|
144
174
|
* @string link to a sample copied message label
|
|
145
175
|
* ]
|
|
146
176
|
*/
|
|
147
|
-
var TUI_DOC_EXAMPLE_TEXTS = new InjectionToken('tui-doc-example i18n texts', {
|
|
177
|
+
var TUI_DOC_EXAMPLE_TEXTS = new InjectionToken('tui-doc-example i18n texts', {
|
|
178
|
+
factory: function () { return ['Preview', 'Link to a sample was successfully copied', 'Done']; },
|
|
179
|
+
});
|
|
148
180
|
var TUI_DOC_MENU_TEXT = new InjectionToken('menu i18n text', {
|
|
149
181
|
factory: function () { return 'Menu'; },
|
|
150
182
|
});
|
|
151
183
|
var TUI_DOC_SEARCH_TEXT = new InjectionToken('search i18n text', {
|
|
152
184
|
factory: function () { return 'Search'; },
|
|
153
185
|
});
|
|
154
|
-
var TUI_DOC_SEE_ALSO_TEXT = new InjectionToken('tui-doc-see-also i18n text', {
|
|
155
|
-
|
|
186
|
+
var TUI_DOC_SEE_ALSO_TEXT = new InjectionToken('tui-doc-see-also i18n text', {
|
|
187
|
+
factory: function () { return 'See also'; },
|
|
188
|
+
});
|
|
189
|
+
var TUI_DOC_SOURCE_CODE_TEXT = new InjectionToken('tui-doc-source-code i18n text', {
|
|
190
|
+
factory: function () { return 'Source code'; },
|
|
191
|
+
});
|
|
156
192
|
|
|
157
193
|
var MIN_COMPONENT_WIDTH = 104;
|
|
158
194
|
// @dynamic
|
|
@@ -163,6 +199,8 @@ var TuiDocDemoComponent = /** @class */ (function () {
|
|
|
163
199
|
this.destroy$ = destroy$;
|
|
164
200
|
this.renderer = renderer;
|
|
165
201
|
this.texts = texts;
|
|
202
|
+
this.initialX = 0;
|
|
203
|
+
this.wrapperWidth = 0;
|
|
166
204
|
this.control = null;
|
|
167
205
|
this.updateOnVariants = ['change', 'blur', 'submit'];
|
|
168
206
|
this.updateOn = 'change';
|
|
@@ -172,8 +210,6 @@ var TuiDocDemoComponent = /** @class */ (function () {
|
|
|
172
210
|
this.mode = null;
|
|
173
211
|
this.change$ = new Subject();
|
|
174
212
|
this.items = ['onLight', 'onDark'];
|
|
175
|
-
this.initialX = 0;
|
|
176
|
-
this.wrapperWidth = 0;
|
|
177
213
|
this.isBrowser = isPlatformBrowser(platformId);
|
|
178
214
|
var parsedMode = locationRef.path().match(/tui-mode=(onDark|onLight)/);
|
|
179
215
|
if (parsedMode !== null && parsedMode.length > 0) {
|
|
@@ -190,6 +226,9 @@ var TuiDocDemoComponent = /** @class */ (function () {
|
|
|
190
226
|
});
|
|
191
227
|
}
|
|
192
228
|
TuiDocDemoComponent_1 = TuiDocDemoComponent;
|
|
229
|
+
TuiDocDemoComponent.prototype.onResize = function () {
|
|
230
|
+
this.setResizerTextContent();
|
|
231
|
+
};
|
|
193
232
|
TuiDocDemoComponent.prototype.ngOnInit = function () {
|
|
194
233
|
this.createForm();
|
|
195
234
|
};
|
|
@@ -206,9 +245,6 @@ var TuiDocDemoComponent = /** @class */ (function () {
|
|
|
206
245
|
var offsetWidth = this.content.nativeElement.offsetWidth;
|
|
207
246
|
this.resizerText.nativeElement.textContent = String(offsetWidth - parseInt(paddingLeft || '0', 10) * 2);
|
|
208
247
|
};
|
|
209
|
-
TuiDocDemoComponent.prototype.onResize = function () {
|
|
210
|
-
this.setResizerTextContent();
|
|
211
|
-
};
|
|
212
248
|
TuiDocDemoComponent.prototype.onDragStart = function (event) {
|
|
213
249
|
event.preventDefault();
|
|
214
250
|
this.initialX = event.clientX;
|
|
@@ -252,12 +288,6 @@ var TuiDocDemoComponent = /** @class */ (function () {
|
|
|
252
288
|
{ type: UrlSerializer, decorators: [{ type: Inject, args: [UrlSerializer,] }] },
|
|
253
289
|
{ type: Array, decorators: [{ type: Inject, args: [TUI_DOC_DEMO_TEXTS,] }] }
|
|
254
290
|
]; };
|
|
255
|
-
__decorate([
|
|
256
|
-
Input()
|
|
257
|
-
], TuiDocDemoComponent.prototype, "control", void 0);
|
|
258
|
-
__decorate([
|
|
259
|
-
ContentChild(TemplateRef)
|
|
260
|
-
], TuiDocDemoComponent.prototype, "template", void 0);
|
|
261
291
|
__decorate([
|
|
262
292
|
ViewChild('content')
|
|
263
293
|
], TuiDocDemoComponent.prototype, "content", void 0);
|
|
@@ -267,13 +297,19 @@ var TuiDocDemoComponent = /** @class */ (function () {
|
|
|
267
297
|
__decorate([
|
|
268
298
|
ViewChild('resizerText')
|
|
269
299
|
], TuiDocDemoComponent.prototype, "resizerText", void 0);
|
|
300
|
+
__decorate([
|
|
301
|
+
Input()
|
|
302
|
+
], TuiDocDemoComponent.prototype, "control", void 0);
|
|
303
|
+
__decorate([
|
|
304
|
+
ContentChild(TemplateRef)
|
|
305
|
+
], TuiDocDemoComponent.prototype, "template", void 0);
|
|
270
306
|
__decorate([
|
|
271
307
|
HostListener('window:resize')
|
|
272
308
|
], TuiDocDemoComponent.prototype, "onResize", null);
|
|
273
309
|
TuiDocDemoComponent = TuiDocDemoComponent_1 = __decorate([
|
|
274
310
|
Component({
|
|
275
311
|
selector: 'tui-doc-demo',
|
|
276
|
-
template: "<div class=\"t-bg-toggle\" [tuiMode]=\"null\">\n <ng-template #tooltip>\n {{texts[0]}}\n <a tuiLink tuiMode=\"onDark\" routerLink=\"/directives/mode\">\n <code>tuiMode</code>\n </a>\n </ng-template>\n <ng-container *ngIf=\"isMobile else desktop\">\n <tui-select\n
|
|
312
|
+
template: "<div class=\"t-bg-toggle\" [tuiMode]=\"null\">\n <ng-template #tooltip>\n {{ texts[0] }}\n <a tuiLink tuiMode=\"onDark\" routerLink=\"/directives/mode\">\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 describeId=\"form\" [content]=\"tooltip\"></tui-tooltip>\n <div tuiGroup class=\"tui-space_left-3\" [collapsed]=\"true\">\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=\"tui-space_left-3\"\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 #content id=\"demoContent\" class=\"t-content\">\n <form *ngIf=\"testForm\" class=\"t-form\" [formGroup]=\"testForm\">\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=\"tui-space_top-3\"\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 class=\"t-expand\" [expanded]=\"expanded\">\n <ng-template tuiExpandContent>\n <pre class=\"t-value\">\nForm data: {{ testForm.value | json }}</pre\n >\n <div tuiGroup class=\"tui-space_top-3\">\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 #resizerText class=\"t-resizer-text\"></span>\n </button>\n</div>\n",
|
|
277
313
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
278
314
|
providers: [
|
|
279
315
|
TuiDestroyService,
|
|
@@ -328,995 +364,1012 @@ var TuiDocDemoModule = /** @class */ (function () {
|
|
|
328
364
|
return TuiDocDemoModule;
|
|
329
365
|
}());
|
|
330
366
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
с: 'c',
|
|
351
|
-
т: 'n',
|
|
352
|
-
у: 'e',
|
|
353
|
-
ф: 'a',
|
|
354
|
-
х: '[',
|
|
355
|
-
ц: 'w',
|
|
356
|
-
ч: 'x',
|
|
357
|
-
ш: 'i',
|
|
358
|
-
щ: 'o',
|
|
359
|
-
ъ: ']',
|
|
360
|
-
ы: 's',
|
|
361
|
-
ь: 'm',
|
|
362
|
-
ю: '.',
|
|
363
|
-
я: 'z',
|
|
364
|
-
};
|
|
365
|
-
/**
|
|
366
|
-
* Translates text mistakenly typed in the Russian layout into English
|
|
367
|
-
* @param string string with Russian layout characters
|
|
368
|
-
* @return string with English layout characters
|
|
369
|
-
*/
|
|
370
|
-
function transliterateKeyboardLayout(string) {
|
|
371
|
-
var newStr = '';
|
|
372
|
-
for (var i = 0; i < string.length; i++) {
|
|
373
|
-
newStr += string.charAt(i) in MAP ? MAP[string.charAt(i)] : string.charAt(i);
|
|
374
|
-
}
|
|
375
|
-
return newStr;
|
|
367
|
+
function rgbToHex(r, g, b) {
|
|
368
|
+
return ('#' +
|
|
369
|
+
[r, g, b]
|
|
370
|
+
.map(function (x) {
|
|
371
|
+
var hex = x.toString(16);
|
|
372
|
+
return hex.length === 1 ? '0' + hex : hex;
|
|
373
|
+
})
|
|
374
|
+
.join(''));
|
|
375
|
+
}
|
|
376
|
+
function hexToRgb(hex) {
|
|
377
|
+
var matches = hex
|
|
378
|
+
.replace('#', '')
|
|
379
|
+
.split('')
|
|
380
|
+
.map(function (char, _, array) { return (array.length === 3 ? char + char : char); })
|
|
381
|
+
.join('')
|
|
382
|
+
.match(/.{2}/g);
|
|
383
|
+
return matches
|
|
384
|
+
? matches.map(function (x) { return Number.parseInt(x, 16); })
|
|
385
|
+
: [0, 0, 0];
|
|
376
386
|
}
|
|
377
387
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
var
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
useFactory: titleProviderFactory,
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
provide: NAVIGATION_LABELS,
|
|
398
|
-
deps: [TUI_DOC_PAGES],
|
|
399
|
-
useFactory: labelsProviderFactory,
|
|
400
|
-
},
|
|
401
|
-
{
|
|
402
|
-
provide: NAVIGATION_ITEMS,
|
|
403
|
-
deps: [TUI_DOC_PAGES],
|
|
404
|
-
useFactory: itemsProviderFactory,
|
|
405
|
-
},
|
|
406
|
-
];
|
|
407
|
-
function titleProviderFactory(router, activatedRoute, titlePrefix, destroy$) {
|
|
408
|
-
return router.events.pipe(filter(function (event) { return event instanceof NavigationEnd; }), map(function () { return activatedRoute.firstChild; }), filter(isPresent), mergeMap(function (_a) {
|
|
409
|
-
var data = _a.data;
|
|
410
|
-
return data;
|
|
411
|
-
}), map(function (_a) {
|
|
412
|
-
var title = _a.title;
|
|
413
|
-
return titlePrefix + title;
|
|
414
|
-
}), takeUntil(destroy$));
|
|
388
|
+
function inspectArray(array, depth) {
|
|
389
|
+
if (depth === 0) {
|
|
390
|
+
return '[…]';
|
|
391
|
+
}
|
|
392
|
+
var result = '';
|
|
393
|
+
var first = true;
|
|
394
|
+
for (var index = 0; index < array.length; index++) {
|
|
395
|
+
if (first) {
|
|
396
|
+
first = false;
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
result += ', ';
|
|
400
|
+
}
|
|
401
|
+
result += index in array ? inspectAny(array[index], depth - 1) : 'empty';
|
|
402
|
+
}
|
|
403
|
+
return "[" + result + "]";
|
|
415
404
|
}
|
|
416
|
-
function
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
405
|
+
function inspectObject(object, depth) {
|
|
406
|
+
if (depth === 0) {
|
|
407
|
+
return "{\u2026}";
|
|
408
|
+
}
|
|
409
|
+
var result = '';
|
|
410
|
+
var first = true;
|
|
411
|
+
for (var key in object) {
|
|
412
|
+
if (!object.hasOwnProperty(key)) {
|
|
413
|
+
continue;
|
|
414
|
+
}
|
|
415
|
+
if (first) {
|
|
416
|
+
first = false;
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
result += ', ';
|
|
420
|
+
}
|
|
421
|
+
result += key + ": " + inspectAny(object[key], depth - 1);
|
|
422
|
+
}
|
|
423
|
+
return "{" + result + "}";
|
|
424
424
|
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
425
|
+
// @bad TODO add more types
|
|
426
|
+
/**
|
|
427
|
+
* Returns readable JS entity
|
|
428
|
+
* @param data
|
|
429
|
+
* @param depth
|
|
430
|
+
* @return readable JS entity
|
|
431
|
+
*/
|
|
432
|
+
function inspectAny(data, depth) {
|
|
433
|
+
if (data === null) {
|
|
434
|
+
return 'null';
|
|
435
|
+
}
|
|
436
|
+
switch (typeof data) {
|
|
437
|
+
case 'string':
|
|
438
|
+
return "'" + data + "'";
|
|
439
|
+
case 'undefined':
|
|
440
|
+
case 'number':
|
|
441
|
+
case 'boolean':
|
|
442
|
+
case 'function':
|
|
443
|
+
return String(data);
|
|
444
|
+
}
|
|
445
|
+
if (data instanceof RegExp) {
|
|
446
|
+
return data.toString();
|
|
447
|
+
}
|
|
448
|
+
if (Array.isArray(data)) {
|
|
449
|
+
return inspectArray(data, depth);
|
|
450
|
+
}
|
|
451
|
+
return inspectObject(data, depth);
|
|
433
452
|
}
|
|
434
453
|
|
|
435
|
-
var
|
|
436
|
-
// @
|
|
437
|
-
var
|
|
438
|
-
function
|
|
439
|
-
|
|
440
|
-
this.
|
|
441
|
-
this.mode = mode;
|
|
442
|
-
this.sidebar = sidebar;
|
|
443
|
-
this.labels = labels;
|
|
444
|
-
this.items = items;
|
|
445
|
-
this.searchText = searchText;
|
|
446
|
-
this.router = router;
|
|
454
|
+
var SERIALIZED_SUFFIX = '$';
|
|
455
|
+
// @bad TODO: refactor output and value sync
|
|
456
|
+
var TuiDocDocumentationPropertyConnectorDirective = /** @class */ (function () {
|
|
457
|
+
function TuiDocDocumentationPropertyConnectorDirective(template, locationRef, activatedRoute, urlSerializer) {
|
|
458
|
+
this.template = template;
|
|
459
|
+
this.locationRef = locationRef;
|
|
447
460
|
this.activatedRoute = activatedRoute;
|
|
448
|
-
this.
|
|
449
|
-
this.
|
|
450
|
-
this.
|
|
451
|
-
this.
|
|
452
|
-
this.
|
|
453
|
-
this.
|
|
454
|
-
this.
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
461
|
+
this.urlSerializer = urlSerializer;
|
|
462
|
+
this.documentationPropertyName = '';
|
|
463
|
+
this.documentationPropertyMode = null;
|
|
464
|
+
this.documentationPropertyType = '';
|
|
465
|
+
this.documentationPropertyValue = null;
|
|
466
|
+
this.documentationPropertyDeprecated = false;
|
|
467
|
+
this.documentationPropertyValues = null;
|
|
468
|
+
this.documentationPropertyValueChange = new EventEmitter();
|
|
469
|
+
this.changed$ = new Subject();
|
|
470
|
+
this.emits$ = new BehaviorSubject(1);
|
|
471
|
+
}
|
|
472
|
+
TuiDocDocumentationPropertyConnectorDirective.prototype.ngOnInit = function () {
|
|
473
|
+
this.parseParams(this.activatedRoute.snapshot.queryParams);
|
|
474
|
+
};
|
|
475
|
+
Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "attrName", {
|
|
476
|
+
get: function () {
|
|
477
|
+
switch (this.documentationPropertyMode) {
|
|
478
|
+
case 'input':
|
|
479
|
+
return "[" + this.documentationPropertyName + "]";
|
|
480
|
+
case 'output':
|
|
481
|
+
return "(" + this.documentationPropertyName + ")";
|
|
482
|
+
case 'input-output':
|
|
483
|
+
return "[(" + this.documentationPropertyName + ")]";
|
|
484
|
+
default:
|
|
485
|
+
return this.documentationPropertyName;
|
|
486
|
+
}
|
|
467
487
|
},
|
|
468
488
|
enumerable: true,
|
|
469
489
|
configurable: true
|
|
470
490
|
});
|
|
471
|
-
Object.defineProperty(
|
|
491
|
+
Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "hasItems", {
|
|
472
492
|
get: function () {
|
|
473
|
-
return this.
|
|
493
|
+
return !!this.documentationPropertyValues;
|
|
474
494
|
},
|
|
475
495
|
enumerable: true,
|
|
476
496
|
configurable: true
|
|
477
497
|
});
|
|
478
|
-
Object.defineProperty(
|
|
498
|
+
Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "shouldShowValues", {
|
|
479
499
|
get: function () {
|
|
480
|
-
return this.
|
|
500
|
+
return this.documentationPropertyMode !== 'output';
|
|
481
501
|
},
|
|
482
502
|
enumerable: true,
|
|
483
503
|
configurable: true
|
|
484
504
|
});
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
};
|
|
488
|
-
TuiDocNavigationComponent.prototype.onGroupClick = function (index) {
|
|
489
|
-
this.openPagesGroupsArr[index] = !this.openPagesGroupsArr[index];
|
|
490
|
-
};
|
|
491
|
-
TuiDocNavigationComponent.prototype.closeMenu = function () {
|
|
492
|
-
this.menuOpen = false;
|
|
493
|
-
};
|
|
494
|
-
TuiDocNavigationComponent.prototype.onSearchChange = function (search) {
|
|
495
|
-
this.search = search;
|
|
496
|
-
this.open = this.canOpen;
|
|
497
|
-
};
|
|
498
|
-
TuiDocNavigationComponent.prototype.onClick = function () {
|
|
499
|
-
this.open = false;
|
|
500
|
-
this.menuOpen = false;
|
|
501
|
-
this.search = '';
|
|
502
|
-
this.openActivePageGroup();
|
|
503
|
-
};
|
|
504
|
-
TuiDocNavigationComponent.prototype.filterItems = function (items, search) {
|
|
505
|
-
return items.map(function (section) {
|
|
506
|
-
return uniqBy(section.filter(function (_a) {
|
|
507
|
-
var title = _a.title, _b = _a.keywords, keywords = _b === void 0 ? '' : _b;
|
|
508
|
-
title = title.toLowerCase();
|
|
509
|
-
search = search.toLowerCase();
|
|
510
|
-
keywords = keywords.toLowerCase();
|
|
511
|
-
return (title.includes(search) ||
|
|
512
|
-
keywords.includes(search) ||
|
|
513
|
-
title.includes(transliterateKeyboardLayout(search)) ||
|
|
514
|
-
keywords.includes(transliterateKeyboardLayout(search)) ||
|
|
515
|
-
search.replace(/-/gi, '').includes(title));
|
|
516
|
-
}), 'title');
|
|
517
|
-
});
|
|
518
|
-
};
|
|
519
|
-
TuiDocNavigationComponent.prototype.flattenSubPages = function (items) {
|
|
520
|
-
return items.reduce(function (array, item) { return __spread(array, [
|
|
521
|
-
item.reduce(function (pages, page) {
|
|
522
|
-
return 'subPages' in page
|
|
523
|
-
? __spread(pages, page.subPages) : __spread(pages, [page]);
|
|
524
|
-
}, []),
|
|
525
|
-
]); }, []);
|
|
526
|
-
};
|
|
527
|
-
TuiDocNavigationComponent.prototype.isActiveRoute = function (route) {
|
|
528
|
-
return this.router.isActive(route, false);
|
|
505
|
+
TuiDocDocumentationPropertyConnectorDirective.prototype.ngOnChanges = function () {
|
|
506
|
+
this.changed$.next();
|
|
529
507
|
};
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
}, SCROLL_INTO_VIEW_DELAY);
|
|
508
|
+
TuiDocDocumentationPropertyConnectorDirective.prototype.onValueChange = function (value) {
|
|
509
|
+
this.documentationPropertyValue = value;
|
|
510
|
+
this.documentationPropertyValueChange.emit(value);
|
|
511
|
+
this.setQueryParam(value);
|
|
535
512
|
};
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
this.
|
|
539
|
-
|
|
540
|
-
if ('route' in page && _this.isActiveRoute(page.route)) {
|
|
541
|
-
_this.openPagesArr[pagesIndex] = true;
|
|
542
|
-
_this.active = page.route;
|
|
543
|
-
}
|
|
544
|
-
if ('subPages' in page) {
|
|
545
|
-
page.subPages.forEach(function (subPage) {
|
|
546
|
-
if (_this.isActiveRoute(subPage.route)) {
|
|
547
|
-
_this.openPagesArr[pagesIndex] = true;
|
|
548
|
-
_this.openPagesGroupsArr[pagesIndex * 100 + pageIndex] = true;
|
|
549
|
-
_this.active = subPage.route;
|
|
550
|
-
}
|
|
551
|
-
});
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
});
|
|
513
|
+
TuiDocDocumentationPropertyConnectorDirective.prototype.emitEvent = function (event) {
|
|
514
|
+
// For more convenient debugging
|
|
515
|
+
console.log(this.attrName, event);
|
|
516
|
+
this.emits$.next(this.emits$.value + 1);
|
|
555
517
|
};
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
518
|
+
TuiDocDocumentationPropertyConnectorDirective.prototype.parseParams = function (params) {
|
|
519
|
+
if (!params[this.documentationPropertyName] &&
|
|
520
|
+
!params[this.documentationPropertyName + SERIALIZED_SUFFIX]) {
|
|
559
521
|
return;
|
|
560
522
|
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
523
|
+
var isValueAvailableByKey = !!params[this.documentationPropertyName + SERIALIZED_SUFFIX];
|
|
524
|
+
if (isValueAvailableByKey && this.documentationPropertyValues) {
|
|
525
|
+
this.onValueChange(this.documentationPropertyValues[params[this.documentationPropertyName + SERIALIZED_SUFFIX]]);
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
this.onValueChange(!isNaN(Number(params[this.documentationPropertyName]))
|
|
529
|
+
? Number(params[this.documentationPropertyName])
|
|
530
|
+
: params[this.documentationPropertyName]);
|
|
567
531
|
};
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
532
|
+
TuiDocDocumentationPropertyConnectorDirective.prototype.setQueryParam = function (value) {
|
|
533
|
+
var _a;
|
|
534
|
+
var tree = this.urlSerializer.parse(this.locationRef.path());
|
|
535
|
+
var isValueAvailableByKey = value instanceof Object;
|
|
536
|
+
var computedValue = isValueAvailableByKey && this.documentationPropertyValues
|
|
537
|
+
? this.documentationPropertyValues.indexOf(value)
|
|
538
|
+
: value;
|
|
539
|
+
var suffix = isValueAvailableByKey ? SERIALIZED_SUFFIX : '';
|
|
540
|
+
var propName = this.documentationPropertyName + suffix;
|
|
541
|
+
tree.queryParams = __assign(__assign({}, tree.queryParams), (_a = {}, _a[propName] = computedValue, _a));
|
|
542
|
+
this.locationRef.go(String(tree));
|
|
543
|
+
};
|
|
544
|
+
TuiDocDocumentationPropertyConnectorDirective.ctorParameters = function () { return [
|
|
545
|
+
{ type: TemplateRef, decorators: [{ type: Inject, args: [TemplateRef,] }] },
|
|
546
|
+
{ type: Location$1, decorators: [{ type: Inject, args: [Location$1,] }] },
|
|
547
|
+
{ type: ActivatedRoute, decorators: [{ type: Inject, args: [ActivatedRoute,] }] },
|
|
548
|
+
{ type: UrlSerializer, decorators: [{ type: Inject, args: [UrlSerializer,] }] }
|
|
580
549
|
]; };
|
|
581
550
|
__decorate([
|
|
582
|
-
|
|
583
|
-
],
|
|
551
|
+
Input()
|
|
552
|
+
], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyName", void 0);
|
|
584
553
|
__decorate([
|
|
585
|
-
|
|
586
|
-
],
|
|
554
|
+
Input()
|
|
555
|
+
], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyMode", void 0);
|
|
587
556
|
__decorate([
|
|
588
|
-
|
|
589
|
-
],
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
557
|
+
Input()
|
|
558
|
+
], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyType", void 0);
|
|
559
|
+
__decorate([
|
|
560
|
+
Input()
|
|
561
|
+
], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValue", void 0);
|
|
562
|
+
__decorate([
|
|
563
|
+
Input()
|
|
564
|
+
], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyDeprecated", void 0);
|
|
565
|
+
__decorate([
|
|
566
|
+
Input()
|
|
567
|
+
], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValues", void 0);
|
|
568
|
+
__decorate([
|
|
569
|
+
Output()
|
|
570
|
+
], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyValueChange", void 0);
|
|
571
|
+
TuiDocDocumentationPropertyConnectorDirective = __decorate([
|
|
572
|
+
Directive({
|
|
573
|
+
selector: 'ng-template[documentationPropertyName]',
|
|
574
|
+
exportAs: 'documentationProperty',
|
|
597
575
|
}),
|
|
598
|
-
__param(0, Inject(
|
|
599
|
-
__param(1, Inject(
|
|
600
|
-
__param(2, Inject(
|
|
601
|
-
__param(3, Inject(
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
__param(5, Inject(TuiSidebarDirective)),
|
|
605
|
-
__param(6, Inject(NAVIGATION_LABELS)),
|
|
606
|
-
__param(7, Inject(NAVIGATION_ITEMS)),
|
|
607
|
-
__param(8, Inject(TUI_DOC_SEARCH_TEXT)),
|
|
608
|
-
__param(9, Inject(Router)),
|
|
609
|
-
__param(10, Inject(ActivatedRoute))
|
|
610
|
-
], TuiDocNavigationComponent);
|
|
611
|
-
return TuiDocNavigationComponent;
|
|
576
|
+
__param(0, Inject(TemplateRef)),
|
|
577
|
+
__param(1, Inject(Location$1)),
|
|
578
|
+
__param(2, Inject(ActivatedRoute)),
|
|
579
|
+
__param(3, Inject(UrlSerializer))
|
|
580
|
+
], TuiDocDocumentationPropertyConnectorDirective);
|
|
581
|
+
return TuiDocDocumentationPropertyConnectorDirective;
|
|
612
582
|
}());
|
|
613
583
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
584
|
+
// @bad TODO subscribe propertiesConnectors changes
|
|
585
|
+
// @bad TODO refactor to make more flexible
|
|
586
|
+
// @dynamic
|
|
587
|
+
var TuiDocDocumentationComponent = /** @class */ (function () {
|
|
588
|
+
function TuiDocDocumentationComponent(changeDetectorRef, texts) {
|
|
589
|
+
this.changeDetectorRef = changeDetectorRef;
|
|
590
|
+
this.texts = texts;
|
|
591
|
+
this.heading = '';
|
|
592
|
+
this.showValues = true;
|
|
593
|
+
this.isAPI = false;
|
|
594
|
+
this.propertiesConnectors = EMPTY_QUERY;
|
|
595
|
+
this.activeItemIndex = 0;
|
|
623
596
|
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
597
|
+
TuiDocDocumentationComponent.prototype.ngAfterContentInit = function () {
|
|
598
|
+
itemsQueryListObservable(this.propertiesConnectors)
|
|
599
|
+
.pipe(switchMap(function (items) { return merge.apply(void 0, __spread(items.map(function (_a) {
|
|
600
|
+
var changed$ = _a.changed$;
|
|
601
|
+
return changed$;
|
|
602
|
+
}))); }), watch(this.changeDetectorRef))
|
|
603
|
+
.subscribe();
|
|
604
|
+
};
|
|
605
|
+
Object.defineProperty(TuiDocDocumentationComponent.prototype, "type", {
|
|
606
|
+
get: function () {
|
|
607
|
+
return this.isAPI ? this.texts[0] : this.texts[1];
|
|
627
608
|
},
|
|
628
609
|
enumerable: true,
|
|
629
610
|
configurable: true
|
|
630
611
|
});
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
612
|
+
TuiDocDocumentationComponent.prototype.getColor = function (color) {
|
|
613
|
+
if (color.length === 4) {
|
|
614
|
+
return color
|
|
615
|
+
.split('')
|
|
616
|
+
.reduce(function (result, current) { return __spread(result, [current, current]); }, [])
|
|
617
|
+
.join('')
|
|
618
|
+
.replace('#', '');
|
|
619
|
+
}
|
|
620
|
+
if (color.startsWith('#')) {
|
|
621
|
+
return color;
|
|
622
|
+
}
|
|
623
|
+
if (color === 'transparent') {
|
|
624
|
+
return '#000000';
|
|
625
|
+
}
|
|
626
|
+
var parsed = color
|
|
627
|
+
.replace('rgb(', '')
|
|
628
|
+
.replace('rgba(', '')
|
|
629
|
+
.replace(')', '')
|
|
630
|
+
.replace(' ', '')
|
|
631
|
+
.split(',')
|
|
632
|
+
.map(function (v) { return Number.parseInt(v, 10); });
|
|
633
|
+
return rgbToHex.apply(void 0, __spread(parsed));
|
|
634
|
+
};
|
|
635
|
+
TuiDocDocumentationComponent.prototype.getOpacity = function (color) {
|
|
636
|
+
if (color.startsWith('#') || color.startsWith('rgb(')) {
|
|
637
|
+
return 100;
|
|
638
|
+
}
|
|
639
|
+
if (color === 'transparent') {
|
|
640
|
+
return 0;
|
|
641
|
+
}
|
|
642
|
+
var lastComma = color.lastIndexOf(',');
|
|
643
|
+
var parsed = color
|
|
644
|
+
.substr(lastComma)
|
|
645
|
+
.replace(')', '')
|
|
646
|
+
.replace(' ', '')
|
|
647
|
+
.replace(',', '');
|
|
648
|
+
return Math.round(Number.parseFloat(parsed) * 100);
|
|
649
|
+
};
|
|
650
|
+
TuiDocDocumentationComponent.prototype.onColorChange = function (connector, color) {
|
|
651
|
+
var opacity = this.getOpacity(connector.documentationPropertyValue || '');
|
|
652
|
+
if (opacity === 100) {
|
|
653
|
+
connector.onValueChange(color);
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
var rgb = hexToRgb(color).join(', ');
|
|
657
|
+
var result = "rgba(" + rgb + ", " + opacity / 100 + ")";
|
|
658
|
+
connector.onValueChange(result);
|
|
659
|
+
};
|
|
660
|
+
TuiDocDocumentationComponent.prototype.onOpacityChange = function (connector, opacity) {
|
|
661
|
+
var hex = this.getColor(connector.documentationPropertyValue || '');
|
|
662
|
+
var rgb = hexToRgb(hex);
|
|
663
|
+
var result = "rgba(" + rgb + ", " + opacity / 100 + ")";
|
|
664
|
+
connector.onValueChange(result);
|
|
665
|
+
};
|
|
666
|
+
TuiDocDocumentationComponent.prototype.stripOptional = function (name) {
|
|
667
|
+
return name.replace('?', '');
|
|
668
|
+
};
|
|
669
|
+
TuiDocDocumentationComponent.prototype.isOptional = function (name) {
|
|
670
|
+
return name.includes('?');
|
|
671
|
+
};
|
|
672
|
+
TuiDocDocumentationComponent.prototype.showCleaner = function (type) {
|
|
673
|
+
return type.includes('null');
|
|
674
|
+
};
|
|
675
|
+
TuiDocDocumentationComponent.prototype.showContentTooltip = function (type) {
|
|
676
|
+
return type.includes('PolymorpheusContent');
|
|
677
|
+
};
|
|
678
|
+
TuiDocDocumentationComponent.prototype.inspectAny = function (data) {
|
|
679
|
+
return inspectAny(data, 2);
|
|
680
|
+
};
|
|
681
|
+
TuiDocDocumentationComponent.ctorParameters = function () { return [
|
|
682
|
+
{ type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] },
|
|
683
|
+
{ type: Array, decorators: [{ type: Inject, args: [TUI_DOC_DOCUMENTATION_TEXTS,] }] }
|
|
684
|
+
]; };
|
|
685
|
+
__decorate([
|
|
686
|
+
Input()
|
|
687
|
+
], TuiDocDocumentationComponent.prototype, "heading", void 0);
|
|
688
|
+
__decorate([
|
|
689
|
+
Input()
|
|
690
|
+
], TuiDocDocumentationComponent.prototype, "showValues", void 0);
|
|
691
|
+
__decorate([
|
|
692
|
+
Input()
|
|
693
|
+
], TuiDocDocumentationComponent.prototype, "isAPI", void 0);
|
|
694
|
+
__decorate([
|
|
695
|
+
ContentChildren(TuiDocDocumentationPropertyConnectorDirective)
|
|
696
|
+
], TuiDocDocumentationComponent.prototype, "propertiesConnectors", void 0);
|
|
697
|
+
TuiDocDocumentationComponent = __decorate([
|
|
698
|
+
Component({
|
|
699
|
+
selector: 'tui-doc-documentation',
|
|
700
|
+
template: "<h1 *ngIf=\"heading\" class=\"tui-text_h4\">{{ heading }}</h1>\n<ng-content></ng-content>\n<table class=\"tui-table tui-table_layout_fixed tui-table_font-size_s\">\n <tr class=\"tui-table__tr tui-table__tr_hover_disabled t-row t-row_header\">\n <th class=\"tui-table__th tui-table__th_first t-cell t-cell_prop\">\n {{ texts[2] }}\n </th>\n <td class=\"tui-table__th\">{{ type }}</td>\n <td\n *ngIf=\"showValues && !isAPI\"\n class=\"tui-table__th tui-table__th_last tui-table__th_text_right t-cell t-cell_value\"\n >\n {{ texts[3] }}\n </td>\n </tr>\n <tr\n *ngFor=\"let propertyConnector of propertiesConnectors; last as lastItem\"\n class=\"tui-table__tr tui-table__tr_hover_disabled t-row\"\n [class.t-deprecated]=\"propertyConnector.documentationPropertyDeprecated\"\n [class.tui-table__tr_border_none]=\"lastItem\"\n >\n <td\n class=\"tui-table__td tui-table__td_first tui-table__td_align_center t-cell\"\n >\n <div\n automation-id=\"tui-documentation__property-name\"\n class=\"t-property t-cell\"\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\n *ngTemplateOutlet=\"propertyConnector.template\"\n ></ng-container>\n </td>\n <td class=\"tui-table__td tui-table__td_align_center 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/TinkoffCreditSystems/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=\"tui-table__td tui-table__td_align_center tui-table__td_last tui-table__td_text_right t-cell\"\n >\n <ng-container\n *ngIf=\"propertyConnector.shouldShowValues; else elseEmitter\"\n >\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 #selectContent let-data>\n <code>{{ inspectAny(data) }}</code>\n </ng-template>\n\n <ng-template #noItems>\n <ng-container\n [ngSwitch]=\"propertyConnector.documentationPropertyType\"\n >\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 *ngSwitchCase=\"'color'\" tuiGroup>\n <tui-primitive-textfield\n tuiTextfieldType=\"color\"\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 </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",
|
|
701
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
702
|
+
animations: [
|
|
703
|
+
trigger('emitEvent', [
|
|
704
|
+
transition(':increment', [style({ opacity: 1 }), animate('500ms ease-in')]),
|
|
705
|
+
]),
|
|
706
|
+
],
|
|
707
|
+
styles: [":host{display:block;min-width:100%}.t-cell_prop{width:40%}.t-cell_value{max-width:20rem}@media screen and (max-width:47.9375em){.t-row{display:flex;flex-wrap:wrap}.t-row_header{display:none}.t-cell_value{width:9.375rem}.t-cell{width:100%;height:auto;padding:.5rem 0;text-align:left}}.t-property{font:var(--tui-font-text-m);margin-bottom:.25rem;font-family:monospace;color:#8f75d1}.t-type{font-family:monospace}.t-deprecated{background-color: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}"]
|
|
708
|
+
}),
|
|
709
|
+
__param(0, Inject(ChangeDetectorRef)),
|
|
710
|
+
__param(1, Inject(TUI_DOC_DOCUMENTATION_TEXTS))
|
|
711
|
+
], TuiDocDocumentationComponent);
|
|
712
|
+
return TuiDocDocumentationComponent;
|
|
713
|
+
}());
|
|
714
|
+
|
|
715
|
+
var TuiInputOpacityDirective = /** @class */ (function () {
|
|
716
|
+
function TuiInputOpacityDirective(renderer, tuiFocusableComponent) {
|
|
717
|
+
this.renderer = renderer;
|
|
718
|
+
this.tuiFocusableComponent = tuiFocusableComponent;
|
|
719
|
+
}
|
|
720
|
+
Object.defineProperty(TuiInputOpacityDirective.prototype, "tuiInputOpacity", {
|
|
721
|
+
set: function (opacity) {
|
|
722
|
+
var nativeFocusableElement = this.tuiFocusableComponent.nativeFocusableElement;
|
|
723
|
+
if (nativeFocusableElement) {
|
|
724
|
+
this.renderer.setStyle(nativeFocusableElement, 'opacity', opacity / 100);
|
|
725
|
+
}
|
|
726
|
+
},
|
|
727
|
+
enumerable: true,
|
|
728
|
+
configurable: true
|
|
729
|
+
});
|
|
730
|
+
TuiInputOpacityDirective.ctorParameters = function () { return [
|
|
731
|
+
{ type: Renderer2, decorators: [{ type: Inject, args: [Renderer2,] }] },
|
|
732
|
+
{ type: undefined, decorators: [{ type: Inject, args: [TUI_FOCUSABLE_ITEM_ACCESSOR,] }] }
|
|
733
|
+
]; };
|
|
734
|
+
__decorate([
|
|
735
|
+
Input()
|
|
736
|
+
], TuiInputOpacityDirective.prototype, "tuiInputOpacity", null);
|
|
737
|
+
TuiInputOpacityDirective = __decorate([
|
|
639
738
|
Directive({
|
|
640
|
-
selector: '[
|
|
641
|
-
providers: [TuiDestroyService],
|
|
739
|
+
selector: '[tuiInputOpacity]',
|
|
642
740
|
}),
|
|
643
|
-
__param(0, Inject(
|
|
644
|
-
__param(1, Inject(
|
|
645
|
-
],
|
|
646
|
-
return
|
|
741
|
+
__param(0, Inject(Renderer2)),
|
|
742
|
+
__param(1, Inject(TUI_FOCUSABLE_ITEM_ACCESSOR))
|
|
743
|
+
], TuiInputOpacityDirective);
|
|
744
|
+
return TuiInputOpacityDirective;
|
|
647
745
|
}());
|
|
648
746
|
|
|
649
|
-
var
|
|
650
|
-
function
|
|
747
|
+
var TuiInputOpacityModule = /** @class */ (function () {
|
|
748
|
+
function TuiInputOpacityModule() {
|
|
651
749
|
}
|
|
652
|
-
|
|
750
|
+
TuiInputOpacityModule = __decorate([
|
|
653
751
|
NgModule({
|
|
654
|
-
declarations: [
|
|
655
|
-
exports: [
|
|
752
|
+
declarations: [TuiInputOpacityDirective],
|
|
753
|
+
exports: [TuiInputOpacityDirective],
|
|
656
754
|
})
|
|
657
|
-
],
|
|
658
|
-
return
|
|
755
|
+
], TuiInputOpacityModule);
|
|
756
|
+
return TuiInputOpacityModule;
|
|
659
757
|
}());
|
|
660
758
|
|
|
661
|
-
var
|
|
662
|
-
function
|
|
759
|
+
var TuiDocDocumentationModule = /** @class */ (function () {
|
|
760
|
+
function TuiDocDocumentationModule() {
|
|
663
761
|
}
|
|
664
|
-
|
|
762
|
+
TuiDocDocumentationModule = __decorate([
|
|
665
763
|
NgModule({
|
|
666
764
|
imports: [
|
|
667
765
|
CommonModule,
|
|
668
766
|
FormsModule,
|
|
669
767
|
RouterModule,
|
|
670
|
-
|
|
671
|
-
|
|
768
|
+
TuiBadgeModule,
|
|
769
|
+
TuiSelectModule,
|
|
770
|
+
TuiToggleModule,
|
|
771
|
+
TuiTooltipModule,
|
|
772
|
+
TuiLinkModule,
|
|
773
|
+
TuiInputCountModule,
|
|
774
|
+
TuiModeModule,
|
|
775
|
+
TuiGroupModule,
|
|
776
|
+
TuiInputOpacityModule,
|
|
672
777
|
TuiPrimitiveTextfieldModule,
|
|
673
778
|
TuiTextfieldControllerModule,
|
|
674
|
-
|
|
675
|
-
TuiLetModule,
|
|
676
|
-
TuiModeModule,
|
|
677
|
-
TuiLinkModule,
|
|
678
|
-
TuiExpandModule,
|
|
679
|
-
TuiHostedDropdownModule,
|
|
779
|
+
TuiHintControllerModule,
|
|
680
780
|
TuiDropdownControllerModule,
|
|
681
|
-
TuiAccordionModule,
|
|
682
|
-
TuiScrollbarModule,
|
|
683
|
-
TuiSvgModule,
|
|
684
781
|
TuiDataListModule,
|
|
685
|
-
|
|
782
|
+
TuiDataListWrapperModule,
|
|
783
|
+
TuiNotificationModule,
|
|
784
|
+
],
|
|
785
|
+
declarations: [
|
|
786
|
+
TuiDocDocumentationComponent,
|
|
787
|
+
TuiDocDocumentationPropertyConnectorDirective,
|
|
788
|
+
],
|
|
789
|
+
exports: [
|
|
790
|
+
TuiDocDocumentationComponent,
|
|
791
|
+
TuiDocDocumentationPropertyConnectorDirective,
|
|
686
792
|
],
|
|
687
|
-
declarations: [TuiDocNavigationComponent],
|
|
688
|
-
exports: [TuiDocNavigationComponent],
|
|
689
793
|
})
|
|
690
|
-
],
|
|
691
|
-
return
|
|
794
|
+
], TuiDocDocumentationModule);
|
|
795
|
+
return TuiDocDocumentationModule;
|
|
692
796
|
}());
|
|
693
797
|
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
798
|
+
var TUI_DOC_CODE_EDITOR = new InjectionToken('Contains service for opening online IDE e.g. Stackblitz');
|
|
799
|
+
|
|
800
|
+
var TUI_DOC_EXAMPLE_CONTENT_PROCESSOR = new InjectionToken('Processes content in example', { factory: function () { return identity; } });
|
|
801
|
+
|
|
802
|
+
function rawLoadRecord(example) {
|
|
803
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
804
|
+
var processedContent, _a, _b, _c, key, content, _d, _e, e_1_1;
|
|
805
|
+
var e_1, _f;
|
|
806
|
+
return __generator(this, function (_g) {
|
|
807
|
+
switch (_g.label) {
|
|
808
|
+
case 0:
|
|
809
|
+
processedContent = {};
|
|
810
|
+
_g.label = 1;
|
|
811
|
+
case 1:
|
|
812
|
+
_g.trys.push([1, 6, 7, 8]);
|
|
813
|
+
_a = __values(Object.entries(example)), _b = _a.next();
|
|
814
|
+
_g.label = 2;
|
|
815
|
+
case 2:
|
|
816
|
+
if (!!_b.done) return [3 /*break*/, 5];
|
|
817
|
+
_c = __read(_b.value, 2), key = _c[0], content = _c[1];
|
|
818
|
+
_d = processedContent;
|
|
819
|
+
_e = key;
|
|
820
|
+
return [4 /*yield*/, rawLoad(content)];
|
|
821
|
+
case 3:
|
|
822
|
+
_d[_e] = _g.sent();
|
|
823
|
+
_g.label = 4;
|
|
824
|
+
case 4:
|
|
825
|
+
_b = _a.next();
|
|
826
|
+
return [3 /*break*/, 2];
|
|
827
|
+
case 5: return [3 /*break*/, 8];
|
|
828
|
+
case 6:
|
|
829
|
+
e_1_1 = _g.sent();
|
|
830
|
+
e_1 = { error: e_1_1 };
|
|
831
|
+
return [3 /*break*/, 8];
|
|
832
|
+
case 7:
|
|
833
|
+
try {
|
|
834
|
+
if (_b && !_b.done && (_f = _a.return)) _f.call(_a);
|
|
835
|
+
}
|
|
836
|
+
finally { if (e_1) throw e_1.error; }
|
|
837
|
+
return [7 /*endfinally*/];
|
|
838
|
+
case 8: return [2 /*return*/, processedContent];
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
});
|
|
713
842
|
}
|
|
714
843
|
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
}
|
|
728
|
-
|
|
844
|
+
// Ambient type cannot be used without dynamic https://github.com/angular/angular/issues/23395
|
|
845
|
+
// @dynamic
|
|
846
|
+
var TuiDocExampleComponent = /** @class */ (function () {
|
|
847
|
+
function TuiDocExampleComponent(id, clipboard, notifications, location, copyTexts$, texts, codeEditor, processContent) {
|
|
848
|
+
this.id = id;
|
|
849
|
+
this.clipboard = clipboard;
|
|
850
|
+
this.notifications = notifications;
|
|
851
|
+
this.location = location;
|
|
852
|
+
this.copyTexts$ = copyTexts$;
|
|
853
|
+
this.texts = texts;
|
|
854
|
+
this.codeEditor = codeEditor;
|
|
855
|
+
this.processContent = processContent;
|
|
856
|
+
this.rawLoader$$ = new BehaviorSubject({});
|
|
857
|
+
this.heading = '';
|
|
858
|
+
this.description = '';
|
|
859
|
+
this.componentName = this.location.pathname.slice(1);
|
|
860
|
+
this.activeItemIndex = 0;
|
|
861
|
+
this.defaultTab = this.texts[0];
|
|
862
|
+
this.copy$ = this.copyTexts$.pipe(map(function (_a) {
|
|
863
|
+
var _b = __read(_a, 1), copy = _b[0];
|
|
864
|
+
return copy;
|
|
865
|
+
}));
|
|
866
|
+
this.processor$ = this.rawLoader$$.pipe(switchMap(rawLoadRecord), map(this.processContent));
|
|
729
867
|
}
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
if (depth === 0) {
|
|
734
|
-
return "{\u2026}";
|
|
735
|
-
}
|
|
736
|
-
var result = '';
|
|
737
|
-
var first = true;
|
|
738
|
-
for (var key in object) {
|
|
739
|
-
if (!object.hasOwnProperty(key)) {
|
|
740
|
-
continue;
|
|
741
|
-
}
|
|
742
|
-
if (first) {
|
|
743
|
-
first = false;
|
|
744
|
-
}
|
|
745
|
-
else {
|
|
746
|
-
result += ', ';
|
|
747
|
-
}
|
|
748
|
-
result += key + ": " + inspectAny(object[key], depth - 1);
|
|
749
|
-
}
|
|
750
|
-
return "{" + result + "}";
|
|
751
|
-
}
|
|
752
|
-
// @bad TODO add more types
|
|
753
|
-
/**
|
|
754
|
-
* Returns readable JS entity
|
|
755
|
-
* @param data
|
|
756
|
-
* @param depth
|
|
757
|
-
* @return readable JS entity
|
|
758
|
-
*/
|
|
759
|
-
function inspectAny(data, depth) {
|
|
760
|
-
if (data === null) {
|
|
761
|
-
return 'null';
|
|
762
|
-
}
|
|
763
|
-
switch (typeof data) {
|
|
764
|
-
case 'string':
|
|
765
|
-
return "'" + data + "'";
|
|
766
|
-
case 'undefined':
|
|
767
|
-
case 'number':
|
|
768
|
-
case 'boolean':
|
|
769
|
-
case 'function':
|
|
770
|
-
return String(data);
|
|
771
|
-
}
|
|
772
|
-
if (data instanceof RegExp) {
|
|
773
|
-
return data.toString();
|
|
774
|
-
}
|
|
775
|
-
if (Array.isArray(data)) {
|
|
776
|
-
return inspectArray(data, depth);
|
|
777
|
-
}
|
|
778
|
-
return inspectObject(data, depth);
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
var SERIALIZED_SUFFIX = '$';
|
|
782
|
-
// @bad TODO: refactor output and value sync
|
|
783
|
-
var TuiDocDocumentationPropertyConnectorDirective = /** @class */ (function () {
|
|
784
|
-
function TuiDocDocumentationPropertyConnectorDirective(template, locationRef, activatedRoute, urlSerializer) {
|
|
785
|
-
this.template = template;
|
|
786
|
-
this.locationRef = locationRef;
|
|
787
|
-
this.activatedRoute = activatedRoute;
|
|
788
|
-
this.urlSerializer = urlSerializer;
|
|
789
|
-
this.documentationPropertyName = '';
|
|
790
|
-
this.documentationPropertyMode = null;
|
|
791
|
-
this.documentationPropertyType = '';
|
|
792
|
-
this.documentationPropertyValue = null;
|
|
793
|
-
this.documentationPropertyDeprecated = false;
|
|
794
|
-
this.documentationPropertyValues = null;
|
|
795
|
-
this.documentationPropertyValueChange = new EventEmitter();
|
|
796
|
-
this.changed$ = new Subject();
|
|
797
|
-
this.emits$ = new BehaviorSubject(1);
|
|
798
|
-
}
|
|
799
|
-
TuiDocDocumentationPropertyConnectorDirective.prototype.ngOnInit = function () {
|
|
800
|
-
this.parseParams(this.activatedRoute.snapshot.queryParams);
|
|
801
|
-
};
|
|
802
|
-
Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "attrName", {
|
|
803
|
-
get: function () {
|
|
804
|
-
switch (this.documentationPropertyMode) {
|
|
805
|
-
case 'input':
|
|
806
|
-
return "[" + this.documentationPropertyName + "]";
|
|
807
|
-
case 'output':
|
|
808
|
-
return "(" + this.documentationPropertyName + ")";
|
|
809
|
-
case 'input-output':
|
|
810
|
-
return "[(" + this.documentationPropertyName + ")]";
|
|
811
|
-
default:
|
|
812
|
-
return this.documentationPropertyName;
|
|
813
|
-
}
|
|
814
|
-
},
|
|
815
|
-
enumerable: true,
|
|
816
|
-
configurable: true
|
|
817
|
-
});
|
|
818
|
-
Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "hasItems", {
|
|
819
|
-
get: function () {
|
|
820
|
-
return !!this.documentationPropertyValues;
|
|
821
|
-
},
|
|
822
|
-
enumerable: true,
|
|
823
|
-
configurable: true
|
|
824
|
-
});
|
|
825
|
-
Object.defineProperty(TuiDocDocumentationPropertyConnectorDirective.prototype, "shouldShowValues", {
|
|
826
|
-
get: function () {
|
|
827
|
-
return this.documentationPropertyMode !== 'output';
|
|
868
|
+
Object.defineProperty(TuiDocExampleComponent.prototype, "content", {
|
|
869
|
+
set: function (content) {
|
|
870
|
+
this.rawLoader$$.next(content);
|
|
828
871
|
},
|
|
829
872
|
enumerable: true,
|
|
830
873
|
configurable: true
|
|
831
874
|
});
|
|
832
|
-
|
|
833
|
-
this.
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
this.
|
|
838
|
-
this.
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
var isValueAvailableByKey = !!params[this.documentationPropertyName + SERIALIZED_SUFFIX];
|
|
846
|
-
if (isValueAvailableByKey && this.documentationPropertyValues) {
|
|
847
|
-
this.onValueChange(this.documentationPropertyValues[params[this.documentationPropertyName + SERIALIZED_SUFFIX]]);
|
|
848
|
-
return;
|
|
849
|
-
}
|
|
850
|
-
this.onValueChange(!isNaN(Number(params[this.documentationPropertyName]))
|
|
851
|
-
? Number(params[this.documentationPropertyName])
|
|
852
|
-
: params[this.documentationPropertyName]);
|
|
853
|
-
};
|
|
854
|
-
TuiDocDocumentationPropertyConnectorDirective.prototype.setQueryParam = function (value) {
|
|
855
|
-
var _a;
|
|
856
|
-
var tree = this.urlSerializer.parse(this.locationRef.path());
|
|
857
|
-
var isValueAvailableByKey = value instanceof Object;
|
|
858
|
-
var computedValue = isValueAvailableByKey && this.documentationPropertyValues
|
|
859
|
-
? this.documentationPropertyValues.indexOf(value)
|
|
860
|
-
: value;
|
|
861
|
-
var suffix = isValueAvailableByKey ? SERIALIZED_SUFFIX : '';
|
|
862
|
-
var propName = this.documentationPropertyName + suffix;
|
|
863
|
-
tree.queryParams = __assign(__assign({}, tree.queryParams), (_a = {}, _a[propName] = computedValue, _a));
|
|
864
|
-
this.locationRef.go(String(tree));
|
|
865
|
-
};
|
|
866
|
-
TuiDocDocumentationPropertyConnectorDirective.prototype.emitEvent = function (event) {
|
|
867
|
-
// For more convenient debugging
|
|
868
|
-
// tslint:disable-next-line:no-console
|
|
869
|
-
console.log(this.attrName, event);
|
|
870
|
-
this.emits$.next(this.emits$.value + 1);
|
|
875
|
+
TuiDocExampleComponent.prototype.copyExampleLink = function () {
|
|
876
|
+
var hashPosition = this.location.href.indexOf('#');
|
|
877
|
+
var currentUrl = hashPosition > -1
|
|
878
|
+
? this.location.href.substr(0, hashPosition)
|
|
879
|
+
: this.location.href;
|
|
880
|
+
var url = currentUrl + "#" + this.id;
|
|
881
|
+
this.clipboard.copy(url);
|
|
882
|
+
this.notifications
|
|
883
|
+
.show(this.texts[1], {
|
|
884
|
+
label: this.texts[2],
|
|
885
|
+
status: "success" /* Success */,
|
|
886
|
+
})
|
|
887
|
+
.subscribe();
|
|
871
888
|
};
|
|
872
|
-
|
|
873
|
-
{ type:
|
|
874
|
-
{ type:
|
|
875
|
-
{ type:
|
|
876
|
-
{ type:
|
|
889
|
+
TuiDocExampleComponent.ctorParameters = function () { return [
|
|
890
|
+
{ type: String, decorators: [{ type: Attribute, args: ['id',] }] },
|
|
891
|
+
{ type: Clipboard, decorators: [{ type: Inject, args: [Clipboard,] }] },
|
|
892
|
+
{ type: TuiNotificationsService, decorators: [{ type: Inject, args: [TuiNotificationsService,] }] },
|
|
893
|
+
{ type: Location, decorators: [{ type: Inject, args: [LOCATION,] }] },
|
|
894
|
+
{ type: Observable, decorators: [{ type: Inject, args: [TUI_COPY_TEXTS,] }] },
|
|
895
|
+
{ type: Array, decorators: [{ type: Inject, args: [TUI_DOC_EXAMPLE_TEXTS,] }] },
|
|
896
|
+
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [TUI_DOC_CODE_EDITOR,] }] },
|
|
897
|
+
{ type: undefined, decorators: [{ type: Inject, args: [TUI_DOC_EXAMPLE_CONTENT_PROCESSOR,] }] }
|
|
877
898
|
]; };
|
|
878
899
|
__decorate([
|
|
879
900
|
Input()
|
|
880
|
-
],
|
|
881
|
-
__decorate([
|
|
882
|
-
Input()
|
|
883
|
-
], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyMode", void 0);
|
|
884
|
-
__decorate([
|
|
885
|
-
Input()
|
|
886
|
-
], TuiDocDocumentationPropertyConnectorDirective.prototype, "documentationPropertyType", void 0);
|
|
901
|
+
], TuiDocExampleComponent.prototype, "heading", void 0);
|
|
887
902
|
__decorate([
|
|
888
903
|
Input()
|
|
889
|
-
],
|
|
904
|
+
], TuiDocExampleComponent.prototype, "description", void 0);
|
|
890
905
|
__decorate([
|
|
891
906
|
Input()
|
|
892
|
-
],
|
|
907
|
+
], TuiDocExampleComponent.prototype, "content", null);
|
|
893
908
|
__decorate([
|
|
894
909
|
Input()
|
|
895
|
-
],
|
|
896
|
-
__decorate([
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
exportAs: 'documentationProperty',
|
|
910
|
+
], TuiDocExampleComponent.prototype, "componentName", void 0);
|
|
911
|
+
TuiDocExampleComponent = __decorate([
|
|
912
|
+
Component({
|
|
913
|
+
selector: 'tui-doc-example',
|
|
914
|
+
template: "<h3 *ngIf=\"heading\" class=\"t-title\">\n <span polymorpheus-outlet [content]=\"heading\"></span>\n <button\n *ngIf=\"id\"\n tuiIconButton\n type=\"button\"\n size=\"xs\"\n icon=\"tuiIconLinkLarge\"\n appearance=\"icon\"\n class=\"t-link-icon\"\n [title]=\"copy$ | async\"\n (click)=\"copyExampleLink()\"\n ></button>\n</h3>\n<h4\n *ngIf=\"description\"\n polymorpheus-outlet\n class=\"t-description\"\n [content]=\"description\"\n></h4>\n\n<div *ngIf=\"processor$ | async as content\" class=\"t-example\">\n <ng-container *ngIf=\"content | tuiDocExampleGetTabs: defaultTab as tabs\">\n <div class=\"t-tabs-wrapper\">\n <tui-tabs-with-more\n class=\"t-tabs\"\n [(activeItemIndex)]=\"activeItemIndex\"\n >\n <ng-container *ngFor=\"let tab of tabs\">\n <button *tuiTab tuiTab>{{tab}}</button>\n </ng-container>\n </tui-tabs-with-more>\n\n <button\n *ngIf=\"codeEditor\"\n tuiButton\n appearance=\"flat\"\n size=\"s\"\n (click)=\"codeEditor.open(componentName, id || '', content)\"\n >\n Edit on {{codeEditor.name}}\n </button>\n </div>\n\n <ng-container\n *ngIf=\"{\n activeTab: tabs[activeItemIndex],\n code: content[tabs[activeItemIndex]] || ''\n } as state\"\n >\n <div\n *ngIf=\"state.activeTab == defaultTab; else codeSection\"\n automation-id=\"tui-doc-example\"\n class=\"t-demo\"\n >\n <ng-content></ng-content>\n </div>\n\n <ng-template #codeSection>\n <tui-doc-copy\n class=\"t-copy-code\"\n [cdkCopyToClipboard]=\"state.code\"\n ></tui-doc-copy>\n <tui-doc-code [code]=\"state.code\"></tui-doc-code>\n </ng-template>\n </ng-container>\n </ng-container>\n</div>\n",
|
|
915
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
916
|
+
styles: [":host{position:relative;display:block;padding-top:3.5rem;clear:right}.t-title{font:var(--tui-font-heading-5);margin:0 0 .5rem}@media screen and (max-width:47.9375em){:host{padding-top:2rem}.t-title{font:var(--tui-font-heading-6)}}.t-description{font:var(--tui-font-text-m);font-weight:400;margin:0}.t-description:first-letter,.t-title:first-letter{text-transform:capitalize}.t-example{position:relative;margin-top:1.5rem;border:1px solid var(--tui-base-03);border-radius:var(--tui-radius-m);box-shadow:0 .125rem .1875rem rgba(0,0,0,.1)}.t-tabs-wrapper{display:flex;padding:0 2rem;box-shadow:inset 0 -1px var(--tui-base-03);justify-content:space-between;align-items:center}@media screen and (max-width:47.9375em){.t-example{margin-top:.75rem}.t-tabs-wrapper{padding:0 1rem}}.t-tabs{flex-grow:1}.t-demo{padding:2rem;overflow-x:auto}@media all and (-webkit-min-device-pixel-ratio:0) and (min-resolution:0.001dpcm){.t-demo::-webkit-scrollbar,.t-demo::-webkit-scrollbar-thumb{width:1rem;height:1rem;border-radius:6.25rem;background-clip:padding-box;border:6px solid transparent}.t-demo::-webkit-scrollbar{background-color:transparent}.t-demo::-webkit-scrollbar-thumb{background-color:var(--tui-clear-hover)}.t-demo::-webkit-scrollbar-thumb:hover{background-color:var(--tui-clear-active)}.t-demo::-webkit-scrollbar-thumb:active{background-color:var(--tui-text-03)}}@media screen and (max-width:47.9375em){.t-demo{padding:1rem}}.t-copy-code{position:absolute;top:4.375rem;right:1rem}.t-link-icon{margin-left:.3rem;vertical-align:baseline}"]
|
|
903
917
|
}),
|
|
904
|
-
__param(0,
|
|
905
|
-
__param(1, Inject(
|
|
906
|
-
__param(2, Inject(
|
|
907
|
-
__param(3, Inject(
|
|
908
|
-
|
|
909
|
-
|
|
918
|
+
__param(0, Attribute('id')),
|
|
919
|
+
__param(1, Inject(Clipboard)),
|
|
920
|
+
__param(2, Inject(TuiNotificationsService)),
|
|
921
|
+
__param(3, Inject(LOCATION)),
|
|
922
|
+
__param(4, Inject(TUI_COPY_TEXTS)),
|
|
923
|
+
__param(5, Inject(TUI_DOC_EXAMPLE_TEXTS)),
|
|
924
|
+
__param(6, Optional()),
|
|
925
|
+
__param(6, Inject(TUI_DOC_CODE_EDITOR)),
|
|
926
|
+
__param(7, Inject(TUI_DOC_EXAMPLE_CONTENT_PROCESSOR))
|
|
927
|
+
], TuiDocExampleComponent);
|
|
928
|
+
return TuiDocExampleComponent;
|
|
910
929
|
}());
|
|
911
930
|
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
// @dynamic
|
|
915
|
-
var TuiDocDocumentationComponent = /** @class */ (function () {
|
|
916
|
-
function TuiDocDocumentationComponent(changeDetectorRef, texts) {
|
|
917
|
-
this.changeDetectorRef = changeDetectorRef;
|
|
918
|
-
this.texts = texts;
|
|
919
|
-
this.heading = '';
|
|
920
|
-
this.showValues = true;
|
|
921
|
-
this.isAPI = false;
|
|
922
|
-
this.propertiesConnectors = EMPTY_QUERY;
|
|
923
|
-
this.activeItemIndex = 0;
|
|
931
|
+
var TuiDocExampleGetTabsPipe = /** @class */ (function () {
|
|
932
|
+
function TuiDocExampleGetTabsPipe() {
|
|
924
933
|
}
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
.pipe(switchMap(function (items) { return merge.apply(void 0, __spread(items.map(function (_a) {
|
|
928
|
-
var changed$ = _a.changed$;
|
|
929
|
-
return changed$;
|
|
930
|
-
}))); }), watch(this.changeDetectorRef))
|
|
931
|
-
.subscribe();
|
|
934
|
+
TuiDocExampleGetTabsPipe.prototype.transform = function (content, defaultTab) {
|
|
935
|
+
return __spread([defaultTab], Object.keys(content));
|
|
932
936
|
};
|
|
933
|
-
|
|
937
|
+
TuiDocExampleGetTabsPipe = __decorate([
|
|
938
|
+
Pipe({ name: 'tuiDocExampleGetTabs' })
|
|
939
|
+
], TuiDocExampleGetTabsPipe);
|
|
940
|
+
return TuiDocExampleGetTabsPipe;
|
|
941
|
+
}());
|
|
942
|
+
|
|
943
|
+
var TuiDocExampleModule = /** @class */ (function () {
|
|
944
|
+
function TuiDocExampleModule() {
|
|
945
|
+
}
|
|
946
|
+
TuiDocExampleModule = __decorate([
|
|
947
|
+
NgModule({
|
|
948
|
+
imports: [
|
|
949
|
+
CommonModule,
|
|
950
|
+
ClipboardModule,
|
|
951
|
+
TuiTabsModule,
|
|
952
|
+
TuiButtonModule,
|
|
953
|
+
TuiDocCopyModule,
|
|
954
|
+
TuiDocCodeModule,
|
|
955
|
+
PolymorpheusModule,
|
|
956
|
+
],
|
|
957
|
+
declarations: [TuiDocExampleComponent, TuiDocExampleGetTabsPipe],
|
|
958
|
+
exports: [TuiDocExampleComponent, TuiDocExampleGetTabsPipe],
|
|
959
|
+
})
|
|
960
|
+
], TuiDocExampleModule);
|
|
961
|
+
return TuiDocExampleModule;
|
|
962
|
+
}());
|
|
963
|
+
|
|
964
|
+
// @dynamic
|
|
965
|
+
var TuiDocMainComponent = /** @class */ (function () {
|
|
966
|
+
function TuiDocMainComponent(storage, windowRef) {
|
|
967
|
+
this.storage = storage;
|
|
968
|
+
this.windowRef = windowRef;
|
|
969
|
+
this.night = this.storage.getItem('night') === 'true' ||
|
|
970
|
+
(this.storage.getItem('night') === null &&
|
|
971
|
+
this.windowRef.matchMedia('(prefers-color-scheme: dark)').matches);
|
|
972
|
+
this.change$ = new Subject();
|
|
973
|
+
}
|
|
974
|
+
TuiDocMainComponent_1 = TuiDocMainComponent;
|
|
975
|
+
Object.defineProperty(TuiDocMainComponent.prototype, "mode", {
|
|
934
976
|
get: function () {
|
|
935
|
-
return this.
|
|
977
|
+
return this.night ? 'onDark' : null;
|
|
936
978
|
},
|
|
937
979
|
enumerable: true,
|
|
938
980
|
configurable: true
|
|
939
981
|
});
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
.reduce(function (result, current) { return __spread(result, [current, current]); }, [])
|
|
945
|
-
.join('')
|
|
946
|
-
.replace('#', '');
|
|
947
|
-
}
|
|
948
|
-
if (color.startsWith('#')) {
|
|
949
|
-
return color;
|
|
950
|
-
}
|
|
951
|
-
if (color === 'transparent') {
|
|
952
|
-
return '#000000';
|
|
953
|
-
}
|
|
954
|
-
var parsed = color
|
|
955
|
-
.replace('rgb(', '')
|
|
956
|
-
.replace('rgba(', '')
|
|
957
|
-
.replace(')', '')
|
|
958
|
-
.replace(' ', '')
|
|
959
|
-
.split(',')
|
|
960
|
-
.map(function (v) { return Number.parseInt(v, 10); });
|
|
961
|
-
return rgbToHex.apply(void 0, __spread(parsed));
|
|
962
|
-
};
|
|
963
|
-
TuiDocDocumentationComponent.prototype.getOpacity = function (color) {
|
|
964
|
-
if (color.startsWith('#') || color.startsWith('rgb(')) {
|
|
965
|
-
return 100;
|
|
966
|
-
}
|
|
967
|
-
if (color === 'transparent') {
|
|
968
|
-
return 0;
|
|
969
|
-
}
|
|
970
|
-
var lastComma = color.lastIndexOf(',');
|
|
971
|
-
var parsed = color
|
|
972
|
-
.substr(lastComma)
|
|
973
|
-
.replace(')', '')
|
|
974
|
-
.replace(' ', '')
|
|
975
|
-
.replace(',', '');
|
|
976
|
-
return Math.round(Number.parseFloat(parsed) * 100);
|
|
977
|
-
};
|
|
978
|
-
TuiDocDocumentationComponent.prototype.onColorChange = function (connector, color) {
|
|
979
|
-
var opacity = this.getOpacity(connector.documentationPropertyValue || '');
|
|
980
|
-
if (opacity === 100) {
|
|
981
|
-
connector.onValueChange(color);
|
|
982
|
-
return;
|
|
983
|
-
}
|
|
984
|
-
var rgb = hexToRgb(color).join(', ');
|
|
985
|
-
var result = "rgba(" + rgb + ", " + opacity / 100 + ")";
|
|
986
|
-
connector.onValueChange(result);
|
|
987
|
-
};
|
|
988
|
-
TuiDocDocumentationComponent.prototype.onOpacityChange = function (connector, opacity) {
|
|
989
|
-
var hex = this.getColor(connector.documentationPropertyValue || '');
|
|
990
|
-
var rgb = hexToRgb(hex);
|
|
991
|
-
var result = "rgba(" + rgb + ", " + opacity / 100 + ")";
|
|
992
|
-
connector.onValueChange(result);
|
|
993
|
-
};
|
|
994
|
-
TuiDocDocumentationComponent.prototype.stripOptional = function (name) {
|
|
995
|
-
return name.replace('?', '');
|
|
996
|
-
};
|
|
997
|
-
TuiDocDocumentationComponent.prototype.isOptional = function (name) {
|
|
998
|
-
return name.includes('?');
|
|
999
|
-
};
|
|
1000
|
-
TuiDocDocumentationComponent.prototype.showCleaner = function (type) {
|
|
1001
|
-
return type.includes('null');
|
|
1002
|
-
};
|
|
1003
|
-
TuiDocDocumentationComponent.prototype.showContentTooltip = function (type) {
|
|
1004
|
-
return type.includes('PolymorpheusContent');
|
|
1005
|
-
};
|
|
1006
|
-
TuiDocDocumentationComponent.prototype.inspectAny = function (data) {
|
|
1007
|
-
return inspectAny(data, 2);
|
|
982
|
+
TuiDocMainComponent.prototype.onMode = function (night) {
|
|
983
|
+
this.night = night;
|
|
984
|
+
this.change$.next();
|
|
985
|
+
this.storage.setItem('night', String(night));
|
|
1008
986
|
};
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
{ type:
|
|
987
|
+
var TuiDocMainComponent_1;
|
|
988
|
+
TuiDocMainComponent.ctorParameters = function () { return [
|
|
989
|
+
{ type: Storage, decorators: [{ type: Inject, args: [LOCAL_STORAGE,] }] },
|
|
990
|
+
{ type: Window, decorators: [{ type: Inject, args: [WINDOW,] }] }
|
|
1012
991
|
]; };
|
|
1013
|
-
__decorate([
|
|
1014
|
-
Input()
|
|
1015
|
-
], TuiDocDocumentationComponent.prototype, "heading", void 0);
|
|
1016
|
-
__decorate([
|
|
1017
|
-
Input()
|
|
1018
|
-
], TuiDocDocumentationComponent.prototype, "showValues", void 0);
|
|
1019
|
-
__decorate([
|
|
1020
|
-
Input()
|
|
1021
|
-
], TuiDocDocumentationComponent.prototype, "isAPI", void 0);
|
|
1022
|
-
__decorate([
|
|
1023
|
-
ContentChildren(TuiDocDocumentationPropertyConnectorDirective)
|
|
1024
|
-
], TuiDocDocumentationComponent.prototype, "propertiesConnectors", void 0);
|
|
1025
|
-
TuiDocDocumentationComponent = __decorate([
|
|
992
|
+
TuiDocMainComponent = TuiDocMainComponent_1 = __decorate([
|
|
1026
993
|
Component({
|
|
1027
|
-
selector: 'tui-doc-
|
|
1028
|
-
template: "<
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
994
|
+
selector: 'tui-doc-main',
|
|
995
|
+
template: "<tui-theme-night *ngIf=\"night\"></tui-theme-night>\n<tui-root>\n <div class=\"tui-doc-page\">\n <tui-doc-navigation class=\"tui-doc-navigation\">\n <ng-content select=\"tuiDocNavigation\"></ng-content>\n </tui-doc-navigation>\n <div class=\"tui-doc-content\">\n <router-outlet class=\"tui-doc-outlet\"></router-outlet>\n </div>\n </div>\n <header tuiDocHeader>\n <label class=\"night-mode\">\n Night mode\n <tui-toggle\n class=\"tui-space_left-2\"\n [ngModel]=\"night\"\n (ngModelChange)=\"onMode($event)\"\n ></tui-toggle>\n </label>\n <ng-content select=\"tuiDocHeader\"></ng-content>\n </header>\n <ng-container ngProjectAs=\"tuiOverContent\">\n <ng-content select=\"tuiOverContent\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverDialogs\">\n <ng-content select=\"tuiOverDialogs\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverNotifications\">\n <ng-content select=\"tuiOverNotifications\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverPortals\">\n <ng-content select=\"tuiOverPortals\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverHints\">\n <ng-content select=\"tuiOverHints\"></ng-content>\n </ng-container>\n</tui-root>\n",
|
|
996
|
+
encapsulation: ViewEncapsulation.None,
|
|
997
|
+
providers: [
|
|
998
|
+
{
|
|
999
|
+
provide: TuiModeDirective,
|
|
1000
|
+
useExisting: forwardRef(function () { return TuiDocMainComponent_1; }),
|
|
1001
|
+
},
|
|
1002
|
+
TuiSwipeService,
|
|
1034
1003
|
],
|
|
1035
|
-
styles: [":
|
|
1004
|
+
styles: ["html{scroll-padding-top:4rem;height:auto}tui-root>tui-scroll-controls{top:4rem!important}@-webkit-keyframes tuiShaking{from,to{transform:translate3d(0,0,0)}10%,30%,50%,70%,90%{transform:translate3d(-.3125rem,0,0)}20%,40%,60%,80%{transform:translate3d(.3125rem,0,0)}}@keyframes tuiShaking{from,to{transform:translate3d(0,0,0)}10%,30%,50%,70%,90%{transform:translate3d(-.3125rem,0,0)}20%,40%,60%,80%{transform:translate3d(.3125rem,0,0)}}body{background:var(--tui-base-01);height:auto}tui-doc-main{display:block}code:not(.hljs):not(.exception){transition-property:background;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;background:var(--tui-base-02);color:var(--tui-text-02);vertical-align:middle;box-shadow:inset 0 -2px var(--tui-secondary);padding:.375rem .5rem;font-size:.875rem;border-radius:.5rem}:focus code:not(.exception){background:var(--tui-base-01)}.tui-doc-page{position:relative;z-index:0;padding-top:4rem}tui-doc-navigation.tui-doc-navigation{position:fixed;top:4rem;bottom:0;width:16.25rem;border-right:1px solid var(--tui-base-03)}.tui-doc-content{margin-left:16.25rem}@media screen and (max-width:47.9375em){tui-doc-navigation.tui-doc-navigation{display:none}.tui-doc-content{margin-left:0}}.tui-doc-outlet+*{display:block}.tui-doc-animated-example{-webkit-animation:1s .3s tuiShaking;animation:1s .3s tuiShaking}label.night-mode{cursor:pointer}.hljs-tag{background:0 0}.hljs{display:block;overflow-x:auto;padding:.5em;color:var(--tui-text-01);background-color:var(--tui-clear-disabled)}.hljs-subst,.hljs-title{font-weight:400;color:var(--tui-text-01)}.hljs-comment,.hljs-quote{color:var(--tui-text-03);font-style:italic}.hljs-meta{color:#e38162}.hljs-keyword,.hljs-literal,.hljs-name,.hljs-section,.hljs-selector-class,.hljs-selector-id,.hljs-selector-tag,.hljs-type{font-weight:700;color:var(--tui-link)}.hljs-attribute,.hljs-link,.hljs-number,.hljs-regexp{font-weight:700;color:var(--tui-support-06)}.hljs-link,.hljs-number,.hljs-regexp{font-weight:400}.hljs-string{color:var(--tui-positive);font-weight:700}.hljs-bullet,.hljs-formula,.hljs-symbol{color:var(--tui-text-01);background:var(--tui-base-02);font-style:italic}.hljs-doctag{text-decoration:underline}.hljs-template-variable,.hljs-variable{color:var(--tui-warning-fill)}.hljs-addition{background:var(--tui-success-bg)}.hljs-deletion{background:var(--tui-error-bg)}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}.hljs .hljs-line-numbers{padding:0}.hljs-ln-numbers{vertical-align:top;opacity:.3;text-align:right;padding-right:1em!important}"]
|
|
1036
1005
|
}),
|
|
1037
|
-
__param(0, Inject(
|
|
1038
|
-
__param(1, Inject(
|
|
1039
|
-
],
|
|
1040
|
-
return
|
|
1006
|
+
__param(0, Inject(LOCAL_STORAGE)),
|
|
1007
|
+
__param(1, Inject(WINDOW))
|
|
1008
|
+
], TuiDocMainComponent);
|
|
1009
|
+
return TuiDocMainComponent;
|
|
1041
1010
|
}());
|
|
1042
1011
|
|
|
1043
|
-
var
|
|
1044
|
-
function
|
|
1045
|
-
|
|
1046
|
-
this.
|
|
1012
|
+
var ScrollIntoViewDirective = /** @class */ (function () {
|
|
1013
|
+
function ScrollIntoViewDirective(destroy$, _a) {
|
|
1014
|
+
var nativeElement = _a.nativeElement;
|
|
1015
|
+
this.scroll$ = new Subject();
|
|
1016
|
+
this.scroll$
|
|
1017
|
+
.pipe(debounceTime(750), filter(function (shallWe) { return shallWe && !!getElementObscurers(nativeElement); }), takeUntil(destroy$))
|
|
1018
|
+
.subscribe(function () {
|
|
1019
|
+
nativeElement.scrollIntoView();
|
|
1020
|
+
});
|
|
1047
1021
|
}
|
|
1048
|
-
Object.defineProperty(
|
|
1049
|
-
set: function (
|
|
1050
|
-
|
|
1051
|
-
if (nativeFocusableElement) {
|
|
1052
|
-
this.renderer.setStyle(nativeFocusableElement, 'opacity', opacity / 100);
|
|
1053
|
-
}
|
|
1022
|
+
Object.defineProperty(ScrollIntoViewDirective.prototype, "scrollIntoView", {
|
|
1023
|
+
set: function (shallWe) {
|
|
1024
|
+
this.scroll$.next(shallWe);
|
|
1054
1025
|
},
|
|
1055
1026
|
enumerable: true,
|
|
1056
1027
|
configurable: true
|
|
1057
1028
|
});
|
|
1058
|
-
|
|
1059
|
-
{ type:
|
|
1060
|
-
{ type:
|
|
1061
|
-
]; };
|
|
1062
|
-
__decorate([
|
|
1063
|
-
Input()
|
|
1064
|
-
],
|
|
1065
|
-
|
|
1066
|
-
Directive({
|
|
1067
|
-
selector: '[
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
__param(
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
], TuiInputOpacityModule);
|
|
1084
|
-
return TuiInputOpacityModule;
|
|
1085
|
-
}());
|
|
1086
|
-
|
|
1087
|
-
var TuiDocDocumentationModule = /** @class */ (function () {
|
|
1088
|
-
function TuiDocDocumentationModule() {
|
|
1089
|
-
}
|
|
1090
|
-
TuiDocDocumentationModule = __decorate([
|
|
1091
|
-
NgModule({
|
|
1092
|
-
imports: [
|
|
1093
|
-
CommonModule,
|
|
1094
|
-
FormsModule,
|
|
1095
|
-
RouterModule,
|
|
1096
|
-
TuiBadgeModule,
|
|
1097
|
-
TuiSelectModule,
|
|
1098
|
-
TuiToggleModule,
|
|
1099
|
-
TuiTooltipModule,
|
|
1100
|
-
TuiLinkModule,
|
|
1101
|
-
TuiInputCountModule,
|
|
1102
|
-
TuiModeModule,
|
|
1103
|
-
TuiGroupModule,
|
|
1104
|
-
TuiInputOpacityModule,
|
|
1105
|
-
TuiPrimitiveTextfieldModule,
|
|
1106
|
-
TuiTextfieldControllerModule,
|
|
1107
|
-
TuiHintControllerModule,
|
|
1108
|
-
TuiDropdownControllerModule,
|
|
1109
|
-
TuiDataListModule,
|
|
1110
|
-
TuiDataListWrapperModule,
|
|
1111
|
-
TuiNotificationModule,
|
|
1112
|
-
],
|
|
1113
|
-
declarations: [
|
|
1114
|
-
TuiDocDocumentationComponent,
|
|
1115
|
-
TuiDocDocumentationPropertyConnectorDirective,
|
|
1116
|
-
],
|
|
1117
|
-
exports: [
|
|
1118
|
-
TuiDocDocumentationComponent,
|
|
1119
|
-
TuiDocDocumentationPropertyConnectorDirective,
|
|
1120
|
-
],
|
|
1029
|
+
ScrollIntoViewDirective.ctorParameters = function () { return [
|
|
1030
|
+
{ type: TuiDestroyService, decorators: [{ type: Inject, args: [TuiDestroyService,] }] },
|
|
1031
|
+
{ type: ElementRef, decorators: [{ type: Inject, args: [ElementRef,] }] }
|
|
1032
|
+
]; };
|
|
1033
|
+
__decorate([
|
|
1034
|
+
Input()
|
|
1035
|
+
], ScrollIntoViewDirective.prototype, "scrollIntoView", null);
|
|
1036
|
+
ScrollIntoViewDirective = __decorate([
|
|
1037
|
+
Directive({
|
|
1038
|
+
selector: '[scrollIntoView]',
|
|
1039
|
+
providers: [TuiDestroyService],
|
|
1040
|
+
}),
|
|
1041
|
+
__param(0, Inject(TuiDestroyService)),
|
|
1042
|
+
__param(1, Inject(ElementRef))
|
|
1043
|
+
], ScrollIntoViewDirective);
|
|
1044
|
+
return ScrollIntoViewDirective;
|
|
1045
|
+
}());
|
|
1046
|
+
|
|
1047
|
+
var ScrollIntoViewModule = /** @class */ (function () {
|
|
1048
|
+
function ScrollIntoViewModule() {
|
|
1049
|
+
}
|
|
1050
|
+
ScrollIntoViewModule = __decorate([
|
|
1051
|
+
NgModule({
|
|
1052
|
+
declarations: [ScrollIntoViewDirective],
|
|
1053
|
+
exports: [ScrollIntoViewDirective],
|
|
1121
1054
|
})
|
|
1122
|
-
],
|
|
1123
|
-
return
|
|
1055
|
+
], ScrollIntoViewModule);
|
|
1056
|
+
return ScrollIntoViewModule;
|
|
1124
1057
|
}());
|
|
1125
1058
|
|
|
1126
|
-
var
|
|
1059
|
+
var MAP = {
|
|
1060
|
+
а: 'f',
|
|
1061
|
+
б: ',',
|
|
1062
|
+
в: 'd',
|
|
1063
|
+
г: 'u',
|
|
1064
|
+
д: 'l',
|
|
1065
|
+
е: 't',
|
|
1066
|
+
ё: '`',
|
|
1067
|
+
ж: ';',
|
|
1068
|
+
з: 'p',
|
|
1069
|
+
и: 'b',
|
|
1070
|
+
й: 'q',
|
|
1071
|
+
к: 'r',
|
|
1072
|
+
л: 'k',
|
|
1073
|
+
м: 'v',
|
|
1074
|
+
н: 'y',
|
|
1075
|
+
о: 'j',
|
|
1076
|
+
п: 'g',
|
|
1077
|
+
р: 'h',
|
|
1078
|
+
с: 'c',
|
|
1079
|
+
т: 'n',
|
|
1080
|
+
у: 'e',
|
|
1081
|
+
ф: 'a',
|
|
1082
|
+
х: '[',
|
|
1083
|
+
ц: 'w',
|
|
1084
|
+
ч: 'x',
|
|
1085
|
+
ш: 'i',
|
|
1086
|
+
щ: 'o',
|
|
1087
|
+
ъ: ']',
|
|
1088
|
+
ы: 's',
|
|
1089
|
+
ь: 'm',
|
|
1090
|
+
ю: '.',
|
|
1091
|
+
я: 'z',
|
|
1092
|
+
};
|
|
1093
|
+
/**
|
|
1094
|
+
* Translates text mistakenly typed in the Russian layout into English
|
|
1095
|
+
* @param string string with Russian layout characters
|
|
1096
|
+
* @return string with English layout characters
|
|
1097
|
+
*/
|
|
1098
|
+
function transliterateKeyboardLayout(string) {
|
|
1099
|
+
var newStr = '';
|
|
1100
|
+
for (var i = 0; i < string.length; i++) {
|
|
1101
|
+
newStr += string.charAt(i) in MAP ? MAP[string.charAt(i)] : string.charAt(i);
|
|
1102
|
+
}
|
|
1103
|
+
return newStr;
|
|
1104
|
+
}
|
|
1127
1105
|
|
|
1128
|
-
var
|
|
1129
|
-
factory: function () { return
|
|
1106
|
+
var TUI_DOC_PAGES = new InjectionToken('Documentation pages', {
|
|
1107
|
+
factory: function () { return []; },
|
|
1130
1108
|
});
|
|
1131
1109
|
|
|
1132
|
-
|
|
1110
|
+
var TUI_DOC_TITLE = new InjectionToken('Page title', {
|
|
1111
|
+
factory: function () { return ''; },
|
|
1112
|
+
});
|
|
1113
|
+
|
|
1114
|
+
var NAVIGATION_TITLE = new InjectionToken('Page title');
|
|
1115
|
+
var NAVIGATION_LABELS = new InjectionToken('Navigation sections labels for search');
|
|
1116
|
+
var NAVIGATION_ITEMS = new InjectionToken('Navigation pages');
|
|
1117
|
+
var NAVIGATION_PROVIDERS = [
|
|
1118
|
+
TuiDestroyService,
|
|
1119
|
+
{
|
|
1120
|
+
provide: NAVIGATION_TITLE,
|
|
1121
|
+
deps: [Router, ActivatedRoute, TUI_DOC_TITLE, TuiDestroyService],
|
|
1122
|
+
useFactory: titleProviderFactory,
|
|
1123
|
+
},
|
|
1124
|
+
{
|
|
1125
|
+
provide: NAVIGATION_LABELS,
|
|
1126
|
+
deps: [TUI_DOC_PAGES],
|
|
1127
|
+
useFactory: labelsProviderFactory,
|
|
1128
|
+
},
|
|
1129
|
+
{
|
|
1130
|
+
provide: NAVIGATION_ITEMS,
|
|
1131
|
+
deps: [TUI_DOC_PAGES],
|
|
1132
|
+
useFactory: itemsProviderFactory,
|
|
1133
|
+
},
|
|
1134
|
+
];
|
|
1135
|
+
function titleProviderFactory(router, activatedRoute, titlePrefix, destroy$) {
|
|
1136
|
+
return router.events.pipe(filter(function (event) { return event instanceof NavigationEnd; }), map(function () { return activatedRoute.firstChild; }), filter(isPresent), mergeMap(function (_a) {
|
|
1137
|
+
var data = _a.data;
|
|
1138
|
+
return data;
|
|
1139
|
+
}), map(function (_a) {
|
|
1140
|
+
var title = _a.title;
|
|
1141
|
+
return titlePrefix + title;
|
|
1142
|
+
}), takeUntil(destroy$));
|
|
1143
|
+
}
|
|
1144
|
+
function labelsProviderFactory(pages) {
|
|
1145
|
+
return pages
|
|
1146
|
+
.map(function (_a) {
|
|
1147
|
+
var section = _a.section;
|
|
1148
|
+
return section;
|
|
1149
|
+
})
|
|
1150
|
+
.filter(isPresent)
|
|
1151
|
+
.filter(function (item, index, array) { return array.indexOf(item) === index; });
|
|
1152
|
+
}
|
|
1153
|
+
function itemsProviderFactory(pages) {
|
|
1154
|
+
var labels = labelsProviderFactory(pages);
|
|
1155
|
+
return __spread(labels.map(function (label) { return pages.filter(function (_a) {
|
|
1156
|
+
var section = _a.section;
|
|
1157
|
+
return section === label;
|
|
1158
|
+
}); }), [
|
|
1159
|
+
pages.filter(function (page) { return !page.section; }),
|
|
1160
|
+
]);
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
var SCROLL_INTO_VIEW_DELAY = 200;
|
|
1133
1164
|
// @dynamic
|
|
1134
|
-
var
|
|
1135
|
-
function
|
|
1136
|
-
|
|
1137
|
-
this.
|
|
1138
|
-
this.
|
|
1139
|
-
this.
|
|
1140
|
-
this.
|
|
1141
|
-
this.
|
|
1142
|
-
this.
|
|
1143
|
-
this.
|
|
1144
|
-
this.
|
|
1145
|
-
this.
|
|
1146
|
-
this.
|
|
1147
|
-
this.
|
|
1148
|
-
this.
|
|
1149
|
-
this.
|
|
1150
|
-
this.
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1165
|
+
var TuiDocNavigationComponent = /** @class */ (function () {
|
|
1166
|
+
function TuiDocNavigationComponent(changeDetectorRef, titleService, title$, documentRef, mode, sidebar, labels, items, searchText, router, activatedRoute) {
|
|
1167
|
+
var _this = this;
|
|
1168
|
+
this.documentRef = documentRef;
|
|
1169
|
+
this.mode = mode;
|
|
1170
|
+
this.sidebar = sidebar;
|
|
1171
|
+
this.labels = labels;
|
|
1172
|
+
this.items = items;
|
|
1173
|
+
this.searchText = searchText;
|
|
1174
|
+
this.router = router;
|
|
1175
|
+
this.activatedRoute = activatedRoute;
|
|
1176
|
+
this.menuOpen = false;
|
|
1177
|
+
this.search = '';
|
|
1178
|
+
this.open = false;
|
|
1179
|
+
this.openPagesArr = [];
|
|
1180
|
+
this.openPagesGroupsArr = [];
|
|
1181
|
+
this.active = '';
|
|
1182
|
+
this.mode$ = this.mode.change$.pipe(startWith(null), map(function () { return _this.mode.mode || 'onLight'; }));
|
|
1183
|
+
// Angular can't navigate no anchor links
|
|
1184
|
+
// https://stackoverflow.com/questions/36101756/angular2-routing-with-hashtag-to-page-anchor
|
|
1185
|
+
title$.subscribe(function (title) {
|
|
1186
|
+
changeDetectorRef.markForCheck();
|
|
1187
|
+
titleService.setTitle(title);
|
|
1188
|
+
_this.openActivePageGroup();
|
|
1189
|
+
_this.handleAnchorLink(_this.activatedRoute.snapshot.fragment);
|
|
1190
|
+
});
|
|
1154
1191
|
}
|
|
1155
|
-
Object.defineProperty(
|
|
1156
|
-
set: function (content) {
|
|
1157
|
-
this.processedContent = this.processContent(content);
|
|
1158
|
-
},
|
|
1159
|
-
enumerable: true,
|
|
1160
|
-
configurable: true
|
|
1161
|
-
});
|
|
1162
|
-
Object.defineProperty(TuiDocExampleComponent.prototype, "activeItem", {
|
|
1163
|
-
get: function () {
|
|
1164
|
-
return this.tabs[this.activeItemIndex];
|
|
1165
|
-
},
|
|
1166
|
-
enumerable: true,
|
|
1167
|
-
configurable: true
|
|
1168
|
-
});
|
|
1169
|
-
Object.defineProperty(TuiDocExampleComponent.prototype, "tabs", {
|
|
1192
|
+
Object.defineProperty(TuiDocNavigationComponent.prototype, "canOpen", {
|
|
1170
1193
|
get: function () {
|
|
1171
|
-
return this.
|
|
1194
|
+
return this.search.length > 2;
|
|
1172
1195
|
},
|
|
1173
1196
|
enumerable: true,
|
|
1174
1197
|
configurable: true
|
|
1175
1198
|
});
|
|
1176
|
-
Object.defineProperty(
|
|
1199
|
+
Object.defineProperty(TuiDocNavigationComponent.prototype, "filteredItems", {
|
|
1177
1200
|
get: function () {
|
|
1178
|
-
|
|
1179
|
-
return code ? code.trim() : '';
|
|
1201
|
+
return this.filterItems(this.flattenSubPages(this.items), this.search);
|
|
1180
1202
|
},
|
|
1181
1203
|
enumerable: true,
|
|
1182
1204
|
configurable: true
|
|
1183
1205
|
});
|
|
1184
|
-
Object.defineProperty(
|
|
1206
|
+
Object.defineProperty(TuiDocNavigationComponent.prototype, "itemsWithoutSections", {
|
|
1185
1207
|
get: function () {
|
|
1186
|
-
return this.
|
|
1208
|
+
return this.items[this.items.length - 1];
|
|
1187
1209
|
},
|
|
1188
1210
|
enumerable: true,
|
|
1189
1211
|
configurable: true
|
|
1190
1212
|
});
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
this.
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1213
|
+
TuiDocNavigationComponent.prototype.isActive = function (route) {
|
|
1214
|
+
return route === this.active;
|
|
1215
|
+
};
|
|
1216
|
+
TuiDocNavigationComponent.prototype.onGroupClick = function (index) {
|
|
1217
|
+
this.openPagesGroupsArr[index] = !this.openPagesGroupsArr[index];
|
|
1218
|
+
};
|
|
1219
|
+
TuiDocNavigationComponent.prototype.closeMenu = function () {
|
|
1220
|
+
this.menuOpen = false;
|
|
1221
|
+
};
|
|
1222
|
+
TuiDocNavigationComponent.prototype.onSearchChange = function (search) {
|
|
1223
|
+
this.search = search;
|
|
1224
|
+
this.open = this.canOpen;
|
|
1225
|
+
};
|
|
1226
|
+
TuiDocNavigationComponent.prototype.onClick = function () {
|
|
1227
|
+
this.open = false;
|
|
1228
|
+
this.menuOpen = false;
|
|
1229
|
+
this.search = '';
|
|
1230
|
+
this.openActivePageGroup();
|
|
1231
|
+
};
|
|
1232
|
+
TuiDocNavigationComponent.prototype.filterItems = function (items, search) {
|
|
1233
|
+
return items.map(function (section) {
|
|
1234
|
+
return uniqBy(section.filter(function (_a) {
|
|
1235
|
+
var title = _a.title, _b = _a.keywords, keywords = _b === void 0 ? '' : _b;
|
|
1236
|
+
title = title.toLowerCase();
|
|
1237
|
+
search = search.toLowerCase();
|
|
1238
|
+
keywords = keywords.toLowerCase();
|
|
1239
|
+
return (title.includes(search) ||
|
|
1240
|
+
keywords.includes(search) ||
|
|
1241
|
+
title.includes(transliterateKeyboardLayout(search)) ||
|
|
1242
|
+
keywords.includes(transliterateKeyboardLayout(search)) ||
|
|
1243
|
+
search.replace(/-/gi, '').includes(title));
|
|
1244
|
+
}), 'title');
|
|
1245
|
+
});
|
|
1246
|
+
};
|
|
1247
|
+
TuiDocNavigationComponent.prototype.flattenSubPages = function (items) {
|
|
1248
|
+
return items.reduce(function (array, item) { return __spread(array, [
|
|
1249
|
+
item.reduce(function (pages, page) {
|
|
1250
|
+
return 'subPages' in page
|
|
1251
|
+
? __spread(pages, page.subPages) : __spread(pages, [page]);
|
|
1252
|
+
}, []),
|
|
1253
|
+
]); }, []);
|
|
1254
|
+
};
|
|
1255
|
+
TuiDocNavigationComponent.prototype.isActiveRoute = function (route) {
|
|
1256
|
+
return this.router.isActive(route, false);
|
|
1257
|
+
};
|
|
1258
|
+
TuiDocNavigationComponent.prototype.handleAnchorLink = function (hash) {
|
|
1259
|
+
var _this = this;
|
|
1260
|
+
setTimeout(function () {
|
|
1261
|
+
_this.navigateToAnchorLink(hash);
|
|
1262
|
+
}, SCROLL_INTO_VIEW_DELAY);
|
|
1263
|
+
};
|
|
1264
|
+
TuiDocNavigationComponent.prototype.openActivePageGroup = function () {
|
|
1265
|
+
var _this = this;
|
|
1266
|
+
this.items.forEach(function (pages, pagesIndex) {
|
|
1267
|
+
pages.forEach(function (page, pageIndex) {
|
|
1268
|
+
if ('route' in page && _this.isActiveRoute(page.route)) {
|
|
1269
|
+
_this.openPagesArr[pagesIndex] = true;
|
|
1270
|
+
_this.active = page.route;
|
|
1271
|
+
}
|
|
1272
|
+
if ('subPages' in page) {
|
|
1273
|
+
page.subPages.forEach(function (subPage) {
|
|
1274
|
+
if (_this.isActiveRoute(subPage.route)) {
|
|
1275
|
+
_this.openPagesArr[pagesIndex] = true;
|
|
1276
|
+
_this.openPagesGroupsArr[pagesIndex * 100 + pageIndex] = true;
|
|
1277
|
+
_this.active = subPage.route;
|
|
1278
|
+
}
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
});
|
|
1282
|
+
});
|
|
1204
1283
|
};
|
|
1205
|
-
|
|
1206
|
-
|
|
1284
|
+
TuiDocNavigationComponent.prototype.navigateToAnchorLink = function (fragment) {
|
|
1285
|
+
var element = fragment && this.documentRef.querySelector("#" + fragment);
|
|
1286
|
+
if (!element) {
|
|
1287
|
+
return;
|
|
1288
|
+
}
|
|
1289
|
+
element.classList.add('tui-doc-animated-example');
|
|
1290
|
+
element.scrollIntoView({
|
|
1291
|
+
block: 'start',
|
|
1292
|
+
inline: 'nearest',
|
|
1293
|
+
behavior: 'smooth',
|
|
1294
|
+
});
|
|
1207
1295
|
};
|
|
1208
|
-
|
|
1209
|
-
{ type:
|
|
1210
|
-
{ type:
|
|
1211
|
-
{ type:
|
|
1212
|
-
{ type:
|
|
1213
|
-
{ type:
|
|
1214
|
-
{ type:
|
|
1215
|
-
{ type:
|
|
1216
|
-
{ type: undefined, decorators: [{ type: Inject, args: [
|
|
1296
|
+
TuiDocNavigationComponent.ctorParameters = function () { return [
|
|
1297
|
+
{ type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] },
|
|
1298
|
+
{ type: Title, decorators: [{ type: Inject, args: [Title,] }] },
|
|
1299
|
+
{ type: Observable, decorators: [{ type: Inject, args: [NAVIGATION_TITLE,] }] },
|
|
1300
|
+
{ type: Document, decorators: [{ type: Inject, args: [DOCUMENT,] }] },
|
|
1301
|
+
{ type: TuiModeDirective, decorators: [{ type: Inject, args: [TuiModeDirective,] }] },
|
|
1302
|
+
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [TuiSidebarDirective,] }] },
|
|
1303
|
+
{ type: Array, decorators: [{ type: Inject, args: [NAVIGATION_LABELS,] }] },
|
|
1304
|
+
{ type: undefined, decorators: [{ type: Inject, args: [NAVIGATION_ITEMS,] }] },
|
|
1305
|
+
{ type: String, decorators: [{ type: Inject, args: [TUI_DOC_SEARCH_TEXT,] }] },
|
|
1306
|
+
{ type: Router, decorators: [{ type: Inject, args: [Router,] }] },
|
|
1307
|
+
{ type: ActivatedRoute, decorators: [{ type: Inject, args: [ActivatedRoute,] }] }
|
|
1217
1308
|
]; };
|
|
1218
1309
|
__decorate([
|
|
1219
|
-
|
|
1220
|
-
],
|
|
1221
|
-
__decorate([
|
|
1222
|
-
Input()
|
|
1223
|
-
], TuiDocExampleComponent.prototype, "description", void 0);
|
|
1224
|
-
__decorate([
|
|
1225
|
-
Input()
|
|
1226
|
-
], TuiDocExampleComponent.prototype, "content", null);
|
|
1310
|
+
HostBinding('class._open')
|
|
1311
|
+
], TuiDocNavigationComponent.prototype, "menuOpen", void 0);
|
|
1227
1312
|
__decorate([
|
|
1228
|
-
|
|
1229
|
-
],
|
|
1313
|
+
tuiPure
|
|
1314
|
+
], TuiDocNavigationComponent.prototype, "filterItems", null);
|
|
1230
1315
|
__decorate([
|
|
1231
1316
|
tuiPure
|
|
1232
|
-
],
|
|
1233
|
-
|
|
1317
|
+
], TuiDocNavigationComponent.prototype, "flattenSubPages", null);
|
|
1318
|
+
TuiDocNavigationComponent = __decorate([
|
|
1234
1319
|
Component({
|
|
1235
|
-
selector: 'tui-doc-
|
|
1236
|
-
template: "<
|
|
1320
|
+
selector: 'tui-doc-navigation',
|
|
1321
|
+
template: "<tui-hosted-dropdown\n *tuiLet=\"filteredItems as filtered\"\n tuiAutoFocus\n tuiDropdownLimitWidth=\"fixed\"\n class=\"input\"\n [autoFocus]=\"!!sidebar\"\n [content]=\"dropdown\"\n [canOpen]=\"canOpen\"\n [(open)]=\"open\"\n>\n <tui-primitive-textfield\n iconAlign=\"left\"\n tuiTextfieldSize=\"m\"\n iconContent=\"tuiIconSearch\"\n [pseudoFocused]=\"open || null\"\n [tuiTextfieldCleaner]=\"true\"\n [tuiTextfieldLabelOutside]=\"true\"\n [value]=\"search\"\n (valueChange)=\"onSearchChange($event)\"\n >\n {{ searchText }}\n </tui-primitive-textfield>\n <ng-template #dropdown let-activeZone>\n <tui-data-list>\n <tui-opt-group\n *ngFor=\"let group of filtered; let index = index\"\n [label]=\"labels[index] || ''\"\n >\n <a\n *ngFor=\"let item of group\"\n tuiOption\n [routerLink]=\"item.route\"\n (click)=\"onClick()\"\n >\n {{ item.title }}\n </a>\n </tui-opt-group>\n </tui-data-list>\n </ng-template>\n</tui-hosted-dropdown>\n\n<nav class=\"navigation\">\n <tui-scrollbar class=\"scrollbar\" [tuiMode]=\"mode$ | async\">\n <tui-accordion [closeOthers]=\"false\" [rounded]=\"false\">\n <tui-accordion-item\n *ngFor=\"let label of labels; index as index\"\n size=\"s\"\n [borders]=\"null\"\n [(open)]=\"!!openPagesArr[index]\"\n >\n <span class=\"tui-space_left-2\">\n <strong>{{ label }}</strong>\n </span>\n <ng-template tuiAccordionItemContent>\n <div class=\"section\">\n <ng-container\n *ngFor=\"let item of items[index]; index as subIndex\"\n >\n <ng-container\n *ngTemplateOutlet=\"pages; context: {item: item, index: index * 100 + subIndex}\"\n ></ng-container>\n </ng-container>\n </div>\n </ng-template>\n </tui-accordion-item>\n </tui-accordion>\n <div class=\"items-container\">\n <ng-container\n *ngFor=\"let item of itemsWithoutSections; let index = index\"\n >\n <ng-container\n *ngTemplateOutlet=\"pages; context: {item: item, index: items.length - 1 + index}\"\n ></ng-container>\n </ng-container>\n </div>\n\n <ng-template #pages let-item=\"item\" let-index=\"index\">\n <a\n *ngIf=\"!item.subPages; else subPages\"\n tuiLink\n routerLinkActive=\"sublink_active\"\n class=\"sublink\"\n [routerLink]=\"item.route\"\n [scrollIntoView]=\"isActive(item.route)\"\n (click)=\"closeMenu()\"\n >\n {{ item.title }}\n </a>\n <ng-template #subPages>\n <div\n routerLinkActive\n class=\"subsection\"\n [routerLinkActiveOptions]=\"{exact: false}\"\n >\n <button\n *ngIf=\"item.subPages\"\n tuiLink\n type=\"button\"\n class=\"sublink sublink_subsection\"\n (click)=\"onGroupClick(index)\"\n >\n <tui-svg\n src=\"tuiIconChevronRight\"\n class=\"chevron\"\n [class.chevron_active]=\"!!openPagesGroupsArr[index]\"\n ></tui-svg>\n {{ item.title }}\n </button>\n <tui-expand\n class=\"tui-space_left-1\"\n [expanded]=\"!!openPagesGroupsArr[index]\"\n >\n <div class=\"section section_bordered\">\n <a\n *ngFor=\"let subPage of item.subPages\"\n tuiLink\n routerLinkActive=\"sublink_active\"\n class=\"sublink sublink_small\"\n [routerLink]=\"subPage.route\"\n [scrollIntoView]=\"isActive(subPage.route)\"\n (click)=\"closeMenu()\"\n >\n {{ subPage.title }}\n </a>\n </div>\n </tui-expand>\n </div>\n </ng-template>\n </ng-template>\n </tui-scrollbar>\n</nav>\n\n<ng-content></ng-content>\n",
|
|
1322
|
+
providers: NAVIGATION_PROVIDERS,
|
|
1237
1323
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1238
|
-
styles: [":host{
|
|
1324
|
+
styles: [":host{z-index:1;display:flex;flex-direction:column;text-align:center;background:var(--tui-base-01)}.input{display:block;margin:1.25rem}.navigation{display:flex;max-height:100%;min-height:0;flex:1 1 0;text-align:left}.scrollbar{width:100%;scroll-behavior:smooth}.items-container{display:flex;flex-direction:column;padding:0 16px}.section{display:flex;flex-direction:column;align-items:flex-start;margin:-1rem 0 -.5rem}.section_bordered{margin:.5rem 0;border-left:1px solid var(--tui-base-03)}.subsection{margin-left:.5rem}.sublink{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:0;border:0;background:0 0;font-size:inherit;font:var(--tui-font-text-m);margin-left:.5rem;line-height:2.75rem}.sublink_small{margin-left:1rem;line-height:1.5rem}.sublink_small:not(:first-child){margin-top:1rem}.sublink_subsection{margin-left:0;line-height:2.75rem}.sublink_active{color:var(--tui-text-01)}.chevron{transition-property:transform;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;width:1rem;height:1rem;margin:-.25rem .25rem 0 -.1875rem}.chevron_active{transform:rotate(90deg)}"]
|
|
1239
1325
|
}),
|
|
1240
|
-
__param(0,
|
|
1241
|
-
__param(1, Inject(
|
|
1242
|
-
__param(2, Inject(
|
|
1243
|
-
__param(3, Inject(
|
|
1244
|
-
__param(4, Inject(
|
|
1245
|
-
__param(5,
|
|
1246
|
-
__param(
|
|
1247
|
-
__param(6, Inject(
|
|
1248
|
-
__param(7, Inject(
|
|
1249
|
-
|
|
1250
|
-
|
|
1326
|
+
__param(0, Inject(ChangeDetectorRef)),
|
|
1327
|
+
__param(1, Inject(Title)),
|
|
1328
|
+
__param(2, Inject(NAVIGATION_TITLE)),
|
|
1329
|
+
__param(3, Inject(DOCUMENT)),
|
|
1330
|
+
__param(4, Inject(TuiModeDirective)),
|
|
1331
|
+
__param(5, Optional()),
|
|
1332
|
+
__param(5, Inject(TuiSidebarDirective)),
|
|
1333
|
+
__param(6, Inject(NAVIGATION_LABELS)),
|
|
1334
|
+
__param(7, Inject(NAVIGATION_ITEMS)),
|
|
1335
|
+
__param(8, Inject(TUI_DOC_SEARCH_TEXT)),
|
|
1336
|
+
__param(9, Inject(Router)),
|
|
1337
|
+
__param(10, Inject(ActivatedRoute))
|
|
1338
|
+
], TuiDocNavigationComponent);
|
|
1339
|
+
return TuiDocNavigationComponent;
|
|
1251
1340
|
}());
|
|
1252
1341
|
|
|
1253
|
-
var
|
|
1254
|
-
function
|
|
1342
|
+
var TuiDocNavigationModule = /** @class */ (function () {
|
|
1343
|
+
function TuiDocNavigationModule() {
|
|
1255
1344
|
}
|
|
1256
|
-
|
|
1345
|
+
TuiDocNavigationModule = __decorate([
|
|
1257
1346
|
NgModule({
|
|
1258
1347
|
imports: [
|
|
1259
1348
|
CommonModule,
|
|
1260
|
-
|
|
1261
|
-
|
|
1349
|
+
FormsModule,
|
|
1350
|
+
RouterModule,
|
|
1351
|
+
ScrollIntoViewModule,
|
|
1262
1352
|
TuiButtonModule,
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1353
|
+
TuiPrimitiveTextfieldModule,
|
|
1354
|
+
TuiTextfieldControllerModule,
|
|
1355
|
+
TuiActiveZoneModule,
|
|
1356
|
+
TuiLetModule,
|
|
1357
|
+
TuiModeModule,
|
|
1358
|
+
TuiLinkModule,
|
|
1359
|
+
TuiExpandModule,
|
|
1360
|
+
TuiHostedDropdownModule,
|
|
1361
|
+
TuiDropdownControllerModule,
|
|
1362
|
+
TuiAccordionModule,
|
|
1363
|
+
TuiScrollbarModule,
|
|
1364
|
+
TuiSvgModule,
|
|
1365
|
+
TuiDataListModule,
|
|
1366
|
+
TuiAutoFocusModule,
|
|
1266
1367
|
],
|
|
1267
|
-
declarations: [
|
|
1268
|
-
exports: [
|
|
1368
|
+
declarations: [TuiDocNavigationComponent],
|
|
1369
|
+
exports: [TuiDocNavigationComponent],
|
|
1269
1370
|
})
|
|
1270
|
-
],
|
|
1271
|
-
return
|
|
1272
|
-
}());
|
|
1273
|
-
|
|
1274
|
-
// @dynamic
|
|
1275
|
-
var TuiDocMainComponent = /** @class */ (function () {
|
|
1276
|
-
function TuiDocMainComponent(storage, windowRef) {
|
|
1277
|
-
this.storage = storage;
|
|
1278
|
-
this.windowRef = windowRef;
|
|
1279
|
-
this.night = this.storage.getItem('night') === 'true' ||
|
|
1280
|
-
(this.storage.getItem('night') === null &&
|
|
1281
|
-
this.windowRef.matchMedia('(prefers-color-scheme: dark)').matches);
|
|
1282
|
-
this.change$ = new Subject();
|
|
1283
|
-
}
|
|
1284
|
-
TuiDocMainComponent_1 = TuiDocMainComponent;
|
|
1285
|
-
Object.defineProperty(TuiDocMainComponent.prototype, "mode", {
|
|
1286
|
-
get: function () {
|
|
1287
|
-
return this.night ? 'onDark' : null;
|
|
1288
|
-
},
|
|
1289
|
-
enumerable: true,
|
|
1290
|
-
configurable: true
|
|
1291
|
-
});
|
|
1292
|
-
TuiDocMainComponent.prototype.onMode = function (night) {
|
|
1293
|
-
this.night = night;
|
|
1294
|
-
this.change$.next();
|
|
1295
|
-
this.storage.setItem('night', String(night));
|
|
1296
|
-
};
|
|
1297
|
-
var TuiDocMainComponent_1;
|
|
1298
|
-
TuiDocMainComponent.ctorParameters = function () { return [
|
|
1299
|
-
{ type: Storage, decorators: [{ type: Inject, args: [LOCAL_STORAGE,] }] },
|
|
1300
|
-
{ type: Window, decorators: [{ type: Inject, args: [WINDOW,] }] }
|
|
1301
|
-
]; };
|
|
1302
|
-
TuiDocMainComponent = TuiDocMainComponent_1 = __decorate([
|
|
1303
|
-
Component({
|
|
1304
|
-
selector: 'tui-doc-main',
|
|
1305
|
-
template: "<tui-theme-night *ngIf=\"night\"></tui-theme-night>\n<tui-root>\n <div class=\"tui-doc-page\">\n <tui-doc-navigation class=\"tui-doc-navigation\">\n <ng-content select=\"tuiDocNavigation\"></ng-content>\n </tui-doc-navigation>\n <div class=\"tui-doc-content\">\n <router-outlet class=\"tui-doc-outlet\"></router-outlet>\n </div>\n </div>\n <header tuiDocHeader>\n <label class=\"night-mode\">\n Night mode\n <tui-toggle\n class=\"tui-space_left-2\"\n [ngModel]=\"night\"\n (ngModelChange)=\"onMode($event)\"\n ></tui-toggle>\n </label>\n <ng-content select=\"tuiDocHeader\"></ng-content>\n </header>\n <ng-container ngProjectAs=\"tuiOverContent\">\n <ng-content select=\"tuiOverContent\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverDialogs\">\n <ng-content select=\"tuiOverDialogs\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverNotifications\">\n <ng-content select=\"tuiOverNotifications\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverPortals\">\n <ng-content select=\"tuiOverPortals\"></ng-content>\n </ng-container>\n <ng-container ngProjectAs=\"tuiOverHints\">\n <ng-content select=\"tuiOverHints\"></ng-content>\n </ng-container>\n</tui-root>\n",
|
|
1306
|
-
encapsulation: ViewEncapsulation.None,
|
|
1307
|
-
providers: [
|
|
1308
|
-
{
|
|
1309
|
-
provide: TuiModeDirective,
|
|
1310
|
-
useExisting: forwardRef(function () { return TuiDocMainComponent_1; }),
|
|
1311
|
-
},
|
|
1312
|
-
TuiSwipeService,
|
|
1313
|
-
],
|
|
1314
|
-
styles: ["html{scroll-padding-top:4rem;height:auto}tui-root>tui-scroll-controls{top:4rem!important}@-webkit-keyframes tuiShaking{from,to{transform:translate3d(0,0,0)}10%,30%,50%,70%,90%{transform:translate3d(-.3125rem,0,0)}20%,40%,60%,80%{transform:translate3d(.3125rem,0,0)}}@keyframes tuiShaking{from,to{transform:translate3d(0,0,0)}10%,30%,50%,70%,90%{transform:translate3d(-.3125rem,0,0)}20%,40%,60%,80%{transform:translate3d(.3125rem,0,0)}}body{background:var(--tui-base-01);height:auto}tui-doc-main{display:block}code:not(.hljs):not(.exception){transition-property:background;transition-duration:var(--tui-duration,300ms);transition-timing-function:ease-in-out;background:var(--tui-base-02);color:var(--tui-text-02);vertical-align:middle;box-shadow:inset 0 -2px var(--tui-secondary);padding:.375rem .5rem;font-size:.875rem;border-radius:.5rem}:focus code:not(.exception){background:var(--tui-base-01)}.tui-doc-page{position:relative;z-index:0;padding-top:4rem}tui-doc-navigation.tui-doc-navigation{position:fixed;top:4rem;bottom:0;width:16.25rem;border-right:1px solid var(--tui-base-03)}.tui-doc-content{margin-left:16.25rem}@media screen and (max-width:47.9375em){tui-doc-navigation.tui-doc-navigation{display:none}.tui-doc-content{margin-left:0}}.tui-doc-outlet+*{display:block}.tui-doc-animated-example{-webkit-animation:1s .3s tuiShaking;animation:1s .3s tuiShaking}label.night-mode{cursor:pointer}.hljs-tag{background:0 0}.hljs{display:block;overflow-x:auto;padding:.5em;color:var(--tui-text-01);background-color:var(--tui-clear-disabled)}.hljs-subst,.hljs-title{font-weight:400;color:var(--tui-text-01)}.hljs-comment,.hljs-quote{color:var(--tui-text-03);font-style:italic}.hljs-meta{color:#e38162}.hljs-keyword,.hljs-literal,.hljs-name,.hljs-section,.hljs-selector-class,.hljs-selector-id,.hljs-selector-tag,.hljs-type{font-weight:700;color:var(--tui-link)}.hljs-attribute,.hljs-link,.hljs-number,.hljs-regexp{font-weight:700;color:var(--tui-support-06)}.hljs-link,.hljs-number,.hljs-regexp{font-weight:400}.hljs-string{color:var(--tui-positive);font-weight:700}.hljs-bullet,.hljs-formula,.hljs-symbol{color:var(--tui-text-01);background:var(--tui-base-02);font-style:italic}.hljs-doctag{text-decoration:underline}.hljs-template-variable,.hljs-variable{color:var(--tui-warning-fill)}.hljs-addition{background:var(--tui-success-bg)}.hljs-deletion{background:var(--tui-error-bg)}.hljs-emphasis{font-style:italic}.hljs-strong{font-weight:700}.hljs .hljs-line-numbers{padding:0}.hljs-ln-numbers{vertical-align:top;opacity:.3;text-align:right;padding-right:1em!important}"]
|
|
1315
|
-
}),
|
|
1316
|
-
__param(0, Inject(LOCAL_STORAGE)),
|
|
1317
|
-
__param(1, Inject(WINDOW))
|
|
1318
|
-
], TuiDocMainComponent);
|
|
1319
|
-
return TuiDocMainComponent;
|
|
1371
|
+
], TuiDocNavigationModule);
|
|
1372
|
+
return TuiDocNavigationModule;
|
|
1320
1373
|
}());
|
|
1321
1374
|
|
|
1322
1375
|
var TUI_DOC_LOGO = new InjectionToken('Main logo', {
|
|
@@ -1349,7 +1402,7 @@ var TuiDocHeaderComponent = /** @class */ (function () {
|
|
|
1349
1402
|
TuiDocHeaderComponent = __decorate([
|
|
1350
1403
|
Component({
|
|
1351
1404
|
selector: 'header[tuiDocHeader]',
|
|
1352
|
-
template: "<button\n tuiIconButton\n
|
|
1405
|
+
template: "<button\n tuiIconButton\n icon=\"tuiIconMenuLarge\"\n appearance=\"icon\"\n class=\"menu\"\n [title]=\"menu\"\n (click)=\"onClick()\"\n (tuiActiveZoneChange)=\"onActiveZone($event)\"\n>\n <tui-doc-navigation\n *tuiSidebar=\"open$ | async\"\n class=\"navigation\"\n ></tui-doc-navigation>\n</button>\n<div polymorpheus-outlet class=\"logo tui-text_h5\" [content]=\"logo\">\n <ng-template let-src>\n <img alt=\"Logo\" class=\"img\" [src]=\"src\" />\n </ng-template>\n</div>\n<ng-content></ng-content>\n",
|
|
1353
1406
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1354
1407
|
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)}.logo{margin-right:auto}.img{display:block}.menu{margin-left:-1.25rem}@media screen and (min-width:48em){.menu{display:none}}.navigation{min-height:100%}"]
|
|
1355
1408
|
}),
|
|
@@ -1409,26 +1462,6 @@ var TUI_DOC_DEFAULT_TABS = new InjectionToken('Array of default tab names', {
|
|
|
1409
1462
|
factory: function () { return []; },
|
|
1410
1463
|
});
|
|
1411
1464
|
|
|
1412
|
-
var TuiDocPageTabConnectorDirective = /** @class */ (function () {
|
|
1413
|
-
function TuiDocPageTabConnectorDirective(template) {
|
|
1414
|
-
this.template = template;
|
|
1415
|
-
}
|
|
1416
|
-
TuiDocPageTabConnectorDirective.ctorParameters = function () { return [
|
|
1417
|
-
{ type: TemplateRef, decorators: [{ type: Inject, args: [TemplateRef,] }] }
|
|
1418
|
-
]; };
|
|
1419
|
-
__decorate([
|
|
1420
|
-
Input(),
|
|
1421
|
-
tuiDefaultProp()
|
|
1422
|
-
], TuiDocPageTabConnectorDirective.prototype, "pageTab", void 0);
|
|
1423
|
-
TuiDocPageTabConnectorDirective = __decorate([
|
|
1424
|
-
Directive({
|
|
1425
|
-
selector: '[pageTab]',
|
|
1426
|
-
}),
|
|
1427
|
-
__param(0, Inject(TemplateRef))
|
|
1428
|
-
], TuiDocPageTabConnectorDirective);
|
|
1429
|
-
return TuiDocPageTabConnectorDirective;
|
|
1430
|
-
}());
|
|
1431
|
-
|
|
1432
1465
|
var TUI_DOC_SEE_ALSO = new InjectionToken('Array of arrays of related pages', {
|
|
1433
1466
|
factory: function () { return []; },
|
|
1434
1467
|
});
|
|
@@ -1451,6 +1484,26 @@ function seeAlsoProviderFactory(_a, seeAlsoGroups) {
|
|
|
1451
1484
|
return Array.from(seeAlsoSet);
|
|
1452
1485
|
}
|
|
1453
1486
|
|
|
1487
|
+
var TuiDocPageTabConnectorDirective = /** @class */ (function () {
|
|
1488
|
+
function TuiDocPageTabConnectorDirective(template) {
|
|
1489
|
+
this.template = template;
|
|
1490
|
+
}
|
|
1491
|
+
TuiDocPageTabConnectorDirective.ctorParameters = function () { return [
|
|
1492
|
+
{ type: TemplateRef, decorators: [{ type: Inject, args: [TemplateRef,] }] }
|
|
1493
|
+
]; };
|
|
1494
|
+
__decorate([
|
|
1495
|
+
Input(),
|
|
1496
|
+
tuiDefaultProp()
|
|
1497
|
+
], TuiDocPageTabConnectorDirective.prototype, "pageTab", void 0);
|
|
1498
|
+
TuiDocPageTabConnectorDirective = __decorate([
|
|
1499
|
+
Directive({
|
|
1500
|
+
selector: '[pageTab]',
|
|
1501
|
+
}),
|
|
1502
|
+
__param(0, Inject(TemplateRef))
|
|
1503
|
+
], TuiDocPageTabConnectorDirective);
|
|
1504
|
+
return TuiDocPageTabConnectorDirective;
|
|
1505
|
+
}());
|
|
1506
|
+
|
|
1454
1507
|
// Ambient type cannot be used without dynamic https://github.com/angular/angular/issues/23395
|
|
1455
1508
|
// @dynamic
|
|
1456
1509
|
var TuiDocPageComponent = /** @class */ (function () {
|
|
@@ -1462,8 +1515,8 @@ var TuiDocPageComponent = /** @class */ (function () {
|
|
|
1462
1515
|
this.package = '';
|
|
1463
1516
|
this.type = '';
|
|
1464
1517
|
this.path = '';
|
|
1465
|
-
this.activeItemIndex = NaN;
|
|
1466
1518
|
this.tabConnectors = EMPTY_QUERY;
|
|
1519
|
+
this.activeItemIndex = NaN;
|
|
1467
1520
|
}
|
|
1468
1521
|
Object.defineProperty(TuiDocPageComponent.prototype, "showSeeAlso", {
|
|
1469
1522
|
get: function () {
|
|
@@ -1499,7 +1552,7 @@ var TuiDocPageComponent = /** @class */ (function () {
|
|
|
1499
1552
|
TuiDocPageComponent = __decorate([
|
|
1500
1553
|
Component({
|
|
1501
1554
|
selector: 'tui-doc-page',
|
|
1502
|
-
template: "<header class=\"t-header\">\n <h1 class=\"t-title\">\n {{header}}\n <tui-tag\n *ngIf=\"deprecated !== null\"\n
|
|
1555
|
+
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\n *ngFor=\"let tab of tabConnectors; first as first; index as index\"\n >\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 *ngIf=\"index === activeItemIndex\">\n <ng-container *ngTemplateOutlet=\"tab.template\"></ng-container>\n </ng-container>\n </ng-container>\n</div>\n",
|
|
1503
1556
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1504
1557
|
providers: PAGE_PROVIDERS,
|
|
1505
1558
|
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)}@media screen and (max-width:47.9375em){.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}@media screen and (max-width:47.9375em){.t-tabs{margin-top:.25rem}}.t-content{padding:2rem 0;margin:0 min(10vw,8.75rem)}@media screen and (max-width:47.9375em){.t-content{padding:2rem 1.25rem;margin:0}}.t-see-also{min-width:18.75rem;width:30%;float:right;margin-left:1.5rem}@media screen and (max-width:47.9375em){.t-see-also{float:none;width:100%;margin:0 0 1.5rem}}.t-source-code{align-self:flex-end;line-height:2.75rem}"]
|
|
@@ -1540,7 +1593,7 @@ var TuiDocSeeAlsoComponent = /** @class */ (function () {
|
|
|
1540
1593
|
TuiDocSeeAlsoComponent = __decorate([
|
|
1541
1594
|
Component({
|
|
1542
1595
|
selector: 'tui-doc-see-also',
|
|
1543
|
-
template: "<h5 class=\"header\">{{text}}</h5>\n<ng-container *ngFor=\"let item of seeAlso; last as last\">\n <a tuiLink [routerLink]=\"getRouterLink(item)\">{{item}}</a>\n <ng-container *ngIf=\"!last\"
|
|
1596
|
+
template: "<h5 class=\"header\">{{ text }}</h5>\n<ng-container *ngFor=\"let item of seeAlso; last as last\">\n <a tuiLink [routerLink]=\"getRouterLink(item)\">{{ item }}</a>\n <ng-container *ngIf=\"!last\">,</ng-container>\n</ng-container>\n",
|
|
1544
1597
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1545
1598
|
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}"]
|
|
1546
1599
|
}),
|
|
@@ -1613,7 +1666,7 @@ var TuiDocSourceCodeComponent = /** @class */ (function () {
|
|
|
1613
1666
|
TuiDocSourceCodeComponent = __decorate([
|
|
1614
1667
|
Component({
|
|
1615
1668
|
selector: 'tui-doc-source-code',
|
|
1616
|
-
template: "<div\n
|
|
1669
|
+
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",
|
|
1617
1670
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
1618
1671
|
}),
|
|
1619
1672
|
__param(0, Inject(TUI_DOC_SOURCE_CODE)),
|
|
@@ -1696,6 +1749,23 @@ var TUI_DOC_RUSSIAN = [
|
|
|
1696
1749
|
},
|
|
1697
1750
|
];
|
|
1698
1751
|
|
|
1752
|
+
var TuiAddonDocModule = /** @class */ (function () {
|
|
1753
|
+
function TuiAddonDocModule() {
|
|
1754
|
+
}
|
|
1755
|
+
TuiAddonDocModule = __decorate([
|
|
1756
|
+
NgModule({
|
|
1757
|
+
exports: [
|
|
1758
|
+
TuiDocCodeModule,
|
|
1759
|
+
TuiDocDemoModule,
|
|
1760
|
+
TuiDocDocumentationModule,
|
|
1761
|
+
TuiDocPageModule,
|
|
1762
|
+
TuiDocExampleModule,
|
|
1763
|
+
],
|
|
1764
|
+
})
|
|
1765
|
+
], TuiAddonDocModule);
|
|
1766
|
+
return TuiAddonDocModule;
|
|
1767
|
+
}());
|
|
1768
|
+
|
|
1699
1769
|
/**
|
|
1700
1770
|
* Generates typical page routing structure
|
|
1701
1771
|
*/
|
|
@@ -1714,23 +1784,6 @@ function generateRoutes(type) {
|
|
|
1714
1784
|
];
|
|
1715
1785
|
}
|
|
1716
1786
|
|
|
1717
|
-
var TuiAddonDocModule = /** @class */ (function () {
|
|
1718
|
-
function TuiAddonDocModule() {
|
|
1719
|
-
}
|
|
1720
|
-
TuiAddonDocModule = __decorate([
|
|
1721
|
-
NgModule({
|
|
1722
|
-
exports: [
|
|
1723
|
-
TuiDocCodeModule,
|
|
1724
|
-
TuiDocDemoModule,
|
|
1725
|
-
TuiDocDocumentationModule,
|
|
1726
|
-
TuiDocPageModule,
|
|
1727
|
-
TuiDocExampleModule,
|
|
1728
|
-
],
|
|
1729
|
-
})
|
|
1730
|
-
], TuiAddonDocModule);
|
|
1731
|
-
return TuiAddonDocModule;
|
|
1732
|
-
}());
|
|
1733
|
-
|
|
1734
1787
|
/**
|
|
1735
1788
|
* Public API Surface of @taiga-ui/addon-doc
|
|
1736
1789
|
*/
|
|
@@ -1739,5 +1792,5 @@ var TuiAddonDocModule = /** @class */ (function () {
|
|
|
1739
1792
|
* Generated bundle index. Do not edit.
|
|
1740
1793
|
*/
|
|
1741
1794
|
|
|
1742
|
-
export { DEMO_TEXTS, DOC_TEXTS, EXAMPLE_TEXTS, ScrollIntoViewDirective, ScrollIntoViewModule, TUI_DOC_CODE_EDITOR, TUI_DOC_DEFAULT_TABS, TUI_DOC_DEMO_TEXTS, TUI_DOC_DOCUMENTATION_TEXTS, TUI_DOC_EXAMPLE_CONTENT_PROCESSOR, TUI_DOC_EXAMPLE_TEXTS, TUI_DOC_LOGO, TUI_DOC_MENU_TEXT, TUI_DOC_PAGES, TUI_DOC_RUSSIAN, TUI_DOC_SEARCH_TEXT, TUI_DOC_SEE_ALSO, TUI_DOC_SEE_ALSO_TEXT, TUI_DOC_SOURCE_CODE, TUI_DOC_SOURCE_CODE_TEXT, TUI_DOC_TITLE, TuiAddonDocModule, TuiDocCodeComponent, TuiDocCodeModule, TuiDocCopyComponent, TuiDocCopyModule, TuiDocDemoComponent, TuiDocDemoModule, TuiDocDocumentationComponent, TuiDocDocumentationModule, TuiDocDocumentationPropertyConnectorDirective, TuiDocExampleComponent, TuiDocExampleModule, TuiDocMainComponent, TuiDocMainModule, TuiDocNavigationComponent, TuiDocNavigationModule, TuiDocPageComponent, TuiDocPageModule, TuiDocPageTabConnectorDirective, generateRoutes,
|
|
1795
|
+
export { DEMO_TEXTS, DOC_TEXTS, EXAMPLE_TEXTS, ScrollIntoViewDirective, ScrollIntoViewModule, TUI_DOC_CODE_EDITOR, TUI_DOC_DEFAULT_TABS, TUI_DOC_DEMO_TEXTS, TUI_DOC_DOCUMENTATION_TEXTS, TUI_DOC_EXAMPLE_CONTENT_PROCESSOR, TUI_DOC_EXAMPLE_TEXTS, TUI_DOC_LOGO, TUI_DOC_MENU_TEXT, TUI_DOC_PAGES, TUI_DOC_RUSSIAN, TUI_DOC_SEARCH_TEXT, TUI_DOC_SEE_ALSO, TUI_DOC_SEE_ALSO_TEXT, TUI_DOC_SOURCE_CODE, TUI_DOC_SOURCE_CODE_TEXT, TUI_DOC_TITLE, TuiAddonDocModule, TuiDocCodeComponent, TuiDocCodeModule, TuiDocCopyComponent, TuiDocCopyModule, TuiDocDemoComponent, TuiDocDemoModule, TuiDocDocumentationComponent, TuiDocDocumentationModule, TuiDocDocumentationPropertyConnectorDirective, TuiDocExampleComponent, TuiDocExampleModule, TuiDocMainComponent, TuiDocMainModule, TuiDocNavigationComponent, TuiDocNavigationModule, TuiDocPageComponent, TuiDocPageModule, TuiDocPageTabConnectorDirective, generateRoutes, TuiInputOpacityModule as ɵa, TuiInputOpacityDirective as ɵb, TuiDocExampleGetTabsPipe as ɵc, TuiDocHeaderModule as ɵd, NAVIGATION_TITLE as ɵe, NAVIGATION_LABELS as ɵf, NAVIGATION_ITEMS as ɵg, NAVIGATION_PROVIDERS as ɵh, titleProviderFactory as ɵi, labelsProviderFactory as ɵj, itemsProviderFactory as ɵk, TuiDocHeaderComponent as ɵl, PAGE_SEE_ALSO as ɵm, PAGE_PROVIDERS as ɵn, seeAlsoProviderFactory as ɵo, TuiDocSeeAlsoModule as ɵp, TuiDocSeeAlsoComponent as ɵq, TuiDocSourceCodeModule as ɵr, TuiDocSourceCodeComponent as ɵs };
|
|
1743
1796
|
//# sourceMappingURL=taiga-ui-addon-doc.js.map
|